From 5f2e457362297c2c0a64a15e2b77027a7e5dd597 Mon Sep 17 00:00:00 2001 From: Chiss Date: Fri, 13 Dec 2013 16:21:39 +1100 Subject: [PATCH] Minor HG Stuffs ;o --- .../mineplex/core/common/util/UtilAlg.java | 8 +++++++ .../mineplex/core/common/util/UtilEnt.java | 22 +++++++++++++++++++ .../src/mineplex/core/punish/Punish.java | 2 +- .../game/games/hungergames/HungerGames.java | 5 +++++ 4 files changed, 36 insertions(+), 1 deletion(-) diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilAlg.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilAlg.java index 4ef023f93..c29b745d1 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilAlg.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilAlg.java @@ -1,5 +1,8 @@ package mineplex.core.common.util; +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; import java.util.Set; import java.util.TreeSet; @@ -111,4 +114,9 @@ public class UtilAlg { return new Vector(vec.getX(), vec.getY(), vec.getZ()); } + + public static T Random(List list) + { + return list.get(UtilMath.r(list.size())); + } } diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilEnt.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilEnt.java index 92106ea98..495226231 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilEnt.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilEnt.java @@ -8,6 +8,7 @@ import net.minecraft.server.v1_6_R3.EntityCreature; import net.minecraft.server.v1_6_R3.EntityEnderDragon; import net.minecraft.server.v1_6_R3.EntityHuman; import net.minecraft.server.v1_6_R3.EntityInsentient; +import net.minecraft.server.v1_6_R3.Navigation; import net.minecraft.server.v1_6_R3.PathfinderGoalLookAtPlayer; import net.minecraft.server.v1_6_R3.PathfinderGoalMoveTowardsRestriction; import net.minecraft.server.v1_6_R3.PathfinderGoalRandomLookaround; @@ -19,11 +20,13 @@ import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.block.BlockFace; import org.bukkit.craftbukkit.v1_6_R3.entity.CraftEntity; +import org.bukkit.entity.Creature; import org.bukkit.entity.Entity; import org.bukkit.entity.EntityType; import org.bukkit.entity.Giant; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; +import org.bukkit.entity.Skeleton; import org.bukkit.craftbukkit.v1_6_R3.entity.CraftCreature; import org.bukkit.craftbukkit.v1_6_R3.CraftWorld; @@ -478,4 +481,23 @@ public class UtilEnt return false; } + + public static void CreatureMove(Creature ent, Location target, float speed) + { + EntityCreature ec = ((CraftCreature)ent).getHandle(); + Navigation nav = ec.getNavigation(); + + if (UtilMath.offset(ent.getLocation(), target) > 24) + { + Location newTarget = ent.getLocation(); + + newTarget.add(UtilAlg.getTrajectory(ent.getLocation(), target).multiply(24)); + + nav.a(newTarget.getX(), newTarget.getY(), newTarget.getZ(), speed); + } + else + { + nav.a(target.getX(), target.getY(), target.getZ(), speed); + } + } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/punish/Punish.java b/Plugins/Mineplex.Core/src/mineplex/core/punish/Punish.java index bf31bc4eb..6dc2c0eca 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/punish/Punish.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/punish/Punish.java @@ -152,7 +152,7 @@ public class Punish extends MiniPlugin if (client != null && client.IsMuted()) { event.getPlayer().sendMessage(F.main(GetName(), "Shh, you're muted for " + C.cGreen + UtilTime.convertString(client.GetPunishment(PunishmentSentence.Mute).GetRemaining(), 1, TimeUnit.FIT) + ".")); - event.setMessage(""); + event.setMessage(" "); event.setCancelled(true); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hungergames/HungerGames.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hungergames/HungerGames.java index 0c0e77615..f2a649ac7 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hungergames/HungerGames.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hungergames/HungerGames.java @@ -239,9 +239,14 @@ public class HungerGames extends SoloGame CreateChestCraftEnchant(); _supplyLocations = WorldData.GetDataLocs("WHITE"); + for (Location loc : _supplyLocations) + loc.getBlock().setType(Material.GLASS); if (!WorldData.GetCustomLocs("VARS").isEmpty()) + { _maxSpreadRate = WorldData.GetCustomLocs("VARS").get(0).getBlockX(); + System.out.println("Spread Rate: " + _maxSpreadRate); + } } private void CreateChestCraftEnchant()