From c247fe931772923a62b162ace8d2fb04e41ab08b Mon Sep 17 00:00:00 2001 From: NewGarbo Date: Sun, 15 Nov 2015 18:19:28 +0000 Subject: [PATCH] World event prettification and fixes --- .../mineplex/core/common/util/UtilTime.java | 2 +- .../teleport/command/TeleportCommand.java | 4 ++-- .../clans/worldevent/EventTerrainFinder.java | 1 - .../clans/worldevent/WorldEventManager.java | 23 +++---------------- .../clans/worldevent/kinghill/KingHill.java | 20 +++++++++++----- .../clans/worldevent/undead/UndeadCamp.java | 19 +++++++-------- .../minecraft/game/core/boss/WorldEvent.java | 2 ++ 7 files changed, 30 insertions(+), 41 deletions(-) diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilTime.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilTime.java index 02ec60991..908272bc6 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilTime.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilTime.java @@ -124,7 +124,7 @@ public class UtilTime if (type == TimeUnit.DAYS) text = (num = UtilMath.trim(trim, time / 86400000d)) + " Day"; else if (type == TimeUnit.HOURS) text = (num = UtilMath.trim(trim, time / 3600000d)) + " Hour"; else if (type == TimeUnit.MINUTES) text = (num = UtilMath.trim(trim, time / 60000d)) + " Minute"; - else if (type == TimeUnit.SECONDS) text = (int) (num = (int) UtilMath.trim(trim, time / 1000d)) + " Second"; + else if (type == TimeUnit.SECONDS) text = (int) (num = (int) UtilMath.trim(trim, time / 1000d)) + " Second"; else text = (int) (num = (int) UtilMath.trim(trim, time)) + " Millisecond"; } else diff --git a/Plugins/Mineplex.Core/src/mineplex/core/teleport/command/TeleportCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/teleport/command/TeleportCommand.java index bdf03cc6e..323c7c2f4 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/teleport/command/TeleportCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/teleport/command/TeleportCommand.java @@ -12,8 +12,8 @@ public class TeleportCommand extends MultiCommandBase { public TeleportCommand(Teleport plugin) { - super(plugin, Rank.ADMIN, "tp", "teleport"); - + super(plugin, Rank.ADMIN, new Rank[]{Rank.JNR_DEV}, "tp", "teleport"); + AddCommand(new AllCommand(plugin)); AddCommand(new BackCommand(plugin)); AddCommand(new HereCommand(plugin)); diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/EventTerrainFinder.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/EventTerrainFinder.java index 3040dd885..d54280029 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/EventTerrainFinder.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/EventTerrainFinder.java @@ -33,7 +33,6 @@ public class EventTerrainFinder public Location findAreaInBorderlands(World world, int size, int vert) { - System.out.println("Starting finding area..."); int borderlandsDist = 31; int borderlandsWidth = 47 - borderlandsDist; diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/WorldEventManager.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/WorldEventManager.java index f341cab6c..89330ff6c 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/WorldEventManager.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/WorldEventManager.java @@ -134,7 +134,7 @@ public class WorldEventManager extends MiniPlugin implements ScoreboardElement else { // Try again in 5 minutes - _nextEventStart = System.currentTimeMillis() + 25000;// 300000; + _nextEventStart = System.currentTimeMillis() + 300000; } } @@ -201,7 +201,7 @@ public class WorldEventManager extends MiniPlugin implements ScoreboardElement private void updateNextEventTime() { // 45 Minutes + (0 - 15 Minutes) - long waitTime = 25000;// 2700000L + _random.nextInt(900000); + long waitTime = 2700000L + _random.nextInt(900000); _nextEventStart = System.currentTimeMillis() + waitTime; } @@ -225,7 +225,7 @@ public class WorldEventManager extends MiniPlugin implements ScoreboardElement output.add(" " + C.cWhite + event.getName()); output.add(" " + C.cWhite + locationString); - ArrayList scoreboardLines = event.getScoreboardLines(manager, player, out); + ArrayList scoreboardLines = event.getLines(manager, player, out); if (scoreboardLines != null) { output.addAll(scoreboardLines); @@ -247,21 +247,4 @@ public class WorldEventManager extends MiniPlugin implements ScoreboardElement { return _runningEvents; } - - @EventHandler - public void gear(PlayerCommandPreprocessEvent event) - { - if (!event.getPlayer().isOp()) return; - - // TODO: Remove - if (event.getMessage().equalsIgnoreCase("/dgear")) - { - PlayerInventory i = event.getPlayer().getInventory(); - i.setHelmet(new ItemStack(Material.DIAMOND_HELMET)); - i.setChestplate(new ItemStack(Material.DIAMOND_CHESTPLATE)); - i.setLeggings(new ItemStack(Material.DIAMOND_LEGGINGS)); - i.setBoots(new ItemStack(Material.DIAMOND_BOOTS)); - i.setItemInHand(new ItemStack(Material.DIAMOND_SWORD)); - } - } } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/kinghill/KingHill.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/kinghill/KingHill.java index 2efa32ead..fd3115a48 100755 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/kinghill/KingHill.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/kinghill/KingHill.java @@ -9,6 +9,7 @@ import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.entity.Player; +import mineplex.core.common.util.F; import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilTime; import mineplex.core.scoreboard.ScoreboardManager; @@ -115,11 +116,6 @@ public class KingHill extends WorldEvent if (clanCount == 1 && lastClan != null) { - if (getTicksRunning() % 40 == 0) - { - Bukkit.broadcastMessage(lastClan.getName() + " owns the hill!"); - } - CaptureData capData = _scoreMap.get(lastClan); if (capData == null) { @@ -128,6 +124,11 @@ public class KingHill extends WorldEvent } capData.TicksOnHill++; + if (getTicksRunning() % 40 == 0) + { + Bukkit.broadcastMessage(F.desc("Hill", F.elem(lastClan.getName()) + " own the hill (" + F.time(UtilTime.MakeStr(capData.TicksOnHill*50)) + ")")); + } + GoldManager.getInstance().dropGold(getCenterLocation().clone().add(0, 13, 0), GOLD_PER_TICK); } } @@ -136,7 +137,14 @@ public class KingHill extends WorldEvent public ArrayList getLines(ScoreboardManager manager, Player player, ArrayList out) { ArrayList list = new ArrayList(1); - list.add(" Loot in " + UtilTime.convertString(_nextLootDrop - System.currentTimeMillis(), 1, UtilTime.TimeUnit.FIT)); + + ClanInfo clan = _clansManager.getClan(player); + + if (clan != null) + { + list.add(" Time on hill: " + UtilTime.MakeStr(_scoreMap.get(clan).TicksOnHill * 50)); + } + return list; } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/undead/UndeadCamp.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/undead/UndeadCamp.java index 253734d61..dffc613a7 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/undead/UndeadCamp.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/undead/UndeadCamp.java @@ -3,7 +3,14 @@ package mineplex.game.clans.clans.worldevent.undead; import java.util.HashSet; import java.util.Iterator; -import mineplex.core.blockrestore.BlockRestore; +import org.bukkit.Effect; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.block.BlockFace; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerInteractEvent; + import mineplex.core.common.util.F; import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilMath; @@ -19,16 +26,6 @@ import mineplex.game.clans.clans.worldevent.undead.creature.UndeadArcher; import mineplex.game.clans.clans.worldevent.undead.creature.UndeadWarrior; import mineplex.minecraft.game.core.boss.EventState; import mineplex.minecraft.game.core.boss.WorldEvent; -import mineplex.minecraft.game.core.condition.ConditionManager; -import mineplex.minecraft.game.core.damage.DamageManager; - -import org.bukkit.Effect; -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.block.Block; -import org.bukkit.block.BlockFace; -import org.bukkit.event.EventHandler; -import org.bukkit.event.player.PlayerInteractEvent; public class UndeadCamp extends WorldEvent { diff --git a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/boss/WorldEvent.java b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/boss/WorldEvent.java index b271e5c63..727e02e6f 100644 --- a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/boss/WorldEvent.java +++ b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/boss/WorldEvent.java @@ -166,6 +166,7 @@ public abstract class WorldEvent implements Listener, ScoreboardElement customStart(); } + @Override public ArrayList getLines(ScoreboardManager manager, Player player, ArrayList out) { return null; @@ -408,4 +409,5 @@ public abstract class WorldEvent implements Listener, ScoreboardElement cancel(); } } + }