mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-06-16 05:43:54 +00:00
Update upstream
This commit is contained in:
@ -156,6 +156,7 @@ public class LocalSession implements TextureHolder {
|
||||
private transient List<Countable<BlockState>> lastDistribution;
|
||||
private transient World worldOverride;
|
||||
private transient boolean tickingWatchdog = false;
|
||||
private transient boolean hasBeenToldVersion;
|
||||
|
||||
// Saved properties
|
||||
private String lastScript;
|
||||
@ -1199,6 +1200,9 @@ public class LocalSession implements TextureHolder {
|
||||
* @param actor the actor
|
||||
*/
|
||||
public void tellVersion(Actor actor) {
|
||||
if (hasBeenToldVersion) return;
|
||||
hasBeenToldVersion = true;
|
||||
actor.sendAnnouncements();
|
||||
}
|
||||
|
||||
public boolean shouldUseServerCUI() {
|
||||
|
@ -1,87 +0,0 @@
|
||||
/*
|
||||
* WorldEdit, a Minecraft world manipulation toolkit
|
||||
* Copyright (C) sk89q <http://www.sk89q.com>
|
||||
* Copyright (C) WorldEdit team and contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Lesser General Public License as published by the
|
||||
* Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.sk89q.worldedit.command.argument;
|
||||
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
|
||||
import java.util.concurrent.locks.StampedLock;
|
||||
|
||||
/**
|
||||
* Lazily-created {@link EditSession}.
|
||||
*/
|
||||
public class EditSessionHolder {
|
||||
|
||||
private final StampedLock lock = new StampedLock();
|
||||
private final WorldEdit worldEdit;
|
||||
private final Player player;
|
||||
|
||||
public EditSessionHolder(WorldEdit worldEdit, Player player) {
|
||||
this.worldEdit = worldEdit;
|
||||
this.player = player;
|
||||
}
|
||||
|
||||
private EditSession session;
|
||||
|
||||
/**
|
||||
* Get the session, but does not create it if it doesn't exist.
|
||||
*/
|
||||
public EditSession getSession() {
|
||||
long stamp = lock.tryOptimisticRead();
|
||||
EditSession result = session;
|
||||
if (!lock.validate(stamp)) {
|
||||
stamp = lock.readLock();
|
||||
try {
|
||||
result = session;
|
||||
} finally {
|
||||
lock.unlockRead(stamp);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public EditSession getOrCreateSession() {
|
||||
// use the already-generated result if possible
|
||||
EditSession result = getSession();
|
||||
if (result != null) {
|
||||
return result;
|
||||
}
|
||||
// otherwise, acquire write lock
|
||||
long stamp = lock.writeLock();
|
||||
try {
|
||||
// check session field again -- maybe another writer hit it in between
|
||||
result = session;
|
||||
if (result != null) {
|
||||
return result;
|
||||
}
|
||||
// now we can do the actual creation
|
||||
LocalSession localSession = worldEdit.getSessionManager().get(player);
|
||||
EditSession editSession = localSession.createEditSession(player);
|
||||
editSession.enableStandardMode();
|
||||
localSession.tellVersion(player);
|
||||
return session = editSession;
|
||||
} finally {
|
||||
lock.unlockWrite(stamp);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -186,7 +186,7 @@ public class DefaultBlockParser extends InputParser<BaseBlock> {
|
||||
if (context.getActor() != null) {
|
||||
throw new NoMatchException("Unknown property " + parts[0] + " for block " + type.getId());
|
||||
} else {
|
||||
WorldEdit.logger.warn("Unknown property " + parts[0] + " for block " + type.getId());
|
||||
WorldEdit.logger.debug("Unknown property " + parts[0] + " for block " + type.getId());
|
||||
}
|
||||
return Maps.newHashMap();
|
||||
}
|
||||
|
@ -275,4 +275,10 @@ public interface Actor extends Identifiable, SessionOwner, Subject, MapMetadatab
|
||||
* @return The locale
|
||||
*/
|
||||
Locale getLocale();
|
||||
|
||||
/**
|
||||
* Sends any relevant notices to the user when they first use WorldEdit in a session.
|
||||
*/
|
||||
default void sendAnnouncements() {
|
||||
}
|
||||
}
|
||||
|
@ -172,6 +172,11 @@ public class PlayerProxy extends AbstractPlayerActor {
|
||||
cuiActor.dispatchCUIEvent(event);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendAnnouncements() {
|
||||
basePlayer.sendAnnouncements();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public <T> T getFacet(Class<? extends T> cls) {
|
||||
|
@ -135,7 +135,7 @@ public final class LegacyMapper {
|
||||
}
|
||||
// if it's still null, both fixer and default failed
|
||||
if (blockState == null) {
|
||||
log.warn("Unknown block: " + value);
|
||||
log.debug("Unknown block: " + value);
|
||||
} else {
|
||||
// it's not null so one of them succeeded, now use it
|
||||
blockToStringMap.put(blockState, id);
|
||||
@ -173,7 +173,7 @@ public final class LegacyMapper {
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
log.warn("Unknown item: " + value);
|
||||
log.debug("Unknown item: " + value);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user