Minor HG Stuffs ;o

This commit is contained in:
Chiss 2013-12-13 16:21:39 +11:00
parent 97d8923678
commit 5f2e457362
4 changed files with 36 additions and 1 deletions

View File

@ -1,5 +1,8 @@
package mineplex.core.common.util; package mineplex.core.common.util;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Set; import java.util.Set;
import java.util.TreeSet; import java.util.TreeSet;
@ -111,4 +114,9 @@ public class UtilAlg
{ {
return new Vector(vec.getX(), vec.getY(), vec.getZ()); return new Vector(vec.getX(), vec.getY(), vec.getZ());
} }
public static <T> T Random(List<T> list)
{
return list.get(UtilMath.r(list.size()));
}
} }

View File

@ -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.EntityEnderDragon;
import net.minecraft.server.v1_6_R3.EntityHuman; import net.minecraft.server.v1_6_R3.EntityHuman;
import net.minecraft.server.v1_6_R3.EntityInsentient; 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.PathfinderGoalLookAtPlayer;
import net.minecraft.server.v1_6_R3.PathfinderGoalMoveTowardsRestriction; import net.minecraft.server.v1_6_R3.PathfinderGoalMoveTowardsRestriction;
import net.minecraft.server.v1_6_R3.PathfinderGoalRandomLookaround; import net.minecraft.server.v1_6_R3.PathfinderGoalRandomLookaround;
@ -19,11 +20,13 @@ import org.bukkit.Material;
import org.bukkit.Sound; import org.bukkit.Sound;
import org.bukkit.block.BlockFace; import org.bukkit.block.BlockFace;
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftEntity; import org.bukkit.craftbukkit.v1_6_R3.entity.CraftEntity;
import org.bukkit.entity.Creature;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;
import org.bukkit.entity.Giant; import org.bukkit.entity.Giant;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player; 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.entity.CraftCreature;
import org.bukkit.craftbukkit.v1_6_R3.CraftWorld; import org.bukkit.craftbukkit.v1_6_R3.CraftWorld;
@ -478,4 +481,23 @@ public class UtilEnt
return false; 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);
}
}
} }

View File

@ -152,7 +152,7 @@ public class Punish extends MiniPlugin
if (client != null && client.IsMuted()) 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.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); event.setCancelled(true);
} }
} }

View File

@ -239,9 +239,14 @@ public class HungerGames extends SoloGame
CreateChestCraftEnchant(); CreateChestCraftEnchant();
_supplyLocations = WorldData.GetDataLocs("WHITE"); _supplyLocations = WorldData.GetDataLocs("WHITE");
for (Location loc : _supplyLocations)
loc.getBlock().setType(Material.GLASS);
if (!WorldData.GetCustomLocs("VARS").isEmpty()) if (!WorldData.GetCustomLocs("VARS").isEmpty())
{
_maxSpreadRate = WorldData.GetCustomLocs("VARS").get(0).getBlockX(); _maxSpreadRate = WorldData.GetCustomLocs("VARS").get(0).getBlockX();
System.out.println("Spread Rate: " + _maxSpreadRate);
}
} }
private void CreateChestCraftEnchant() private void CreateChestCraftEnchant()