Fix global protection registration

This commit is contained in:
Tim Daniel Saukel 2021-04-08 00:06:37 +02:00
parent c956344176
commit 228345ece0
5 changed files with 4 additions and 15 deletions

View File

@ -70,6 +70,7 @@ public class PortalCommand extends DCommand {
if (dPortal == null) {
dPortal = new DPortal(plugin, plugin.getGlobalProtectionCache().generateId(DPortal.class, player.getWorld()), player.getWorld(), material, false);
plugin.getGlobalProtectionCache().addProtection(dPortal);
dGlobalPlayer.setCreatingPortal(dPortal);
dGlobalPlayer.setCachedItem(player.getInventory().getItemInHand());
player.getInventory().setItemInHand(VanillaItem.WOODEN_SWORD.toItemStack());

View File

@ -54,10 +54,6 @@ public class DPortal extends GlobalProtection {
private boolean active;
private Set<Block> blocks;
public DPortal(DungeonsXL plugin, int id, World world, boolean active) {
this(plugin, id, world, VanillaItem.NETHER_PORTAL, active);
}
public DPortal(DungeonsXL plugin, int id, World world, ExItem material, boolean active) {
super(plugin, world, id);
@ -65,16 +61,6 @@ public class DPortal extends GlobalProtection {
this.active = active;
}
public DPortal(DungeonsXL plugin, int id, Block block1, Block block2, ExItem material, boolean zAxis, boolean active) {
super(plugin, block1.getWorld(), id);
this.block1 = block1;
this.block2 = block2;
this.material = material;
this.zAxis = zAxis;
this.active = active;
}
public DPortal(DungeonsXL plugin, World world, int id, ConfigurationSection config) {
super(plugin, world, id);

View File

@ -223,6 +223,7 @@ public class GameSign extends JoinSign {
onCreation(plugin, startSign, identifier, maxElements, startIfElementsAtLeast);
GameSign sign = new GameSign(plugin, plugin.getGlobalProtectionCache().generateId(GameSign.class, startSign.getWorld()), startSign, identifier,
maxElements, startIfElementsAtLeast);
plugin.getGlobalProtectionCache().addProtection(sign);
return sign;
}

View File

@ -290,7 +290,7 @@ public class GlobalProtectionListener implements Listener {
} else if (lines[1].equalsIgnoreCase(LeaveSign.LEAVE_SIGN_TAG)) {
Sign sign = (Sign) state;
new LeaveSign(plugin, plugin.getGlobalProtectionCache().generateId(LeaveSign.class, sign.getWorld()), sign);
plugin.getGlobalProtectionCache().addProtection(new LeaveSign(plugin, plugin.getGlobalProtectionCache().generateId(LeaveSign.class, sign.getWorld()), sign));
event.setCancelled(true);
}
}

View File

@ -229,6 +229,7 @@ public class GroupSign extends JoinSign {
onCreation(plugin, startSign, identifier, maxElements, startIfElementsAtLeast);
GroupSign sign = new GroupSign(plugin, plugin.getGlobalProtectionCache().generateId(GroupSign.class, startSign.getWorld()), startSign, identifier,
maxElements, startIfElementsAtLeast, groupName);
plugin.getGlobalProtectionCache().addProtection(sign);
return sign;
}