Merge branch 'master' of ssh://184.154.0.242:7999/min/Mineplex
Conflicts: Plugins/Mineplex.Core/src/mineplex/core/CustomTagFix.java
This commit is contained in:
commit
a196e43fde
@ -10,7 +10,7 @@
|
||||
<option name="ENABLE_SWING_INSPECTOR" value="false" />
|
||||
<option name="ENV_VARIABLES" />
|
||||
<option name="PASS_PARENT_ENVS" value="true" />
|
||||
<module name="" />
|
||||
<module name="Classpath.Dummy" />
|
||||
<envs />
|
||||
<RunnerSettings RunnerId="Debug">
|
||||
<option name="DEBUG_PORT" value="" />
|
||||
|
@ -10,7 +10,7 @@
|
||||
<option name="ENABLE_SWING_INSPECTOR" value="false" />
|
||||
<option name="ENV_VARIABLES" />
|
||||
<option name="PASS_PARENT_ENVS" value="true" />
|
||||
<module name="" />
|
||||
<module name="Classpath.Dummy" />
|
||||
<envs />
|
||||
<RunnerSettings RunnerId="Debug">
|
||||
<option name="DEBUG_PORT" value="" />
|
||||
|
@ -24,6 +24,7 @@
|
||||
<include name="**/*.class"/>
|
||||
</fileset>
|
||||
|
||||
<zipfileset src="../Libraries/jooq-3.4.2.jar" />
|
||||
<zipfileset src="../Libraries/httpclient-4.2.jar" />
|
||||
<zipfileset src="../Libraries/httpcore-4.2.jar" />
|
||||
<zipfileset src="../Libraries/httpclient-cache-4.2.jar" />
|
||||
|
Binary file not shown.
@ -84,4 +84,9 @@ public enum Rank
|
||||
if (bold) return Color + C.Bold + name;
|
||||
else return Color + name;
|
||||
}
|
||||
|
||||
public ChatColor GetColor()
|
||||
{
|
||||
return Color;
|
||||
}
|
||||
}
|
||||
|
@ -59,12 +59,6 @@ public class C
|
||||
public static String listValueOn = "" + ChatColor.GREEN;
|
||||
public static String listValueOff = "" + ChatColor.RED;
|
||||
|
||||
public static String rAll = "" + ChatColor.WHITE;
|
||||
public static String rHelp = "" + ChatColor.GREEN;
|
||||
public static String rMod = "" + ChatColor.GOLD;
|
||||
public static String rAdmin = "" + ChatColor.RED;
|
||||
public static String rOwner = "" + ChatColor.DARK_RED;
|
||||
|
||||
public static String consoleHead = "" + ChatColor.RED;
|
||||
public static String consoleFill = "" + ChatColor.WHITE;
|
||||
public static String consoleBody = "" + ChatColor.YELLOW;
|
||||
|
@ -95,22 +95,15 @@ public class F
|
||||
|
||||
public static String help(String cmd, String body, Rank rank)
|
||||
{
|
||||
if (rank == Rank.OWNER) return C.rOwner + cmd + " " + C.mBody + body + " " + rank(Rank.OWNER);
|
||||
else if (rank == Rank.ADMIN) return C.rAdmin + cmd + " " + C.mBody + body + " " + rank(Rank.ADMIN);
|
||||
else if (rank == Rank.MODERATOR) return C.rMod + cmd + " " + C.mBody + body + " " + rank(Rank.MODERATOR);
|
||||
else if (rank == Rank.HELPER) return C.rHelp + cmd + " " + C.mBody + body + " " + rank(Rank.HELPER);
|
||||
else return C.rAll + cmd + " " + C.mBody + body + " " + rank(Rank.ALL);
|
||||
return rank.GetColor() + cmd + " " + C.mBody + body + " " + rank(rank);
|
||||
}
|
||||
|
||||
public static String rank(Rank rank)
|
||||
{
|
||||
if (rank == Rank.OWNER) return C.rOwner + "Owner";
|
||||
else if (rank == Rank.ADMIN) return C.rAdmin + "Admin";
|
||||
else if (rank == Rank.DEVELOPER) return C.rAdmin + "Developer";
|
||||
else if (rank == Rank.SNR_MODERATOR) return C.rMod + "Senior Mod";
|
||||
else if (rank == Rank.MODERATOR) return C.rMod + "Mod";
|
||||
else if (rank == Rank.HELPER) return C.rHelp + "Helper";
|
||||
else return C.rAll + "Player";
|
||||
if (rank == Rank.ALL)
|
||||
return rank.GetColor() + "Player";
|
||||
|
||||
return rank.GetTag(false, false);
|
||||
}
|
||||
|
||||
public static String value(String variable, String value)
|
||||
|
@ -10,7 +10,7 @@ import org.bukkit.inventory.meta.FireworkMeta;
|
||||
|
||||
public class FireworkUtil
|
||||
{
|
||||
public static void LaunchRandomFirework(Location location)
|
||||
public static Firework LaunchRandomFirework(Location location)
|
||||
{
|
||||
Builder builder = FireworkEffect.builder();
|
||||
|
||||
@ -40,5 +40,7 @@ public class FireworkUtil
|
||||
data.addEffects(builder.build());
|
||||
data.setPower(RandomUtils.nextInt(3));
|
||||
firework.setFireworkMeta(data);
|
||||
|
||||
return firework;
|
||||
}
|
||||
}
|
||||
|
@ -12,6 +12,7 @@ import net.minecraft.server.v1_7_R4.PacketPlayOutEntityDestroy;
|
||||
import net.minecraft.server.v1_7_R4.PacketPlayOutEntityMetadata;
|
||||
import net.minecraft.server.v1_7_R4.PacketPlayOutSpawnEntityLiving;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.CraftWorld;
|
||||
@ -20,10 +21,13 @@ import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
public class UtilDisplay
|
||||
{
|
||||
public static final int ENTITY_ID = 777777;
|
||||
public static final EntityType ENTITY_TYPE = EntityType.WITHER;
|
||||
public static final boolean HALF_HEALTH = true;
|
||||
|
||||
private static HashMap<String, Boolean> hasHealthBar = new HashMap<String, Boolean>();
|
||||
|
||||
@ -34,11 +38,12 @@ public class UtilDisplay
|
||||
}
|
||||
|
||||
//Accessing packets
|
||||
public static PacketPlayOutSpawnEntityLiving getMobPacket(String text, double healthPercent, Location loc){
|
||||
public static PacketPlayOutSpawnEntityLiving getMobPacket(String text, double healthPercent, Location loc)
|
||||
{
|
||||
PacketPlayOutSpawnEntityLiving mobPacket = new PacketPlayOutSpawnEntityLiving();
|
||||
|
||||
mobPacket.a = (int) ENTITY_ID; //Entity ID
|
||||
mobPacket.b = (byte) EntityType.WITHER.getTypeId(); //Mob type (ID: 64)
|
||||
mobPacket.b = (byte) ENTITY_TYPE.getTypeId(); //Mob type (ID: 64)
|
||||
mobPacket.c = (int) Math.floor(loc.getBlockX() * 32.0D); //X position
|
||||
mobPacket.d = (int) MathHelper.floor(loc.getBlockY() * 32.0D); //Y position
|
||||
mobPacket.e = (int) Math.floor(loc.getBlockZ() * 32.0D); //Z position
|
||||
@ -49,30 +54,52 @@ public class UtilDisplay
|
||||
mobPacket.j = (short) 0; //Y velocity
|
||||
mobPacket.k = (short) 0; //Z velocity
|
||||
|
||||
DataWatcher watcher = getWatcher(text, 101 + healthPercent * 99, loc.getWorld());
|
||||
//Dragon or Wither
|
||||
double health;
|
||||
if (ENTITY_TYPE == EntityType.WITHER)
|
||||
{
|
||||
if (HALF_HEALTH)
|
||||
health = healthPercent * 149 + 151;
|
||||
else
|
||||
health = healthPercent * 299.9 + 0.1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (HALF_HEALTH)
|
||||
health = healthPercent * 99 + 101;
|
||||
else
|
||||
health = healthPercent * 199.9 + 0.1;
|
||||
}
|
||||
|
||||
DataWatcher watcher = getWatcher(text, health, loc.getWorld());
|
||||
|
||||
mobPacket.l = watcher;
|
||||
|
||||
return mobPacket;
|
||||
}
|
||||
|
||||
public static PacketPlayOutEntityDestroy getDestroyEntityPacket(){
|
||||
public static PacketPlayOutEntityDestroy getDestroyEntityPacket()
|
||||
{
|
||||
PacketPlayOutEntityDestroy packet = new PacketPlayOutEntityDestroy(ENTITY_ID);
|
||||
|
||||
return packet;
|
||||
}
|
||||
|
||||
public static PacketPlayOutEntityMetadata getMetadataPacket(DataWatcher watcher){
|
||||
public static PacketPlayOutEntityMetadata getMetadataPacket(DataWatcher watcher)
|
||||
{
|
||||
PacketPlayOutEntityMetadata metaPacket = new PacketPlayOutEntityMetadata();
|
||||
|
||||
metaPacket.a = (int) ENTITY_ID;
|
||||
|
||||
try{
|
||||
try
|
||||
{
|
||||
Field b = PacketPlayOutEntityMetadata.class.getDeclaredField("b");
|
||||
|
||||
b.setAccessible(true);
|
||||
b.set(metaPacket, watcher.c());
|
||||
} catch(Exception e){
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
@ -83,16 +110,14 @@ public class UtilDisplay
|
||||
{
|
||||
DataWatcher watcher = new DataWatcher(new DummyEntity(((CraftWorld)world).getHandle()));
|
||||
|
||||
health = Math.max(151, health);
|
||||
|
||||
watcher.a(0, (Byte) (byte) 0); //Flags, 0x20 = invisible
|
||||
watcher.a(6, (Float) (float) health);
|
||||
watcher.a(2, (String) text); //Entity name
|
||||
watcher.a(10, (String) text); //Entity name
|
||||
watcher.a(3, (Byte) (byte) 0); //Show name, 1 = show, 0 = don't show
|
||||
watcher.a(11, (Byte) (byte) 0); //Show name, 1 = show, 0 = don't show
|
||||
watcher.a(16, (Integer) (int) health); //Wither health, 200 = full health
|
||||
watcher.a(20, (Integer) (int) 0); //Wither invuln, 200 = full health
|
||||
watcher.a(16, (Integer) (int) health); //Wither health, 300 = full health
|
||||
watcher.a(20, (Integer) (int) 0); //Wither invuln,
|
||||
|
||||
int i1 = watcher.getInt(0);
|
||||
watcher.watch(0, Byte.valueOf((byte)(i1 | 1 << 5)));
|
||||
@ -101,93 +126,44 @@ public class UtilDisplay
|
||||
return watcher;
|
||||
}
|
||||
|
||||
//Other methods
|
||||
//Display
|
||||
public static void displayTextBar(JavaPlugin plugin, final Player player, double healthPercent, String text)
|
||||
{
|
||||
PacketPlayOutEntityDestroy destroyEntityPacket = getDestroyEntityPacket();
|
||||
|
||||
sendPacket(player, destroyEntityPacket);
|
||||
|
||||
PacketPlayOutSpawnEntityLiving mobPacket = getMobPacket(text, healthPercent, player.getEyeLocation().getDirection().multiply(24).toLocation(player.getWorld()).add(player.getLocation()));
|
||||
Location loc = player.getEyeLocation().add(player.getLocation().getDirection().multiply(24));
|
||||
|
||||
/*
|
||||
//Downward
|
||||
if (player.getLocation().getPitch() > 0)
|
||||
{
|
||||
loc = player.getLocation().subtract(0, 10, 0);
|
||||
}
|
||||
//Upward
|
||||
else
|
||||
{
|
||||
loc.add(player.getLocation().getDirection().multiply(12));
|
||||
loc.add(UtilAlg.getDown(player.getLocation().getDirection()).multiply(12));
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
PacketPlayOutSpawnEntityLiving mobPacket = getMobPacket(text, healthPercent, loc);
|
||||
|
||||
sendPacket(player, mobPacket);
|
||||
hasHealthBar.put(player.getName(), true);
|
||||
|
||||
new BukkitRunnable(){
|
||||
@Override
|
||||
public void run(){
|
||||
Bukkit.getServer().getScheduler().runTaskLater(plugin, new Runnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
PacketPlayOutEntityDestroy destroyEntityPacket = getDestroyEntityPacket();
|
||||
|
||||
sendPacket(player, destroyEntityPacket);
|
||||
hasHealthBar.put(player.getName(), false);
|
||||
}
|
||||
}.runTaskLater(plugin, 120L);
|
||||
}
|
||||
|
||||
public static void displayLoadingBar(final String text, final String completeText, final Player player, final int healthAdd, final long delay, final boolean loadUp, final JavaPlugin plugin){
|
||||
PacketPlayOutEntityDestroy destroyEntityPacket = getDestroyEntityPacket();
|
||||
|
||||
sendPacket(player, destroyEntityPacket);
|
||||
PacketPlayOutSpawnEntityLiving mobPacket = getMobPacket(text, 0, player.getEyeLocation().getDirection().multiply(24).toLocation(player.getWorld()).add(player.getLocation()));
|
||||
|
||||
sendPacket(player, mobPacket);
|
||||
hasHealthBar.put(player.getName(), true);
|
||||
|
||||
new BukkitRunnable(){
|
||||
int health = (loadUp ? 150 : 300);
|
||||
|
||||
@Override
|
||||
public void run(){
|
||||
if((loadUp ? health < 300 : health > 150)){
|
||||
DataWatcher watcher = getWatcher(text, health, player.getWorld());
|
||||
PacketPlayOutEntityMetadata metaPacket = getMetadataPacket(watcher);
|
||||
|
||||
sendPacket(player, metaPacket);
|
||||
|
||||
if(loadUp){
|
||||
health += healthAdd;
|
||||
} else {
|
||||
health -= healthAdd;
|
||||
}
|
||||
} else {
|
||||
DataWatcher watcher = getWatcher(text, (loadUp ? 300 : 150), player.getWorld());
|
||||
PacketPlayOutEntityMetadata metaPacket = getMetadataPacket(watcher);
|
||||
PacketPlayOutEntityDestroy destroyEntityPacket = getDestroyEntityPacket();
|
||||
|
||||
sendPacket(player, metaPacket);
|
||||
sendPacket(player, destroyEntityPacket);
|
||||
hasHealthBar.put(player.getName(), false);
|
||||
|
||||
//Complete text
|
||||
PacketPlayOutSpawnEntityLiving mobPacket = getMobPacket(completeText, 150, player.getLocation());
|
||||
|
||||
sendPacket(player, mobPacket);
|
||||
hasHealthBar.put(player.getName(), true);
|
||||
|
||||
DataWatcher watcher2 = getWatcher(completeText, 300, player.getWorld());
|
||||
PacketPlayOutEntityMetadata metaPacket2 = getMetadataPacket(watcher2);
|
||||
|
||||
sendPacket(player, metaPacket2);
|
||||
|
||||
new BukkitRunnable(){
|
||||
@Override
|
||||
public void run(){
|
||||
PacketPlayOutEntityDestroy destroyEntityPacket = getDestroyEntityPacket();
|
||||
|
||||
sendPacket(player, destroyEntityPacket);
|
||||
hasHealthBar.put(player.getName(), false);
|
||||
}
|
||||
}.runTaskLater(plugin, 40L);
|
||||
|
||||
this.cancel();
|
||||
}
|
||||
}
|
||||
}.runTaskTimer(plugin, delay, delay);
|
||||
}
|
||||
|
||||
public static void displayLoadingBar(final String text, final String completeText, final Player player, final int secondsDelay, final boolean loadUp, JavaPlugin plugin){
|
||||
final int healthChangePerSecond = 150 / secondsDelay;
|
||||
|
||||
displayLoadingBar(text, completeText, player, healthChangePerSecond, 20L, loadUp, plugin);
|
||||
}, 20);
|
||||
}
|
||||
}
|
@ -33,6 +33,8 @@ import org.bukkit.craftbukkit.v1_7_R4.CraftWorld;
|
||||
|
||||
public class UtilEnt
|
||||
{
|
||||
private static int entityIdCount = 455000;
|
||||
|
||||
//Custom Entity Names
|
||||
private static HashMap<Entity, String> _nameMap = new HashMap<Entity, String>();
|
||||
private static HashMap<String, EntityType> creatureMap = new HashMap<String, EntityType>();
|
||||
@ -568,4 +570,9 @@ public class UtilEnt
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static int getNewEntityId()
|
||||
{
|
||||
return entityIdCount++;
|
||||
}
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ import org.bukkit.FireworkEffect;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.CraftWorld;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftFirework;
|
||||
import org.bukkit.entity.Firework;
|
||||
import org.bukkit.inventory.meta.FireworkMeta;
|
||||
import org.bukkit.util.Vector;
|
||||
@ -20,9 +21,9 @@ public class UtilFirework
|
||||
data.addEffect(fe);
|
||||
firework.setFireworkMeta(data);
|
||||
|
||||
((CraftWorld)loc.getWorld()).getHandle().broadcastEntityEffect(((CraftEntity)firework).getHandle(), (byte)17);
|
||||
|
||||
firework.remove();
|
||||
((CraftFirework) firework).getHandle().expectedLifespan = 1;
|
||||
// ((CraftWorld)loc.getWorld()).getHandle().broadcastEntityEffect(((CraftEntity)firework).getHandle(), (byte)17);
|
||||
// firework.remove();
|
||||
}
|
||||
|
||||
public static Firework launchFirework(Location loc, FireworkEffect fe, Vector dir, int power)
|
||||
|
@ -10,6 +10,7 @@ import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@ -396,6 +397,11 @@ public class UtilPlayer
|
||||
return (((CraftEntity)player).getHandle().getDataWatcher().getByte(0) & 1 << 4) != 0;
|
||||
}
|
||||
|
||||
public static boolean is1_8(Player player)
|
||||
{
|
||||
return ((CraftPlayer)player).getHandle().playerConnection.networkManager.getVersion() >= 47;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
public void setListName(Player player, CoreClient client)
|
||||
|
@ -0,0 +1,82 @@
|
||||
package mineplex.core.common.util;
|
||||
|
||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import net.minecraft.server.v1_7_R4.ChatMessage;
|
||||
|
||||
import org.spigotmc.ProtocolInjector.PacketTitle;
|
||||
import org.spigotmc.ProtocolInjector.PacketTitle.Action;
|
||||
|
||||
/**
|
||||
* Created by Shaun on 9/5/2014.
|
||||
*/
|
||||
public class UtilTitle
|
||||
{
|
||||
/**
|
||||
* Show Title text for a player with their current set timings.
|
||||
*
|
||||
* Default timings are 20, 60, 20 (in ticks)
|
||||
*/
|
||||
public static void showTitle(String text, Player... players)
|
||||
{
|
||||
ChatMessage message = new ChatMessage(text);
|
||||
PacketTitle packet = new PacketTitle(Action.TITLE, message);
|
||||
sendPacket(packet, players);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the current subtitle for a player.
|
||||
*
|
||||
* This stays unless reset or cleared, and doesn't appear unless a title is showing
|
||||
*/
|
||||
public static void setSubtitle(String text, Player... players)
|
||||
{
|
||||
ChatMessage message = new ChatMessage(text);
|
||||
PacketTitle packet = new PacketTitle(Action.SUBTITLE, message);
|
||||
sendPacket(packet, players);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set timings for a player.
|
||||
*
|
||||
* Remember these are in ticks
|
||||
*/
|
||||
public static void setTimings(int fadeInTicks, int stayTicks, int fadeOutTicks, Player... players)
|
||||
{
|
||||
PacketTitle packet = new PacketTitle(Action.TIMES, fadeInTicks, stayTicks, fadeOutTicks);
|
||||
sendPacket(packet, players);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear the title that is currently being displayed, has no affect on timings or subtitle.
|
||||
*/
|
||||
public static void clear(Player... players)
|
||||
{
|
||||
PacketTitle packet = new PacketTitle(Action.CLEAR);
|
||||
sendPacket(packet, players);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset subtitle and timings for a player.
|
||||
*
|
||||
* This will set the subtitle to nothing and timings back to default (20, 60, 20)
|
||||
*/
|
||||
public static void reset(Player... players)
|
||||
{
|
||||
PacketTitle packet = new PacketTitle(Action.RESET);
|
||||
sendPacket(packet, players);
|
||||
}
|
||||
|
||||
private static void sendPacket(PacketTitle packet, Player... players)
|
||||
{
|
||||
for (Player player : players)
|
||||
{
|
||||
if (UtilPlayer.is1_8(player))
|
||||
{
|
||||
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -10,5 +10,7 @@
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/Mineplex.ServerData"/>
|
||||
<classpathentry kind="var" path="REPO_DIR/Plugins/Libraries/jedis-2.4.2.jar"/>
|
||||
<classpathentry kind="var" path="REPO_DIR/Plugins/Libraries/commons-pool2-2.2.jar"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/Mineplex.Database"/>
|
||||
<classpathentry kind="var" path="REPO_DIR/Plugins/Libraries/jooq-3.4.2.jar"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
|
@ -15,8 +15,8 @@
|
||||
<orderEntry type="module" module-name="Mineplex.Core.Common" />
|
||||
<orderEntry type="module" module-name="Mineplex.ServerData" />
|
||||
<orderEntry type="library" name="craftbukkit" level="project" />
|
||||
<orderEntry type="library" name="jooq" level="project" />
|
||||
<orderEntry type="module" module-name="Mineplex.Database" />
|
||||
<orderEntry type="library" name="jooq" level="project" />
|
||||
</component>
|
||||
</module>
|
||||
|
||||
|
@ -6,7 +6,9 @@ import java.util.List;
|
||||
import mineplex.core.common.DummyEntity;
|
||||
import mineplex.core.common.util.NautHashMap;
|
||||
import mineplex.core.packethandler.IPacketHandler;
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.packethandler.PacketHandler;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.packethandler.PacketVerifier;
|
||||
import mineplex.core.packethandler.PacketInfo;
|
||||
import net.minecraft.server.v1_7_R4.DataWatcher;
|
||||
@ -29,7 +31,6 @@ import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
public class CustomTagFix extends MiniPlugin implements IPacketHandler
|
||||
{
|
||||
private static int _fakeIdCounter = 455000;
|
||||
private NautHashMap<Player, NautHashMap<Integer, Integer>> _entityMap = new NautHashMap<Player, NautHashMap<Integer, Integer>>();
|
||||
|
||||
private Field _destroyId;
|
||||
@ -68,7 +69,7 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler
|
||||
Player owner = packetInfo.getPlayer();
|
||||
PacketVerifier verifier = packetInfo.getVerifier();
|
||||
|
||||
if (((CraftPlayer)owner).getHandle().playerConnection.networkManager.getVersion() >= 47)
|
||||
if (UtilPlayer.is1_8(owner))
|
||||
{
|
||||
if (owner.isOnline() && !_entityMap.containsKey(owner))
|
||||
_entityMap.put(owner, new NautHashMap<Integer, Integer>());
|
||||
@ -77,6 +78,12 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler
|
||||
{
|
||||
PacketPlayOutSpawnEntityLiving spawnPacket = (PacketPlayOutSpawnEntityLiving)packet;
|
||||
|
||||
// Ignore Armor stand packets
|
||||
if (spawnPacket.b == 30)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final String entityName = spawnPacket.l.getString(10);
|
||||
|
||||
if (spawnPacket.l.getByte(11) == 1 || spawnPacket.l.getByte(3) == 1)
|
||||
@ -86,7 +93,7 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler
|
||||
verifier.bypassProcess(new PacketPlayOutEntityDestroy(_entityMap.get(owner).get(spawnPacket.a)));
|
||||
}
|
||||
|
||||
int newId = _fakeIdCounter++;
|
||||
int newId = UtilEnt.getNewEntityId();
|
||||
sendProtocolPackets(owner, spawnPacket.a, newId, entityName, verifier);
|
||||
_entityMap.get(owner).put(spawnPacket.a, newId);
|
||||
}
|
||||
@ -109,7 +116,7 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler
|
||||
|
||||
if (!entityName.isEmpty())
|
||||
{
|
||||
int newId = _fakeIdCounter++;
|
||||
int newId = UtilEnt.getNewEntityId();
|
||||
sendProtocolPackets(owner, metaPacket.a, newId, entityName, verifier);
|
||||
_entityMap.get(owner).put(metaPacket.a, newId);
|
||||
}
|
||||
|
@ -88,8 +88,8 @@ public class AchievementMainPage extends ShopPageBase<AchievementManager, Achiev
|
||||
PlayerStats stats = _statsManager.Get(_target);
|
||||
for (int i = 0; i < statsToDisplay.length && i < max; i++)
|
||||
{
|
||||
// Skip showing Wins and Losses for other players
|
||||
if ((!Player.equals(_target)) && (statsToDisplay[i].equalsIgnoreCase("Wins") || statsToDisplay[i].equalsIgnoreCase("Losses")))
|
||||
// Skip showing Losses, Kills, Deaths for other players
|
||||
if ((!Player.equals(_target)) && (statsToDisplay[i].equalsIgnoreCase("Losses") || statsToDisplay[i].contains("Kills") || statsToDisplay[i].contains("Deaths")))
|
||||
continue;
|
||||
|
||||
String statName = statsToDisplay[i];
|
||||
|
@ -162,8 +162,8 @@ public class AchievementPage extends ShopPageBase<AchievementManager, Achievemen
|
||||
String[] friendlyStatNames = _category.getFriendlyStatNames();
|
||||
for (int i = 0; i < statsToDisplay.length; i++)
|
||||
{
|
||||
// Skip showing Wins and Losses for other players
|
||||
if ((!Player.equals(_target)) && (statsToDisplay[i].equalsIgnoreCase("Wins") || statsToDisplay[i].equalsIgnoreCase("Losses")))
|
||||
// Skip showing Losses, Kills, Deaths for other players
|
||||
if ((!Player.equals(_target)) && (statsToDisplay[i].equalsIgnoreCase("Losses") || statsToDisplay[i].contains("Kills") || statsToDisplay[i].contains("Deaths")))
|
||||
continue;
|
||||
|
||||
int statNumber = 0;
|
||||
|
@ -2,13 +2,17 @@ package mineplex.core.blockrestore;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
|
||||
import mineplex.core.MiniPlugin;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
|
||||
import org.bukkit.Effect;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
@ -90,6 +94,32 @@ public class BlockRestore extends MiniPlugin
|
||||
_blocks.remove(block).restore();
|
||||
}
|
||||
|
||||
public HashSet<Location> RestoreBlockAround(Material type, Location location, int radius)
|
||||
{
|
||||
HashSet<Location> restored = new HashSet<Location>();
|
||||
|
||||
Iterator<Block> blockIterator = _blocks.keySet().iterator();
|
||||
|
||||
while (blockIterator.hasNext())
|
||||
{
|
||||
Block block = blockIterator.next();
|
||||
|
||||
if (block.getType() != type)
|
||||
continue;
|
||||
|
||||
if (UtilMath.offset(block.getLocation().add(0.5, 0.5, 0.5), location) > radius)
|
||||
continue;
|
||||
|
||||
restored.add(block.getLocation().add(0.5, 0.5, 0.5));
|
||||
|
||||
_blocks.get(block).restore();
|
||||
|
||||
blockIterator.remove();
|
||||
}
|
||||
|
||||
return restored;
|
||||
}
|
||||
|
||||
public void Add(Block block, int toID, byte toData, long expireTime)
|
||||
{
|
||||
if (!Contains(block)) GetBlocks().put(block, new BlockRestoreData(block, toID, toData, expireTime, 0));
|
||||
@ -168,4 +198,6 @@ public class BlockRestore extends MiniPlugin
|
||||
{
|
||||
return _blocks;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ public class MorphBlaze extends MorphGadget
|
||||
C.cPurple + "Unlocked with Hero Rank",
|
||||
},
|
||||
-1,
|
||||
Material.FIRE, (byte)0);
|
||||
Material.BLAZE_POWDER, (byte)0);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -36,6 +36,8 @@ public abstract class OutfitGadget extends Gadget
|
||||
{
|
||||
Manager.RemoveMorph(player);
|
||||
|
||||
Manager.RemoveOutfit(player, _slot);
|
||||
|
||||
_active.add(player);
|
||||
|
||||
UtilPlayer.message(player, F.main("Gadget", "You put on " + F.elem(GetName()) + "."));
|
||||
@ -60,7 +62,7 @@ public abstract class OutfitGadget extends Gadget
|
||||
|
||||
UtilPlayer.message(player, F.main("Gadget", "You took off " + F.elem(GetName()) + "."));
|
||||
|
||||
if (_slot == ArmorSlot.Helmet) player.getInventory().setHelmet(null);
|
||||
if (_slot == ArmorSlot.Helmet) player.getInventory().setHelmet(null);
|
||||
else if (_slot == ArmorSlot.Chest) player.getInventory().setChestplate(null);
|
||||
else if (_slot == ArmorSlot.Legs) player.getInventory().setLeggings(null);
|
||||
else if (_slot == ArmorSlot.Boots) player.getInventory().setBoots(null);
|
||||
|
@ -0,0 +1,89 @@
|
||||
package mineplex.core.hologram;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.CraftWorld;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
import net.minecraft.server.v1_7_R4.DataWatcher;
|
||||
import net.minecraft.server.v1_7_R4.EnumEntitySize;
|
||||
import net.minecraft.server.v1_7_R4.MathHelper;
|
||||
import net.minecraft.server.v1_7_R4.Packet;
|
||||
import net.minecraft.server.v1_7_R4.PacketPlayOutEntityDestroy;
|
||||
import net.minecraft.server.v1_7_R4.PacketPlayOutSpawnEntityLiving;
|
||||
import net.minecraft.server.v1_7_R4.PlayerConnection;
|
||||
|
||||
import mineplex.core.common.DummyEntity;
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
|
||||
/**
|
||||
* Created by Shaun on 9/5/2014.
|
||||
*/
|
||||
public class ArmorStandHologram
|
||||
{
|
||||
private String _text;
|
||||
private Packet _packet;
|
||||
private int _entityId;
|
||||
|
||||
public ArmorStandHologram(Location location, String text)
|
||||
{
|
||||
_text = text;
|
||||
|
||||
_entityId = UtilEnt.getNewEntityId();
|
||||
_packet = createArmorStandPacket(location);
|
||||
}
|
||||
|
||||
public void sendToPlayer(Player player)
|
||||
{
|
||||
((CraftPlayer) player).getHandle().playerConnection.sendPacket(_packet);
|
||||
}
|
||||
|
||||
public void removeForPlayer(Player player)
|
||||
{
|
||||
PacketPlayOutEntityDestroy entityDestroyPacket = new PacketPlayOutEntityDestroy(_entityId);
|
||||
((CraftPlayer) player).getHandle().playerConnection.sendPacket(entityDestroyPacket);
|
||||
}
|
||||
|
||||
private PacketPlayOutSpawnEntityLiving createArmorStandPacket(Location location)
|
||||
{
|
||||
final PacketPlayOutSpawnEntityLiving packet = new PacketPlayOutSpawnEntityLiving();
|
||||
packet.a = _entityId;
|
||||
packet.b = (byte) 30;
|
||||
packet.c = MathHelper.floor(location.getX() * 32D);//(int) EnumEntitySize.SIZE_2.a(100);
|
||||
packet.d = MathHelper.floor((location.getY() - 0.8) * 32D);//(int) MathHelper.floor(64 * 32.0D);
|
||||
packet.e = MathHelper.floor(location.getZ() * 32D);//(int)EnumEntitySize.SIZE_2.a(100);
|
||||
packet.f = 0; // Velocity X
|
||||
packet.g = 0; // Velocity Y
|
||||
packet.h = 0; // Velocity Z
|
||||
packet.i = (byte) 0; // Yaw
|
||||
packet.j = (byte) 0; // Pitch
|
||||
packet.k = (byte) 0; // Head Pitch
|
||||
|
||||
final DataWatcher watcher = new DataWatcher(new DummyEntity(((CraftWorld)location.getWorld()).getHandle()));
|
||||
|
||||
watcher.a(0, Byte.valueOf((byte)0));
|
||||
watcher.a(1, Short.valueOf((short)300));
|
||||
watcher.a(2, _text);
|
||||
watcher.a(3, Byte.valueOf((byte) 1));
|
||||
watcher.a(4, Byte.valueOf((byte)0));
|
||||
watcher.a(7, Integer.valueOf(0));
|
||||
watcher.a(8, Byte.valueOf((byte)0));
|
||||
watcher.a(9, Byte.valueOf((byte)0));
|
||||
watcher.a(6, Float.valueOf(1.0F));
|
||||
watcher.a(10, Byte.valueOf((byte)0));
|
||||
|
||||
// Set invisible
|
||||
int i1 = watcher.getInt(0);
|
||||
watcher.watch(0, Byte.valueOf((byte)(i1 | 1 << 5)));
|
||||
|
||||
// Set small and No Gravity
|
||||
byte b1 = watcher.getByte(10);
|
||||
b1 = (byte)(b1 | 0x1);
|
||||
b1 = (byte)(b1 | 0x2);
|
||||
watcher.watch(10, Byte.valueOf(b1));
|
||||
|
||||
packet.l = watcher;
|
||||
|
||||
return packet;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,68 @@
|
||||
package mineplex.core.hologram;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
|
||||
/**
|
||||
* Created by shaun on 2014-09-09.
|
||||
*/
|
||||
public class Hologram
|
||||
{
|
||||
private HorseHologram _horseHologram;
|
||||
private ArmorStandHologram _armorStandHologram;
|
||||
|
||||
private Location _location;
|
||||
private String _text;
|
||||
|
||||
public Hologram(Location location, String text)
|
||||
{
|
||||
_location = location;
|
||||
_text = text;
|
||||
|
||||
_horseHologram = new HorseHologram(location, text);
|
||||
_armorStandHologram = new ArmorStandHologram(location, text);
|
||||
}
|
||||
|
||||
public void sendToPlayer(Player player)
|
||||
{
|
||||
if (UtilPlayer.is1_8(player))
|
||||
{
|
||||
_armorStandHologram.sendToPlayer(player);
|
||||
}
|
||||
else
|
||||
{
|
||||
_horseHologram.sendToPlayer(player);
|
||||
}
|
||||
}
|
||||
|
||||
public void sendToPlayers(Player... players)
|
||||
{
|
||||
for (Player player : players)
|
||||
{
|
||||
sendToPlayer(player);
|
||||
}
|
||||
}
|
||||
|
||||
public void removeForPlayer(Player player)
|
||||
{
|
||||
if (UtilPlayer.is1_8(player))
|
||||
{
|
||||
_armorStandHologram.removeForPlayer(player);
|
||||
}
|
||||
else
|
||||
{
|
||||
_horseHologram.removeForPlayer(player);
|
||||
}
|
||||
}
|
||||
|
||||
public void removeForPlayers(Player... players)
|
||||
{
|
||||
for (Player player : players)
|
||||
{
|
||||
removeForPlayer(player);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -19,10 +19,10 @@ import mineplex.core.common.util.UtilServer;
|
||||
/**
|
||||
* Created by Shaun on 8/29/2014.
|
||||
*/
|
||||
public class SimpleHologram
|
||||
public class HorseHologram
|
||||
{
|
||||
/**
|
||||
* SimpleHologram creates the required entities to spawn in a hologram. It is possible to send the packets for the entities to a player,
|
||||
* HorseHologram creates the required entities to spawn in a hologram. It is possible to send the packets for the entities to a player,
|
||||
* but it is also possible to add the entities to the nmsWorld to keep them loaded into the server.
|
||||
*/
|
||||
|
||||
@ -33,7 +33,7 @@ public class SimpleHologram
|
||||
private EntityFireball _fireball;
|
||||
private EntityHorse _horse;
|
||||
|
||||
public SimpleHologram(Location location, String text)
|
||||
public HorseHologram(Location location, String text)
|
||||
{
|
||||
_location = location;
|
||||
_text = text;
|
||||
@ -52,31 +52,40 @@ public class SimpleHologram
|
||||
_horse.setCustomNameVisible(true);
|
||||
}
|
||||
|
||||
public void spawnWithPackets()
|
||||
public void sendToPlayer(Player player)
|
||||
{
|
||||
Packet fireballSpawn = getFireballSpawnPacket();
|
||||
Packet horseSpawn = getHorseSpawnPacket();
|
||||
Packet attachPacket = getAttachEntityPacket();
|
||||
|
||||
sendPacket(player, fireballSpawn);
|
||||
sendPacket(player, horseSpawn);
|
||||
sendPacket(player, attachPacket);
|
||||
}
|
||||
|
||||
public void removeForPlayer(Player player)
|
||||
{
|
||||
Packet horseDestroy = getHorseDestroyPacket();
|
||||
Packet fireballDestroy = getFireballDestroyPacket();
|
||||
|
||||
sendPacket(player, horseDestroy);
|
||||
sendPacket(player, fireballDestroy);
|
||||
}
|
||||
|
||||
public void spawnWithPackets()
|
||||
{
|
||||
for (Player player : UtilServer.getPlayers())
|
||||
{
|
||||
sendPacket(player, fireballSpawn);
|
||||
sendPacket(player, horseSpawn);
|
||||
sendPacket(player, attachPacket);
|
||||
sendToPlayer(player);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void removeWithPackets()
|
||||
{
|
||||
Packet horseDestroy = getHorseDestroyPacket();
|
||||
Packet fireballDestroy = getFireballDestroyPacket();
|
||||
|
||||
for (Player player : UtilServer.getPlayers())
|
||||
{
|
||||
sendPacket(player, horseDestroy);
|
||||
sendPacket(player, fireballDestroy);
|
||||
}
|
||||
for (Player player : UtilServer.getPlayers())
|
||||
{
|
||||
removeForPlayer(player);
|
||||
}
|
||||
}
|
||||
|
||||
public void setText(String text)
|
@ -18,13 +18,11 @@ public class ChestData
|
||||
private Block _block;
|
||||
private ITreasureReward _reward;
|
||||
private boolean _opened;
|
||||
private boolean _finishedOpen;
|
||||
|
||||
public ChestData(Block block, ITreasureReward reward)
|
||||
{
|
||||
_block = block;
|
||||
_opened = false;
|
||||
_finishedOpen = false;
|
||||
_reward = reward;
|
||||
}
|
||||
|
||||
@ -33,21 +31,11 @@ public class ChestData
|
||||
return _opened;
|
||||
}
|
||||
|
||||
public boolean isFinishedOpen()
|
||||
{
|
||||
return _finishedOpen;
|
||||
}
|
||||
|
||||
public void setOpened(boolean opened)
|
||||
{
|
||||
_opened = opened;
|
||||
}
|
||||
|
||||
public void setFinishedOpen(boolean finishedOpen)
|
||||
{
|
||||
_finishedOpen = finishedOpen;
|
||||
}
|
||||
|
||||
public Block getBlock()
|
||||
{
|
||||
return _block;
|
||||
|
@ -5,21 +5,26 @@ import java.util.LinkedList;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Effect;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.NautHashMap;
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
import mineplex.core.treasure.animation.ChestSpawnAnimation;
|
||||
import mineplex.core.treasure.animation.ChestOpenAnimation;
|
||||
import mineplex.core.treasure.animation.ParticleAnimation;
|
||||
import mineplex.core.treasure.animation.Animation;
|
||||
import mineplex.core.treasure.reward.ExampleReward;
|
||||
import mineplex.core.treasure.animation.ChestExplodeAnimation;
|
||||
import mineplex.core.treasure.animation.ChestOpenAnimation;
|
||||
import mineplex.core.treasure.animation.ChestSpawnAnimation;
|
||||
import mineplex.core.treasure.animation.CircleAnimation;
|
||||
import mineplex.core.treasure.animation.FireworksAnimation;
|
||||
import mineplex.core.treasure.event.TreasureFinishEvent;
|
||||
import mineplex.core.treasure.reward.ITreasureReward;
|
||||
import mineplex.core.treasure.reward.RewardRarity;
|
||||
|
||||
/**
|
||||
* Created by Shaun on 8/27/2014.
|
||||
@ -32,18 +37,20 @@ public class Treasure
|
||||
private Block _centerBlock;
|
||||
private int _tickCount;
|
||||
private ChestData[] _chestData;
|
||||
private ITreasureReward[] _rewards;
|
||||
|
||||
private boolean _finished;
|
||||
private int _finishedTickCount;
|
||||
|
||||
private LinkedList<Animation> _animations;
|
||||
|
||||
private TreasureStyle _style;
|
||||
|
||||
public Treasure(Player player)
|
||||
public Treasure(Player player, ITreasureReward[] rewards)
|
||||
{
|
||||
this(player, new Random());
|
||||
this(player, new Random(), rewards);
|
||||
}
|
||||
|
||||
public Treasure(Player player, Random seed)
|
||||
public Treasure(Player player, Random seed, ITreasureReward[] rewards)
|
||||
{
|
||||
_player = player;
|
||||
_random = seed;
|
||||
@ -56,10 +63,12 @@ public class Treasure
|
||||
// _animations.add(new ParticleAnimation(this));
|
||||
|
||||
_chestData = new ChestData[4];
|
||||
_chestData[0] = new ChestData(_centerBlock.getRelative(2, 1, 0), new ExampleReward());
|
||||
_chestData[1] = new ChestData(_centerBlock.getRelative(-2, 1, 0), new ExampleReward());
|
||||
_chestData[2] = new ChestData(_centerBlock.getRelative(0, 1, 2), new ExampleReward());
|
||||
_chestData[3] = new ChestData(_centerBlock.getRelative(0, 1, -2), new ExampleReward());
|
||||
_chestData[0] = new ChestData(_centerBlock.getRelative(2, 1, 0), rewards[0]);
|
||||
_chestData[1] = new ChestData(_centerBlock.getRelative(-2, 1, 0), rewards[1]);
|
||||
_chestData[2] = new ChestData(_centerBlock.getRelative(0, 1, 2), rewards[2]);
|
||||
_chestData[3] = new ChestData(_centerBlock.getRelative(0, 1, -2), rewards[3]);
|
||||
|
||||
Bukkit.broadcastMessage(F.main("Treasure", F.name(_player.getName()) + " is opening a " + C.cGreen + "Treasure Chest"));
|
||||
}
|
||||
|
||||
private void createCenterClay()
|
||||
@ -122,8 +131,17 @@ public class Treasure
|
||||
}
|
||||
}
|
||||
|
||||
public int getFinishedTickCount()
|
||||
{
|
||||
return _finishedTickCount;
|
||||
}
|
||||
|
||||
public void update()
|
||||
{
|
||||
if (_finished)
|
||||
{
|
||||
_finishedTickCount++;
|
||||
}
|
||||
|
||||
if (_tickCount == 5)
|
||||
{
|
||||
@ -218,14 +236,30 @@ public class Treasure
|
||||
ChestData data = getChestData(block);
|
||||
if (data != null && !data.isOpened())
|
||||
{
|
||||
data.setOpened(true);
|
||||
String text = data.getReward().giveReward(_player);
|
||||
|
||||
ChestOpenAnimation chestOpenTask = new ChestOpenAnimation(this, data);
|
||||
data.setOpened(true);
|
||||
ChestOpenAnimation chestOpenTask = new ChestOpenAnimation(this, data, text);
|
||||
_animations.add(chestOpenTask);
|
||||
|
||||
// Extra effects based off the rarity of the treasure
|
||||
if (data.getReward().getRarity() == RewardRarity.UNCOMMON)
|
||||
{
|
||||
_animations.add(new FireworksAnimation(this, data.getBlock()));
|
||||
}
|
||||
else if (data.getReward().getRarity() == RewardRarity.RARE)
|
||||
{
|
||||
_animations.add(new CircleAnimation(this, data.getBlock().getLocation().add(0.5, 1.5, 0.5)));
|
||||
}
|
||||
else if (data.getReward().getRarity() == RewardRarity.VERY_RARE)
|
||||
{
|
||||
_animations.add(new ChestExplodeAnimation(this, data.getBlock()));
|
||||
Bukkit.broadcastMessage(F.main("Treasure", F.name(_player.getName()) + " opened an extremely rare treasure!"));
|
||||
}
|
||||
|
||||
if (isFinished())
|
||||
{
|
||||
System.out.println("finished");
|
||||
_finished = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -242,6 +276,11 @@ public class Treasure
|
||||
return null;
|
||||
}
|
||||
|
||||
public Player getPlayer()
|
||||
{
|
||||
return _player;
|
||||
}
|
||||
|
||||
public boolean isFinished()
|
||||
{
|
||||
boolean allOpened = true;
|
||||
@ -254,8 +293,20 @@ public class Treasure
|
||||
return allOpened;
|
||||
}
|
||||
|
||||
public void finish()
|
||||
public void cleanup()
|
||||
{
|
||||
for (ChestData chestData : _chestData)
|
||||
{
|
||||
// Give any unopened rewards to the player
|
||||
// This only applies if they leave the server
|
||||
// while opening a treasure
|
||||
if (!chestData.isOpened())
|
||||
{
|
||||
chestData.setOpened(true);
|
||||
chestData.getReward().giveReward(_player);
|
||||
}
|
||||
}
|
||||
|
||||
for (Map.Entry<Block, BlockInfo> entry : _blockRestoreMap.entrySet())
|
||||
{
|
||||
Block block = entry.getKey();
|
||||
@ -263,6 +314,7 @@ public class Treasure
|
||||
|
||||
block.setTypeId(data.getId());
|
||||
block.setData(data.getData());
|
||||
block.getLocation().getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, block.getTypeId());
|
||||
}
|
||||
|
||||
for (Animation animation : _animations)
|
||||
|
@ -1,16 +1,11 @@
|
||||
package mineplex.core.treasure;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.block.CraftBlock;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.util.CraftMagicNumbers;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.block.Action;
|
||||
@ -18,18 +13,28 @@ import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import net.minecraft.server.v1_7_R4.PacketPlayOutBlockAction;
|
||||
|
||||
import mineplex.core.MiniPlugin;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.NautHashMap;
|
||||
import mineplex.core.common.util.UtilAction;
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.inventory.InventoryManager;
|
||||
import mineplex.core.treasure.event.TreasureFinishEvent;
|
||||
import mineplex.core.treasure.event.TreasureStartEvent;
|
||||
import mineplex.core.treasure.reward.ITreasureReward;
|
||||
import mineplex.core.treasure.reward.RewardManager;
|
||||
import mineplex.core.treasure.reward.RewardRarity;
|
||||
import mineplex.core.treasure.reward.rewards.CoinReward;
|
||||
import mineplex.core.treasure.reward.rewards.InventoryReward;
|
||||
import mineplex.core.treasure.reward.rewards.UnknownPackageReward;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
|
||||
@ -39,12 +44,77 @@ import mineplex.core.updater.event.UpdateEvent;
|
||||
public class TreasureManager extends MiniPlugin
|
||||
{
|
||||
private NautHashMap<Player, Treasure> _playerTreasureMap;
|
||||
private RewardManager _rewardManager;
|
||||
private DonationManager _donationManager;
|
||||
private InventoryManager _inventoryManager;
|
||||
|
||||
public TreasureManager(JavaPlugin plugin)
|
||||
public TreasureManager(JavaPlugin plugin, DonationManager donationManager, InventoryManager inventoryManager)
|
||||
{
|
||||
super("Treasure", plugin);
|
||||
|
||||
_donationManager = donationManager;
|
||||
_playerTreasureMap = new NautHashMap<Player, Treasure>();
|
||||
_rewardManager = new RewardManager();
|
||||
_inventoryManager = inventoryManager;
|
||||
|
||||
// Very Rare
|
||||
_rewardManager.addReward(new CoinReward(donationManager, 1000, 2000, 1000, RewardRarity.VERY_RARE));
|
||||
_rewardManager.addReward(new UnknownPackageReward(donationManager, "Helix Particles", "Blood Helix",
|
||||
new ItemStack(Material.REDSTONE), RewardRarity.VERY_RARE, 100));
|
||||
_rewardManager.addReward(new UnknownPackageReward(donationManager, "Enchant Particles", "Enchanted",
|
||||
new ItemStack(Material.BOOK), RewardRarity.VERY_RARE, 1000));
|
||||
_rewardManager.addReward(new UnknownPackageReward(donationManager, "Fire Rings Particles", "Flame Rings",
|
||||
new ItemStack(Material.BLAZE_POWDER), RewardRarity.VERY_RARE, 600));
|
||||
_rewardManager.addReward(new UnknownPackageReward(donationManager, "Foot Particles", "Shadow Walk",
|
||||
new ItemStack(Material.LEATHER_BOOTS), RewardRarity.VERY_RARE, 1200));
|
||||
_rewardManager.addReward(new UnknownPackageReward(donationManager, "Green Particles", "Green Ring",
|
||||
new ItemStack(Material.EMERALD), RewardRarity.VERY_RARE, 200));
|
||||
_rewardManager.addReward(new UnknownPackageReward(donationManager, "Rain Particles", "Rain Cloud",
|
||||
new ItemStack(Material.INK_SACK), RewardRarity.VERY_RARE, 300));
|
||||
// _rewardManager.addReward(new UnknownPackageReward(donationManager, "Notch Morph", "Notch",
|
||||
// new ItemStack(Material.INK_SACK), RewardRarity.VERY_RARE, 10));
|
||||
_rewardManager.addReward(new InventoryReward(inventoryManager, "Gem Boosters", "Gem Booster", 50, 100,
|
||||
new ItemStack(Material.EMERALD_BLOCK), RewardRarity.VERY_RARE, 500));
|
||||
|
||||
// Rare
|
||||
_rewardManager.addReward(new CoinReward(donationManager, 500, 1000, 1000, RewardRarity.RARE));
|
||||
_rewardManager.addReward(new UnknownPackageReward(donationManager, "Bat Morph", "Bat Morph",
|
||||
new ItemStack(Material.SKULL_ITEM, 1, (short) 0, (byte) 1), RewardRarity.RARE, 100));
|
||||
_rewardManager.addReward(new UnknownPackageReward(donationManager, "Block Morph", "Block Morph",
|
||||
new ItemStack(Material.EMERALD_BLOCK), RewardRarity.RARE, 200));
|
||||
_rewardManager.addReward(new UnknownPackageReward(donationManager, "Chicken Morph", "Chicken Morph",
|
||||
new ItemStack(Material.FEATHER), RewardRarity.RARE, 300));
|
||||
_rewardManager.addReward(new UnknownPackageReward(donationManager, "Cow Morph", "Cow Morph",
|
||||
new ItemStack(Material.LEATHER), RewardRarity.RARE, 500));
|
||||
_rewardManager.addReward(new UnknownPackageReward(donationManager, "Enderman Morph", "Enderman Morph",
|
||||
new ItemStack(Material.ENDER_PEARL), RewardRarity.RARE, 200));
|
||||
_rewardManager.addReward(new InventoryReward(inventoryManager, "Gem Boosters", "Gem Booster", 10, 20,
|
||||
new ItemStack(Material.EMERALD_BLOCK), RewardRarity.RARE, 500));
|
||||
|
||||
// Uncommon
|
||||
_rewardManager.addReward(new CoinReward(donationManager, 100, 500, 2000, RewardRarity.UNCOMMON));
|
||||
_rewardManager.addReward(new InventoryReward(inventoryManager, "Ender Pearls", "Ethereal Pearl", 75, 150,
|
||||
new ItemStack(Material.ENDER_PEARL), RewardRarity.UNCOMMON, 1000));
|
||||
_rewardManager.addReward(new InventoryReward(inventoryManager, "Fireworks", "Fireworks", 75, 150,
|
||||
new ItemStack(Material.FIREWORK), RewardRarity.UNCOMMON, 1000));
|
||||
_rewardManager.addReward(new InventoryReward(inventoryManager, "TNT", "TNT", 30, 60,
|
||||
new ItemStack(Material.TNT), RewardRarity.UNCOMMON, 1000));
|
||||
_rewardManager.addReward(new InventoryReward(inventoryManager, "Melons", "Melon Launcher", 150, 300,
|
||||
new ItemStack(Material.MELON_BLOCK), RewardRarity.UNCOMMON, 1000));
|
||||
_rewardManager.addReward(new InventoryReward(inventoryManager, "Gem Boosters", "Gem Booster", 1, 10,
|
||||
new ItemStack(Material.EMERALD_BLOCK), RewardRarity.UNCOMMON, 500));
|
||||
|
||||
// Common
|
||||
_rewardManager.addReward(new CoinReward(donationManager, 0, 100, 2000, RewardRarity.COMMON));
|
||||
_rewardManager.addReward(new InventoryReward(inventoryManager, "Ender Pearls", "Ethereal Pearl", 25, 75,
|
||||
new ItemStack(Material.ENDER_PEARL), RewardRarity.COMMON, 1000));
|
||||
_rewardManager.addReward(new InventoryReward(inventoryManager, "Fireworks", "Fireworks", 25, 75,
|
||||
new ItemStack(Material.FIREWORK), RewardRarity.COMMON, 1000));
|
||||
_rewardManager.addReward(new InventoryReward(inventoryManager, "TNT", "TNT", 10, 30,
|
||||
new ItemStack(Material.TNT), RewardRarity.COMMON, 1000));
|
||||
_rewardManager.addReward(new InventoryReward(inventoryManager, "Melons", "Melon Launcher", 50, 150,
|
||||
new ItemStack(Material.MELON_BLOCK), RewardRarity.COMMON, 1000));
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -52,16 +122,25 @@ public class TreasureManager extends MiniPlugin
|
||||
{
|
||||
for (Treasure treasure : _playerTreasureMap.values())
|
||||
{
|
||||
treasure.finish();
|
||||
treasure.cleanup();
|
||||
}
|
||||
}
|
||||
|
||||
public void attemptOpenTreasure(Player player)
|
||||
{
|
||||
if (!checkNearbyBlocks(player))
|
||||
if (!checkNearbyBlocks(player) || checkNearSpawn(player) || checkInAir(player))
|
||||
return;
|
||||
|
||||
Treasure treasure = new Treasure(player);
|
||||
TreasureStartEvent event = new TreasureStartEvent(player);
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ITreasureReward[] rewards = _rewardManager.getRewards(player);
|
||||
Treasure treasure = new Treasure(player, rewards);
|
||||
_playerTreasureMap.put(player, treasure);
|
||||
|
||||
Location teleportLocation = treasure.getPlayerBlock().getLocation().add(0.5, 0, 0.5);
|
||||
@ -74,6 +153,7 @@ public class TreasureManager extends MiniPlugin
|
||||
|
||||
private boolean checkNearbyBlocks(Player player)
|
||||
{
|
||||
//todo improve this
|
||||
Block centerBlock = player.getLocation().getBlock();
|
||||
|
||||
for (int y = 0; y <= 3; y++)
|
||||
@ -85,7 +165,7 @@ public class TreasureManager extends MiniPlugin
|
||||
Block block = centerBlock.getRelative(x, y, z);
|
||||
if (UtilBlock.solid(block))
|
||||
{
|
||||
UtilPlayer.message(player, F.main("Treasure", "You can not open a treasure at this spot. Please find a more open location"));
|
||||
UtilPlayer.message(player, F.main("Treasure", "You can't open chests here."));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -94,6 +174,25 @@ public class TreasureManager extends MiniPlugin
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean checkInAir(Player player)
|
||||
{
|
||||
boolean grounded = UtilEnt.isGrounded(player);
|
||||
|
||||
if (!grounded)
|
||||
UtilPlayer.message(player, F.main("Treasure", "You can't open chests while in the air."));
|
||||
|
||||
return !grounded;
|
||||
}
|
||||
|
||||
private boolean checkNearSpawn(Player player)
|
||||
{
|
||||
boolean nearSpawn = UtilMath.offset2d(new Location(player.getWorld(), 0, 0, 0), player.getLocation()) < 10;
|
||||
|
||||
if (nearSpawn)
|
||||
UtilPlayer.message(player, F.main("Treasure", "You can't open chests near spawn."));
|
||||
|
||||
return nearSpawn;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void update(UpdateEvent event)
|
||||
@ -101,9 +200,21 @@ public class TreasureManager extends MiniPlugin
|
||||
if (event.getType() != UpdateType.TICK)
|
||||
return;
|
||||
|
||||
for (Treasure treasure : _playerTreasureMap.values())
|
||||
Iterator<Treasure> iterator = _playerTreasureMap.values().iterator();
|
||||
while(iterator.hasNext())
|
||||
{
|
||||
Treasure treasure = iterator.next();
|
||||
|
||||
treasure.update();
|
||||
|
||||
if (treasure.isFinished() && treasure.getFinishedTickCount() >= 100)
|
||||
{
|
||||
treasure.cleanup();
|
||||
iterator.remove();
|
||||
|
||||
TreasureFinishEvent finishEvent = new TreasureFinishEvent(treasure.getPlayer(), treasure);
|
||||
Bukkit.getPluginManager().callEvent(finishEvent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -113,7 +224,7 @@ public class TreasureManager extends MiniPlugin
|
||||
if (_playerTreasureMap.containsKey(event.getPlayer()))
|
||||
{
|
||||
Treasure treasure = _playerTreasureMap.remove(event.getPlayer());
|
||||
treasure.finish();
|
||||
treasure.cleanup();
|
||||
}
|
||||
}
|
||||
|
||||
@ -175,16 +286,22 @@ public class TreasureManager extends MiniPlugin
|
||||
}
|
||||
}
|
||||
|
||||
// @EventHandler
|
||||
// public void command(PlayerCommandPreprocessEvent event)
|
||||
// {
|
||||
// //TODO Remove
|
||||
// if (event.getMessage().startsWith("/treasure"))
|
||||
// {
|
||||
// event.getPlayer().sendMessage("Attempting to open treasure...");
|
||||
// attemptOpenTreasure(event.getPlayer());
|
||||
// event.setCancelled(true);
|
||||
// }
|
||||
// }
|
||||
@EventHandler
|
||||
public void treasureFinish(TreasureFinishEvent event)
|
||||
{
|
||||
_playerTreasureMap.remove(event.getPlayer());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void command(PlayerCommandPreprocessEvent event)
|
||||
{
|
||||
//TODO Remove
|
||||
if (event.getMessage().startsWith("/treasure"))
|
||||
{
|
||||
event.getPlayer().sendMessage("Attempting to open treasure...");
|
||||
attemptOpenTreasure(event.getPlayer());
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -12,20 +12,40 @@ public enum TreasureStyle
|
||||
/**
|
||||
* These are examples, not final!
|
||||
*/
|
||||
RED(Material.STAINED_CLAY, (byte) 14,
|
||||
Material.STAINED_CLAY, (byte) 6,
|
||||
Material.STAINED_GLASS_PANE, (byte) 14,
|
||||
ParticleType.HEART,
|
||||
ParticleType.HAPPY_VILLAGER,
|
||||
ParticleType.FLAME),
|
||||
|
||||
|
||||
GREEN(Material.STAINED_CLAY,(byte) 5,
|
||||
Material.STAINED_CLAY, (byte) 13,
|
||||
Material.STAINED_GLASS_PANE, (byte) 5,
|
||||
NETHER(Material.NETHERRACK, (byte) 0,
|
||||
Material.NETHER_BRICK, (byte) 0,
|
||||
Material.NETHER_FENCE, (byte) 0,
|
||||
null,
|
||||
ParticleType.FLAME,
|
||||
ParticleType.RED_DUST,
|
||||
ParticleType.LAVA);
|
||||
ParticleType.LAVA),
|
||||
|
||||
NATURE(Material.GRASS, (byte) 0,
|
||||
Material.LOG, (byte) 0,
|
||||
Material.LEAVES, (byte) 0,
|
||||
null,
|
||||
ParticleType.HAPPY_VILLAGER,
|
||||
ParticleType.SLIME),
|
||||
|
||||
WATER(Material.ICE,(byte) 9,
|
||||
Material.PACKED_ICE, (byte) 5,
|
||||
Material.STAINED_GLASS_PANE, (byte) 8,
|
||||
null,
|
||||
ParticleType.SPLASH,
|
||||
ParticleType.SNOWBALL_POOF);
|
||||
|
||||
// FANCY(Material.DIAMOND_BLOCK,(byte) 0,
|
||||
// Material.GOLD_BLOCK, (byte) 0,
|
||||
// Material.AIR, (byte) 0,
|
||||
// ParticleType.FLAME,
|
||||
// ParticleType.CLOUD,
|
||||
// ParticleType.LAVA),
|
||||
//
|
||||
// FANCY_2(Material.IRON_BLOCK,(byte) 0,
|
||||
// Material.EMERALD_BLOCK, (byte) 0,
|
||||
// Material.AIR, (byte) 0,
|
||||
// ParticleType.FLAME,
|
||||
// ParticleType.HAPPY_VILLAGER,
|
||||
// null);
|
||||
|
||||
private Material _primaryMaterial;
|
||||
private byte _primaryData;
|
||||
|
@ -0,0 +1,68 @@
|
||||
package mineplex.core.treasure.animation;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.FireworkEffect;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.block.Block;
|
||||
|
||||
import mineplex.core.common.util.UtilFirework;
|
||||
import mineplex.core.treasure.Treasure;
|
||||
|
||||
/**
|
||||
* Created by shaun on 14-09-12.
|
||||
*/
|
||||
public class ChestExplodeAnimation extends Animation
|
||||
{
|
||||
/**
|
||||
* Played when a "Very Rare" chest is opened
|
||||
*/
|
||||
|
||||
private Random _random = new Random();
|
||||
private Block _chestBlock;
|
||||
|
||||
public ChestExplodeAnimation(Treasure treasure, Block chestBlock)
|
||||
{
|
||||
super(treasure);
|
||||
|
||||
_chestBlock = chestBlock;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void tick()
|
||||
{
|
||||
if (getTicks() == 1)
|
||||
{
|
||||
// _chestBlock.getLocation().getWorld().playSound(_chestBlock.getLocation().add(0.5, 0.5, 0.5), Sound.WITHER_SPAWN, 10F, 1.2F);
|
||||
_chestBlock.getLocation().getWorld().playSound(_chestBlock.getLocation().add(0.5, 0.5, 0.5), Sound.ENDERDRAGON_DEATH, 10F, 2.0F);
|
||||
}
|
||||
if (getTicks() == 10)
|
||||
{
|
||||
FireworkEffect effect = FireworkEffect.builder().with(FireworkEffect.Type.BALL_LARGE).withColor(Color.RED).withFade(Color.BLACK).build();
|
||||
UtilFirework.playFirework(_chestBlock.getLocation().add(0.5, 0.5, 0.5), effect);
|
||||
// ((CraftWorld) _chestBlock.getWorld()).getHandle().triggerEffect(1005, _chestBlock.getX(), _chestBlock.getY(), _chestBlock.getZ(), 2257);
|
||||
}
|
||||
else if (getTicks() < 10)
|
||||
{
|
||||
double xDif = _random.nextGaussian() * 0.5;
|
||||
double zDif = _random.nextGaussian() * 0.5;
|
||||
double yDif = _random.nextGaussian() * 0.5;
|
||||
|
||||
Location loc = _chestBlock.getLocation().add(0.5, 0.5, 0.5).add(xDif, zDif, yDif);
|
||||
|
||||
loc.getWorld().createExplosion(loc.getX(), loc.getY(), loc.getZ(), 0F);
|
||||
}
|
||||
else
|
||||
{
|
||||
finish();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onFinish()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
@ -8,11 +8,11 @@ import org.bukkit.craftbukkit.v1_7_R4.util.CraftMagicNumbers;
|
||||
import org.bukkit.entity.Item;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import net.minecraft.server.v1_7_R4.PacketPlayOutBlockAction;
|
||||
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.hologram.SimpleHologram;
|
||||
import mineplex.core.hologram.Hologram;
|
||||
import mineplex.core.hologram.HorseHologram;
|
||||
import mineplex.core.treasure.ChestData;
|
||||
import mineplex.core.treasure.Treasure;
|
||||
|
||||
@ -22,14 +22,16 @@ import mineplex.core.treasure.Treasure;
|
||||
public class ChestOpenAnimation extends Animation
|
||||
{
|
||||
private ChestData _chestData;
|
||||
private String _text;
|
||||
|
||||
private Item _itemEntity;
|
||||
private SimpleHologram _hologram;
|
||||
private Hologram _hologram;
|
||||
|
||||
public ChestOpenAnimation(Treasure treasure, ChestData chestData)
|
||||
public ChestOpenAnimation(Treasure treasure, ChestData chestData, String text)
|
||||
{
|
||||
super(treasure);
|
||||
_chestData = chestData;
|
||||
_text = text;
|
||||
|
||||
// Send chest open packet
|
||||
Block block = chestData.getBlock();
|
||||
@ -53,10 +55,8 @@ public class ChestOpenAnimation extends Animation
|
||||
}
|
||||
else if (getTicks() == 15)
|
||||
{
|
||||
_hologram = new SimpleHologram(_chestData.getBlock().getLocation().add(0.5, 1.1, 0.5), _chestData.getReward().getText());
|
||||
_hologram.spawnWithPackets();
|
||||
|
||||
_chestData.setFinishedOpen(true);
|
||||
_hologram = new Hologram(_chestData.getBlock().getLocation().add(0.5, 1.1, 0.5), _text);
|
||||
_hologram.sendToPlayers(_chestData.getBlock().getLocation().getWorld().getPlayers().toArray(new Player[0]));
|
||||
}
|
||||
}
|
||||
|
||||
@ -64,7 +64,7 @@ public class ChestOpenAnimation extends Animation
|
||||
{
|
||||
if (_hologram != null)
|
||||
{
|
||||
_hologram.removeWithPackets();
|
||||
_hologram.removeForPlayers(_chestData.getBlock().getLocation().getWorld().getPlayers().toArray(new Player[0]));
|
||||
_itemEntity.remove();
|
||||
}
|
||||
}
|
||||
|
@ -4,6 +4,10 @@ import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.CraftWorld;
|
||||
|
||||
import net.minecraft.server.v1_7_R4.MathHelper;
|
||||
import net.minecraft.server.v1_7_R4.PacketPlayOutWorldEvent;
|
||||
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
import mineplex.core.treasure.Treasure;
|
||||
@ -49,7 +53,20 @@ public class ChestSpawnAnimation extends Animation
|
||||
getTreasure().setBlock(_block, Material.CHEST, _direction);
|
||||
_block.getLocation().getWorld().playSound(_centerLocation, Sound.ANVIL_LAND, 0.5f, 1f);
|
||||
|
||||
UtilParticle.PlayParticle(getTreasure().getStyle().getChestSpawnParticle(), _centerLocation, 0.2f, 0.2f, 0.2f, 0, 50);
|
||||
UtilParticle.ParticleType particleType = getTreasure().getStyle().getChestSpawnParticle();
|
||||
|
||||
if (particleType != null)
|
||||
{
|
||||
UtilParticle.PlayParticle(particleType, _centerLocation, 0.2f, 0.2f, 0.2f, 0, 50);
|
||||
}
|
||||
else
|
||||
{
|
||||
// TODO This doesnt work for 1.8 clients
|
||||
int i = MathHelper.floor(_centerLocation.getX());
|
||||
int j = MathHelper.floor(_centerLocation.getY() - 0.20000000298023224D - 0.5);
|
||||
int k = MathHelper.floor(_centerLocation.getZ());
|
||||
((CraftWorld) _centerLocation.getWorld()).getHandle().triggerEffect(2006, i, j, k, MathHelper.f(60 - 3.0F));
|
||||
}
|
||||
finish();
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,60 @@
|
||||
package mineplex.core.treasure.animation;
|
||||
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.FireworkEffect;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.block.Block;
|
||||
|
||||
import mineplex.core.common.util.UtilFirework;
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
import mineplex.core.treasure.Treasure;
|
||||
|
||||
/**
|
||||
* Created by shaun on 2014-09-09.
|
||||
*/
|
||||
public class CircleAnimation extends Animation
|
||||
{
|
||||
/**
|
||||
* Played when a "Rare" chest is opened
|
||||
*/
|
||||
|
||||
private Location _centerLocation;
|
||||
|
||||
public CircleAnimation(Treasure treasure, Location centerLocation)
|
||||
{
|
||||
super(treasure);
|
||||
|
||||
_centerLocation = centerLocation;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void tick()
|
||||
{
|
||||
if (getTicks() == 2)
|
||||
{
|
||||
UtilFirework.playFirework(_centerLocation, FireworkEffect.builder().withColor(Color.ORANGE).with(FireworkEffect.Type.BURST).build());
|
||||
_centerLocation.getWorld().playSound(_centerLocation, Sound.WITHER_SPAWN, 10F, 1.2F);
|
||||
}
|
||||
else if (getTicks() >= 60)
|
||||
{
|
||||
finish();
|
||||
}
|
||||
|
||||
double currentRotation = getTicks() / 20D;
|
||||
double radius = currentRotation;
|
||||
double yDiff = currentRotation;
|
||||
double xDiff = Math.sin(currentRotation * 2 * Math.PI) * radius;
|
||||
double zDiff = Math.cos(currentRotation * 2 * Math.PI) * radius;
|
||||
|
||||
Location location = _centerLocation.clone().add(xDiff, yDiff, zDiff);
|
||||
|
||||
UtilParticle.PlayParticle(UtilParticle.ParticleType.FLAME, location, 0, 0, 0, 0, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onFinish()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,68 @@
|
||||
package mineplex.core.treasure.animation;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.FireworkEffect;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftFirework;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Firework;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import net.minecraft.server.v1_7_R4.PacketPlayOutEntityStatus;
|
||||
|
||||
import mineplex.core.common.util.FireworkUtil;
|
||||
import mineplex.core.common.util.UtilFirework;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.treasure.Treasure;
|
||||
|
||||
/**
|
||||
* Created by shaun on 2014-09-09.
|
||||
*/
|
||||
public class FireworksAnimation extends Animation
|
||||
{
|
||||
/**
|
||||
* Played when an "Uncommon" chest is opened
|
||||
*/
|
||||
|
||||
private Random _random = new Random();
|
||||
private Block _block;
|
||||
|
||||
public FireworksAnimation(Treasure treasure, Block block)
|
||||
{
|
||||
super(treasure);
|
||||
|
||||
_block = block;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void tick()
|
||||
{
|
||||
if (getTicks() >= 1)
|
||||
finish();
|
||||
|
||||
if (getTicks() % 10 == 0)
|
||||
{
|
||||
double xDif = 0;//_random.nextGaussian() * 1;
|
||||
double zDif = 0;//_random.nextGaussian() * 1;
|
||||
double yDif = 2;//(_random.nextInt(3) * _random.nextDouble()) + 2;
|
||||
|
||||
FireworkEffect effect = FireworkEffect.builder().withColor(Color.fromRGB(_random.nextInt(255), _random.nextInt(255), _random.nextInt(255)))
|
||||
.withFade(Color.fromRGB(_random.nextInt(255), _random.nextInt(255), _random.nextInt(255)))
|
||||
.with(FireworkEffect.Type.STAR)
|
||||
.build();
|
||||
|
||||
UtilFirework.playFirework(_block.getLocation().add(xDif, yDif, zDif), effect);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onFinish()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
package mineplex.core.treasure.event;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
import mineplex.core.treasure.Treasure;
|
||||
|
||||
/**
|
||||
* Created by shaun on 14-09-12.
|
||||
*/
|
||||
public class TreasureFinishEvent extends Event
|
||||
{
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
private final Player _player;
|
||||
private final Treasure _treasure;
|
||||
|
||||
public TreasureFinishEvent(Player player, Treasure treasure)
|
||||
{
|
||||
_player = player;
|
||||
_treasure = treasure;
|
||||
}
|
||||
|
||||
public Player getPlayer()
|
||||
{
|
||||
return _player;
|
||||
}
|
||||
|
||||
public Treasure getTreasure()
|
||||
{
|
||||
return _treasure;
|
||||
}
|
||||
|
||||
public HandlerList getHandlers()
|
||||
{
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList()
|
||||
{
|
||||
return handlers;
|
||||
}
|
||||
}
|
@ -0,0 +1,49 @@
|
||||
package mineplex.core.treasure.event;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* Created by shaun on 14-09-12.
|
||||
*/
|
||||
public class TreasureStartEvent extends Event implements Cancellable
|
||||
{
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
private Player _player;
|
||||
private boolean _cancelled = false;
|
||||
|
||||
public TreasureStartEvent(Player player)
|
||||
{
|
||||
_player = player;
|
||||
}
|
||||
|
||||
public Player getPlayer()
|
||||
{
|
||||
return _player;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCancelled()
|
||||
{
|
||||
return _cancelled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCancelled(boolean cancelled)
|
||||
{
|
||||
_cancelled = cancelled;
|
||||
}
|
||||
|
||||
public HandlerList getHandlers()
|
||||
{
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList()
|
||||
{
|
||||
return handlers;
|
||||
}
|
||||
}
|
@ -1,30 +0,0 @@
|
||||
package mineplex.core.treasure.reward;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
|
||||
/**
|
||||
* Created by Shaun on 9/2/2014.
|
||||
*/
|
||||
public class ExampleReward implements ITreasureReward
|
||||
{
|
||||
@Override
|
||||
public String getText()
|
||||
{
|
||||
return C.cGreen + "100 Gems";
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getItem()
|
||||
{
|
||||
return new ItemStack(Material.EMERALD);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RewardRarity getRarity()
|
||||
{
|
||||
return RewardRarity.COMMON;
|
||||
}
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
package mineplex.core.treasure.reward;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
/**
|
||||
@ -7,10 +8,22 @@ import org.bukkit.inventory.ItemStack;
|
||||
*/
|
||||
public interface ITreasureReward
|
||||
{
|
||||
public String getText();
|
||||
|
||||
public ItemStack getItem();
|
||||
|
||||
public RewardRarity getRarity();
|
||||
|
||||
/**
|
||||
* Give the reward to the player.
|
||||
*
|
||||
* @return String detailing the reward. This will be shown to the player
|
||||
*/
|
||||
public String giveReward(Player player);
|
||||
|
||||
public boolean canGiveReward(Player player);
|
||||
|
||||
/**
|
||||
* This is used to weight rewards across different rarities. Rewards with a larger weight
|
||||
* will have a higher chance of being selected
|
||||
*/
|
||||
public int getWeight();
|
||||
}
|
||||
|
@ -0,0 +1,149 @@
|
||||
package mineplex.core.treasure.reward;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
/**
|
||||
* Created by shaun on 2014-09-04.
|
||||
*/
|
||||
public class RewardManager
|
||||
{
|
||||
private HashMap<RewardRarity, List<ITreasureReward>> _treasureMap;
|
||||
private Random _random;
|
||||
|
||||
public RewardManager()
|
||||
{
|
||||
_treasureMap = new HashMap<RewardRarity, List<ITreasureReward>>();
|
||||
_random = new Random();
|
||||
|
||||
for (RewardRarity rarity : RewardRarity.values())
|
||||
{
|
||||
_treasureMap.put(rarity, new ArrayList<ITreasureReward>());
|
||||
}
|
||||
}
|
||||
|
||||
public void addReward(ITreasureReward reward)
|
||||
{
|
||||
RewardRarity rarity = reward.getRarity();
|
||||
|
||||
List<ITreasureReward> treasureList = _treasureMap.get(rarity);
|
||||
|
||||
treasureList.add(reward);
|
||||
}
|
||||
|
||||
public ITreasureReward[] getRewards(Player player)
|
||||
{
|
||||
int currentReward = 0;
|
||||
ITreasureReward[] rewards = new ITreasureReward[4];
|
||||
boolean hasUncommon = false;
|
||||
|
||||
while (currentReward < 4)
|
||||
{
|
||||
ITreasureReward reward = nextReward(player, rewards, currentReward == 3 && !hasUncommon);
|
||||
|
||||
if (reward == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (reward.getRarity().ordinal() >= RewardRarity.UNCOMMON.ordinal())
|
||||
{
|
||||
hasUncommon = true;
|
||||
}
|
||||
rewards[currentReward] = reward;
|
||||
currentReward++;
|
||||
}
|
||||
|
||||
// Swap the last reward with another one, this makes the uncommon added at the end of some chests seem more random
|
||||
int slotToSwitch = _random.nextInt(4);
|
||||
if (slotToSwitch != 3)
|
||||
{
|
||||
ITreasureReward thirdReward = rewards[3];
|
||||
ITreasureReward otherReward = rewards[slotToSwitch];
|
||||
|
||||
rewards[3] = otherReward;
|
||||
rewards[slotToSwitch] = thirdReward;
|
||||
}
|
||||
|
||||
return rewards;
|
||||
}
|
||||
|
||||
private ITreasureReward nextReward(Player player, ITreasureReward[] excludedRewards)
|
||||
{
|
||||
return nextReward(player, excludedRewards, false);
|
||||
}
|
||||
|
||||
private ITreasureReward nextReward(Player player, ITreasureReward[] excludedRewards, boolean requiresUncommon)
|
||||
{
|
||||
double rand = _random.nextDouble();
|
||||
RewardRarity rarity;
|
||||
|
||||
if (rand <= 0.01)
|
||||
{
|
||||
// 1%
|
||||
rarity = RewardRarity.VERY_RARE;
|
||||
}
|
||||
else if (rand <= 0.05)
|
||||
{
|
||||
// 4%
|
||||
rarity = RewardRarity.RARE;
|
||||
}
|
||||
else if (rand <= 0.30 || requiresUncommon)
|
||||
{
|
||||
// 25%
|
||||
rarity = RewardRarity.UNCOMMON;
|
||||
}
|
||||
else
|
||||
{
|
||||
// 70%
|
||||
rarity = RewardRarity.COMMON;
|
||||
}
|
||||
|
||||
List<ITreasureReward> treasureList = _treasureMap.get(rarity);
|
||||
|
||||
int totalWeight = 0;
|
||||
ArrayList<ITreasureReward> possibleRewards = new ArrayList<ITreasureReward>();
|
||||
for (ITreasureReward treasure : treasureList)
|
||||
{
|
||||
boolean isExcluded = false;
|
||||
|
||||
if (excludedRewards != null)
|
||||
{
|
||||
for (int i = 0; i < excludedRewards.length && !isExcluded; i++)
|
||||
{
|
||||
if (excludedRewards[i] != null && excludedRewards[i].equals(treasure))
|
||||
{
|
||||
isExcluded = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (treasure.canGiveReward(player) && !isExcluded)
|
||||
{
|
||||
possibleRewards.add(treasure);
|
||||
totalWeight += treasure.getWeight();
|
||||
}
|
||||
}
|
||||
|
||||
if (totalWeight > 0)
|
||||
{
|
||||
int weight = _random.nextInt(totalWeight);
|
||||
int currentWeight = 0;
|
||||
|
||||
for (ITreasureReward reward : possibleRewards)
|
||||
{
|
||||
currentWeight += reward.getWeight();
|
||||
|
||||
if (weight <= currentWeight)
|
||||
return reward;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
@ -1,17 +1,31 @@
|
||||
package mineplex.core.treasure.reward;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import static mineplex.core.common.util.C.*;
|
||||
|
||||
/**
|
||||
* Created by Shaun on 9/2/2014.
|
||||
*/
|
||||
public enum RewardRarity
|
||||
{
|
||||
|
||||
/**
|
||||
* This will probably be used to figure out what effects are shown when the chest is opened
|
||||
*
|
||||
* (Fireworks, sounds, etc)
|
||||
*/
|
||||
|
||||
COMMON, UNCOMMON, RARE, VERY_RARE;
|
||||
COMMON(cAqua), UNCOMMON(cGreen), RARE(cGold), VERY_RARE(cRed);
|
||||
|
||||
private String _color;
|
||||
|
||||
RewardRarity(String color)
|
||||
{
|
||||
_color = color;
|
||||
}
|
||||
|
||||
public String getColor()
|
||||
{
|
||||
return _color;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,45 @@
|
||||
package mineplex.core.treasure.reward.rewards;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import mineplex.core.treasure.reward.ITreasureReward;
|
||||
import mineplex.core.treasure.reward.RewardRarity;
|
||||
|
||||
/**
|
||||
* Created by shaun on 2014-09-08.
|
||||
*/
|
||||
public abstract class AbstractReward implements ITreasureReward
|
||||
{
|
||||
protected static final Random RANDOM = new Random();
|
||||
|
||||
private ItemStack _itemStack;
|
||||
private RewardRarity _rarity;
|
||||
private int _weight;
|
||||
|
||||
public AbstractReward(ItemStack itemStack, RewardRarity rarity, int weight)
|
||||
{
|
||||
_itemStack = itemStack;
|
||||
_rarity = rarity;
|
||||
_weight = weight;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getItem()
|
||||
{
|
||||
return _itemStack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getWeight()
|
||||
{
|
||||
return _weight;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RewardRarity getRarity()
|
||||
{
|
||||
return _rarity;
|
||||
}
|
||||
}
|
@ -0,0 +1,75 @@
|
||||
package mineplex.core.treasure.reward.rewards;
|
||||
|
||||
/**
|
||||
* Created by shaun on 2014-09-08.
|
||||
*/
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.Callback;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.treasure.reward.RewardRarity;
|
||||
|
||||
/**
|
||||
* Created by shaun on 2014-09-08.
|
||||
*/
|
||||
public class CoinReward extends AbstractReward
|
||||
{
|
||||
private DonationManager _donationManager;
|
||||
private Random _random;
|
||||
private int _minCoinCount;
|
||||
private int _maxCoinCount;
|
||||
|
||||
public CoinReward(DonationManager donationManager, int minGemCount, int maxGemCount, int weight, RewardRarity rarity)
|
||||
{
|
||||
this(donationManager, minGemCount, maxGemCount, weight, rarity, RANDOM);
|
||||
}
|
||||
|
||||
public CoinReward(DonationManager donationManager, int minCoinCount, int maxCoinCount, int weight, RewardRarity rarity, Random random)
|
||||
{
|
||||
super(new ItemStack(Material.GOLD_INGOT), rarity, weight);
|
||||
_donationManager = donationManager;
|
||||
_minCoinCount = minCoinCount;
|
||||
_maxCoinCount = maxCoinCount;
|
||||
|
||||
_random = random;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String giveReward(Player player)
|
||||
{
|
||||
int gemsToReward = _random.nextInt(_maxCoinCount - _minCoinCount) + _minCoinCount;
|
||||
|
||||
_donationManager.RewardCoins(new Callback<Boolean>()
|
||||
{
|
||||
@Override
|
||||
public void run(Boolean data)
|
||||
{
|
||||
|
||||
}
|
||||
}, "Treasure Chest", player.getName(), gemsToReward);
|
||||
|
||||
return getRarity().getColor() + gemsToReward + " Coins";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canGiveReward(Player player)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj)
|
||||
{
|
||||
if (obj instanceof CoinReward)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,54 @@
|
||||
package mineplex.core.treasure.reward.rewards;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.gadget.types.Gadget;
|
||||
import mineplex.core.treasure.reward.RewardRarity;
|
||||
|
||||
/**
|
||||
* Created by shaun on 2014-09-04.
|
||||
*/
|
||||
public class GadgetReward extends AbstractReward
|
||||
{
|
||||
private DonationManager _donationManager;
|
||||
private Gadget _gadget;
|
||||
|
||||
public GadgetReward(Gadget gadget, DonationManager donationManager, RewardRarity rarity, int weight)
|
||||
{
|
||||
super(new ItemStack(gadget.GetDisplayMaterial()), rarity, weight);
|
||||
_gadget = gadget;
|
||||
_donationManager = donationManager;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String giveReward(Player player)
|
||||
{
|
||||
_donationManager.Get(player.getName()).AddUnknownSalesPackagesOwned(_gadget.GetName());
|
||||
|
||||
return getRarity().getColor() + _gadget.GetDisplayName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canGiveReward(Player player)
|
||||
{
|
||||
return !(_donationManager.Get(player.getName()).OwnsUnknownPackage(_gadget.GetName()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj)
|
||||
{
|
||||
if (obj instanceof GadgetReward)
|
||||
{
|
||||
return ((GadgetReward) obj).getGadget().equals(_gadget);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
protected Gadget getGadget()
|
||||
{
|
||||
return _gadget;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,70 @@
|
||||
package mineplex.core.treasure.reward.rewards;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.Callback;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.treasure.reward.RewardRarity;
|
||||
|
||||
/**
|
||||
* Created by shaun on 2014-09-04.
|
||||
*/
|
||||
public class GemReward extends AbstractReward
|
||||
{
|
||||
private DonationManager _donationManager;
|
||||
private Random _random;
|
||||
private int _minGemCount;
|
||||
private int _maxGemCount;
|
||||
|
||||
public GemReward(DonationManager donationManager, int minGemCount, int maxGemCount, int weight, RewardRarity rarity)
|
||||
{
|
||||
this(donationManager, minGemCount, maxGemCount, weight, rarity, RANDOM);
|
||||
}
|
||||
|
||||
public GemReward(DonationManager donationManager, int minGemCount, int maxGemCount, int weight, RewardRarity rarity, Random random)
|
||||
{
|
||||
super(new ItemStack(Material.EMERALD), rarity, weight);
|
||||
_donationManager = donationManager;
|
||||
_minGemCount = minGemCount;
|
||||
_maxGemCount = maxGemCount;
|
||||
|
||||
_random = random;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String giveReward(Player player)
|
||||
{
|
||||
int gemsToReward = _random.nextInt(_maxGemCount - _minGemCount) + _minGemCount;
|
||||
|
||||
_donationManager.RewardGems(new Callback<Boolean>()
|
||||
{
|
||||
@Override
|
||||
public void run(Boolean data)
|
||||
{
|
||||
|
||||
}
|
||||
}, "Treasure Chest", player.getName(), gemsToReward);
|
||||
|
||||
return C.cGreen + gemsToReward + " Gems";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canGiveReward(Player player)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj)
|
||||
{
|
||||
if (obj instanceof GemReward)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
@ -0,0 +1,73 @@
|
||||
package mineplex.core.treasure.reward.rewards;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.inventory.InventoryManager;
|
||||
import mineplex.core.treasure.reward.RewardRarity;
|
||||
|
||||
/**
|
||||
* Created by shaun on 14-09-12.
|
||||
*/
|
||||
public class InventoryReward extends AbstractReward
|
||||
{
|
||||
private Random _random;
|
||||
|
||||
private InventoryManager _inventoryManager;
|
||||
private String _name;
|
||||
private String _packageName;
|
||||
private int _minAmount;
|
||||
private int _maxAmount;
|
||||
|
||||
public InventoryReward(InventoryManager inventoryManager, String name, String packageName, int minAmount, int maxAmount, ItemStack itemStack, RewardRarity rarity, int weight)
|
||||
{
|
||||
this(RANDOM, inventoryManager, name, packageName, minAmount, maxAmount, itemStack, rarity, weight);
|
||||
}
|
||||
|
||||
public InventoryReward(Random random, InventoryManager inventoryManager, String name, String packageName, int minAmount, int maxAmount, ItemStack itemStack, RewardRarity rarity, int weight)
|
||||
{
|
||||
super(itemStack, rarity, weight);
|
||||
|
||||
_random = random;
|
||||
_name = name;
|
||||
_packageName = packageName;
|
||||
_minAmount = minAmount;
|
||||
_maxAmount = maxAmount;
|
||||
_inventoryManager = inventoryManager;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String giveReward(Player player)
|
||||
{
|
||||
int amountToGive = _random.nextInt(_maxAmount - _minAmount) + _minAmount;
|
||||
|
||||
_inventoryManager.addItemToInventory(player, "Item", _packageName, amountToGive);
|
||||
|
||||
return getRarity().getColor() + amountToGive + " " + _name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canGiveReward(Player player)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
protected String getPackageName()
|
||||
{
|
||||
return _packageName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj)
|
||||
{
|
||||
if (obj instanceof InventoryReward)
|
||||
{
|
||||
return ((InventoryReward) obj).getPackageName().equals(_packageName);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
@ -0,0 +1,55 @@
|
||||
package mineplex.core.treasure.reward.rewards;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.treasure.reward.RewardRarity;
|
||||
|
||||
/**
|
||||
* Created by shaun on 14-09-12.
|
||||
*/
|
||||
public class UnknownPackageReward extends AbstractReward
|
||||
{
|
||||
private DonationManager _donationManager;
|
||||
private String _name;
|
||||
private String _packageName;
|
||||
|
||||
public UnknownPackageReward(DonationManager donationManager, String name, String packageName, ItemStack itemStack, RewardRarity rarity, int weight)
|
||||
{
|
||||
super(itemStack, rarity, weight);
|
||||
_donationManager = donationManager;
|
||||
_name = name;
|
||||
_packageName = packageName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String giveReward(Player player)
|
||||
{
|
||||
_donationManager.Get(player.getName()).AddUnknownSalesPackagesOwned(_packageName);
|
||||
|
||||
return getRarity().getColor() + _name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canGiveReward(Player player)
|
||||
{
|
||||
return _donationManager.Get(player.getName()).OwnsUnknownPackage(_packageName);
|
||||
}
|
||||
|
||||
protected String getPackageName()
|
||||
{
|
||||
return _packageName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj)
|
||||
{
|
||||
if (obj instanceof UnknownPackageReward)
|
||||
{
|
||||
return ((UnknownPackageReward) obj).getPackageName().equals(_packageName);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
9
Plugins/Mineplex.Database/.classpath
Normal file
9
Plugins/Mineplex.Database/.classpath
Normal file
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="var" path="REPO_DIR/Plugins/Libraries/jooq-3.4.2.jar"/>
|
||||
<classpathentry kind="var" path="REPO_DIR/Plugins/Libraries/jooq-meta-3.4.2.jar"/>
|
||||
<classpathentry kind="var" path="REPO_DIR/Plugins/Libraries/jooq-codegen-3.4.2.jar"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
17
Plugins/Mineplex.Database/.project
Normal file
17
Plugins/Mineplex.Database/.project
Normal file
@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>Mineplex.Database</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
@ -11,7 +11,7 @@ package mineplex.database.tables;
|
||||
@java.lang.SuppressWarnings({ "all", "unchecked", "rawtypes" })
|
||||
public class TournamentLeaderboard extends org.jooq.impl.TableImpl<mineplex.database.tables.records.TournamentLeaderboard> implements java.io.Serializable, java.lang.Cloneable {
|
||||
|
||||
private static final long serialVersionUID = -2050960225;
|
||||
private static final long serialVersionUID = 1795216465;
|
||||
|
||||
/**
|
||||
* The singleton instance of <code>Account.tournamentLeaderboard</code>
|
||||
@ -57,9 +57,9 @@ public class TournamentLeaderboard extends org.jooq.impl.TableImpl<mineplex.data
|
||||
public final org.jooq.TableField<mineplex.database.tables.records.TournamentLeaderboard, java.lang.Integer> total = createField("total", org.jooq.impl.SQLDataType.INTEGER.nullable(false).defaulted(true), this, "");
|
||||
|
||||
/**
|
||||
* The column <code>Account.tournamentLeaderboard.ratio</code>.
|
||||
* The column <code>Account.tournamentLeaderboard.score</code>.
|
||||
*/
|
||||
public final org.jooq.TableField<mineplex.database.tables.records.TournamentLeaderboard, java.lang.Double> ratio = createField("ratio", org.jooq.impl.SQLDataType.FLOAT, this, "");
|
||||
public final org.jooq.TableField<mineplex.database.tables.records.TournamentLeaderboard, java.lang.Double> score = createField("score", org.jooq.impl.SQLDataType.DOUBLE, this, "");
|
||||
|
||||
/**
|
||||
* Create a <code>Account.tournamentLeaderboard</code> table reference
|
||||
|
@ -11,7 +11,7 @@ package mineplex.database.tables.records;
|
||||
@java.lang.SuppressWarnings({ "all", "unchecked", "rawtypes" })
|
||||
public class TournamentLeaderboard extends org.jooq.impl.UpdatableRecordImpl<mineplex.database.tables.records.TournamentLeaderboard> implements java.io.Serializable, java.lang.Cloneable, org.jooq.Record7<java.lang.Integer, java.lang.Integer, java.lang.Integer, java.lang.Integer, java.lang.Integer, java.lang.Integer, java.lang.Double> {
|
||||
|
||||
private static final long serialVersionUID = -1193236965;
|
||||
private static final long serialVersionUID = 1130073862;
|
||||
|
||||
/**
|
||||
* Setter for <code>Account.tournamentLeaderboard.id</code>.
|
||||
@ -98,16 +98,16 @@ public class TournamentLeaderboard extends org.jooq.impl.UpdatableRecordImpl<min
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter for <code>Account.tournamentLeaderboard.ratio</code>.
|
||||
* Setter for <code>Account.tournamentLeaderboard.score</code>.
|
||||
*/
|
||||
public void setRatio(java.lang.Double value) {
|
||||
public void setScore(java.lang.Double value) {
|
||||
setValue(6, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for <code>Account.tournamentLeaderboard.ratio</code>.
|
||||
* Getter for <code>Account.tournamentLeaderboard.score</code>.
|
||||
*/
|
||||
public java.lang.Double getRatio() {
|
||||
public java.lang.Double getScore() {
|
||||
return (java.lang.Double) getValue(6);
|
||||
}
|
||||
|
||||
@ -196,7 +196,7 @@ public class TournamentLeaderboard extends org.jooq.impl.UpdatableRecordImpl<min
|
||||
*/
|
||||
@Override
|
||||
public org.jooq.Field<java.lang.Double> field7() {
|
||||
return mineplex.database.tables.TournamentLeaderboard.tournamentLeaderboard.ratio;
|
||||
return mineplex.database.tables.TournamentLeaderboard.tournamentLeaderboard.score;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -252,7 +252,7 @@ public class TournamentLeaderboard extends org.jooq.impl.UpdatableRecordImpl<min
|
||||
*/
|
||||
@Override
|
||||
public java.lang.Double value7() {
|
||||
return getRatio();
|
||||
return getScore();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -314,7 +314,7 @@ public class TournamentLeaderboard extends org.jooq.impl.UpdatableRecordImpl<min
|
||||
*/
|
||||
@Override
|
||||
public TournamentLeaderboard value7(java.lang.Double value) {
|
||||
setRatio(value);
|
||||
setScore(value);
|
||||
return this;
|
||||
}
|
||||
|
||||
@ -340,7 +340,7 @@ public class TournamentLeaderboard extends org.jooq.impl.UpdatableRecordImpl<min
|
||||
/**
|
||||
* Create a detached, initialised TournamentLeaderboard
|
||||
*/
|
||||
public TournamentLeaderboard(java.lang.Integer id, java.lang.Integer tournamentId, java.lang.Integer accountId, java.lang.Integer gameId, java.lang.Integer wins, java.lang.Integer total, java.lang.Double ratio) {
|
||||
public TournamentLeaderboard(java.lang.Integer id, java.lang.Integer tournamentId, java.lang.Integer accountId, java.lang.Integer gameId, java.lang.Integer wins, java.lang.Integer total, java.lang.Double score) {
|
||||
super(mineplex.database.tables.TournamentLeaderboard.tournamentLeaderboard);
|
||||
|
||||
setValue(0, id);
|
||||
@ -349,6 +349,6 @@ public class TournamentLeaderboard extends org.jooq.impl.UpdatableRecordImpl<min
|
||||
setValue(3, gameId);
|
||||
setValue(4, wins);
|
||||
setValue(5, total);
|
||||
setValue(6, ratio);
|
||||
setValue(6, score);
|
||||
}
|
||||
}
|
||||
|
@ -54,6 +54,7 @@ import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.common.util.UtilWorld;
|
||||
import mineplex.core.treasure.TreasureManager;
|
||||
import mineplex.minecraft.game.core.condition.ConditionManager;
|
||||
import mineplex.core.cosmetic.CosmeticManager;
|
||||
import mineplex.core.disguise.DisguiseManager;
|
||||
@ -81,6 +82,7 @@ import mineplex.hub.modules.MapManager;
|
||||
import mineplex.hub.modules.NewsManager;
|
||||
import mineplex.hub.modules.ParkourManager;
|
||||
import mineplex.hub.modules.TextManager;
|
||||
import mineplex.hub.modules.UHCManager;
|
||||
import mineplex.hub.modules.VisibilityManager;
|
||||
import mineplex.hub.modules.WorldManager;
|
||||
import mineplex.hub.party.Party;
|
||||
@ -151,6 +153,7 @@ public class HubManager extends MiniClientPlugin<HubClient>
|
||||
new MapManager(this);
|
||||
new WorldManager(this);
|
||||
new JumpManager(this);
|
||||
//new UHCManager(this);
|
||||
|
||||
_news = new NewsManager(this);
|
||||
|
||||
@ -158,7 +161,7 @@ public class HubManager extends MiniClientPlugin<HubClient>
|
||||
_inventoryManager = new InventoryManager(plugin);
|
||||
_gadgetManager = new GadgetManager(_plugin, clientManager, donationManager, _inventoryManager, _mountManager, petManager, preferences, disguiseManager, blockRestore, new ProjectileManager(plugin));
|
||||
new CosmeticManager(_plugin, clientManager, donationManager, _inventoryManager, _gadgetManager, _mountManager, petManager, false);
|
||||
// new TreasureManager(_plugin);
|
||||
new TreasureManager(_plugin, donationManager, _inventoryManager);
|
||||
|
||||
_partyManager = partyManager;
|
||||
_preferences = preferences;
|
||||
|
@ -39,6 +39,7 @@ import mineplex.core.gadget.event.GadgetBlockEvent;
|
||||
import mineplex.core.mount.event.MountActivateEvent;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.task.TaskManager;
|
||||
import mineplex.core.treasure.event.TreasureStartEvent;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.hub.HubManager;
|
||||
@ -356,7 +357,7 @@ public class ParkourManager extends MiniPlugin
|
||||
if (!isParkourMode(player))
|
||||
{
|
||||
//Inform
|
||||
UtilPlayer.message(player, F.main("Parkour", "You must be in " + F.elem("Parkour Mode") + " to finish."));
|
||||
UtilPlayer.message(player, F.main("Parkour", "You must be in " + F.elem("Parkour Mode") + " to cleanup."));
|
||||
UtilPlayer.message(player, F.main("Parkour", "Talk to the " + F.elem("Start NPC") + " to enter Parkour Mode."));
|
||||
return;
|
||||
}
|
||||
@ -419,6 +420,15 @@ public class ParkourManager extends MiniPlugin
|
||||
return false;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void preventTreasureNearParkour(TreasureStartEvent event)
|
||||
{
|
||||
if (InsideParkour(event.getPlayer().getLocation()))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
UtilPlayer.message(event.getPlayer(), F.main("Parkour", "You can't open chests near Parkour."));
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void snakeUpdate(UpdateEvent event)
|
||||
|
@ -89,6 +89,8 @@ public class TextManager extends MiniPlugin
|
||||
UtilText.MakeText("SURVIVAL GAMES", locSurvival.clone().add(-15, 21, 0), faceSurvival, 159, (byte)1, TextAlign.CENTER);
|
||||
UtilText.MakeText("SURVIVAL GAMES", locSurvival.clone().add(-16, 21, 0), faceSurvival, 159, (byte)15, TextAlign.CENTER);
|
||||
|
||||
//UtilText.MakeText("ULTRA HARDCORE", locSurvival.clone().add(-15, 28, 0), faceSurvival, 159, (byte)14, TextAlign.CENTER);
|
||||
//UtilText.MakeText("ULTRA HARDCORE", locSurvival.clone().add(-16, 28, 0), faceSurvival, 159, (byte)15, TextAlign.CENTER);
|
||||
|
||||
//Other
|
||||
UtilText.MakeText("CLASSICS", locClassics, faceOther, 159, (byte)5, TextAlign.CENTER);
|
||||
|
@ -0,0 +1,82 @@
|
||||
package mineplex.hub.modules;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
|
||||
import mineplex.core.MiniPlugin;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.hub.HubManager;
|
||||
|
||||
public class UHCManager extends MiniPlugin
|
||||
{
|
||||
public HubManager Manager;
|
||||
|
||||
private long _delay = 3600000;
|
||||
private boolean _canAnnounce3 = true;
|
||||
private boolean _canAnnounce2 = true;
|
||||
private boolean _canAnnounce1 = true;
|
||||
private boolean _canAnnounce0 = true;
|
||||
|
||||
public UHCManager(HubManager manager)
|
||||
{
|
||||
super("UHC Manager", manager.GetPlugin());
|
||||
|
||||
Manager = manager;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void AnnounceUpdate(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.TICK)
|
||||
return;
|
||||
|
||||
System.out.println("UHC in " + UtilTime.MakeStr(_delay - (System.currentTimeMillis() % _delay)));
|
||||
|
||||
//Reset
|
||||
if (System.currentTimeMillis() % _delay > 30000 && System.currentTimeMillis() % _delay < _delay - 180000)
|
||||
{
|
||||
_canAnnounce3 = true;
|
||||
_canAnnounce2 = true;
|
||||
_canAnnounce1 = true;
|
||||
_canAnnounce0 = true;
|
||||
}
|
||||
//Announce
|
||||
else
|
||||
{
|
||||
if (_canAnnounce3 && System.currentTimeMillis() % _delay > _delay - 180000)
|
||||
{
|
||||
_canAnnounce3 = false;
|
||||
announce("Starting in 3 minutes...");
|
||||
}
|
||||
|
||||
else if (_canAnnounce2 && System.currentTimeMillis() % _delay > _delay - 120000)
|
||||
{
|
||||
_canAnnounce2 = false;
|
||||
announce("Starting in 2 minutes...");
|
||||
}
|
||||
|
||||
else if (_canAnnounce1 && System.currentTimeMillis() % _delay > _delay - 60000)
|
||||
{
|
||||
_canAnnounce1 = false;
|
||||
announce("Starting in 1 minute...");
|
||||
}
|
||||
|
||||
else if (_canAnnounce0 && System.currentTimeMillis() % _delay < 30000)
|
||||
{
|
||||
_canAnnounce0 = false;
|
||||
announce("Join at the Ultra Hardcore NPC!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void announce(String message)
|
||||
{
|
||||
for (Player player : UtilServer.getPlayers())
|
||||
UtilPlayer.message(player, C.cDPurple + "[Ultra Hardcore] " + C.cPurple + C.Bold + message);
|
||||
}
|
||||
}
|
@ -162,14 +162,14 @@ public class ServerNpcPage extends ShopPageBase<ServerManager, ServerNpcShop> im
|
||||
}
|
||||
else
|
||||
{
|
||||
if (serverInfo.CurrentPlayers >= serverInfo.MaxPlayers && !ownsUltraPackage)
|
||||
{
|
||||
lore.add(MESSAGE_FULL_GET_ULTRA);
|
||||
}
|
||||
else
|
||||
{
|
||||
lore.add(MESSAGE_JOIN);
|
||||
}
|
||||
if (serverInfo.CurrentPlayers >= serverInfo.MaxPlayers && !ownsUltraPackage)
|
||||
{
|
||||
lore.add(MESSAGE_FULL_GET_ULTRA);
|
||||
}
|
||||
else
|
||||
{
|
||||
lore.add(MESSAGE_JOIN);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -7,6 +7,7 @@ import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
@ -29,6 +30,8 @@ import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.permissions.PermissionAttachmentInfo;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
@ -109,6 +112,9 @@ public class MapParser extends JavaPlugin implements Listener
|
||||
ResetInventory(event.getPlayer());
|
||||
|
||||
DisplayHelp(player);
|
||||
|
||||
for (Plugin plugin : Bukkit.getPluginManager().getPlugins())
|
||||
player.addAttachment(plugin, "worldedit.*", true);
|
||||
}
|
||||
|
||||
public void DisplayHelp(Player player)
|
||||
|
@ -203,7 +203,7 @@ public class Immolate extends Skill
|
||||
int level = getLevel(cur);
|
||||
|
||||
//Fire
|
||||
Item fire = cur.getWorld().dropItem(cur.getLocation().add(0, 0.5, 0), ItemStackFactory.Instance.CreateStack(Material.FIRE));
|
||||
Item fire = cur.getWorld().dropItem(cur.getLocation().add(0, 0.5, 0), ItemStackFactory.Instance.CreateStack(Material.BLAZE_POWDER));
|
||||
fire.setVelocity(new Vector((Math.random() - 0.5)/3,Math.random()/3,(Math.random() - 0.5)/3));
|
||||
Factory.Fire().Add(fire, cur, 2, 0, 0.25 + (level * 0.25), 0, GetName());
|
||||
|
||||
|
@ -103,7 +103,7 @@ public class Inferno extends SkillActive
|
||||
}
|
||||
|
||||
//Fire
|
||||
Item fire = cur.getWorld().dropItem(cur.getEyeLocation().add(cur.getLocation().getDirection()), ItemStackFactory.Instance.CreateStack(Material.FIRE));
|
||||
Item fire = cur.getWorld().dropItem(cur.getEyeLocation().add(cur.getLocation().getDirection()), ItemStackFactory.Instance.CreateStack(Material.BLAZE_POWDER));
|
||||
Factory.Fire().Add(fire, cur, 0.7, 0, 0.3 + (0.1 * level), 1, GetName());
|
||||
|
||||
fire.teleport(cur.getEyeLocation());
|
||||
|
@ -121,7 +121,7 @@ public class NapalmShot extends SkillActive
|
||||
|
||||
for (int i = 0 ; i < 8 + (8 * level) ; i++)
|
||||
{
|
||||
Item fire = proj.getWorld().dropItemNaturally(proj.getLocation(), ItemStackFactory.Instance.CreateStack(Material.FIRE, 1));
|
||||
Item fire = proj.getWorld().dropItemNaturally(proj.getLocation(), ItemStackFactory.Instance.CreateStack(Material.BLAZE_POWDER, 1));
|
||||
Factory.Fire().Add(fire, damager, 16, 0.25, 2, 0, GetName());
|
||||
fire.setVelocity(fire.getVelocity().multiply(1 + (0.15 * level)));
|
||||
}
|
||||
|
@ -105,13 +105,13 @@ public class CustomBuildPage extends ShopPageBase<ClassShopManager, ClassCombatS
|
||||
if (i != 0)
|
||||
{
|
||||
AddButton(slot + 18, new ShopItem(Material.ANVIL, "Edit Build", new String[] { }, 1, locked, true), new EditAndSaveCustomBuildButton(this, customBuild));
|
||||
AddButton(slot + 36, new ShopItem(Material.FIRE, "Delete Build", new String[] { "§rIt will never come back..."}, 1, locked, true), new DeleteCustomBuildButton(this, customBuild));
|
||||
AddButton(slot + 36, new ShopItem(Material.TNT, "Delete Build", new String[] { "§rIt will never come back..."}, 1, locked, true), new DeleteCustomBuildButton(this, customBuild));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
getInventory().setItem(slot + 18, new ShopItem(Material.ANVIL, "Edit Build", new String[] { }, 1, locked, true).getHandle());
|
||||
getInventory().setItem(slot + 36, new ShopItem(Material.FIRE, "Delete Build", new String[] { "§rIt will never come back..."}, 1, locked, true).getHandle());
|
||||
getInventory().setItem(slot + 36, new ShopItem(Material.TNT, "Delete Build", new String[] { "§rIt will never come back..."}, 1, locked, true).getHandle());
|
||||
}
|
||||
|
||||
slot += 2;
|
||||
|
@ -13,6 +13,7 @@ import nautilus.game.arcade.game.Game;
|
||||
import nautilus.game.arcade.game.Game.GameState;
|
||||
import nautilus.game.arcade.game.GameServerConfig;
|
||||
import nautilus.game.arcade.game.GameTeam;
|
||||
import nautilus.game.arcade.game.games.uhc.UHC;
|
||||
import nautilus.game.arcade.managers.*;
|
||||
import nautilus.game.arcade.shop.ArcadeShop;
|
||||
import nautilus.game.arcade.world.FireworkHandler;
|
||||
@ -468,7 +469,18 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
||||
String extrainformation = "|" + _serverConfig.ServerType + "|" + (_game == null ? "Unknown" : _game.GetName())
|
||||
+ "|" + ((_game == null || _game.WorldData == null) ? "Unknown" : _game.WorldData.MapName);
|
||||
|
||||
if (_game == null || _game.GetState() == GameState.Recruit)
|
||||
//Always Joinable
|
||||
if (_game.JoinInProgress)
|
||||
{
|
||||
event.setMotd(ChatColor.GREEN + "Recruiting" + extrainformation);
|
||||
}
|
||||
//UHC Timed
|
||||
else if (_game != null && _game.GetType() == GameType.UHC)
|
||||
{
|
||||
event.setMotd(((UHC)_game).getMotdStatus() + extrainformation);
|
||||
}
|
||||
//Recruiting
|
||||
else if (_game == null || _game.GetState() == GameState.Recruit)
|
||||
{
|
||||
if (_game != null && _game.GetCountdown() != -1)
|
||||
{
|
||||
@ -478,8 +490,8 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
||||
{
|
||||
event.setMotd(ChatColor.GREEN + "Recruiting" + extrainformation);
|
||||
}
|
||||
|
||||
}
|
||||
//In Progress
|
||||
else
|
||||
{
|
||||
event.setMotd(ChatColor.YELLOW + "In Progress" + extrainformation);
|
||||
|
@ -139,7 +139,8 @@ public abstract class Game implements Listener
|
||||
public HashSet<Integer> ItemDropAllow = new HashSet<Integer>();
|
||||
public HashSet<Integer> ItemDropDeny = new HashSet<Integer>();
|
||||
|
||||
public boolean InventoryOpen = false;
|
||||
public boolean InventoryOpenBlock = false;
|
||||
public boolean InventoryOpenChest = false;
|
||||
public boolean InventoryClick = false;
|
||||
|
||||
public boolean PrivateBlocks = false;
|
||||
@ -151,7 +152,7 @@ public abstract class Game implements Listener
|
||||
|
||||
public boolean QuitOut = true;
|
||||
|
||||
public boolean IdleKick = true;
|
||||
public boolean IdleKickz = true;
|
||||
|
||||
public boolean CreatureAllow = false;
|
||||
public boolean CreatureAllowOverride = false;
|
||||
@ -181,12 +182,10 @@ public abstract class Game implements Listener
|
||||
|
||||
public boolean DisplayLobbySide = true;
|
||||
|
||||
//Tourney
|
||||
public boolean AutoBalance = true;
|
||||
public boolean AutoStart = true;
|
||||
|
||||
public GameState KitRegisterState = GameState.Live;
|
||||
|
||||
public boolean JoinInProgress = false;
|
||||
|
||||
//Addons
|
||||
public boolean CompassEnabled = false;
|
||||
public boolean CompassGiveItem = true;
|
||||
@ -821,7 +820,7 @@ public abstract class Game implements Listener
|
||||
|
||||
public boolean CanJoinTeam(GameTeam team)
|
||||
{
|
||||
return (AutoBalance && Manager.IsTeamBalance()) ? team.GetSize() < Math.max(1, UtilServer.getPlayers().length/GetTeamList().size()) : true;
|
||||
return Manager.IsTeamBalance() ? team.GetSize() < Math.max(1, UtilServer.getPlayers().length/GetTeamList().size()) : true;
|
||||
}
|
||||
|
||||
public GameTeam GetTeamPreference(Player player)
|
||||
|
@ -286,6 +286,7 @@ public class GameTeam
|
||||
//if (GetColor() == ChatColor.BROWN) return (byte)12;
|
||||
if (GetColor() == ChatColor.DARK_GREEN) return (byte)13;
|
||||
if (GetColor() == ChatColor.RED) return (byte)14;
|
||||
if (GetColor() == ChatColor.DARK_RED) return (byte)14;
|
||||
else return (byte)15;
|
||||
}
|
||||
|
||||
|
@ -127,7 +127,7 @@ public abstract class SoloGame extends Game
|
||||
@Override
|
||||
public List<Player> getWinners()
|
||||
{
|
||||
if (GetPlayers(true).size() <= 1)
|
||||
if (GetState().ordinal() >= GameState.End.ordinal())
|
||||
{
|
||||
List<Player> places = _players.GetPlacements(true);
|
||||
|
||||
|
@ -41,8 +41,10 @@ import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.common.util.UtilEvent;
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
import mineplex.core.common.util.UtilWorld;
|
||||
import mineplex.core.common.util.UtilEvent.ActionType;
|
||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
@ -77,7 +79,7 @@ public class Bridge extends TeamGame implements OreObsfucation
|
||||
private static final Material[] PLAYER_DROP_DELAY_MATERIALS = new Material[] { Material.LOG, Material.LOG_2, Material.IRON_ORE, Material.DIAMOND_ORE, Material.COAL_ORE, Material.GOLD_ORE, Material.WORKBENCH, Material.FURNACE };
|
||||
|
||||
//Bridge Timer
|
||||
private int _bridgeTime = 600000;
|
||||
private int _bridgeTime = 5000; //600000
|
||||
private boolean _bridgesDown = false;
|
||||
|
||||
//Wood Bridge
|
||||
@ -157,7 +159,8 @@ public class Bridge extends TeamGame implements OreObsfucation
|
||||
BlockBreak = true;
|
||||
BlockPlace = true;
|
||||
|
||||
InventoryOpen = true;
|
||||
InventoryOpenBlock = true;
|
||||
InventoryOpenChest = true;
|
||||
|
||||
WorldTimeSet = 2000;
|
||||
|
||||
@ -732,7 +735,7 @@ public class Bridge extends TeamGame implements OreObsfucation
|
||||
|
||||
// Create Part
|
||||
FallingBlock block = bestLoc.getWorld().spawnFallingBlock(
|
||||
source, 10, (byte) 0);
|
||||
source, 87, (byte) 0);
|
||||
BridgePart part = new BridgePart(block, bestLoc, true);
|
||||
_bridgeParts.add(part);
|
||||
|
||||
|
@ -53,6 +53,8 @@ public class ChampionsDominate extends Domination
|
||||
|
||||
Manager.GetDamage().UseSimpleWeaponDamage = false;
|
||||
|
||||
InventoryOpenChest = true;
|
||||
|
||||
EloRanking = false;
|
||||
EloStart = 1000;
|
||||
|
||||
|
@ -54,6 +54,8 @@ public class ChampionsTDM extends TeamDeathmatch
|
||||
|
||||
this.Manager.GetDamage().UseSimpleWeaponDamage = false;
|
||||
|
||||
InventoryOpenChest = true;
|
||||
|
||||
registerStatTrackers(
|
||||
new WinWithoutLosingTeammateStatTracker(this, "FlawlessVictory"),
|
||||
new KillAllOpposingStatTracker(this),
|
||||
|
@ -413,7 +413,7 @@ public class Halloween extends SoloGame
|
||||
{
|
||||
Material type = event.getEntity().getItemStack().getType();
|
||||
|
||||
if (type == Material.DIAMOND_AXE || type == Material.FIRE || type == Material.SNOW_BALL)
|
||||
if (type == Material.DIAMOND_AXE || type == Material.BLAZE_POWDER || type == Material.SNOW_BALL)
|
||||
return;
|
||||
|
||||
event.setCancelled(true);
|
||||
|
@ -146,7 +146,7 @@ public class PumpkinKing extends CreatureBase<Skeleton>
|
||||
return;
|
||||
|
||||
//Effect
|
||||
Host.Manager.GetBlood().Effects(event.GetDamageeEntity().getLocation(), 10, 0.2, null, 0f, 0f, Material.FIRE, (byte)0, 10, false);
|
||||
Host.Manager.GetBlood().Effects(event.GetDamageeEntity().getLocation(), 10, 0.2, null, 0f, 0f, Material.BLAZE_POWDER, (byte)0, 10, false);
|
||||
event.GetDamageeEntity().getWorld().playEffect(event.GetDamageeEntity().getLocation(), Effect.STEP_SOUND, 51);
|
||||
|
||||
//Remove
|
||||
|
@ -206,7 +206,6 @@ public class HideSeek extends TeamGame
|
||||
|
||||
this.DamageSelf = false;
|
||||
this.DeathOut = false;
|
||||
this.InventoryOpen = false;
|
||||
this.HungerSet = 20;
|
||||
this.PrepareFreeze = false;
|
||||
|
||||
|
@ -87,6 +87,7 @@ import nautilus.game.arcade.game.games.minestrike.data.Bomb;
|
||||
import nautilus.game.arcade.game.games.minestrike.data.Bullet;
|
||||
import nautilus.game.arcade.game.games.minestrike.items.StrikeItem;
|
||||
import nautilus.game.arcade.game.games.minestrike.items.StrikeItemType;
|
||||
import nautilus.game.arcade.game.games.minestrike.items.equipment.DefusalKit;
|
||||
import nautilus.game.arcade.game.games.minestrike.items.equipment.armor.Armor;
|
||||
import nautilus.game.arcade.game.games.minestrike.items.grenades.Grenade;
|
||||
import nautilus.game.arcade.game.games.minestrike.items.guns.Gun;
|
||||
@ -131,6 +132,8 @@ public class MineStrike extends TeamGame
|
||||
private HashMap<Entity, Bullet> _bullets = new HashMap<Entity, Bullet>();
|
||||
private HashMap<Entity, Grenade> _grenadesThrown = new HashMap<Entity, Grenade>();
|
||||
|
||||
private HashSet<Entity> _defusalDropped = new HashSet<Entity>();
|
||||
|
||||
private HashMap<Location, Long> _incendiary = new HashMap<Location, Long>();
|
||||
|
||||
private Bomb _bomb = null;
|
||||
@ -182,6 +185,8 @@ public class MineStrike extends TeamGame
|
||||
|
||||
this.InventoryClick = true;
|
||||
|
||||
this.JoinInProgress = true;
|
||||
|
||||
this._help = new String[]
|
||||
{
|
||||
//"Tap Crouch when close to an ally to Boost",
|
||||
@ -380,9 +385,15 @@ public class MineStrike extends TeamGame
|
||||
}
|
||||
else
|
||||
{
|
||||
for (Player other : team.GetPlayers(false))
|
||||
if (!other.equals(player))
|
||||
UtilPlayer.message(other, C.cGold + C.Bold + player.getName() + " picked up the Bomb!");
|
||||
|
||||
UtilPlayer.message(player, C.cGold + C.Bold + "You picked up the Bomb!");
|
||||
}
|
||||
|
||||
|
||||
|
||||
player.playSound(player.getLocation(), Sound.NOTE_PLING, 1f, 2f);
|
||||
_bombHolder = player;
|
||||
|
||||
@ -618,6 +629,7 @@ public class MineStrike extends TeamGame
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void deathDrop(PlayerDeathEvent event)
|
||||
{
|
||||
_scoped.remove(event.getEntity());
|
||||
dropInventory(event.getEntity());
|
||||
}
|
||||
|
||||
@ -691,6 +703,12 @@ public class MineStrike extends TeamGame
|
||||
item.drop(this, player, true, false);
|
||||
}
|
||||
|
||||
//Defuse Kit
|
||||
if (stack.getType() == Material.SHEARS)
|
||||
{
|
||||
_defusalDropped.add(player.getWorld().dropItemNaturally(player.getEyeLocation(), stack));
|
||||
}
|
||||
|
||||
//Bomb
|
||||
if (stack.getType() == Material.GOLD_SWORD)
|
||||
{
|
||||
@ -722,14 +740,34 @@ public class MineStrike extends TeamGame
|
||||
Gun gun = _gunsDropped.get(event.getItem());
|
||||
if (gun != null)
|
||||
{
|
||||
gun.pickup(this, event.getPlayer());
|
||||
if (gun.pickup(this, event.getPlayer()))
|
||||
event.getItem().remove();
|
||||
}
|
||||
|
||||
//Grenades
|
||||
Grenade grenade = _grenadesDropped.get(event.getItem());
|
||||
if (grenade != null)
|
||||
{
|
||||
grenade.pickup(this, event.getPlayer());
|
||||
if (grenade.pickup(this, event.getPlayer()))
|
||||
event.getItem().remove();
|
||||
}
|
||||
|
||||
//Defusal
|
||||
if (UtilGear.isMat(event.getItem().getItemStack(), Material.SHEARS))
|
||||
{
|
||||
if (GetTeam(event.getPlayer()).GetColor() == ChatColor.RED)
|
||||
return;
|
||||
|
||||
if (UtilInv.contains(event.getPlayer(), Material.SHEARS, (byte)0, 1))
|
||||
return;
|
||||
|
||||
event.getPlayer().getInventory().setItem(8, event.getItem().getItemStack());
|
||||
|
||||
UtilPlayer.message(event.getPlayer(), F.main("Game", "You equipped Defusal Kit."));
|
||||
|
||||
event.getPlayer().playSound(event.getPlayer().getLocation(), Sound.HORSE_ARMOR, 1.5f, 1f);
|
||||
|
||||
event.getItem().remove();
|
||||
}
|
||||
|
||||
//Bomb
|
||||
@ -739,6 +777,18 @@ public class MineStrike extends TeamGame
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void reloadCancel(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.TICK)
|
||||
return;
|
||||
|
||||
for (Gun gun : _gunsEquipped.keySet())
|
||||
{
|
||||
gun.cancelReloadCheck(_gunsEquipped.get(gun), this);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void rechargeWeapons(RechargedEvent event)
|
||||
{
|
||||
@ -1074,7 +1124,9 @@ public class MineStrike extends TeamGame
|
||||
{
|
||||
event.AddMod(bullet.Shooter.getName(), "Headshot", damage*2, true);
|
||||
|
||||
if (Armor.isArmor(event.GetDamageePlayer().getInventory().getHelmet()))
|
||||
//Wearing Helmet
|
||||
if (Armor.isArmor(event.GetDamageePlayer().getInventory().getHelmet()) ||
|
||||
(_scoped.containsKey(event.GetDamageePlayer()) && UtilGear.isMat(_scoped.get(event.GetDamageePlayer()), Material.LEATHER_HELMET)))
|
||||
{
|
||||
event.AddMod(event.GetDamageePlayer().getName(), "Helmet", -damage*1, false);
|
||||
event.GetDamageePlayer().getWorld().playSound(event.GetDamageePlayer().getEyeLocation(), Sound.SPIDER_DEATH, 1f, 1f);
|
||||
@ -1106,22 +1158,34 @@ public class MineStrike extends TeamGame
|
||||
|
||||
public int getArrowHitArea(Player damagee, Location origin, Vector trajectory)
|
||||
{
|
||||
System.out.println("Getting Area");
|
||||
|
||||
//Move to near-player
|
||||
Location start = origin.clone().add(trajectory.multiply(UtilMath.offset(origin, damagee.getEyeLocation()) - 2));
|
||||
Location start = origin.clone().add(trajectory.clone().multiply(UtilMath.offset(origin, damagee.getEyeLocation()) - 2));
|
||||
|
||||
Location loc = start.clone();
|
||||
|
||||
while (!hitHead(damagee, loc) && !hitBody(damagee, loc) && UtilMath.offset(damagee.getLocation(), loc) < 6)
|
||||
{
|
||||
UtilParticle.PlayParticle(ParticleType.HAPPY_VILLAGER, loc, 0, 0, 0, 0, 1);
|
||||
loc.add(trajectory.clone().multiply(0.1));
|
||||
}
|
||||
|
||||
if (hitHead(damagee, loc))
|
||||
{
|
||||
System.out.println("Head");
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
if (hitBody(damagee, loc))
|
||||
{
|
||||
System.out.println("Body");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
System.out.println("Miss");
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -1704,12 +1768,16 @@ public class MineStrike extends TeamGame
|
||||
GetKit(player).ApplyKit(player);
|
||||
}
|
||||
|
||||
//Remove Scope
|
||||
for (Player player : GetPlayers(false))
|
||||
removeScope(player);
|
||||
|
||||
//Prepare Sound
|
||||
for (Player player : GetPlayers(false))
|
||||
{
|
||||
player.playSound(player.getLocation(), Sound.HORSE_ARMOR, 1f, 2f);
|
||||
Manager.GetCondition().Factory().Blind("Respawn", player, null, 2, 0, false, false, false);
|
||||
UtilPlayer.message(player, F.main("Game", "You have " + F.elem(C.cGreen + "$" + _shopManager.getMoney(player)) + "."));
|
||||
UtilPlayer.message(player, F.main("Game", "You have " + F.elem(C.cGreen + "$" + _shopManager.getMoney(player)) + ". Open your Inventory to spend it."));
|
||||
}
|
||||
|
||||
//Give Bomb
|
||||
@ -1827,6 +1895,11 @@ public class MineStrike extends TeamGame
|
||||
ent.remove();
|
||||
_bullets.clear();
|
||||
|
||||
//Bullets
|
||||
for (Entity ent : _defusalDropped)
|
||||
ent.remove();
|
||||
_defusalDropped.clear();
|
||||
|
||||
//Incendiary
|
||||
_incendiary.clear();
|
||||
|
||||
@ -1973,7 +2046,9 @@ public class MineStrike extends TeamGame
|
||||
if (gun.getGunType() == GunType.SNIPER)
|
||||
{
|
||||
event.getPlayer().getWorld().playSound(event.getPlayer().getEyeLocation(), Sound.GHAST_DEATH, 0.8f, 1f);
|
||||
Manager.GetCondition().Factory().Blind("Scope Blind", event.getPlayer(), null, 1, 1, false, false, false);
|
||||
|
||||
//if (Manager.GetCondition().GetActiveCondition(event.getPlayer(), ConditionType.BLINDNESS) == null)
|
||||
Manager.GetCondition().Factory().Blind("Scope Blind", event.getPlayer(), null, 1, 0, false, false, false);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -1997,7 +2072,7 @@ public class MineStrike extends TeamGame
|
||||
continue;
|
||||
|
||||
Gun gun = getGunInHand(player, null);
|
||||
if (!gun.hasScope() || !player.isSneaking())
|
||||
if (gun == null || !gun.hasScope() || !player.isSneaking())
|
||||
{
|
||||
removeScope(player);
|
||||
}
|
||||
@ -2006,7 +2081,11 @@ public class MineStrike extends TeamGame
|
||||
|
||||
public void removeScope(Player player)
|
||||
{
|
||||
if (!_scoped.containsKey(player))
|
||||
return;
|
||||
|
||||
ItemStack stack = _scoped.remove(player);
|
||||
|
||||
player.getInventory().setHelmet(stack);
|
||||
Manager.GetCondition().EndCondition(player, null, "Scope");
|
||||
|
||||
@ -2230,6 +2309,9 @@ public class MineStrike extends TeamGame
|
||||
if (_bullets.containsKey(ent))
|
||||
continue;
|
||||
|
||||
if (_defusalDropped.contains(ent))
|
||||
continue;
|
||||
|
||||
if (_bombItem != null && _bombItem.equals(ent))
|
||||
continue;
|
||||
|
||||
@ -2256,6 +2338,9 @@ public class MineStrike extends TeamGame
|
||||
else if (_grenadesThrown.containsKey(event.getEntity()))
|
||||
event.setCancelled(true);
|
||||
|
||||
else if (_defusalDropped.contains(event.getEntity()))
|
||||
event.setCancelled(true);
|
||||
|
||||
else if (_bombItem != null && _bombItem.equals(event.getEntity()))
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
@ -14,6 +14,10 @@ public class Bomb
|
||||
public long BombTime = 45000;
|
||||
|
||||
public Block Block;
|
||||
|
||||
public Material Type;
|
||||
public byte Data;
|
||||
|
||||
public long StartTime;
|
||||
public long LastBeep;
|
||||
|
||||
@ -27,6 +31,10 @@ public class Bomb
|
||||
Planter = planter;
|
||||
|
||||
Block = planter.getLocation().getBlock();
|
||||
|
||||
Type = Block.getType();
|
||||
Data = Block.getData();
|
||||
|
||||
Block.setType(Material.DAYLIGHT_DETECTOR);
|
||||
|
||||
StartTime = System.currentTimeMillis();
|
||||
@ -49,7 +57,7 @@ public class Bomb
|
||||
|
||||
if (UtilTime.elapsed(StartTime, BombTime))
|
||||
{
|
||||
Block.setType(Material.AIR);
|
||||
clean();
|
||||
|
||||
//Effect
|
||||
UtilParticle.PlayParticle(ParticleType.HUGE_EXPLOSION, Block.getLocation(), 10f, 10f, 10f, 0, 30);
|
||||
@ -73,7 +81,7 @@ public class Bomb
|
||||
|
||||
public void defuse()
|
||||
{
|
||||
Block.setType(Material.AIR);
|
||||
clean();
|
||||
|
||||
//Effect
|
||||
UtilParticle.PlayParticle(ParticleType.CLOUD, Block.getLocation().add(0.5, 0.5, 0.5), 0, 0, 0, 0, 1);
|
||||
@ -81,6 +89,7 @@ public class Bomb
|
||||
|
||||
public void clean()
|
||||
{
|
||||
Block.setType(Material.AIR);
|
||||
Block.setType(Type);
|
||||
Block.setData(Data);
|
||||
}
|
||||
}
|
||||
|
@ -58,7 +58,6 @@ public class Armor extends StrikeItem
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ public abstract class FireGrenadeBase extends Grenade
|
||||
{
|
||||
|
||||
},
|
||||
price, gemCost, Material.PORK, 1);
|
||||
price, gemCost, skin, 1);
|
||||
|
||||
_baseTime = burnTime;
|
||||
}
|
||||
@ -56,7 +56,7 @@ public abstract class FireGrenadeBase extends Grenade
|
||||
final HashMap<Block, Double> blocks = UtilBlock.getInRadius(loc, 3.5d);
|
||||
for (final Block block : blocks.keySet())
|
||||
{
|
||||
if (block.getType() != Material.AIR)
|
||||
if (block.getType() != Material.AIR && !block.getType().name().toLowerCase().contains("step"))
|
||||
continue;
|
||||
|
||||
if (!UtilBlock.solid(block.getRelative(BlockFace.DOWN)))
|
||||
|
@ -185,6 +185,8 @@ public abstract class Grenade extends StrikeItem
|
||||
{
|
||||
game.registerGrenade(this, player);
|
||||
game.deregisterDroppedGrenade(this);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -4,6 +4,7 @@ import mineplex.core.common.util.UtilParticle;
|
||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||
import nautilus.game.arcade.game.games.minestrike.MineStrike;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Entity;
|
||||
@ -24,10 +25,15 @@ public class Smoke extends Grenade
|
||||
{
|
||||
if (ent.getTicksLived() > 60)
|
||||
{
|
||||
UtilParticle.PlayParticle(ParticleType.HUGE_EXPLOSION, ent.getLocation(), 0, 0, 0, 0, 1);
|
||||
UtilParticle.PlayParticle(ParticleType.HUGE_EXPLOSION, ent.getLocation(), 0.3f, 0.3f, 0.3f, 0, 1);
|
||||
|
||||
ent.getWorld().playSound(ent.getLocation(), Sound.FIZZ, 0.1f, 0.1f);
|
||||
|
||||
for (Location loc : game.Manager.GetBlockRestore().RestoreBlockAround(Material.FIRE, ent.getLocation(), 5))
|
||||
{
|
||||
loc.getWorld().playSound(loc, Sound.FIZZ, 1f, 1f);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -3,6 +3,7 @@ package nautilus.game.arcade.game.games.minestrike.items.guns;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilDisplay;
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.common.util.UtilGear;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
@ -52,6 +53,8 @@ public abstract class Gun extends StrikeItem
|
||||
|
||||
protected boolean _scope = false;
|
||||
|
||||
protected boolean _reloading = false;
|
||||
|
||||
|
||||
//Active Data
|
||||
protected int _loadedAmmo;
|
||||
@ -102,6 +105,9 @@ public abstract class Gun extends StrikeItem
|
||||
|
||||
public void shoot(final Player player, final MineStrike game)
|
||||
{
|
||||
if (_reloading)
|
||||
return;
|
||||
|
||||
//Standard (300) RPM
|
||||
shootOnce(player, game);
|
||||
|
||||
@ -157,6 +163,10 @@ public abstract class Gun extends StrikeItem
|
||||
loc.add(UtilAlg.getDown(player.getLocation().getDirection()).multiply(0.3));
|
||||
UtilParticle.PlayParticle(ParticleType.EXPLODE, loc, 0, 0, 0, 0, 1);
|
||||
|
||||
//Unscope
|
||||
if (_gunType == GunType.SNIPER)
|
||||
game.removeScope(player);
|
||||
|
||||
game.registerBullet(fireBullet(player, game));
|
||||
}
|
||||
|
||||
@ -263,24 +273,19 @@ public abstract class Gun extends StrikeItem
|
||||
|
||||
int ammo = _reserveAmmo + _loadedAmmo;
|
||||
|
||||
if (ammo == 0)
|
||||
if (ammo == 0 || _reserveAmmo == 0)
|
||||
{
|
||||
UtilPlayer.message(player, F.main("Gun", "You have no ammo for " + F.name(getName()) + "."));
|
||||
UtilPlayer.message(player, F.main("Gun", "You have no more ammo for " + F.name(getName()) + "."));
|
||||
return;
|
||||
}
|
||||
|
||||
_loadedAmmo = Math.min(ammo, _clipSize);
|
||||
_reserveAmmo = Math.max(0, ammo - _clipSize);
|
||||
|
||||
//Recharge
|
||||
Recharge.Instance.useForce(player, getName() + " Shoot", getReloadTime());
|
||||
Recharge.Instance.use(player, getName() + " Reload", getReloadTime(), false, true);
|
||||
|
||||
//Sound
|
||||
soundReload(player.getLocation());
|
||||
|
||||
//Update
|
||||
updateWeaponName(player);
|
||||
_reloading = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -321,9 +326,39 @@ public abstract class Gun extends StrikeItem
|
||||
loc.getWorld().playSound(loc, Sound.PISTON_RETRACT, 1f, 0.8f);
|
||||
}
|
||||
|
||||
public void soundReloaded(Location loc)
|
||||
public void cancelReloadCheck(Player player, MineStrike game)
|
||||
{
|
||||
loc.getWorld().playSound(loc, Sound.PISTON_EXTEND, 1f, 1.6f);
|
||||
if (!_reloading)
|
||||
return;
|
||||
|
||||
if (!isHolding(player))
|
||||
{
|
||||
_reloading = false;
|
||||
|
||||
Recharge.Instance.recharge(player, getName() + " Reload");
|
||||
UtilDisplay.displayTextBar(game.Manager.GetPlugin(), player, 1, C.cRed + C.Bold + getName() + " Reload");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
public void handleReloaded(Player player)
|
||||
{
|
||||
if (!_reloading)
|
||||
return;
|
||||
|
||||
_reloading = false;
|
||||
|
||||
//Update Ammo
|
||||
int ammo = _reserveAmmo + _loadedAmmo;
|
||||
|
||||
_loadedAmmo = Math.min(ammo, _clipSize);
|
||||
_reserveAmmo = Math.max(0, ammo - _clipSize);
|
||||
|
||||
//Update
|
||||
updateWeaponName(player);
|
||||
|
||||
//Sound
|
||||
player.getWorld().playSound(player.getEyeLocation(), Sound.PISTON_EXTEND, 1f, 1.6f);
|
||||
}
|
||||
|
||||
public void soundRefire(Location loc)
|
||||
@ -365,7 +400,7 @@ public abstract class Gun extends StrikeItem
|
||||
}
|
||||
else if (event.GetAbility().equals(getName() + " Reload"))
|
||||
{
|
||||
soundReloaded(event.GetPlayer().getEyeLocation());
|
||||
handleReloaded(event.GetPlayer());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -34,6 +34,9 @@ public abstract class Shotgun extends Gun
|
||||
@Override
|
||||
public void shoot(Player player, MineStrike game)
|
||||
{
|
||||
if (_reloading)
|
||||
return;
|
||||
|
||||
//Check Ammo
|
||||
if (!ammoCheck(player))
|
||||
return;
|
||||
@ -78,6 +81,8 @@ public abstract class Shotgun extends Gun
|
||||
@Override
|
||||
public long getReloadTime()
|
||||
{
|
||||
return _reloadTime * Math.min(_reserveAmmo, _clipSize - _loadedAmmo);
|
||||
long time = _reloadTime + _reloadTime * Math.min(_reserveAmmo, _clipSize - _loadedAmmo);
|
||||
|
||||
return time;
|
||||
}
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ public class AWP extends Gun
|
||||
10, 3, //Clip Size, Spare Ammo
|
||||
1500, 3600, //ROF, Reload Time
|
||||
115, 0, 0.97, //Damage, Dropoff, Armor Penetration
|
||||
0.1, 0.1, //COF Min, COF Max
|
||||
0.14, 0.14, //COF Min, COF Max
|
||||
0, 0, //COF Inc per Bullet, COF Dec per Second
|
||||
Material.GOLD_SPADE, Sound.DRINK);
|
||||
|
||||
|
@ -17,9 +17,9 @@ public class Nova extends Shotgun
|
||||
},
|
||||
1200, 5000, //Cost, Gem Cost
|
||||
8, 4, //Clip Size, Spare Ammo
|
||||
1000, 800, //ROF, Reload Time
|
||||
1000, 600, //ROF, Reload Time
|
||||
26, 0.01, 0.5, //Damage, Dropoff, Armor Penetration
|
||||
0.15, 0.15, //COF Min, COF Max
|
||||
0.1, 0.1, //COF Min, COF Max
|
||||
0, 0, //COF Inc per Bullet, COF Dec per Second
|
||||
Material.GOLD_AXE, Sound.BLAZE_DEATH, 9);
|
||||
}
|
||||
|
@ -17,9 +17,9 @@ public class XM1014 extends Shotgun
|
||||
},
|
||||
2000, 5000, //Cost, Gem Cost
|
||||
7, 4, //Clip Size, Spare Ammo
|
||||
260, 800, //ROF, Reload Time
|
||||
260, 600, //ROF, Reload Time
|
||||
20, 0.01, 0.8, //Damage, Dropoff, Armor Penetration
|
||||
0.15, 0.15, //COF Min, COF Max
|
||||
0.12, 0.12, //COF Min, COF Max
|
||||
0, 0, //COF Inc per Bullet, COF Dec per Second
|
||||
Material.DIAMOND_AXE, Sound.SKELETON_DEATH, 6);
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ public class P90 extends Gun
|
||||
2350, 5000, //Cost, Gem Cost
|
||||
50, 2, //Clip Size, Spare Ammo
|
||||
35, 3300, //ROF, Reload Time
|
||||
22, 0.006, 0.65, //Damage, Dropoff, Armor Penetration
|
||||
17, 0.006, 0.65, //Damage, Dropoff, Armor Penetration
|
||||
0, 0.25, //COF Min, COF Max
|
||||
0.022, 0.3, //COF Inc per Bullet, COF Dec per Second
|
||||
Material.STONE_AXE, Sound.CREEPER_DEATH);
|
||||
|
@ -84,8 +84,9 @@ public class MineWare extends SoloGame
|
||||
this.ItemDrop = true;
|
||||
this.ItemPickup = true;
|
||||
|
||||
this.InventoryOpen = true;
|
||||
this.InventoryClick = true;
|
||||
InventoryOpenBlock = true;
|
||||
InventoryOpenChest = true;
|
||||
InventoryClick = true;
|
||||
|
||||
PopulateOrders();
|
||||
}
|
||||
|
@ -87,8 +87,6 @@ public class SuperSmash extends SoloGame
|
||||
|
||||
this.SpawnDistanceRequirement = 16;
|
||||
|
||||
this.InventoryOpen = false;
|
||||
|
||||
// Add stat table here
|
||||
// Example
|
||||
//Manager.GetStatsManager().addTable("SuperSmashMobStats", "Kills", "Deaths", "Wins", "Losses");
|
||||
|
@ -87,8 +87,6 @@ public class SuperSmashTeam extends TeamGame
|
||||
|
||||
this.SpawnDistanceRequirement = 16;
|
||||
|
||||
this.InventoryOpen = false;
|
||||
|
||||
this.TeamArmorHotbar = true;
|
||||
}
|
||||
|
||||
|
@ -71,7 +71,7 @@ public class KitSkeletalHorse extends SmashKit
|
||||
}));
|
||||
|
||||
if (Manager.GetGame().GetState() == GameState.Recruit)
|
||||
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.FIRE, (byte)0, 1,
|
||||
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BLAZE_POWDER, (byte)0, 1,
|
||||
C.cYellow + C.Bold + "Passive" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Infernal Horror",
|
||||
new String[]
|
||||
{
|
||||
|
@ -174,6 +174,8 @@ public class SurvivalGames extends SoloGame
|
||||
this.ItemPickup = true;
|
||||
|
||||
this.InventoryClick = true;
|
||||
this.InventoryOpenBlock = true;
|
||||
this.InventoryOpenChest = true;
|
||||
|
||||
this.CompassEnabled = false; //XXX
|
||||
|
||||
|
@ -110,7 +110,8 @@ public class UHC extends TeamGame
|
||||
this.BlockBreak = true;
|
||||
this.BlockPlace = true;
|
||||
|
||||
this.InventoryOpen = true;
|
||||
this.InventoryOpenBlock = true;
|
||||
this.InventoryOpenChest = true;
|
||||
|
||||
this.DeathOut = true;
|
||||
this.QuitOut = false;
|
||||
@ -125,8 +126,6 @@ public class UHC extends TeamGame
|
||||
|
||||
this.SoupEnabled = false;
|
||||
|
||||
this.IdleKick = true;
|
||||
this.AutoStart = true;
|
||||
this.CompassEnabled = true;
|
||||
|
||||
this.WorldBoundaryKill = false;
|
||||
@ -143,10 +142,6 @@ public class UHC extends TeamGame
|
||||
|
||||
_scoreObj = Scoreboard.GetScoreboard().registerNewObjective("Health", "health");
|
||||
_scoreObj.setDisplaySlot(DisplaySlot.PLAYER_LIST);
|
||||
|
||||
//Tournament
|
||||
this.AutoBalance = false;
|
||||
this.AutoStart = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -260,7 +255,7 @@ public class UHC extends TeamGame
|
||||
Manager.GetCondition().Factory().Poison("Border", event.getPlayer(), event.getPlayer(), 1.9, 0, false, false, false);
|
||||
}
|
||||
}
|
||||
*/
|
||||
*/
|
||||
|
||||
@EventHandler
|
||||
public void WorldBoundaryCheck(UpdateEvent event)
|
||||
@ -276,29 +271,88 @@ public class UHC extends TeamGame
|
||||
player.damage(0.75);
|
||||
}
|
||||
|
||||
//Effect
|
||||
if (Math.abs(player.getLocation().getX()) + 7 < _borderSize && Math.abs(player.getLocation().getZ()) + 7 < _borderSize)
|
||||
VisualBoundary(player);
|
||||
VisualBoundaryClose(player);
|
||||
}
|
||||
}
|
||||
|
||||
public void VisualBoundary(Player player)
|
||||
{
|
||||
//Effect 1
|
||||
if (Math.abs(player.getLocation().getX()) + 16 < _borderSize && Math.abs(player.getLocation().getZ()) + 16 < _borderSize)
|
||||
return;
|
||||
|
||||
//X Wall
|
||||
if (Math.abs(player.getLocation().getX()) + 16 >= _borderSize)
|
||||
{
|
||||
Location loc = player.getLocation().getBlock().getLocation().add(0.5, 0.5, 0.5);
|
||||
loc.setX(_borderSize);
|
||||
|
||||
for (int y=-16 ; y<=16 ; y++)
|
||||
{
|
||||
for (int z=-16 ; z<=16 ; z++)
|
||||
{
|
||||
if (Math.abs(loc.getZ() + z) > _borderSize)
|
||||
continue;
|
||||
|
||||
Location newLoc = loc.clone().add(0, y, z);
|
||||
|
||||
if (UtilMath.offset(player.getLocation(), newLoc) > 16)
|
||||
continue;
|
||||
|
||||
UtilParticle.PlayParticle(player, ParticleType.FLAME, newLoc, 0.5f, 0.5f, 0.5f, 0, 1);
|
||||
|
||||
if (_borderSize > 16)
|
||||
player.playSound(newLoc, Sound.FIZZ, 0.1f, 0.1f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Z Wall
|
||||
if (Math.abs(player.getLocation().getZ()) + 16 >= _borderSize)
|
||||
{
|
||||
Location loc = player.getLocation().getBlock().getLocation().add(0.5, 0.5, 0.5);
|
||||
loc.setZ(_borderSize);
|
||||
|
||||
for (int x=-16 ; x<=16 ; x++)
|
||||
{
|
||||
for (int y=-16 ; y<=16 ; y++)
|
||||
{
|
||||
if (Math.abs(loc.getX() + x) > _borderSize)
|
||||
continue;
|
||||
|
||||
Location newLoc = loc.clone().add(x, y, 0);
|
||||
|
||||
if (UtilMath.offset(player.getLocation(), newLoc) > 16)
|
||||
continue;
|
||||
|
||||
UtilParticle.PlayParticle(player, ParticleType.FLAME, newLoc, 0.5f, 0.5f, 0.5f, 0, 1);
|
||||
|
||||
if (_borderSize > 16)
|
||||
player.playSound(newLoc, Sound.FIZZ, 0.1f, 0.1f);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void VisualBoundaryClose(Player player)
|
||||
{
|
||||
//Effect
|
||||
if (Math.abs(player.getLocation().getX()) + 5 < _borderSize && Math.abs(player.getLocation().getZ()) + 5 < _borderSize)
|
||||
return;
|
||||
|
||||
for (Block block : UtilBlock.getInRadius(player.getLocation(), 5d).keySet())
|
||||
{
|
||||
if (Math.random() > 0.80)
|
||||
continue;
|
||||
|
||||
for (Block block : UtilBlock.getInRadius(player.getLocation(), 7d).keySet())
|
||||
{
|
||||
if (Math.random() > 0.80)
|
||||
continue;
|
||||
if (Math.abs(block.getX()) < _borderSize && Math.abs(block .getZ()) < _borderSize)
|
||||
continue;
|
||||
|
||||
if (Math.abs(block.getX()) < _borderSize && Math.abs(block .getZ()) < _borderSize)
|
||||
continue;
|
||||
if (!UtilBlock.airFoliage(block))
|
||||
continue;
|
||||
|
||||
if (!UtilBlock.airFoliage(block))
|
||||
continue;
|
||||
|
||||
if (!UtilBlock.solid(block.getRelative(BlockFace.DOWN)))
|
||||
continue;
|
||||
|
||||
|
||||
UtilParticle.PlayParticle(player, ParticleType.LARGE_EXPLODE, block.getLocation(), (float)Math.random(), (float)Math.random(), (float)Math.random(), 0, 1);
|
||||
|
||||
player.playSound(block.getLocation(), Sound.FIZZ, 0.1f, 0.1f);
|
||||
}
|
||||
UtilParticle.PlayParticle(player, ParticleType.LAVA, block.getLocation().add(0.5, 0.5, 0.5), 0.5f, 0.5f, 0.5f, 0, 1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -331,6 +385,7 @@ public class UHC extends TeamGame
|
||||
this.WorldData.MinY = -1000;
|
||||
this.WorldData.MaxY = 1000;
|
||||
|
||||
/*
|
||||
for (int y=0 ; y<128 ; y++)
|
||||
for (int x=-_borderSize ; x<_borderSize ; x++)
|
||||
for (int z=-_borderSize ; z<_borderSize ; z++)
|
||||
@ -340,6 +395,7 @@ public class UHC extends TeamGame
|
||||
MapUtil.QuickChangeBlockAt(WorldData.World, x, y, z , 159, (byte)14);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
System.out.println("Time: " + UtilTime.MakeStr(System.currentTimeMillis() - time));
|
||||
}
|
||||
@ -609,7 +665,7 @@ public class UHC extends TeamGame
|
||||
return;
|
||||
}
|
||||
}
|
||||
*/
|
||||
*/
|
||||
|
||||
@EventHandler(priority=EventPriority.MONITOR)
|
||||
public void DamageRecord(CustomDamageEvent event)
|
||||
@ -1034,4 +1090,21 @@ public class UHC extends TeamGame
|
||||
|
||||
return health;
|
||||
}
|
||||
|
||||
public String getMotdStatus()
|
||||
{
|
||||
long hour = 3600000;
|
||||
|
||||
if (InProgress())
|
||||
{
|
||||
return ChatColor.YELLOW + "In Progress";
|
||||
}
|
||||
|
||||
if (System.currentTimeMillis() % hour < 60000)
|
||||
{
|
||||
return ChatColor.GREEN + "Recruiting";
|
||||
}
|
||||
|
||||
return ChatColor.GOLD + "Starting in " + UtilTime.MakeStr(hour - (System.currentTimeMillis() % hour));
|
||||
}
|
||||
}
|
@ -149,7 +149,7 @@ public class PerkBoneRush extends Perk implements IThrown
|
||||
}
|
||||
else
|
||||
{
|
||||
Item fire = player.getWorld().dropItem(player.getLocation().add(Math.random()*5 - 2.5, Math.random()*3, Math.random()*5 - 2.5), new ItemStack(Material.FIRE));
|
||||
Item fire = player.getWorld().dropItem(player.getLocation().add(Math.random()*5 - 2.5, Math.random()*3, Math.random()*5 - 2.5), new ItemStack(Material.BLAZE_POWDER));
|
||||
UtilAction.velocity(fire, dir, 0.6 + 0.3 * Math.random(), false, 0, 0.1 + Math.random() * 0.05, 0.3, false);
|
||||
Manager.GetProjectile().AddThrow(fire, player, this, -1, true, true, true, false, 1d);
|
||||
}
|
||||
@ -169,7 +169,7 @@ public class PerkBoneRush extends Perk implements IThrown
|
||||
@Override
|
||||
public void Collide(LivingEntity target, Block block, ProjectileUser data)
|
||||
{
|
||||
boolean burning = ((Item)data.GetThrown()).getItemStack().getType() == Material.FIRE;
|
||||
boolean burning = ((Item)data.GetThrown()).getItemStack().getType() == Material.BLAZE_POWDER;
|
||||
|
||||
data.GetThrown().remove();
|
||||
|
||||
|
@ -110,7 +110,7 @@ public class PerkFlamingSword extends Perk
|
||||
}
|
||||
|
||||
//Fire
|
||||
Item fire = cur.getWorld().dropItem(cur.getEyeLocation(), ItemStackFactory.Instance.CreateStack(Material.FIRE));
|
||||
Item fire = cur.getWorld().dropItem(cur.getEyeLocation(), ItemStackFactory.Instance.CreateStack(Material.BLAZE_POWDER));
|
||||
Manager.GetFire().Add(fire, cur, 0.7, 0, 0.5, 1, "Inferno");
|
||||
|
||||
fire.teleport(cur.getEyeLocation());
|
||||
|
@ -100,7 +100,7 @@ public class PerkInferno extends Perk
|
||||
}
|
||||
|
||||
//Fire
|
||||
Item fire = cur.getWorld().dropItem(cur.getEyeLocation(), ItemStackFactory.Instance.CreateStack(Material.FIRE));
|
||||
Item fire = cur.getWorld().dropItem(cur.getEyeLocation(), ItemStackFactory.Instance.CreateStack(Material.BLAZE_POWDER));
|
||||
Manager.GetFire().Add(fire, cur, 0.7, 0, 0.5, 1, "Inferno");
|
||||
|
||||
fire.teleport(cur.getEyeLocation());
|
||||
|
@ -85,7 +85,7 @@ public class PerkInfernoFinn extends Perk
|
||||
}
|
||||
|
||||
//Fire
|
||||
Item fire = cur.getWorld().dropItem(cur.getEyeLocation(), ItemStackFactory.Instance.CreateStack(Material.FIRE));
|
||||
Item fire = cur.getWorld().dropItem(cur.getEyeLocation(), ItemStackFactory.Instance.CreateStack(Material.BLAZE_POWDER));
|
||||
Manager.GetFire().Add(fire, cur, 0.7, 0, 2, 2, "Inferno");
|
||||
|
||||
fire.teleport(cur.getEyeLocation());
|
||||
|
@ -14,6 +14,7 @@ import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.GameType;
|
||||
import nautilus.game.arcade.game.Game;
|
||||
import nautilus.game.arcade.game.Game.GameState;
|
||||
import nautilus.game.arcade.stats.StatTracker;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -92,8 +93,12 @@ public class GameCreationManager implements Listener
|
||||
{
|
||||
Game game = gameIterator.next();
|
||||
|
||||
|
||||
HandlerList.unregisterAll(game);
|
||||
|
||||
for (StatTracker tracker : game.getStatTrackers())
|
||||
HandlerList.unregisterAll(tracker);
|
||||
|
||||
TimingManager.start("GameCreationManager - Attempting Removal - " + game.GetName());
|
||||
|
||||
//Cleaned
|
||||
|
@ -44,6 +44,7 @@ import org.bukkit.event.entity.CreatureSpawnEvent;
|
||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.event.inventory.InventoryOpenEvent;
|
||||
import org.bukkit.event.inventory.InventoryType;
|
||||
import org.bukkit.event.player.PlayerDropItemEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
@ -231,7 +232,7 @@ public class GameFlagManager implements Listener
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void InventoryOpen(PlayerInteractEvent event)
|
||||
public void InventoryOpen(InventoryOpenEvent event)
|
||||
{
|
||||
Game game = Manager.GetGame();
|
||||
if (game == null)
|
||||
@ -240,16 +241,34 @@ public class GameFlagManager implements Listener
|
||||
if (!game.InProgress())
|
||||
return;
|
||||
|
||||
if (game.InventoryOpen)
|
||||
return;
|
||||
if (!game.InventoryOpenBlock)
|
||||
{
|
||||
if (event.getInventory().getType() == InventoryType.ANVIL ||
|
||||
event.getInventory().getType() == InventoryType.BEACON ||
|
||||
event.getInventory().getType() == InventoryType.BREWING ||
|
||||
event.getInventory().getType() == InventoryType.DISPENSER ||
|
||||
event.getInventory().getType() == InventoryType.DROPPER ||
|
||||
event.getInventory().getType() == InventoryType.ENCHANTING ||
|
||||
event.getInventory().getType() == InventoryType.FURNACE ||
|
||||
event.getInventory().getType() == InventoryType.HOPPER ||
|
||||
event.getInventory().getType() == InventoryType.MERCHANT ||
|
||||
event.getInventory().getType() == InventoryType.ENDER_CHEST ||
|
||||
event.getInventory().getType() == InventoryType.WORKBENCH)
|
||||
{
|
||||
event.setCancelled(true);
|
||||
event.getPlayer().closeInventory();
|
||||
}
|
||||
}
|
||||
|
||||
if (event.getClickedBlock() == null)
|
||||
return;
|
||||
|
||||
if (!UtilBlock.usable(event.getClickedBlock()))
|
||||
return;
|
||||
|
||||
event.setCancelled(true);
|
||||
if (!game.InventoryOpenChest)
|
||||
{
|
||||
if (event.getInventory().getType() == InventoryType.CHEST)
|
||||
{
|
||||
event.setCancelled(true);
|
||||
event.getPlayer().closeInventory();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
|
@ -317,6 +317,55 @@ public class GameLobbyManager implements Listener, IPacketHandler
|
||||
return;
|
||||
}
|
||||
|
||||
//UHC
|
||||
if (game.GetType() == GameType.UHC)
|
||||
{
|
||||
if (game.GetTeamList().size() > 1)
|
||||
{
|
||||
//Text
|
||||
WriteTeamLine("", 0, 159, (byte)15);
|
||||
WriteTeamLine("", 1, 159, (byte)4);
|
||||
|
||||
for (int i=0 ; i<game.GetTeamList().size() ; i++)
|
||||
{
|
||||
GameTeam team = game.GetTeamList().get(i);
|
||||
|
||||
//Circle Math
|
||||
double lead = i * ((2d * Math.PI)/game.GetTeamList().size());
|
||||
double sizeMod = 32;
|
||||
double oX = -Math.sin(lead) * sizeMod;
|
||||
double oZ = Math.cos(lead) * sizeMod;
|
||||
|
||||
//Location
|
||||
Location entLoc = spawn.clone().add(oX, 0, oZ);
|
||||
entLoc.setY(_teamDisplay.getY());
|
||||
|
||||
//Blocks
|
||||
SetKitTeamBlocks(entLoc.clone(), 35, team.GetColorData(), _teamBlocks);
|
||||
|
||||
entLoc.add(0, 1.5, 0);
|
||||
|
||||
entLoc.getChunk().load();
|
||||
|
||||
//NPC
|
||||
Sheep ent = (Sheep)Manager.GetCreature().SpawnEntity(entLoc, EntityType.SHEEP);
|
||||
ent.setRemoveWhenFarAway(false);
|
||||
ent.setCustomNameVisible(false);
|
||||
|
||||
ent.setColor(DyeColor.getByWoolData(team.GetColorData()));
|
||||
|
||||
UtilEnt.Vegetate(ent);
|
||||
|
||||
team.SetTeamEntity(ent);
|
||||
|
||||
_teams.put(ent, new LobbyEnt(ent, entLoc, team));
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//Standard
|
||||
if (game.GetKits().length > 1 || game.GetTeamList().size() < 6)
|
||||
{
|
||||
|
@ -123,7 +123,7 @@ public class GameManager implements Listener
|
||||
if (game.GetCountdown() != -1)
|
||||
StateCountdown(game, -1, false);
|
||||
|
||||
else if (game.AutoStart && Manager.IsGameAutoStart())
|
||||
else if (Manager.IsGameAutoStart())
|
||||
{
|
||||
if (UtilServer.getPlayers().length >= Manager.GetPlayerFull())
|
||||
StateCountdown(game, 20, false);
|
||||
@ -339,19 +339,20 @@ public class GameManager implements Listener
|
||||
{
|
||||
color = ChatColor.DARK_GREEN;
|
||||
|
||||
if (game.GetTeamList().size() == 0) if (game.WorldData.SpawnLocs.size() > 1) color = ChatColor.RED;
|
||||
if (game.GetTeamList().size() == 1) color = ChatColor.YELLOW;
|
||||
if (game.GetTeamList().size() == 2) color = ChatColor.GREEN;
|
||||
if (game.GetTeamList().size() == 3) color = ChatColor.AQUA;
|
||||
if (game.GetTeamList().size() == 4) color = ChatColor.GOLD;
|
||||
if (game.GetTeamList().size() == 5) color = ChatColor.LIGHT_PURPLE;
|
||||
if (game.GetTeamList().size() == 6) color = ChatColor.DARK_BLUE;
|
||||
if (game.GetTeamList().size() == 7) color = ChatColor.WHITE;
|
||||
if (game.GetTeamList().size() == 8) color = ChatColor.BLUE;
|
||||
if (game.GetTeamList().size() == 9) color = ChatColor.DARK_GREEN;
|
||||
if (game.GetTeamList().size() == 10) color = ChatColor.DARK_PURPLE;
|
||||
if (game.GetTeamList().size() == 11) color = ChatColor.DARK_GRAY;
|
||||
if (game.GetTeamList().size() == 12) color = ChatColor.DARK_RED;
|
||||
if (game.GetTeamList().size()%14 == 0) if (game.WorldData.SpawnLocs.size() > 1) color = ChatColor.RED;
|
||||
if (game.GetTeamList().size()%14 == 1) color = ChatColor.YELLOW;
|
||||
if (game.GetTeamList().size()%14 == 2) color = ChatColor.GREEN;
|
||||
if (game.GetTeamList().size()%14 == 3) color = ChatColor.AQUA;
|
||||
if (game.GetTeamList().size()%14 == 4) color = ChatColor.GOLD;
|
||||
if (game.GetTeamList().size()%14 == 5) color = ChatColor.LIGHT_PURPLE;
|
||||
if (game.GetTeamList().size()%14 == 6) color = ChatColor.DARK_BLUE;
|
||||
if (game.GetTeamList().size()%14 == 7) color = ChatColor.WHITE;
|
||||
if (game.GetTeamList().size()%14 == 8) color = ChatColor.BLUE;
|
||||
if (game.GetTeamList().size()%14 == 9) color = ChatColor.DARK_GREEN;
|
||||
if (game.GetTeamList().size()%14 == 10) color = ChatColor.DARK_PURPLE;
|
||||
if (game.GetTeamList().size()%14 == 11) color = ChatColor.GRAY;
|
||||
if (game.GetTeamList().size()%14 == 12) color = ChatColor.DARK_RED;
|
||||
if (game.GetTeamList().size()%14 == 13) color = ChatColor.DARK_AQUA;
|
||||
}
|
||||
|
||||
GameTeam newTeam = new GameTeam(game, team, color, game.WorldData.SpawnLocs.get(team));
|
||||
|
@ -46,9 +46,6 @@ public class IdleManager implements Listener
|
||||
if (Manager.GetGame() == null)
|
||||
return;
|
||||
|
||||
if (Manager.GetGame() != null && !Manager.GetGame().IdleKick)
|
||||
return;
|
||||
|
||||
for (Player player : UtilServer.getPlayers())
|
||||
{
|
||||
if (!_yaw.containsKey(player) || !_idle.containsKey(player))
|
||||
|
@ -53,7 +53,7 @@ public class TheLongestShotStatTracker extends StatTracker<Game>
|
||||
{
|
||||
Arrow arrow = (Arrow) edbee.getDamager();
|
||||
|
||||
if (arrow.getShooter() == killer && killer.getLocation().distanceSquared(player.getLocation()) <= 64 * 64)
|
||||
if (arrow.getShooter() == killer && killer.getLocation().distanceSquared(player.getLocation()) >= 64 * 64)
|
||||
addStat(killer, "TheLongestShot", 1, false, false);
|
||||
}
|
||||
}
|
||||
|
@ -22,6 +22,9 @@ public class WinWithoutLosingTeammateStatTracker extends StatTracker<TeamGame>
|
||||
{
|
||||
GameTeam winner = getGame().WinnerTeam;
|
||||
|
||||
if (winner == null)
|
||||
return;
|
||||
|
||||
if (winner.GetPlayers(false).size() < 4)
|
||||
return;
|
||||
|
||||
|
125
Webpages/leaderboard.php
Normal file
125
Webpages/leaderboard.php
Normal file
@ -0,0 +1,125 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>The Fall Invitational Leaderboard</title>
|
||||
<meta http-equiv="refresh" content="30">
|
||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
|
||||
<style type="text/css">
|
||||
.table td.center, .table th.center {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.panel-heading {
|
||||
text-align: center;
|
||||
font-size: 18pt;
|
||||
font-weight: bold;
|
||||
color: orange!important;
|
||||
background-color: #333!important;
|
||||
border-color: #333!important;
|
||||
}
|
||||
|
||||
.panel-primary {
|
||||
border-color: #333!important;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="jumbotron" style="text-align: center">
|
||||
<div class="container" style="text-align: center">
|
||||
<img src="mineplex.png" alt="Mineplex"/>
|
||||
<h1>The Fall Invitational</h1>
|
||||
<h2>Tournament Leaderboard</h2>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr/>
|
||||
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
|
||||
<?php
|
||||
|
||||
$tournamentTypes = array('Super Smash Mobs', 'Survival Games', 'Mixed Arcade');
|
||||
|
||||
$con = mysqli_connect('db.mineplex.com', 'root', 'tAbechAk3wR7tuTh', 'Account');
|
||||
|
||||
for ($i = 0; $i < count($tournamentTypes); $i++)
|
||||
{
|
||||
?>
|
||||
<div class="col-md-4">
|
||||
<div class="panel panel-primary">
|
||||
<div class="panel-heading"><?php echo $tournamentTypes[$i] ?></div>
|
||||
<div class="table-responsive">
|
||||
<table class="table">
|
||||
<col style="width: 15%">
|
||||
<col style="width: 40%">
|
||||
<col style="width: 15%">
|
||||
<col style="width: 15%">
|
||||
<col style="width: 15%">
|
||||
<tr>
|
||||
<th class="center">Rank</th>
|
||||
<th>Player</th>
|
||||
<th class="center">Wins</th>
|
||||
<th class="center">Losses</th>
|
||||
<th class="center">Score*</th>
|
||||
</tr>
|
||||
<?php
|
||||
|
||||
$query = <<<QUERY
|
||||
SELECT name, wins, total, score
|
||||
FROM tournamentLeaderboard
|
||||
JOIN accounts ON accounts.id = accountId
|
||||
WHERE tournamentId = 0
|
||||
AND gameId = $i
|
||||
AND score IS NOT NULL
|
||||
ORDER BY score DESC, name ASC
|
||||
LIMIT 50;
|
||||
QUERY;
|
||||
|
||||
$result = mysqli_query($con, $query);
|
||||
|
||||
$index = 1;
|
||||
$rank = 1;
|
||||
$lastScore = null;
|
||||
|
||||
while($row = mysqli_fetch_array($result))
|
||||
{
|
||||
$score = $row['score'];
|
||||
|
||||
if ($score != $lastScore)
|
||||
{
|
||||
$rank = $index;
|
||||
}
|
||||
|
||||
?>
|
||||
<tr>
|
||||
<td class="center"><?php echo $rank ?></td>
|
||||
<td><?php echo $row['name'] ?></td>
|
||||
<td class="center"><?php echo $row['wins'] ?></td>
|
||||
<td class="center"><?php echo ($row['total'] - $row['wins']) ?></td>
|
||||
<td class="center"><?php echo round($score*100, 3) ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
|
||||
$index++;
|
||||
$lastScore = $score;
|
||||
}
|
||||
|
||||
?>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
mysqli_close($con);
|
||||
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<p style="text-align: center; font-style: italic">*Score = 100 × Wins × (Wins / Total)<sup>3</sup></p>
|
||||
<hr/>
|
||||
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user