Merge branch 'development'
This commit is contained in:
commit
db24460ed3
2
pom.xml
2
pom.xml
|
@ -2,7 +2,7 @@
|
|||
<groupId>com.songoda</groupId>
|
||||
<artifactId>UltimateRepairing</artifactId>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<version>1.4.6</version>
|
||||
<version>1.4.7</version>
|
||||
<build>
|
||||
<defaultGoal>clean install</defaultGoal>
|
||||
<finalName>UltimateRepairing-${project.version}</finalName>
|
||||
|
|
|
@ -27,11 +27,11 @@ public class AnvilSettingsGui extends Gui {
|
|||
|
||||
setDefaultItem(glass1);
|
||||
|
||||
GuiUtils.mirrorFill(this, 0, 0, true, true, glass2);
|
||||
GuiUtils.mirrorFill(this, 0, 1, true, true, glass2);
|
||||
GuiUtils.mirrorFill(this, 0, 2, true, true, glass3);
|
||||
GuiUtils.mirrorFill(this, 1, 0, false, true, glass2);
|
||||
GuiUtils.mirrorFill(this, 1, 1, false, true, glass3);
|
||||
mirrorFill(0, 0, true, true, glass2);
|
||||
mirrorFill(0, 1, true, true, glass2);
|
||||
mirrorFill(0, 2, true, true, glass3);
|
||||
mirrorFill(1, 0, false, true, glass2);
|
||||
mirrorFill(1, 1, false, true, glass3);
|
||||
|
||||
setButton(1, 2, GuiUtils.createButtonItem(CompatibleMaterial.NAME_TAG, ChatColor.BLUE.toString() + ChatColor.BOLD + "Toggle Holograms",
|
||||
ChatColor.GRAY + "Currently: " + (anvil.isHologram() ? ChatColor.GREEN + "Enabled" : ChatColor.RED + "Disabled") + ChatColor.GRAY + "."),
|
||||
|
|
|
@ -53,9 +53,9 @@ public class RepairGui extends Gui {
|
|||
|
||||
setDefaultItem(glass1);
|
||||
|
||||
GuiUtils.mirrorFill(this, 0, 0, true, true, glass2);
|
||||
GuiUtils.mirrorFill(this, 0, 1, true, true, glass2);
|
||||
GuiUtils.mirrorFill(this, 0, 2, true, true, glass3);
|
||||
mirrorFill(0, 0, true, true, glass2);
|
||||
mirrorFill(0, 1, true, true, glass2);
|
||||
mirrorFill(0, 2, true, true, glass3);
|
||||
|
||||
|
||||
if (Arrays.stream(RepairType.values()).filter(p -> p.hasPermission(player)).count() > 1)
|
||||
|
@ -100,6 +100,7 @@ public class RepairGui extends Gui {
|
|||
plugin.getLocale().getMessage("event.repair.notfound").sendPrefixedMessage(player);
|
||||
return;
|
||||
}
|
||||
player.getInventory().removeItem(toRepair);
|
||||
plugin.getRepairHandler().preRepair(toRepair, finalplayerslot, player, type, anvil);
|
||||
});
|
||||
i++;
|
||||
|
|
|
@ -55,11 +55,11 @@ public class StartConfirmGui extends Gui {
|
|||
|
||||
setDefaultItem(glass1);
|
||||
|
||||
GuiUtils.mirrorFill(this, 0, 0, true, true, glass2);
|
||||
GuiUtils.mirrorFill(this, 0, 1, true, true, glass2);
|
||||
GuiUtils.mirrorFill(this, 0, 2, true, true, glass3);
|
||||
GuiUtils.mirrorFill(this, 1, 0, false, true, glass2);
|
||||
GuiUtils.mirrorFill(this, 1, 1, false, true, glass3);
|
||||
mirrorFill(0, 0, true, true, glass2);
|
||||
mirrorFill(0, 1, true, true, glass2);
|
||||
mirrorFill(0, 2, true, true, glass3);
|
||||
mirrorFill(1, 0, false, true, glass2);
|
||||
mirrorFill(1, 1, false, true, glass3);
|
||||
|
||||
setItem(4, item);
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@ import org.bukkit.event.EventHandler;
|
|||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.block.BlockBreakEvent;
|
||||
import org.bukkit.event.block.BlockDamageEvent;
|
||||
import org.bukkit.event.block.BlockPlaceEvent;
|
||||
|
||||
/**
|
||||
|
@ -46,4 +47,17 @@ public class BlockListeners implements Listener {
|
|||
anvil.setHologram(false);
|
||||
plugin.getAnvilManager().removeAnvil(event.getBlock().getLocation());
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onBlockDamage(BlockDamageEvent event) {
|
||||
String loc = Methods.serializeLocation(event.getBlock());
|
||||
if (!event.getBlock().getType().name().contains("ANVIL") && !plugin.getConfig().contains("data.anvil." + loc))
|
||||
return;
|
||||
|
||||
UAnvil anvil = plugin.getAnvilManager().getAnvil(event.getBlock());
|
||||
if (anvil.isInfinity())
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -33,7 +33,6 @@ public class InteractListeners implements Listener {
|
|||
@EventHandler
|
||||
public void onAnvilClick(PlayerInteractEvent event) {
|
||||
boolean ourRepair = false;
|
||||
boolean vanillaRepair = false;
|
||||
Player player = event.getPlayer();
|
||||
Block block = event.getClickedBlock();
|
||||
if (block == null) return;
|
||||
|
@ -63,10 +62,7 @@ public class InteractListeners implements Listener {
|
|||
return;
|
||||
}
|
||||
ourRepair = true;
|
||||
} else if (rightClick) {
|
||||
// allowing normal repair
|
||||
vanillaRepair = true;
|
||||
} else if (!player.isSneaking()) {
|
||||
} else if (!rightClick && !player.isSneaking()) {
|
||||
// that's us!
|
||||
ourRepair = true;
|
||||
}
|
||||
|
@ -74,9 +70,6 @@ public class InteractListeners implements Listener {
|
|||
if (ourRepair) {
|
||||
RepairGui.newGui(player, anvil1.getLocation());
|
||||
event.setCancelled(true);
|
||||
} else if (vanillaRepair && anvil1.isInfinity()) {
|
||||
player.openInventory(Bukkit.createInventory(null, InventoryType.ANVIL, ChatColor.DARK_GRAY + "Repair & Name"));
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue