Minor fixes

This commit is contained in:
boy0001 2015-08-23 22:04:17 +10:00
parent dbdd207390
commit d52e9b4c8c
8 changed files with 29 additions and 22 deletions

View File

@ -89,19 +89,19 @@ public class DebugExec extends SubCommand {
private Bindings scope; private Bindings scope;
public DebugExec() { public DebugExec() {
try {
File file = new File(PS.get().IMP.getDirectory(), "scripts" + File.separator + "start.js"); File file = new File(PS.get().IMP.getDirectory(), "scripts" + File.separator + "start.js");
if (file.exists()) { if (file.exists()) {
init(); init();
try {
String script = StringMan.join(Files.readLines(new File(new File(PS.get().IMP.getDirectory() + File.separator + "scripts"), "start.js"), StandardCharsets.UTF_8), System.getProperty("line.separator")); String script = StringMan.join(Files.readLines(new File(new File(PS.get().IMP.getDirectory() + File.separator + "scripts"), "start.js"), StandardCharsets.UTF_8), System.getProperty("line.separator"));
scope.put("THIS", this); scope.put("THIS", this);
scope.put("PlotPlayer", ConsolePlayer.getConsole()); scope.put("PlotPlayer", ConsolePlayer.getConsole());
engine.eval(script, scope); engine.eval(script, scope);
}
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
}
public ScriptEngine getEngine() { public ScriptEngine getEngine() {
return engine; return engine;

View File

@ -47,6 +47,9 @@ public class Unclaim extends SubCommand {
if (plot == null) { if (plot == null) {
return !sendMessage(plr, C.NOT_IN_PLOT); return !sendMessage(plr, C.NOT_IN_PLOT);
} }
if (!plot.hasOwner()) {
return !sendMessage(plr, C.PLOT_NOT_CLAIMED);
}
if (!MainUtil.getTopPlot(plot).equals(MainUtil.getBottomPlot(plot))) { if (!MainUtil.getTopPlot(plot).equals(MainUtil.getBottomPlot(plot))) {
return !sendMessage(plr, C.UNLINK_REQUIRED); return !sendMessage(plr, C.UNLINK_REQUIRED);
} }

View File

@ -42,7 +42,9 @@ public class SendChunk {
private final RefClass classConnection = getRefClass("{nms}.PlayerConnection"); private final RefClass classConnection = getRefClass("{nms}.PlayerConnection");
private final RefClass classChunk = getRefClass("{nms}.Chunk"); private final RefClass classChunk = getRefClass("{nms}.Chunk");
private final RefClass classCraftPlayer = getRefClass("{cb}.entity.CraftPlayer"); private final RefClass classCraftPlayer = getRefClass("{cb}.entity.CraftPlayer");
private final RefClass classCraftChunk = getRefClass("{cb}.CraftChunk");
private RefMethod methodGetHandlePlayer; private RefMethod methodGetHandlePlayer;
private RefMethod methodGetHandleChunk;
private RefConstructor MapChunk; private RefConstructor MapChunk;
private RefField connection; private RefField connection;
private RefMethod send; private RefMethod send;
@ -54,6 +56,7 @@ public class SendChunk {
*/ */
public SendChunk() throws NoSuchMethodException { public SendChunk() throws NoSuchMethodException {
methodGetHandlePlayer = classCraftPlayer.getMethod("getHandle"); methodGetHandlePlayer = classCraftPlayer.getMethod("getHandle");
methodGetHandleChunk = classCraftChunk.getMethod("getHandle");
MapChunk = classMapChunk.getConstructor(classChunk.getRealClass(), boolean.class, int.class); MapChunk = classMapChunk.getConstructor(classChunk.getRealClass(), boolean.class, int.class);
connection = classEntityPlayer.getField("playerConnection"); connection = classEntityPlayer.getField("playerConnection");
send = classConnection.getMethod("sendPacket", classPacket.getRealClass()); send = classConnection.getMethod("sendPacket", classPacket.getRealClass());
@ -101,19 +104,15 @@ public class SendChunk {
if (dx > view || dz > view) { if (dx > view || dz > view) {
continue; continue;
} }
Object c = methodGetHandleChunk.of(chunk).call();
chunks.remove(chunk); chunks.remove(chunk);
Object packet = MapChunk.create(chunk, true, 0);
Object con = connection.of(entity).get(); Object con = connection.of(entity).get();
if (dx != 0 || dz != 0) {
Object packet = MapChunk.create(c, true, 1);
send.of(con).call(packet); send.of(con).call(packet);
packet = MapChunk.create(chunk, true, 65565); }
Object packet = MapChunk.create(c, true, 65565);
send.of(con).call(packet); send.of(con).call(packet);
// Object packet = MapChunk.create(chunk, true, 0);
//
// PacketPlayOutMapChunk packet = new PacketPlayOutMapChunk(chunk, true, 0);
// entity.playerConnection.sendPacket(packet);
// packet = new PacketPlayOutMapChunk(chunk, true, 65565);
// entity.playerConnection.sendPacket(packet);
} }
} }
for (final Chunk chunk : chunks) { for (final Chunk chunk : chunks) {

View File

@ -131,6 +131,7 @@ public class SetBlockFast extends BukkitSetBlockManager {
try { try {
chunksender.sendChunk(chunks); chunksender.sendChunk(chunks);
} catch (final Throwable e) { } catch (final Throwable e) {
e.printStackTrace();
MainUtil.canSendChunk = false; MainUtil.canSendChunk = false;
} }
} }

View File

@ -349,6 +349,7 @@ public class SetBlockFast_1_8 extends BukkitSetBlockManager {
try { try {
chunksender.sendChunk(chunks); chunksender.sendChunk(chunks);
} catch (final Throwable e) { } catch (final Throwable e) {
e.printStackTrace();
MainUtil.canSendChunk = false; MainUtil.canSendChunk = false;
} }
} }

View File

@ -136,6 +136,9 @@ public abstract class Command<E extends CommandCaller> extends CommandManager {
} }
final public Argument<?>[] getRequiredArguments() { final public Argument<?>[] getRequiredArguments() {
if (this.requiredArguments == null) {
return new Argument<?>[0];
}
return this.requiredArguments; return this.requiredArguments;
} }

View File

@ -12,7 +12,6 @@ import java.util.Locale;
import java.util.Map; import java.util.Map;
import java.util.Map.Entry; import java.util.Map.Entry;
import java.util.UUID; import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.spongepowered.api.CatalogType; import org.spongepowered.api.CatalogType;
@ -21,7 +20,6 @@ import org.spongepowered.api.Server;
import org.spongepowered.api.block.BlockState; import org.spongepowered.api.block.BlockState;
import org.spongepowered.api.block.BlockType; import org.spongepowered.api.block.BlockType;
import org.spongepowered.api.block.BlockTypes; import org.spongepowered.api.block.BlockTypes;
import org.spongepowered.api.data.manipulator.mutable.block.StoneData;
import org.spongepowered.api.entity.player.Player; import org.spongepowered.api.entity.player.Player;
import org.spongepowered.api.event.Subscribe; import org.spongepowered.api.event.Subscribe;
import org.spongepowered.api.event.entity.player.PlayerChatEvent; import org.spongepowered.api.event.entity.player.PlayerChatEvent;

View File

@ -34,6 +34,8 @@ public class WorldModify implements WorldGeneratorModifier {
} }
} }
else { else {
gen.getGeneratorPopulators().clear();
gen.getPopulators().clear();
gen.setBaseGeneratorPopulator(plotgen.getBaseGeneratorPopulator()); gen.setBaseGeneratorPopulator(plotgen.getBaseGeneratorPopulator());
gen.setBiomeGenerator(plotgen.getBiomeGenerator()); gen.setBiomeGenerator(plotgen.getBiomeGenerator());
} }