Dieser Commit ist enthalten in:
matt 2019-04-01 21:28:49 -04:00
Ursprung 86ce762982
Commit c997a2583c
10 geänderte Dateien mit 81 neuen und 120 gelöschten Zeilen

Datei anzeigen

@ -103,7 +103,7 @@ public class BukkitImageListener implements Listener {
if (event.getHand() == EquipmentSlot.OFF_HAND) return; if (event.getHand() == EquipmentSlot.OFF_HAND) return;
} catch (NoSuchFieldError | NoSuchMethodError ignored) {} } catch (NoSuchFieldError | NoSuchMethodError ignored) {}
List<Block> target = player.getLastTwoTargetBlocks((Set<Material>) null, 100); List<Block> target = player.getLastTwoTargetBlocks(null, 100);
if (target.isEmpty()) return; if (target.isEmpty()) return;
Block targetBlock = target.get(0); Block targetBlock = target.get(0);
@ -151,7 +151,7 @@ public class BukkitImageListener implements Listener {
if (generator == null) return null; if (generator == null) return null;
ImageViewer viewer = generator.getImageViewer(); ImageViewer viewer = generator.getImageViewer();
if (viewer == null || !(viewer instanceof BukkitImageViewer)) return null; if (!(viewer instanceof BukkitImageViewer)) return null;
BukkitImageViewer biv = (BukkitImageViewer) viewer; BukkitImageViewer biv = (BukkitImageViewer) viewer;
return biv; return biv;
@ -185,12 +185,7 @@ public class BukkitImageListener implements Listener {
if (frames == null || tool == null) { if (frames == null || tool == null) {
viewer.selectFrame(itemFrame); viewer.selectFrame(itemFrame);
player.updateInventory(); player.updateInventory();
TaskManager.IMP.laterAsync(new Runnable() { TaskManager.IMP.laterAsync(() -> viewer.view(generator), 1);
@Override
public void run() {
viewer.view(generator);
}
}, 1);
return; return;
} }
@ -250,9 +245,7 @@ public class BukkitImageListener implements Listener {
if (worldX < 0 || worldX > width || worldZ < 0 || worldZ > length) return; if (worldX < 0 || worldX > width || worldZ < 0 || worldZ > length) return;
fp.runAction(new Runnable() { fp.runAction(() -> {
@Override
public void run() {
BlockVector3 wPos = BlockVector3.at(worldX, 0, worldZ); BlockVector3 wPos = BlockVector3.at(worldX, 0, worldZ);
viewer.refresh(); viewer.refresh();
int topY = generator.getNearestSurfaceTerrainBlock(wPos.getBlockX(), wPos.getBlockZ(), 255, 0, 255); int topY = generator.getNearestSurfaceTerrainBlock(wPos.getBlockX(), wPos.getBlockZ(), 255, 0, 255);
@ -269,7 +262,6 @@ public class BukkitImageListener implements Listener {
} }
es.flushQueue(); es.flushQueue();
viewer.view(generator); viewer.view(generator);
}
}, true, true); }, true, true);

Datei anzeigen

@ -90,12 +90,8 @@ public class CFIPacketListener implements Listener {
PlayerInventory inv = plr.getInventory(); PlayerInventory inv = plr.getInventory();
ItemStack hand = enumHand == EnumWrappers.Hand.MAIN_HAND ? inv.getItemInMainHand() : inv.getItemInOffHand(); ItemStack hand = enumHand == EnumWrappers.Hand.MAIN_HAND ? inv.getItemInMainHand() : inv.getItemInOffHand();
if (hand != null && hand.getType().isBlock()) { if (hand != null && hand.getType().isBlock()) {
switch (hand.getType()) { Material type = hand.getType();
case AIR: if (!type.isEmpty()) {
case CAVE_AIR:
case VOID_AIR:
break;
default:
BlockStateHolder block = BukkitAdapter.asBlockState(hand); BlockStateHolder block = BukkitAdapter.asBlockState(hand);
if (block != null) { if (block != null) {
gen.setBlock(pt, block); gen.setBlock(pt, block);
@ -201,9 +197,7 @@ public class CFIPacketListener implements Listener {
reply.getIntegers().write(0, id); reply.getIntegers().write(0, id);
try { try {
protocolmanager.recieveClientPacket(player, reply); protocolmanager.recieveClientPacket(player, reply);
} catch (IllegalAccessException e) { } catch (IllegalAccessException | InvocationTargetException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace(); e.printStackTrace();
} }
event.setCancelled(true); event.setCancelled(true);

Datei anzeigen

@ -8,7 +8,8 @@ public class VaultUtil {
public final Permission permission; public final Permission permission;
public VaultUtil() { public VaultUtil() {
final RegisteredServiceProvider<Permission> permissionProvider = Bukkit.getServer().getServicesManager().getRegistration(net.milkbowl.vault.permission.Permission.class); final RegisteredServiceProvider<Permission> permissionProvider =
Bukkit.getServer().getServicesManager().getRegistration(Permission.class);
if (permissionProvider != null) { if (permissionProvider != null) {
this.permission = permissionProvider.getProvider(); this.permission = permissionProvider.getProvider();
} else { } else {

Datei anzeigen

@ -104,7 +104,7 @@ public class BukkitChunk_All extends IntFaweChunk<Chunk, BukkitQueue_All> {
int[][] sections = getCombinedIdArrays(); int[][] sections = getCombinedIdArrays();
final int bx = getX() << 4; final int bx = getX() << 4;
final int bz = getZ() << 4; final int bz = getZ() << 4;
boolean update = adapter != null ? adapter.isChunkInUse(chunk) : true; boolean update = adapter == null || adapter.isChunkInUse(chunk);
if (layer == -1) { if (layer == -1) {
if (adapter != null) if (adapter != null)
{ {

Datei anzeigen

@ -113,14 +113,15 @@ public abstract class BukkitQueue_0<CHUNK, CHUNKSECTIONS, SECTION> extends NMSMa
WirePacket packet = null; WirePacket packet = null;
int viewDistance = Bukkit.getViewDistance(); int viewDistance = Bukkit.getViewDistance();
try { try {
for (int i = 0; i < players.length; i++) { for (FawePlayer fawePlayer : players) {
int cx = chunk.getX(); int cx = chunk.getX();
int cz = chunk.getZ(); int cz = chunk.getZ();
Player player = ((BukkitPlayer) players[i]).parent; Player player = ((BukkitPlayer) fawePlayer).parent;
Location loc = player.getLocation(); Location loc = player.getLocation();
if (Math.abs((loc.getBlockX() >> 4) - cx) <= viewDistance && Math.abs((loc.getBlockZ() >> 4) - cz) <= viewDistance) { if (Math.abs((loc.getBlockX() >> 4) - cx) <= viewDistance
&& Math.abs((loc.getBlockZ() >> 4) - cz) <= viewDistance) {
if (packet == null) { if (packet == null) {
byte[] data; byte[] data;
byte[] buffer = new byte[8192]; byte[] buffer = new byte[8192];

Datei anzeigen

@ -181,9 +181,7 @@ public class BukkitQueue_All extends BukkitQueue_0<ChunkSnapshot, ChunkSnapshot,
if (load && unloaded != null) { if (load && unloaded != null) {
final ArrayDeque<Chunk> finalUnloaded = unloaded; final ArrayDeque<Chunk> finalUnloaded = unloaded;
TaskManager.IMP.async(new Runnable() { TaskManager.IMP.async(() -> {
@Override
public void run() {
for (Chunk chunk : finalUnloaded) { for (Chunk chunk : finalUnloaded) {
int cx = chunk.getX(); int cx = chunk.getX();
int cz = chunk.getZ(); int cz = chunk.getZ();
@ -194,7 +192,6 @@ public class BukkitQueue_All extends BukkitQueue_0<ChunkSnapshot, ChunkSnapshot,
}); });
} }
}
}); });
// load chunks // load chunks

Datei anzeigen

@ -58,9 +58,7 @@ public abstract class ChunkListener implements Listener {
Plugin plugin = Fawe.<FaweBukkit>imp().getPlugin(); Plugin plugin = Fawe.<FaweBukkit>imp().getPlugin();
plm.registerEvents(this, plugin); plm.registerEvents(this, plugin);
try { plm.registerEvents(new ChunkListener_8Plus(this), plugin); } catch (Throwable ignore) {} try { plm.registerEvents(new ChunkListener_8Plus(this), plugin); } catch (Throwable ignore) {}
TaskManager.IMP.repeat(new Runnable() { TaskManager.IMP.repeat(() -> {
@Override
public void run() {
rateLimit--; rateLimit--;
physicsFreeze = false; physicsFreeze = false;
itemFreeze = false; itemFreeze = false;
@ -77,7 +75,6 @@ public abstract class ChunkListener implements Listener {
counter.put(key, badLimit); counter.put(key, badLimit);
} }
badChunks.clear(); badChunks.clear();
}
}, Settings.IMP.TICK_LIMITER.INTERVAL); }, Settings.IMP.TICK_LIMITER.INTERVAL);
} }
} }

Datei anzeigen

@ -204,9 +204,10 @@ public class AsyncBlock implements Block {
@Override @Override
public BlockFace getFace(Block block) { public BlockFace getFace(Block block) {
BlockFace[] directions = BlockFace.values(); BlockFace[] directions = BlockFace.values();
for(int i = 0; i < directions.length; ++i) { for (BlockFace face : directions) {
BlockFace face = directions[i]; if (this.getX() + face.getModX() == block.getX()
if(this.getX() + face.getModX() == block.getX() && this.getY() + face.getModY() == block.getY() && this.getZ() + face.getModZ() == block.getZ()) { && this.getY() + face.getModY() == block.getY()
&& this.getZ() + face.getModZ() == block.getZ()) {
return face; return face;
} }
} }
@ -272,14 +273,7 @@ public class AsyncBlock implements Block {
@Override @Override
public boolean isEmpty() { public boolean isEmpty() {
switch (getType()) { return getType().isEmpty();
case AIR:
case CAVE_AIR:
case VOID_AIR:
return true;
default:
return false;
}
} }
@Override @Override

Datei anzeigen

@ -29,7 +29,7 @@ public class AsyncChunk implements Chunk {
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (obj == null || !(obj instanceof Chunk)) { if (!(obj instanceof Chunk)) {
return false; return false;
} }
Chunk other = (Chunk) obj; Chunk other = (Chunk) obj;
@ -88,14 +88,14 @@ public class AsyncChunk implements Chunk {
BukkitQueue_0 bq = (BukkitQueue_0) queue; BukkitQueue_0 bq = (BukkitQueue_0) queue;
if (world.isChunkLoaded(x, z)) { if (world.isChunkLoaded(x, z)) {
long pair = MathMan.pairInt(x, z); long pair = MathMan.pairInt(x, z);
Long originalKeep = bq.keepLoaded.get(pair); Long originalKeep = BukkitQueue_0.keepLoaded.get(pair);
bq.keepLoaded.put(pair, Long.MAX_VALUE); BukkitQueue_0.keepLoaded.put(pair, Long.MAX_VALUE);
if (world.isChunkLoaded(x, z)) { if (world.isChunkLoaded(x, z)) {
task.run(); task.run();
if (originalKeep != null) { if (originalKeep != null) {
bq.keepLoaded.put(pair, originalKeep); BukkitQueue_0.keepLoaded.put(pair, originalKeep);
} else { } else {
bq.keepLoaded.remove(pair); BukkitQueue_0.keepLoaded.remove(pair);
} }
return task.value; return task.value;
} }

Datei anzeigen

@ -114,7 +114,7 @@ public class AsyncWorld extends DelegateFaweQueue implements World, HasFaweQueue
this.parent = parent; this.parent = parent;
this.queue = queue; this.queue = queue;
if (queue instanceof BukkitQueue_0) { if (queue instanceof BukkitQueue_0) {
this.adapter = (BukkitImplAdapter) ((BukkitQueue_0) queue).getAdapter(); this.adapter = BukkitQueue_0.getAdapter();
} else { } else {
try { try {
this.adapter = WorldEditPlugin.getInstance().getBukkitImplAdapter(); this.adapter = WorldEditPlugin.getInstance().getBukkitImplAdapter();
@ -141,12 +141,7 @@ public class AsyncWorld extends DelegateFaweQueue implements World, HasFaweQueue
if (queue != this.queue) { if (queue != this.queue) {
if (this.queue != null) { if (this.queue != null) {
final FaweQueue oldQueue = this.queue; final FaweQueue oldQueue = this.queue;
TaskManager.IMP.async(new Runnable() { TaskManager.IMP.async(oldQueue::flush);
@Override
public void run() {
oldQueue.flush();
}
});
} }
this.queue = queue; this.queue = queue;
} }
@ -354,7 +349,7 @@ public class AsyncWorld extends DelegateFaweQueue implements World, HasFaweQueue
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (obj == null || !(obj instanceof World)) { if (!(obj instanceof World)) {
return false; return false;
} }
World other = (World) obj; World other = (World) obj;
@ -571,7 +566,7 @@ public class AsyncWorld extends DelegateFaweQueue implements World, HasFaweQueue
return TaskManager.IMP.sync(new RunnableVal<Collection<T>>() { return TaskManager.IMP.sync(new RunnableVal<Collection<T>>() {
@Override @Override
public void run(Collection<T> value) { public void run(Collection<T> value) {
this.value = (Collection<T>) parent.getEntitiesByClass(classes); this.value = parent.getEntitiesByClass(classes);
} }
}); });
} }
@ -581,7 +576,7 @@ public class AsyncWorld extends DelegateFaweQueue implements World, HasFaweQueue
return TaskManager.IMP.sync(new RunnableVal<Collection<T>>() { return TaskManager.IMP.sync(new RunnableVal<Collection<T>>() {
@Override @Override
public void run(Collection<T> value) { public void run(Collection<T> value) {
this.value = (Collection<T>) parent.getEntitiesByClass(cls); this.value = parent.getEntitiesByClass(cls);
} }
}); });
} }
@ -799,22 +794,12 @@ public class AsyncWorld extends DelegateFaweQueue implements World, HasFaweQueue
@Override @Override
@Deprecated @Deprecated
public FallingBlock spawnFallingBlock(Location location, Material material, byte data) throws IllegalArgumentException { public FallingBlock spawnFallingBlock(Location location, Material material, byte data) throws IllegalArgumentException {
return TaskManager.IMP.sync(new Supplier<FallingBlock>() { return TaskManager.IMP.sync(() -> parent.spawnFallingBlock(location, material, data));
@Override
public FallingBlock get() {
return parent.spawnFallingBlock(location, material, data);
}
});
} }
@Override @Override
public FallingBlock spawnFallingBlock(Location location, BlockData blockData) throws IllegalArgumentException { public FallingBlock spawnFallingBlock(Location location, BlockData blockData) throws IllegalArgumentException {
return TaskManager.IMP.sync(new Supplier<FallingBlock>() { return TaskManager.IMP.sync(() -> parent.spawnFallingBlock(location, blockData));
@Override
public FallingBlock get() {
return parent.spawnFallingBlock(location, blockData);
}
});
} }
@Override @Override