Mirror von
https://github.com/St3venAU/ArmorStandTools.git
synchronisiert 2024-12-27 12:00:07 +01:00
V3.0.1 Fix worldguard compatibility issue
Dieser Commit ist enthalten in:
Ursprung
607fdf795c
Commit
edf2e3aed4
@ -76,7 +76,7 @@ class ArmorStandGUI implements Listener {
|
||||
p.openInventory(i);
|
||||
}
|
||||
|
||||
public static boolean isInUse(ArmorStand as) {
|
||||
static boolean isInUse(ArmorStand as) {
|
||||
return inUse.contains(as.getEntityId());
|
||||
}
|
||||
|
||||
|
@ -152,11 +152,14 @@ class Config {
|
||||
}
|
||||
|
||||
Plugin worldGuard = plugin.getServer().getPluginManager().getPlugin("WorldGuard");
|
||||
worldGuardPlugin = worldGuard == null || !(worldGuard instanceof WorldGuardPlugin) ? null : (WorldGuardPlugin) worldGuard;
|
||||
if(worldGuard instanceof WorldGuardPlugin) {
|
||||
worldGuardPlugin = (WorldGuardPlugin) worldGuard;
|
||||
}
|
||||
if(config.getBoolean("integrateWithWorldGuard")) {
|
||||
plugin.getLogger().log(Level.INFO, worldGuardPlugin == null ? "WorldGuard plugin not found. Continuing without WorldGuard support." : "WorldGuard plugin found. WorldGuard support enabled.");
|
||||
} else if(worldGuardPlugin != null) {
|
||||
plugin.getLogger().log(Level.WARNING, "WorldGuard plugin was found, but integrateWithWorldGuard is set to false in config.yml. Continuing without WorldGuard support.");
|
||||
worldGuardPlugin = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -24,8 +24,8 @@ public class Main extends JavaPlugin {
|
||||
|
||||
static NMS nms;
|
||||
|
||||
public final HashMap<UUID, ArmorStand> carryingArmorStand = new HashMap<UUID, ArmorStand>();
|
||||
public final HashMap<UUID, ItemStack[]> savedInventories = new HashMap<UUID, ItemStack[]>();
|
||||
final HashMap<UUID, ArmorStand> carryingArmorStand = new HashMap<UUID, ArmorStand>();
|
||||
final HashMap<UUID, ItemStack[]> savedInventories = new HashMap<UUID, ItemStack[]>();
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
@ -108,7 +108,7 @@ public class Main extends JavaPlugin {
|
||||
}
|
||||
}
|
||||
|
||||
public void saveInventoryAndClear(Player p) {
|
||||
void saveInventoryAndClear(Player p) {
|
||||
ItemStack[] inv = p.getInventory().getContents().clone();
|
||||
savedInventories.put(p.getUniqueId(), inv);
|
||||
p.getInventory().clear();
|
||||
@ -174,7 +174,7 @@ public class Main extends JavaPlugin {
|
||||
}
|
||||
}
|
||||
if(Config.worldGuardPlugin != null) {
|
||||
return Config.worldGuardPlugin.canBuild(p, b);
|
||||
return Config.worldGuardPlugin.createProtectionQuery().testBlockBreak(p, b);
|
||||
}
|
||||
BlockBreakEvent breakEvent = new BlockBreakEvent(b, p);
|
||||
Bukkit.getServer().getPluginManager().callEvent(breakEvent);
|
||||
|
@ -433,12 +433,13 @@ public class MainListener implements Listener {
|
||||
final Block b = event.getBlock();
|
||||
final ArmorStand as = getArmorStand(b);
|
||||
if (as != null) {
|
||||
String input = "";
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (String line : event.getLines()) {
|
||||
if (line != null && line.length() > 0) {
|
||||
input += ChatColor.translateAlternateColorCodes('&', line);
|
||||
sb.append(ChatColor.translateAlternateColorCodes('&', line));
|
||||
}
|
||||
}
|
||||
String input = sb.toString();
|
||||
if(b.hasMetadata("setName")) {
|
||||
if (input.length() > 0) {
|
||||
as.setCustomName(input);
|
||||
|
@ -28,7 +28,7 @@ class Utils {
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean hasPermissionNode(Player player, String perm) {
|
||||
static boolean hasPermissionNode(Player player, String perm) {
|
||||
if ((player == null) || player.isOp()) {
|
||||
return true;
|
||||
}
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren