mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-21 11:45:19 +01:00
.
This commit is contained in:
parent
b063494955
commit
2185384746
1
.gitignore
vendored
1
.gitignore
vendored
@ -136,3 +136,4 @@ hs_err_pid*
|
||||
*.java
|
||||
target/PlotSquared-Null.jar
|
||||
target/PlotSquared-Uber.jar
|
||||
/target/
|
||||
|
@ -158,55 +158,6 @@ public class PlayerEvents extends com.plotsquared.listener.PlotListener implemen
|
||||
}, 3);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onInventoryPickup(InventoryPickupItemEvent event) {
|
||||
Inventory inv = event.getInventory();
|
||||
System.out.print(inv.getTitle() + " | " + inv.getHolder() + " | " + inv + " | " + inv.getType());
|
||||
Location loc = BukkitUtil.getLocation(event.getItem().getLocation());
|
||||
if (!PS.get().isPlotWorld(loc.getWorld())) {
|
||||
return;
|
||||
}
|
||||
Plot plot = MainUtil.getPlot(loc);
|
||||
if (plot == null || !plot.hasOwner()) {
|
||||
return;
|
||||
}
|
||||
Flag redstone = FlagManager.getPlotFlag(plot, "redstone");
|
||||
if (redstone != null) {
|
||||
if ((Boolean) redstone.getValue()) {
|
||||
return;
|
||||
}
|
||||
else {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (Settings.REDSTONE_DISABLER) {
|
||||
if (UUIDHandler.getPlayer(plot.owner) == null) {
|
||||
boolean disable = true;
|
||||
for (UUID trusted : plot.getTrusted()) {
|
||||
if (UUIDHandler.getPlayer(trusted) != null) {
|
||||
disable = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (disable) {
|
||||
event.setCancelled(true);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (Settings.REDSTONE_DISABLER_UNOCCUPIED) {
|
||||
for (PlotPlayer pp : UUIDHandler.getPlayers().values()) {
|
||||
if (plot.equals(pp.getCurrentPlot())) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onRedstoneEvent(BlockRedstoneEvent event) {
|
||||
Block block = event.getBlock();
|
||||
|
@ -22,6 +22,7 @@ import com.intellectualcrafters.plot.util.ReflectionUtils.RefMethod;
|
||||
import com.intellectualcrafters.plot.util.TaskManager;
|
||||
import com.intellectualcrafters.plot.util.UUIDHandler;
|
||||
import com.plotsquared.bukkit.object.BukkitPlayer;
|
||||
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.Bukkit;
|
||||
@ -37,10 +38,10 @@ public class SendChunk {
|
||||
// // Ref Class
|
||||
private final RefClass classEntityPlayer = getRefClass("{nms}.EntityPlayer");
|
||||
private final RefClass classMapChunk = getRefClass("{nms}.PacketPlayOutMapChunk");
|
||||
private final RefClass classConnection = getRefClass("{nms}.EntityPlayer.playerConnection");
|
||||
private final RefClass classCraftChunk = getRefClass("{cb}.CraftChunk");
|
||||
private final RefClass classCraftPlayer = getRefClass("{cb}.CraftPlayer");
|
||||
private RefMethod methodGetHandleChunk;
|
||||
private final RefClass classPacket = getRefClass("{nms}.Packet");
|
||||
private final RefClass classConnection = getRefClass("{nms}.PlayerConnection");
|
||||
private final RefClass classChunk = getRefClass("{nms}.Chunk");
|
||||
private final RefClass classCraftPlayer = getRefClass("{cb}.entity.CraftPlayer");
|
||||
private RefMethod methodGetHandlePlayer;
|
||||
private RefConstructor MapChunk;
|
||||
private RefField connection;
|
||||
@ -52,11 +53,10 @@ public class SendChunk {
|
||||
* @throws NoSuchMethodException
|
||||
*/
|
||||
public SendChunk() throws NoSuchMethodException {
|
||||
methodGetHandleChunk = classCraftChunk.getMethod("getHandle");
|
||||
methodGetHandlePlayer = classCraftPlayer.getMethod("getHandle");
|
||||
MapChunk = classMapChunk.getConstructor(Chunk.class, boolean.class, int.class);
|
||||
connection = classCraftPlayer.getField("playerConnection");
|
||||
send = classConnection.getMethod("sendPacket", classMapChunk.getRealClass());
|
||||
MapChunk = classMapChunk.getConstructor(classChunk.getRealClass(), boolean.class, int.class);
|
||||
connection = classEntityPlayer.getField("playerConnection");
|
||||
send = classConnection.getMethod("sendPacket", classPacket.getRealClass());
|
||||
}
|
||||
|
||||
public void sendChunk(final Collection<Chunk> input) {
|
||||
|
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user