From 6efa416d818aba63c614ab5ddfbf4017f6f02d0e Mon Sep 17 00:00:00 2001 From: Jonathan Williams Date: Fri, 21 Nov 2014 18:30:26 -0800 Subject: [PATCH 1/2] Fixed glitching dom items in Hub due to portal throw. --- Plugins/Mineplex.Hub/src/mineplex/hub/server/ServerManager.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ServerManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ServerManager.java index 005ada843..da3bf384a 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ServerManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ServerManager.java @@ -145,6 +145,8 @@ public class ServerManager extends MiniPlugin long timeUntilPortal = getMillisecondsUntilPortal(player, false); if (!_hubManager.CanPortal(player) || timeUntilPortal > 0) { + player.closeInventory(); + if (timeUntilPortal > 0) { player.playSound(player.getEyeLocation(), Sound.CHICKEN_EGG_POP, 2, 2); From 695ed95b5d7b9704af63988c12a9b3bac86debc8 Mon Sep 17 00:00:00 2001 From: Jonathan Williams Date: Fri, 21 Nov 2014 18:34:28 -0800 Subject: [PATCH 2/2] Fixed StaffServer commands for inventory. --- .../salespackage/command/BoosterCommand.java | 19 +++++++++++++----- .../command/TreasureChestCommand.java | 20 ++++++++++++++----- .../command/TreasureKeyCommand.java | 19 +++++++++++++----- 3 files changed, 43 insertions(+), 15 deletions(-) diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/BoosterCommand.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/BoosterCommand.java index aaeee75a9..231d64b49 100644 --- a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/BoosterCommand.java +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/BoosterCommand.java @@ -6,6 +6,7 @@ import org.bukkit.entity.Player; import mineplex.core.command.CommandBase; import mineplex.core.common.Rank; +import mineplex.core.common.util.Callback; import mineplex.core.common.util.F; import mineplex.core.common.util.UUIDFetcher; import mineplex.staffServer.salespackage.SalesPackageManager; @@ -18,18 +19,26 @@ public class BoosterCommand extends CommandBase } @Override - public void Execute(Player caller, String[] args) + public void Execute(final Player caller, String[] args) { if (args == null || args.length != 2) return; - String playerName = args[0]; - int amount = Integer.parseInt(args[1]); + final String playerName = args[0]; + final int amount = Integer.parseInt(args[1]); UUID uuid = UUIDFetcher.getUUIDOf(playerName); Plugin.getDonationManager().PurchaseUnknownSalesPackage(null, playerName, uuid, "Gem Booster " + amount, false, 0, false); - Plugin.getInventoryManager().addItemToInventoryForOffline(uuid.toString(), "Utility", "Gem Booster", amount); - caller.sendMessage(F.main(Plugin.getName(), "Added " + amount + " boosters to " + playerName + "'s account!")); + Plugin.getInventoryManager().addItemToInventoryForOffline(new Callback() + { + public void run(Boolean success) + { + if (success) + caller.sendMessage(F.main(Plugin.getName(), "Added " + amount + " boosters to " + playerName + "'s account!")); + else + caller.sendMessage(F.main(Plugin.getName(), "There was an error adding " + amount + " boosters to " + playerName + "'s account!")); + } + }, uuid.toString(), "Utility", "Gem Booster", amount); } } diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/TreasureChestCommand.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/TreasureChestCommand.java index 8f49792ae..55363cb09 100644 --- a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/TreasureChestCommand.java +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/TreasureChestCommand.java @@ -6,6 +6,7 @@ import org.bukkit.entity.Player; import mineplex.core.command.CommandBase; import mineplex.core.common.Rank; +import mineplex.core.common.util.Callback; import mineplex.core.common.util.F; import mineplex.core.common.util.UUIDFetcher; import mineplex.staffServer.salespackage.SalesPackageManager; @@ -18,18 +19,27 @@ public class TreasureChestCommand extends CommandBase } @Override - public void Execute(Player caller, String[] args) + public void Execute(final Player caller, String[] args) { if (args == null || args.length != 2) return; - String playerName = args[0]; - int amount = Integer.parseInt(args[1]); + final String playerName = args[0]; + final int amount = Integer.parseInt(args[1]); UUID uuid = UUIDFetcher.getUUIDOf(playerName); Plugin.getDonationManager().PurchaseUnknownSalesPackage(null, playerName, uuid, "Treasure Chest " + amount, false, 0, false); - Plugin.getInventoryManager().addItemToInventoryForOffline(uuid.toString(), "Utility", "Treasure Chest", amount); - caller.sendMessage(F.main(Plugin.getName(), "Added " + amount + " treasure chests to " + playerName + "'s account!")); + Plugin.getInventoryManager().addItemToInventoryForOffline(new Callback() + { + public void run(Boolean success) + { + if (success) + caller.sendMessage(F.main(Plugin.getName(), "Added " + amount + " treasure chests to " + playerName + "'s account!")); + else + caller.sendMessage(F.main(Plugin.getName(), "There was an error adding " + amount + " treasure chests to " + playerName + "'s account!")); + } + }, uuid.toString(), "Utility", "Treasure Chest", amount); + } } diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/TreasureKeyCommand.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/TreasureKeyCommand.java index 077b4fc28..b3cde9224 100644 --- a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/TreasureKeyCommand.java +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/TreasureKeyCommand.java @@ -6,6 +6,7 @@ import org.bukkit.entity.Player; import mineplex.core.command.CommandBase; import mineplex.core.common.Rank; +import mineplex.core.common.util.Callback; import mineplex.core.common.util.F; import mineplex.core.common.util.UUIDFetcher; import mineplex.staffServer.salespackage.SalesPackageManager; @@ -18,18 +19,26 @@ public class TreasureKeyCommand extends CommandBase } @Override - public void Execute(Player caller, String[] args) + public void Execute(final Player caller, String[] args) { if (args == null || args.length != 2) return; - String playerName = args[0]; - int amount = Integer.parseInt(args[1]); + final String playerName = args[0]; + final int amount = Integer.parseInt(args[1]); UUID uuid = UUIDFetcher.getUUIDOf(playerName); Plugin.getDonationManager().PurchaseUnknownSalesPackage(null, playerName, uuid, "Treasure Key " + amount, false, 0, false); - Plugin.getInventoryManager().addItemToInventoryForOffline(uuid.toString(), "Treasure", "Treasure Key", amount); - caller.sendMessage(F.main(Plugin.getName(), "Added " + amount + " treasure Keys to " + playerName + "'s account!")); + Plugin.getInventoryManager().addItemToInventoryForOffline(new Callback() + { + public void run(Boolean success) + { + if (success) + caller.sendMessage(F.main(Plugin.getName(), "Added " + amount + " treasure Keys to " + playerName + "'s account!")); + else + caller.sendMessage(F.main(Plugin.getName(), "There was an error adding " + amount + " treasure Keys to " + playerName + "'s account!")); + } + }, uuid.toString(), "Treasure", "Treasure Key", amount); } }