From e28548d53426d8c2add1c66b11a7a53056920466 Mon Sep 17 00:00:00 2001 From: Acrobot Date: Thu, 19 Apr 2012 17:12:49 +0200 Subject: [PATCH] Changed name of 1 class and 1 variable --- .../ChestObject.java => Containers/Container.java} | 4 ++-- .../ChestShop/{Chests => Containers}/MinecraftChest.java | 4 ++-- com/Acrobot/ChestShop/Listeners/playerInteract.java | 7 +++---- com/Acrobot/ChestShop/Shop/Shop.java | 8 ++++---- com/Acrobot/ChestShop/Shop/ShopManagement.java | 2 +- 5 files changed, 12 insertions(+), 13 deletions(-) rename com/Acrobot/ChestShop/{Chests/ChestObject.java => Containers/Container.java} (88%) rename com/Acrobot/ChestShop/{Chests => Containers}/MinecraftChest.java (94%) diff --git a/com/Acrobot/ChestShop/Chests/ChestObject.java b/com/Acrobot/ChestShop/Containers/Container.java similarity index 88% rename from com/Acrobot/ChestShop/Chests/ChestObject.java rename to com/Acrobot/ChestShop/Containers/Container.java index ba05c9b..be68a80 100644 --- a/com/Acrobot/ChestShop/Chests/ChestObject.java +++ b/com/Acrobot/ChestShop/Containers/Container.java @@ -1,11 +1,11 @@ -package com.Acrobot.ChestShop.Chests; +package com.Acrobot.ChestShop.Containers; import org.bukkit.inventory.ItemStack; /** * @author Acrobot */ -public interface ChestObject { +public interface Container { public ItemStack[] getContents(); public void setSlot(int slot, ItemStack item); diff --git a/com/Acrobot/ChestShop/Chests/MinecraftChest.java b/com/Acrobot/ChestShop/Containers/MinecraftChest.java similarity index 94% rename from com/Acrobot/ChestShop/Chests/MinecraftChest.java rename to com/Acrobot/ChestShop/Containers/MinecraftChest.java index fe51bd6..5feac89 100644 --- a/com/Acrobot/ChestShop/Chests/MinecraftChest.java +++ b/com/Acrobot/ChestShop/Containers/MinecraftChest.java @@ -1,4 +1,4 @@ -package com.Acrobot.ChestShop.Chests; +package com.Acrobot.ChestShop.Containers; import com.Acrobot.ChestShop.Utils.uBlock; import com.Acrobot.ChestShop.Utils.uInventory; @@ -8,7 +8,7 @@ import org.bukkit.inventory.ItemStack; /** * @author Acrobot */ -public class MinecraftChest implements ChestObject { +public class MinecraftChest implements Container { private final Chest chest; public MinecraftChest(Chest chest) { diff --git a/com/Acrobot/ChestShop/Listeners/playerInteract.java b/com/Acrobot/ChestShop/Listeners/playerInteract.java index 3abcadc..657b0b3 100644 --- a/com/Acrobot/ChestShop/Listeners/playerInteract.java +++ b/com/Acrobot/ChestShop/Listeners/playerInteract.java @@ -29,8 +29,7 @@ import java.util.HashMap; * @author Acrobot */ public class playerInteract implements Listener { - - private static final HashMap lastTransactionTime = new HashMap(); //Last player's transaction + private static final HashMap timeOfTheLatestSignClick = new HashMap(); public static int interval = 100;//Minimal interval between transactions @EventHandler(priority = EventPriority.HIGHEST) @@ -61,7 +60,7 @@ public class playerInteract implements Listener { return; } - lastTransactionTime.put(player, System.currentTimeMillis()); + timeOfTheLatestSignClick.put(player, System.currentTimeMillis()); if (action == Action.RIGHT_CLICK_BLOCK) event.setCancelled(true); @@ -88,7 +87,7 @@ public class playerInteract implements Listener { } private static boolean enoughTimeHasPassed(Player player) { - return !lastTransactionTime.containsKey(player) || (System.currentTimeMillis() - lastTransactionTime.get(player)) >= interval; + return !timeOfTheLatestSignClick.containsKey(player) || (System.currentTimeMillis() - timeOfTheLatestSignClick.get(player)) >= interval; } private static boolean hasAdminPermissions(Player player) { diff --git a/com/Acrobot/ChestShop/Shop/Shop.java b/com/Acrobot/ChestShop/Shop/Shop.java index 4a85d0a..c115baf 100644 --- a/com/Acrobot/ChestShop/Shop/Shop.java +++ b/com/Acrobot/ChestShop/Shop/Shop.java @@ -1,7 +1,7 @@ package com.Acrobot.ChestShop.Shop; import com.Acrobot.ChestShop.ChestShop; -import com.Acrobot.ChestShop.Chests.ChestObject; +import com.Acrobot.ChestShop.Containers.Container; import com.Acrobot.ChestShop.Config.Config; import com.Acrobot.ChestShop.Config.Language; import com.Acrobot.ChestShop.Config.Property; @@ -19,14 +19,14 @@ import org.bukkit.inventory.ItemStack; */ public class Shop { private final short durability; - private final ChestObject chest; + private final Container chest; public final ItemStack stock; public int stockAmount; public final String owner; public final Sign sign; - public Shop(ChestObject chest, Sign sign, ItemStack... itemStacks) { + public Shop(Container chest, Sign sign, ItemStack... itemStacks) { this.stock = itemStacks[0]; this.durability = stock.getDurability(); this.chest = chest; @@ -208,7 +208,7 @@ public class Shop { return uInventory.fits(player.getInventory(), stock, stockAmount, durability) <= 0; } - private boolean stockFitsChest(ChestObject chest) { + private boolean stockFitsChest(Container chest) { return chest.fits(stock, stockAmount, durability); } diff --git a/com/Acrobot/ChestShop/Shop/ShopManagement.java b/com/Acrobot/ChestShop/Shop/ShopManagement.java index f28a1b1..2f5eb49 100644 --- a/com/Acrobot/ChestShop/Shop/ShopManagement.java +++ b/com/Acrobot/ChestShop/Shop/ShopManagement.java @@ -1,6 +1,6 @@ package com.Acrobot.ChestShop.Shop; -import com.Acrobot.ChestShop.Chests.MinecraftChest; +import com.Acrobot.ChestShop.Containers.MinecraftChest; import com.Acrobot.ChestShop.Items.Items; import com.Acrobot.ChestShop.Utils.uBlock; import org.bukkit.ChatColor;