3
0
Mirror von https://github.com/St3venAU/ArmorStandTools.git synchronisiert 2024-12-27 12:00:07 +01:00

v2.4.3 - Bugfix

Dieser Commit ist enthalten in:
Steven 2017-07-30 19:21:39 +08:00
Ursprung 03ed547630
Commit 528a2bfa6f
5 geänderte Dateien mit 27 neuen und 6 gelöschten Zeilen

Datei anzeigen

@ -32,7 +32,7 @@ class ArmorStandGUI implements Listener {
private Main plugin;
ArmorStandGUI(Main plugin, ArmorStand as, Player p) {
if(inUse.contains(as.getEntityId())) {
if(isInUse(as)) {
p.sendMessage(ChatColor.RED + Config.guiInUse);
return;
}
@ -81,6 +81,10 @@ class ArmorStandGUI implements Listener {
p.openInventory(i);
}
public static boolean isInUse(ArmorStand as) {
return inUse.contains(as.getEntityId());
}
private ItemStack updateLore(ArmorStandTool tool) {
ItemStack item = tool.getItem();
switch (tool) {
@ -117,7 +121,7 @@ class ArmorStandGUI implements Listener {
}
@EventHandler
public void inInventoryClose(InventoryCloseEvent event) {
public void onInventoryClose(InventoryCloseEvent event) {
if(!event.getInventory().equals(i)) return;
HandlerList.unregisterAll(this);
inUse.remove(as.getEntityId());

Datei anzeigen

@ -18,6 +18,7 @@ import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.block.SignChangeEvent;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.event.inventory.CraftItemEvent;
import org.bukkit.event.inventory.InventoryAction;
@ -56,6 +57,11 @@ public class MainListener implements Listener {
if (event.getRightClicked() instanceof ArmorStand) {
Player p = event.getPlayer();
ArmorStand as = (ArmorStand) event.getRightClicked();
if(ArmorStandGUI.isInUse(as)) {
Main.nms.actionBarMsg(p, Config.guiInUse);
event.setCancelled(true);
return;
}
if(plugin.carryingArmorStand.containsKey(p.getUniqueId())) {
if (plugin.playerHasPermission(p, plugin.carryingArmorStand.get(p.getUniqueId()).getLocation().getBlock(), null)) {
plugin.carryingArmorStand.remove(p.getUniqueId());
@ -359,7 +365,8 @@ public class MainListener implements Listener {
@EventHandler
public void onEntityDamageByEntity(EntityDamageByEntityEvent event) {
if(event.getEntity() instanceof ArmorStand) {
if(Main.nms.isInvulnerable((ArmorStand) event.getEntity())) {
ArmorStand as = (ArmorStand) event.getEntity();
if(ArmorStandGUI.isInUse(as) || Main.nms.isInvulnerable(as)) {
event.setCancelled(true);
}
if(event.getDamager() instanceof Player && ArmorStandTool.isHoldingTool((Player) event.getDamager())) {
@ -371,6 +378,16 @@ public class MainListener implements Listener {
}
}
@EventHandler
public void onEntityDamage(EntityDamageEvent event) {
if(event.getEntity() instanceof ArmorStand) {
ArmorStand as = (ArmorStand) event.getEntity();
if(ArmorStandGUI.isInUse(as) || Main.nms.isInvulnerable(as)) {
event.setCancelled(true);
}
}
}
private boolean noCooldown(Entity e) {
for(MetadataValue meta : e.getMetadata("lastDrop")) {
if(meta.getOwningPlugin() == plugin) {

Datei anzeigen

@ -4,7 +4,7 @@
#
# Main Config
#
# File generated by: v2.4.2
# File generated by: v2.4.3
# (If this is not the version you are running, consider deleting this
# config to allow it to be re-created. There may be new config options)
#

Datei anzeigen

@ -4,7 +4,7 @@
#
# Language Config
#
# File generated by: v2.4.2
# File generated by: v2.4.3
# (If this is not the version you are running, consider deleting this
# config to allow it to be re-created. There may be new config options)
#

Datei anzeigen

@ -1,6 +1,6 @@
main: com.gmail.St3venAU.plugins.ArmorStandTools.Main
name: ArmorStandTools
version: 2.4.2
version: 2.4.3
author: St3venAU
description: Armor stand manipulation tools
softdepend: [WorldGuard, PlotSquared]