Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-12-25 18:40:05 +01:00
Dieser Commit ist enthalten in:
Ursprung
d9906c9026
Commit
55dad5a972
@ -128,7 +128,7 @@ public class LocalSession implements TextureHolder {
|
|||||||
private transient boolean superPickaxe = false;
|
private transient boolean superPickaxe = false;
|
||||||
private transient BlockTool pickaxeMode = new SinglePickaxe();
|
private transient BlockTool pickaxeMode = new SinglePickaxe();
|
||||||
private transient boolean hasTool = false;
|
private transient boolean hasTool = false;
|
||||||
private transient Map<ItemType, Tool> tools = new HashMap<>();
|
private transient Tool[] tools = new Tool[ItemTypes.size()];
|
||||||
private transient int maxBlocksChanged = -1;
|
private transient int maxBlocksChanged = -1;
|
||||||
private transient int maxTimeoutTime;
|
private transient int maxTimeoutTime;
|
||||||
private transient boolean useInventory;
|
private transient boolean useInventory;
|
||||||
@ -374,9 +374,6 @@ public class LocalSession implements TextureHolder {
|
|||||||
public void remember(EditSession editSession) {
|
public void remember(EditSession editSession) {
|
||||||
checkNotNull(editSession);
|
checkNotNull(editSession);
|
||||||
|
|
||||||
// Don't store anything if no changes were made
|
|
||||||
if (editSession.size() == 0) return;
|
|
||||||
|
|
||||||
FawePlayer fp = editSession.getPlayer();
|
FawePlayer fp = editSession.getPlayer();
|
||||||
int limit = fp == null ? Integer.MAX_VALUE : fp.getLimit().MAX_HISTORY;
|
int limit = fp == null ? Integer.MAX_VALUE : fp.getLimit().MAX_HISTORY;
|
||||||
remember(editSession, true, limit);
|
remember(editSession, true, limit);
|
||||||
@ -573,7 +570,7 @@ public class LocalSession implements TextureHolder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void unregisterTools(Player player) {
|
public void unregisterTools(Player player) {
|
||||||
for (Tool tool : tools.values()) {
|
for (Tool tool : tools) {
|
||||||
if (tool instanceof BrushTool) {
|
if (tool instanceof BrushTool) {
|
||||||
((BrushTool) tool).clear(player);
|
((BrushTool) tool).clear(player);
|
||||||
}
|
}
|
||||||
@ -689,7 +686,7 @@ public class LocalSession implements TextureHolder {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (world != null) {
|
if (world != null) {
|
||||||
//Fawe.imp().registerPacketListener();
|
Fawe.imp().registerPacketListener();
|
||||||
world.update();
|
world.update();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -957,7 +954,7 @@ public class LocalSession implements TextureHolder {
|
|||||||
*/
|
*/
|
||||||
@Nullable
|
@Nullable
|
||||||
public Tool getTool(ItemType item) {
|
public Tool getTool(ItemType item) {
|
||||||
return tools.get(item);
|
return tools[item.getInternalId()];
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
@ -1004,7 +1001,7 @@ public class LocalSession implements TextureHolder {
|
|||||||
Tool tool = getTool(item, player);
|
Tool tool = getTool(item, player);
|
||||||
if (!(tool instanceof BrushTool)) {
|
if (!(tool instanceof BrushTool)) {
|
||||||
if (create) {
|
if (create) {
|
||||||
tool = new BrushTool("worldedit.brush.sphere");
|
tool = new BrushTool();
|
||||||
setTool(item, tool, player);
|
setTool(item, tool, player);
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
@ -1039,7 +1036,7 @@ public class LocalSession implements TextureHolder {
|
|||||||
|
|
||||||
public void setTool(BaseItem item, @Nullable Tool tool, Player player) throws InvalidToolBindException {
|
public void setTool(BaseItem item, @Nullable Tool tool, Player player) throws InvalidToolBindException {
|
||||||
ItemType type = item.getType();
|
ItemType type = item.getType();
|
||||||
if (type.hasBlockType()) {
|
if (type.hasBlockType() && type.getBlockType().getMaterial().isAir()) {
|
||||||
throw new InvalidToolBindException(type, "Blocks can't be used");
|
throw new InvalidToolBindException(type, "Blocks can't be used");
|
||||||
} else if (type.getId().equalsIgnoreCase(config.wandItem)) {
|
} else if (type.getId().equalsIgnoreCase(config.wandItem)) {
|
||||||
throw new InvalidToolBindException(type, "Already used for the wand");
|
throw new InvalidToolBindException(type, "Already used for the wand");
|
||||||
@ -1053,20 +1050,18 @@ public class LocalSession implements TextureHolder {
|
|||||||
if (tool != null) {
|
if (tool != null) {
|
||||||
((BrushTool) tool).setHolder(item);
|
((BrushTool) tool).setHolder(item);
|
||||||
} else {
|
} else {
|
||||||
this.tools.remove(type);
|
this.tools[type.getInternalId()] = null;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
previous = this.tools.get(type);
|
previous = this.tools[type.getInternalId()];
|
||||||
this.tools.put(type, tool);
|
this.tools[type.getInternalId()] = tool;
|
||||||
if (tool != null) {
|
if (tool != null) {
|
||||||
hasTool = true;
|
hasTool = true;
|
||||||
} else {
|
} else {
|
||||||
hasTool = false;
|
hasTool = false;
|
||||||
for (Tool i : this.tools.values()) {
|
for (Tool i : this.tools) if (i != null) {
|
||||||
if (i != null) {
|
hasTool = true;
|
||||||
hasTool = true;
|
break;
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -162,7 +162,12 @@ public enum BuiltInClipboardFormat implements ClipboardFormat {
|
|||||||
@Override
|
@Override
|
||||||
public ClipboardWriter getWriter(OutputStream outputStream) throws IOException {
|
public ClipboardWriter getWriter(OutputStream outputStream) throws IOException {
|
||||||
outputStream = new BufferedOutputStream(outputStream);
|
outputStream = new BufferedOutputStream(outputStream);
|
||||||
OutputStream gzip = new PGZIPOutputStream(outputStream);
|
OutputStream gzip;
|
||||||
|
if (outputStream instanceof PGZIPOutputStream || outputStream instanceof GZIPOutputStream) {
|
||||||
|
gzip = outputStream;
|
||||||
|
} else {
|
||||||
|
gzip = new PGZIPOutputStream(outputStream);
|
||||||
|
}
|
||||||
NBTOutputStream nbtStream = new NBTOutputStream(new BufferedOutputStream(gzip));
|
NBTOutputStream nbtStream = new NBTOutputStream(new BufferedOutputStream(gzip));
|
||||||
return new StructureFormat(nbtStream);
|
return new StructureFormat(nbtStream);
|
||||||
}
|
}
|
||||||
|
@ -846,4 +846,7 @@ public final class ItemTypes {
|
|||||||
return ItemType.REGISTRY.getByInternalId(ordinal);
|
return ItemType.REGISTRY.getByInternalId(ordinal);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static int size() {
|
||||||
|
return ItemType.REGISTRY.size();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren