Merge branch 'master' of ssh://184.154.0.242:7999/min/Mineplex
This commit is contained in:
commit
c89461628b
@ -0,0 +1,118 @@
|
|||||||
|
package mineplex.core.common.util;
|
||||||
|
|
||||||
|
import java.net.URL;
|
||||||
|
import java.net.URLConnection;
|
||||||
|
import java.util.Scanner;
|
||||||
|
import java.util.UUID;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
|
||||||
|
import net.minecraft.util.com.mojang.authlib.GameProfile;
|
||||||
|
import net.minecraft.util.com.mojang.authlib.properties.Property;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
|
import org.json.simple.JSONArray;
|
||||||
|
import org.json.simple.JSONObject;
|
||||||
|
import org.json.simple.parser.JSONParser;
|
||||||
|
|
||||||
|
public class ProfileLoader
|
||||||
|
{
|
||||||
|
private final String uuid;
|
||||||
|
private final String name;
|
||||||
|
private final String skinOwner;
|
||||||
|
|
||||||
|
public ProfileLoader(String uuid, String name)
|
||||||
|
{
|
||||||
|
this(uuid, name, name);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ProfileLoader(String uuid, String name, String skinOwner)
|
||||||
|
{
|
||||||
|
this.uuid = uuid == null ? null : uuid.replaceAll("-", ""); // We add
|
||||||
|
// these
|
||||||
|
// later
|
||||||
|
String displayName = ChatColor.translateAlternateColorCodes('&', name);
|
||||||
|
this.name = ChatColor.stripColor(displayName);
|
||||||
|
this.skinOwner = skinOwner;
|
||||||
|
}
|
||||||
|
|
||||||
|
public GameProfile loadProfile()
|
||||||
|
{
|
||||||
|
UUID id = uuid == null ? parseUUID(getUUID(name)) : parseUUID(uuid);
|
||||||
|
GameProfile profile = new GameProfile(id, name);
|
||||||
|
addProperties(profile);
|
||||||
|
return profile;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addProperties(GameProfile profile)
|
||||||
|
{
|
||||||
|
String uuid = getUUID(skinOwner);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// Get the name from SwordPVP
|
||||||
|
URL url = new URL("https://sessionserver.mojang.com/session/minecraft/profile/" + uuid + "?unsigned=false");
|
||||||
|
URLConnection uc = url.openConnection();
|
||||||
|
uc.setUseCaches(false);
|
||||||
|
uc.setDefaultUseCaches(false);
|
||||||
|
uc.addRequestProperty("User-Agent", "Mozilla/5.0");
|
||||||
|
uc.addRequestProperty("Cache-Control", "no-cache, no-store, must-revalidate");
|
||||||
|
uc.addRequestProperty("Pragma", "no-cache");
|
||||||
|
|
||||||
|
// Parse it
|
||||||
|
String json = new Scanner(uc.getInputStream(), "UTF-8").useDelimiter("\\A").next();
|
||||||
|
JSONParser parser = new JSONParser();
|
||||||
|
Object obj = parser.parse(json);
|
||||||
|
JSONArray properties = (JSONArray) ((JSONObject) obj).get("properties");
|
||||||
|
for (int i = 0; i < properties.size(); i++)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
JSONObject property = (JSONObject) properties.get(i);
|
||||||
|
String name = (String) property.get("name");
|
||||||
|
String value = (String) property.get("value");
|
||||||
|
String signature = property.containsKey("signature") ? (String) property.get("signature") : null;
|
||||||
|
if (signature != null)
|
||||||
|
{
|
||||||
|
profile.getProperties().put(name, new Property(name, value, signature));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
profile.getProperties().put(name, new Property(value, name));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Bukkit.getLogger().log(Level.WARNING, "Failed to apply auth property", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
; // Failed to load skin
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
private String getUUID(String name)
|
||||||
|
{
|
||||||
|
return Bukkit.getOfflinePlayer(name).getUniqueId().toString().replaceAll("-", "");
|
||||||
|
}
|
||||||
|
|
||||||
|
private UUID parseUUID(String uuidStr)
|
||||||
|
{
|
||||||
|
// Split uuid in to 5 components
|
||||||
|
String[] uuidComponents = new String[] { uuidStr.substring(0, 8), uuidStr.substring(8, 12),
|
||||||
|
uuidStr.substring(12, 16), uuidStr.substring(16, 20), uuidStr.substring(20, uuidStr.length()) };
|
||||||
|
|
||||||
|
// Combine components with a dash
|
||||||
|
StringBuilder builder = new StringBuilder();
|
||||||
|
for (String component : uuidComponents)
|
||||||
|
{
|
||||||
|
builder.append(component).append('-');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Correct uuid length, remove last dash
|
||||||
|
builder.setLength(builder.length() - 1);
|
||||||
|
return UUID.fromString(builder.toString());
|
||||||
|
}
|
||||||
|
}
|
@ -1,5 +1,7 @@
|
|||||||
package mineplex.core.achievement;
|
package mineplex.core.achievement;
|
||||||
|
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
|
|
||||||
public class AchivementData
|
public class AchivementData
|
||||||
{
|
{
|
||||||
private int _level;
|
private int _level;
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
package mineplex.core.disguise.disguises;
|
package mineplex.core.disguise.disguises;
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
import net.minecraft.server.v1_7_R4.MathHelper;
|
import net.minecraft.server.v1_7_R4.MathHelper;
|
||||||
import net.minecraft.server.v1_7_R4.Packet;
|
import net.minecraft.server.v1_7_R4.Packet;
|
||||||
import net.minecraft.server.v1_7_R4.PacketPlayOutNamedEntitySpawn;
|
import net.minecraft.server.v1_7_R4.PacketPlayOutNamedEntitySpawn;
|
||||||
@ -9,26 +7,23 @@ import net.minecraft.util.com.mojang.authlib.GameProfile;
|
|||||||
|
|
||||||
public class DisguisePlayer extends DisguiseHuman
|
public class DisguisePlayer extends DisguiseHuman
|
||||||
{
|
{
|
||||||
private String _name;
|
private GameProfile _profile;
|
||||||
|
|
||||||
public DisguisePlayer(org.bukkit.entity.Entity entity)
|
public DisguisePlayer(org.bukkit.entity.Entity entity)
|
||||||
{
|
{
|
||||||
super(entity);
|
super(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
public DisguisePlayer(org.bukkit.entity.Entity entity, String name)
|
public DisguisePlayer(org.bukkit.entity.Entity entity, GameProfile profile)
|
||||||
{
|
{
|
||||||
this(entity);
|
this(entity);
|
||||||
|
|
||||||
setName(name);
|
setProfile(profile);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setName(String name)
|
public void setProfile(GameProfile profile)
|
||||||
{
|
{
|
||||||
if (name.length() > 16)
|
_profile = profile;
|
||||||
_name = name.substring(0, 16);
|
|
||||||
else
|
|
||||||
_name = name;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -36,7 +31,7 @@ public class DisguisePlayer extends DisguiseHuman
|
|||||||
{
|
{
|
||||||
PacketPlayOutNamedEntitySpawn packet = new PacketPlayOutNamedEntitySpawn();
|
PacketPlayOutNamedEntitySpawn packet = new PacketPlayOutNamedEntitySpawn();
|
||||||
packet.a = Entity.getId();
|
packet.a = Entity.getId();
|
||||||
packet.b = new GameProfile(UUID.randomUUID(), _name);
|
packet.b = _profile;
|
||||||
packet.c = MathHelper.floor(Entity.locX * 32.0D);
|
packet.c = MathHelper.floor(Entity.locX * 32.0D);
|
||||||
packet.d = MathHelper.floor(Entity.locY * 32.0D);
|
packet.d = MathHelper.floor(Entity.locY * 32.0D);
|
||||||
packet.e = MathHelper.floor(Entity.locZ * 32.0D);
|
packet.e = MathHelper.floor(Entity.locZ * 32.0D);
|
||||||
|
@ -14,7 +14,7 @@ public class DisguiseSheep extends DisguiseAnimal
|
|||||||
|
|
||||||
public boolean isSheared()
|
public boolean isSheared()
|
||||||
{
|
{
|
||||||
return (DataWatcher.getByte(16) & 0x10) != 0;
|
return (DataWatcher.getByte(16) & 16) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSheared(boolean sheared)
|
public void setSheared(boolean sheared)
|
||||||
@ -22,14 +22,14 @@ public class DisguiseSheep extends DisguiseAnimal
|
|||||||
byte b0 = DataWatcher.getByte(16);
|
byte b0 = DataWatcher.getByte(16);
|
||||||
|
|
||||||
if (sheared)
|
if (sheared)
|
||||||
DataWatcher.watch(16, Byte.valueOf((byte)(b0 | 0x10)));
|
DataWatcher.watch(16, Byte.valueOf((byte)(b0 | 16)));
|
||||||
else
|
else
|
||||||
DataWatcher.watch(16, Byte.valueOf((byte)(b0 & 0xFFFFFFEF)));
|
DataWatcher.watch(16, Byte.valueOf((byte)(b0 & -17)));
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getColor()
|
public int getColor()
|
||||||
{
|
{
|
||||||
return DataWatcher.getByte(16) & 0xF;
|
return DataWatcher.getByte(16) & 15;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
@ -37,6 +37,6 @@ public class DisguiseSheep extends DisguiseAnimal
|
|||||||
{
|
{
|
||||||
byte b0 = DataWatcher.getByte(16);
|
byte b0 = DataWatcher.getByte(16);
|
||||||
|
|
||||||
DataWatcher.watch(16, Byte.valueOf((byte)(b0 & 0xF0 | color.getWoolData() & 0xF)));
|
DataWatcher.watch(16, Byte.valueOf((byte)(b0 & 240 | color.getWoolData() & 15)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,7 @@ import org.bukkit.Bukkit;
|
|||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||||
import org.bukkit.event.player.PlayerJoinEvent;
|
import org.bukkit.event.player.PlayerJoinEvent;
|
||||||
import org.bukkit.event.player.PlayerMoveEvent;
|
import org.bukkit.event.player.PlayerMoveEvent;
|
||||||
import org.bukkit.event.player.PlayerQuitEvent;
|
import org.bukkit.event.player.PlayerQuitEvent;
|
||||||
@ -87,6 +88,8 @@ public class GadgetManager extends MiniPlugin
|
|||||||
addGadget(new ItemTNT(this));
|
addGadget(new ItemTNT(this));
|
||||||
addGadget(new ItemFleshHook(this));
|
addGadget(new ItemFleshHook(this));
|
||||||
addGadget(new ItemMelonLauncher(this));
|
addGadget(new ItemMelonLauncher(this));
|
||||||
|
//addGadget(new ItemFootball(this));
|
||||||
|
//addGadget(new ItemDuelingSword(this));
|
||||||
|
|
||||||
// Morphs
|
// Morphs
|
||||||
addGadget(new MorphBlaze(this));
|
addGadget(new MorphBlaze(this));
|
||||||
@ -97,6 +100,8 @@ public class GadgetManager extends MiniPlugin
|
|||||||
addGadget(new MorphBat(this));
|
addGadget(new MorphBat(this));
|
||||||
addGadget(new MorphBlock(this));
|
addGadget(new MorphBlock(this));
|
||||||
addGadget(new MorphVillager(this));
|
addGadget(new MorphVillager(this));
|
||||||
|
addGadget(new MorphCow(this));
|
||||||
|
addGadget(new MorphNotch(this));
|
||||||
|
|
||||||
// Particles
|
// Particles
|
||||||
addGadget(new ParticleGreen(this));
|
addGadget(new ParticleGreen(this));
|
||||||
@ -320,6 +325,14 @@ public class GadgetManager extends MiniPlugin
|
|||||||
_playerActiveGadgetMap.remove(event.getPlayer());
|
_playerActiveGadgetMap.remove(event.getPlayer());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void death(PlayerDeathEvent event)
|
||||||
|
{
|
||||||
|
_lastMove.remove(event.getEntity());
|
||||||
|
|
||||||
|
_playerActiveGadgetMap.remove(event.getEntity());
|
||||||
|
}
|
||||||
|
|
||||||
public void setActive(Player player, Gadget gadget)
|
public void setActive(Player player, Gadget gadget)
|
||||||
{
|
{
|
||||||
if (!_playerActiveGadgetMap.containsKey(player))
|
if (!_playerActiveGadgetMap.containsKey(player))
|
||||||
|
@ -0,0 +1,66 @@
|
|||||||
|
package mineplex.core.gadget.gadgets;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
|
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.entity.Bat;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.EventPriority;
|
||||||
|
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.bukkit.inventory.meta.ItemMeta;
|
||||||
|
|
||||||
|
import mineplex.core.common.util.C;
|
||||||
|
import mineplex.core.common.util.F;
|
||||||
|
import mineplex.core.common.util.UtilGear;
|
||||||
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
|
import mineplex.core.gadget.GadgetManager;
|
||||||
|
import mineplex.core.gadget.types.ItemGadget;
|
||||||
|
|
||||||
|
public class ItemDuelingSword extends ItemGadget
|
||||||
|
{
|
||||||
|
public ItemDuelingSword(GadgetManager manager)
|
||||||
|
{
|
||||||
|
super(manager, "Dueling Sword", new String[]
|
||||||
|
{
|
||||||
|
C.cWhite + "While active, you are able to fight",
|
||||||
|
C.cWhite + "against other people who are also",
|
||||||
|
C.cWhite + "wielding a dueling sword.",
|
||||||
|
},
|
||||||
|
-1,
|
||||||
|
Material.WOOD_SWORD, (byte)3,
|
||||||
|
1000, new Ammo("Dueling Sword", "10 Swords", Material.WOOD_SWORD, (byte)0, new String[] { C.cWhite + "10 Swords to duel with" }, 1000, 10));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void ActivateCustom(Player player)
|
||||||
|
{
|
||||||
|
ItemStack stack = new ItemStack(Material.GOLD_SWORD);
|
||||||
|
ItemMeta meta = stack.getItemMeta();
|
||||||
|
meta.setDisplayName("Dueling Sword");
|
||||||
|
stack.setItemMeta(meta);
|
||||||
|
|
||||||
|
player.getInventory().setItem(Manager.getActiveItemSlot(), stack);
|
||||||
|
|
||||||
|
//Inform
|
||||||
|
UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(GetName()) + "."));
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
|
public void damage(EntityDamageByEntityEvent event)
|
||||||
|
{
|
||||||
|
if (!(event.getEntity() instanceof Player) || !(event.getDamager() instanceof Player))
|
||||||
|
return;
|
||||||
|
|
||||||
|
Player damager = (Player)event.getDamager();
|
||||||
|
Player damagee = (Player)event.getEntity();
|
||||||
|
|
||||||
|
if (!UtilGear.isMat(damager.getItemInHand(), Material.GOLD_SWORD) || !UtilGear.isMat(damagee.getItemInHand(), Material.GOLD_SWORD))
|
||||||
|
return;
|
||||||
|
|
||||||
|
event.setCancelled(false);
|
||||||
|
|
||||||
|
event.setDamage(4);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,125 @@
|
|||||||
|
package mineplex.core.gadget.gadgets;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
|
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.Sound;
|
||||||
|
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftFallingSand;
|
||||||
|
import org.bukkit.entity.Bat;
|
||||||
|
import org.bukkit.entity.FallingBlock;
|
||||||
|
import org.bukkit.entity.Item;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
|
|
||||||
|
import mineplex.core.common.util.C;
|
||||||
|
import mineplex.core.common.util.F;
|
||||||
|
import mineplex.core.common.util.UtilAction;
|
||||||
|
import mineplex.core.common.util.UtilAlg;
|
||||||
|
import mineplex.core.common.util.UtilEnt;
|
||||||
|
import mineplex.core.common.util.UtilEvent;
|
||||||
|
import mineplex.core.common.util.UtilMath;
|
||||||
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
|
import mineplex.core.common.util.UtilServer;
|
||||||
|
import mineplex.core.common.util.UtilEvent.ActionType;
|
||||||
|
import mineplex.core.gadget.GadgetManager;
|
||||||
|
import mineplex.core.gadget.types.ItemGadget;
|
||||||
|
import mineplex.core.recharge.Recharge;
|
||||||
|
import mineplex.core.updater.UpdateType;
|
||||||
|
import mineplex.core.updater.event.UpdateEvent;
|
||||||
|
|
||||||
|
public class ItemFootball extends ItemGadget
|
||||||
|
{
|
||||||
|
private HashSet<Bat> _active = new HashSet<Bat>();
|
||||||
|
|
||||||
|
public ItemFootball(GadgetManager manager)
|
||||||
|
{
|
||||||
|
super(manager, "Football", new String[]
|
||||||
|
{
|
||||||
|
C.cWhite + "An amazing souvenier from the",
|
||||||
|
C.cWhite + "Mineplex World Cup in 2053!",
|
||||||
|
},
|
||||||
|
-1,
|
||||||
|
Material.CLAY_BALL, (byte)3,
|
||||||
|
1000, new Ammo("Melon Launcher", "10 Footballs", Material.CLAY_BALL, (byte)0, new String[] { C.cWhite + "10 Footballs to play with" }, 1000, 10));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void ActivateCustom(Player player)
|
||||||
|
{
|
||||||
|
//Action
|
||||||
|
FallingBlock ball = player.getWorld().spawnFallingBlock(player.getLocation().add(0, 1, 0), Material.SKULL, (byte) 3);
|
||||||
|
|
||||||
|
Bat bat = player.getWorld().spawn(player.getLocation(), Bat.class);
|
||||||
|
UtilEnt.Vegetate(bat);
|
||||||
|
UtilEnt.ghost(bat, true, true);
|
||||||
|
UtilEnt.silence(bat, true);
|
||||||
|
|
||||||
|
bat.setPassenger(ball);
|
||||||
|
|
||||||
|
_active.add(bat);
|
||||||
|
|
||||||
|
//Inform
|
||||||
|
UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(GetName()) + "."));
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void Collide(UpdateEvent event)
|
||||||
|
{
|
||||||
|
if (event.getType() != UpdateType.TICK)
|
||||||
|
return;
|
||||||
|
|
||||||
|
for (Bat ball : _active)
|
||||||
|
{
|
||||||
|
if (ball.getPassenger() != null)
|
||||||
|
{
|
||||||
|
((CraftFallingSand)ball.getPassenger()).getHandle().ticksLived = 1;
|
||||||
|
ball.getPassenger().setTicksLived(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (Player other : UtilServer.getPlayers())
|
||||||
|
{
|
||||||
|
if (UtilMath.offset(ball, other) > 1.5)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (!Recharge.Instance.use(other, GetName() + " Bump", 200, false, false))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
|
||||||
|
double power = 0.4;
|
||||||
|
if (other.isSprinting())
|
||||||
|
power = 0.7;
|
||||||
|
|
||||||
|
//Velocity
|
||||||
|
UtilAction.velocity(ball, UtilAlg.getTrajectory2d(other, ball), power, false, 0, 0, 0, false);
|
||||||
|
|
||||||
|
other.getWorld().playSound(other.getLocation(), Sound.ITEM_PICKUP, 0.2f, 0.2f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void Snort(PlayerInteractEvent event)
|
||||||
|
{
|
||||||
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
|
if (!UtilEvent.isAction(event, ActionType.L))
|
||||||
|
return;
|
||||||
|
|
||||||
|
for (Bat ball : _active)
|
||||||
|
{
|
||||||
|
if (UtilMath.offset(ball, player) > 2)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (!Recharge.Instance.use(player, GetName() + " Kick", 1000, false, false))
|
||||||
|
return;
|
||||||
|
|
||||||
|
Recharge.Instance.useForce(player, GetName() + " Bump", 1000);
|
||||||
|
|
||||||
|
//Velocity
|
||||||
|
UtilAction.velocity(ball, UtilAlg.getTrajectory2d(player, ball), 2, false, 0, 0, 0, false);
|
||||||
|
|
||||||
|
player.getWorld().playSound(player.getLocation(), Sound.ITEM_PICKUP, 1f, 0.1f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -33,7 +33,7 @@ public class MorphBlock extends MorphGadget
|
|||||||
C.cYellow + "Left Click" + C.cGray + " to use " + C.cGreen + "Change Block",
|
C.cYellow + "Left Click" + C.cGray + " to use " + C.cGreen + "Change Block",
|
||||||
C.cYellow + "Stay Still" + C.cGray + " to use " + C.cGreen + "Solidify",
|
C.cYellow + "Stay Still" + C.cGray + " to use " + C.cGreen + "Solidify",
|
||||||
},
|
},
|
||||||
40000,
|
30000,
|
||||||
ArmorSlot.Helmet, Material.EMERALD_BLOCK, (byte)0);
|
ArmorSlot.Helmet, Material.EMERALD_BLOCK, (byte)0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,66 @@
|
|||||||
|
package mineplex.core.gadget.gadgets;
|
||||||
|
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.Sound;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.player.*;
|
||||||
|
|
||||||
|
import mineplex.core.common.util.C;
|
||||||
|
import mineplex.core.common.util.UtilEvent;
|
||||||
|
import mineplex.core.common.util.UtilEvent.ActionType;
|
||||||
|
import mineplex.core.disguise.disguises.DisguiseCow;
|
||||||
|
import mineplex.core.recharge.Recharge;
|
||||||
|
import mineplex.core.gadget.GadgetManager;
|
||||||
|
import mineplex.core.gadget.types.MorphGadget;
|
||||||
|
|
||||||
|
public class MorphCow extends MorphGadget
|
||||||
|
{
|
||||||
|
public MorphCow(GadgetManager manager)
|
||||||
|
{
|
||||||
|
super(manager, "Cow Morph", new String[]
|
||||||
|
{
|
||||||
|
C.cWhite + "How now brown cow?",
|
||||||
|
" ",
|
||||||
|
C.cYellow + "Left Click" + C.cGray + " to use " + C.cGreen + "Moo",
|
||||||
|
},
|
||||||
|
6000,
|
||||||
|
ArmorSlot.Helmet, Material.LEATHER, (byte)0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void EnableCustom(final Player player)
|
||||||
|
{
|
||||||
|
this.ApplyArmor(player);
|
||||||
|
|
||||||
|
DisguiseCow disguise = new DisguiseCow(player);
|
||||||
|
disguise.SetName(player.getName(), Manager.getClientManager().Get(player).GetRank());
|
||||||
|
disguise.SetCustomNameVisible(true);
|
||||||
|
Manager.getDisguiseManager().disguise(disguise);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void DisableCustom(Player player)
|
||||||
|
{
|
||||||
|
this.RemoveArmor(player);
|
||||||
|
Manager.getDisguiseManager().undisguise(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void Audio(PlayerInteractEvent event)
|
||||||
|
{
|
||||||
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
|
if (!IsActive(player))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (!UtilEvent.isAction(event, ActionType.L))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (!Recharge.Instance.use(player, GetName(), 2500, false, false))
|
||||||
|
return;
|
||||||
|
|
||||||
|
player.getWorld().playSound(player.getLocation(), Sound.COW_IDLE, 1f, 1f);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,70 @@
|
|||||||
|
package mineplex.core.gadget.gadgets;
|
||||||
|
|
||||||
|
import net.minecraft.util.com.mojang.authlib.GameProfile;
|
||||||
|
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.player.*;
|
||||||
|
|
||||||
|
import mineplex.core.common.util.C;
|
||||||
|
import mineplex.core.common.util.ProfileLoader;
|
||||||
|
import mineplex.core.common.util.UUIDFetcher;
|
||||||
|
import mineplex.core.common.util.UtilEvent;
|
||||||
|
import mineplex.core.common.util.UtilEvent.ActionType;
|
||||||
|
import mineplex.core.disguise.disguises.DisguisePlayer;
|
||||||
|
import mineplex.core.recharge.Recharge;
|
||||||
|
import mineplex.core.gadget.GadgetManager;
|
||||||
|
import mineplex.core.gadget.types.MorphGadget;
|
||||||
|
|
||||||
|
public class MorphNotch extends MorphGadget
|
||||||
|
{
|
||||||
|
private GameProfile _notchProfile = null;
|
||||||
|
|
||||||
|
public MorphNotch(GadgetManager manager)
|
||||||
|
{
|
||||||
|
super(manager, "Notch", new String[]
|
||||||
|
{
|
||||||
|
" ",
|
||||||
|
C.cYellow + "Left Click" + C.cGray + " to use " + C.cGreen + "Enforce EULA",
|
||||||
|
},
|
||||||
|
50000,
|
||||||
|
ArmorSlot.Helmet, Material.SKULL_ITEM, (byte)3);
|
||||||
|
|
||||||
|
_notchProfile = new ProfileLoader(UUIDFetcher.getUUIDOf("Notch").toString(), "Notch").loadProfile();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void EnableCustom(final Player player)
|
||||||
|
{
|
||||||
|
this.ApplyArmor(player);
|
||||||
|
|
||||||
|
DisguisePlayer disguise = new DisguisePlayer(player, _notchProfile);
|
||||||
|
Manager.getDisguiseManager().disguise(disguise);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void DisableCustom(Player player)
|
||||||
|
{
|
||||||
|
this.RemoveArmor(player);
|
||||||
|
Manager.getDisguiseManager().undisguise(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void Audio(PlayerInteractEvent event)
|
||||||
|
{
|
||||||
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
|
if (!IsActive(player))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (!UtilEvent.isAction(event, ActionType.L))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (!Recharge.Instance.use(player, GetName(), 1500, false, false))
|
||||||
|
return;
|
||||||
|
|
||||||
|
player.sendMessage("You have enforced the EULA.");
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -5,6 +5,7 @@ import org.bukkit.ChatColor;
|
|||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.entity.Skeleton.SkeletonType;
|
import org.bukkit.entity.Skeleton.SkeletonType;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
import mineplex.core.common.util.C;
|
import mineplex.core.common.util.C;
|
||||||
import mineplex.core.common.util.UtilServer;
|
import mineplex.core.common.util.UtilServer;
|
||||||
@ -41,6 +42,8 @@ public class MorphPumpkinKing extends MorphGadget
|
|||||||
disguise.SetSkeletonType(SkeletonType.WITHER);
|
disguise.SetSkeletonType(SkeletonType.WITHER);
|
||||||
Manager.getDisguiseManager().disguise(disguise);
|
Manager.getDisguiseManager().disguise(disguise);
|
||||||
|
|
||||||
|
player.getInventory().setHelmet(new ItemStack(Material.JACK_O_LANTERN));
|
||||||
|
|
||||||
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(Manager.GetPlugin(), new Runnable()
|
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(Manager.GetPlugin(), new Runnable()
|
||||||
{
|
{
|
||||||
public void run()
|
public void run()
|
||||||
|
@ -1,46 +0,0 @@
|
|||||||
package mineplex.core.gadget.gadgets;
|
|
||||||
|
|
||||||
import org.bukkit.ChatColor;
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
import mineplex.core.common.util.C;
|
|
||||||
import mineplex.core.disguise.disguises.DisguiseSnowman;
|
|
||||||
import mineplex.core.gadget.GadgetManager;
|
|
||||||
import mineplex.core.gadget.types.MorphGadget;
|
|
||||||
|
|
||||||
public class MorphSnowman extends MorphGadget
|
|
||||||
{
|
|
||||||
public MorphSnowman(GadgetManager manager)
|
|
||||||
{
|
|
||||||
super(manager, "Snowmans Head", new String[]
|
|
||||||
{
|
|
||||||
C.cWhite + "Transforms the wearer into",
|
|
||||||
C.cWhite + "a Christmas Snowman!",
|
|
||||||
"",
|
|
||||||
C.cYellow + "Earned by defeating the Pumpkin King",
|
|
||||||
C.cYellow + "in the 2013 Christmas Chaos Event.",
|
|
||||||
},
|
|
||||||
-1,
|
|
||||||
ArmorSlot.Helmet, Material.SNOW_BLOCK, (byte)0);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void EnableCustom(final Player player)
|
|
||||||
{
|
|
||||||
this.ApplyArmor(player);
|
|
||||||
|
|
||||||
DisguiseSnowman disguise = new DisguiseSnowman(player);
|
|
||||||
disguise.SetName(player.getName(), Manager.getClientManager().Get(player).GetRank());
|
|
||||||
disguise.SetCustomNameVisible(true);
|
|
||||||
Manager.getDisguiseManager().disguise(disguise);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void DisableCustom(Player player)
|
|
||||||
{
|
|
||||||
this.RemoveArmor(player);
|
|
||||||
Manager.getDisguiseManager().undisguise(player);
|
|
||||||
}
|
|
||||||
}
|
|
@ -26,7 +26,7 @@ public class MorphVillager extends MorphGadget
|
|||||||
" ",
|
" ",
|
||||||
C.cYellow + "Left Click" + C.cGray + " to use " + C.cGreen + "HURRR",
|
C.cYellow + "Left Click" + C.cGray + " to use " + C.cGreen + "HURRR",
|
||||||
},
|
},
|
||||||
20000,
|
12000,
|
||||||
ArmorSlot.Helmet, Material.EMERALD, (byte)0);
|
ArmorSlot.Helmet, Material.EMERALD, (byte)0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,7 +9,9 @@ import org.bukkit.entity.Horse;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.entity.ItemSpawnEvent;
|
import org.bukkit.event.entity.ItemSpawnEvent;
|
||||||
|
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||||
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
||||||
|
import org.bukkit.event.player.PlayerQuitEvent;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
import mineplex.core.MiniPlugin;
|
import mineplex.core.MiniPlugin;
|
||||||
@ -113,6 +115,18 @@ public class MountManager extends MiniPlugin
|
|||||||
mount.Disable(player);
|
mount.Disable(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void quit(PlayerQuitEvent event)
|
||||||
|
{
|
||||||
|
_playerActiveMountMap.remove(event.getPlayer());
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void death(PlayerDeathEvent event)
|
||||||
|
{
|
||||||
|
_playerActiveMountMap.remove(event.getEntity());
|
||||||
|
}
|
||||||
|
|
||||||
public void setActive(Player player, Mount<?> mount)
|
public void setActive(Player player, Mount<?> mount)
|
||||||
{
|
{
|
||||||
_playerActiveMountMap.put(player, mount);
|
_playerActiveMountMap.put(player, mount);
|
||||||
|
@ -8,14 +8,18 @@ import org.bukkit.entity.Horse.Color;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.entity.Horse.Style;
|
import org.bukkit.entity.Horse.Style;
|
||||||
import org.bukkit.entity.Horse.Variant;
|
import org.bukkit.entity.Horse.Variant;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
import mineplex.core.common.util.F;
|
import mineplex.core.common.util.F;
|
||||||
import mineplex.core.common.util.UtilPlayer;
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
|
import mineplex.core.disguise.disguises.DisguiseBase;
|
||||||
import mineplex.core.disguise.disguises.DisguisePig;
|
import mineplex.core.disguise.disguises.DisguisePig;
|
||||||
import mineplex.core.disguise.disguises.DisguiseSheep;
|
import mineplex.core.disguise.disguises.DisguiseSheep;
|
||||||
import mineplex.core.mount.HorseMount;
|
import mineplex.core.mount.HorseMount;
|
||||||
import mineplex.core.mount.MountManager;
|
import mineplex.core.mount.MountManager;
|
||||||
|
import mineplex.core.updater.UpdateType;
|
||||||
|
import mineplex.core.updater.event.UpdateEvent;
|
||||||
|
|
||||||
public class MountSheep extends HorseMount
|
public class MountSheep extends HorseMount
|
||||||
{
|
{
|
||||||
@ -42,16 +46,8 @@ public class MountSheep extends HorseMount
|
|||||||
|
|
||||||
Horse horse = player.getWorld().spawn(player.getLocation(), Horse.class);
|
Horse horse = player.getWorld().spawn(player.getLocation(), Horse.class);
|
||||||
|
|
||||||
/*horse.setAdult();
|
|
||||||
horse.setAgeLock(true);
|
|
||||||
horse.setColor(_color);
|
|
||||||
horse.setStyle(_style);
|
|
||||||
horse.setVariant(_variant);
|
|
||||||
*/
|
|
||||||
horse.setOwner(player);
|
horse.setOwner(player);
|
||||||
horse.setMaxDomestication(1);
|
horse.setMaxDomestication(1);
|
||||||
//horse.setJumpStrength(_jump);
|
|
||||||
|
|
||||||
horse.getInventory().setSaddle(new ItemStack(Material.SADDLE));
|
horse.getInventory().setSaddle(new ItemStack(Material.SADDLE));
|
||||||
|
|
||||||
DisguiseSheep disguise = new DisguiseSheep(horse);
|
DisguiseSheep disguise = new DisguiseSheep(horse);
|
||||||
@ -66,4 +62,25 @@ public class MountSheep extends HorseMount
|
|||||||
//Store
|
//Store
|
||||||
_active.put(player, horse);
|
_active.put(player, horse);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void updateColor(UpdateEvent event)
|
||||||
|
{
|
||||||
|
if (event.getType() != UpdateType.TICK)
|
||||||
|
return;
|
||||||
|
|
||||||
|
for (Horse horse : GetActive().values())
|
||||||
|
{
|
||||||
|
DisguiseBase base = Manager.getDisguiseManager().getDisguise(horse);
|
||||||
|
if (base == null || !(base instanceof DisguiseSheep))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
DisguiseSheep sheep = (DisguiseSheep)base;
|
||||||
|
|
||||||
|
if (horse.getTicksLived() % 4 == 0) sheep.setColor(DyeColor.RED);
|
||||||
|
else if (horse.getTicksLived() % 4 == 1) sheep.setColor(DyeColor.YELLOW);
|
||||||
|
else if (horse.getTicksLived() % 4 == 2) sheep.setColor(DyeColor.GREEN);
|
||||||
|
else if (horse.getTicksLived() % 4 == 3) sheep.setColor(DyeColor.BLUE);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package mineplex.hub;
|
package mineplex.hub;
|
||||||
|
|
||||||
|
import net.minecraft.server.v1_7_R4.MinecraftServer;
|
||||||
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
@ -130,6 +132,8 @@ public class Hub extends JavaPlugin implements IRelation
|
|||||||
|
|
||||||
//Updates
|
//Updates
|
||||||
getServer().getScheduler().scheduleSyncRepeatingTask(this, new Updater(this), 1, 1);
|
getServer().getScheduler().scheduleSyncRepeatingTask(this, new Updater(this), 1, 1);
|
||||||
|
|
||||||
|
MinecraftServer.getServer().getPropertyManager().setProperty("debug", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -20,6 +20,7 @@ import org.bukkit.event.block.BlockDamageEvent;
|
|||||||
import org.bukkit.event.entity.EntityDamageEvent;
|
import org.bukkit.event.entity.EntityDamageEvent;
|
||||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||||
import org.bukkit.event.entity.ItemSpawnEvent;
|
import org.bukkit.event.entity.ItemSpawnEvent;
|
||||||
|
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||||
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
||||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||||
@ -55,14 +56,12 @@ import mineplex.core.common.util.UtilWorld;
|
|||||||
import mineplex.minecraft.game.core.condition.ConditionManager;
|
import mineplex.minecraft.game.core.condition.ConditionManager;
|
||||||
import mineplex.core.cosmetic.CosmeticManager;
|
import mineplex.core.cosmetic.CosmeticManager;
|
||||||
import mineplex.core.disguise.DisguiseManager;
|
import mineplex.core.disguise.DisguiseManager;
|
||||||
import mineplex.core.disguise.disguises.DisguisePlayer;
|
|
||||||
import mineplex.core.disguise.disguises.DisguiseSlime;
|
import mineplex.core.disguise.disguises.DisguiseSlime;
|
||||||
import mineplex.core.donation.DonationManager;
|
import mineplex.core.donation.DonationManager;
|
||||||
import mineplex.core.gadget.GadgetManager;
|
import mineplex.core.gadget.GadgetManager;
|
||||||
import mineplex.core.gadget.event.GadgetCollideEntityEvent;
|
import mineplex.core.gadget.event.GadgetCollideEntityEvent;
|
||||||
import mineplex.core.inventory.InventoryManager;
|
import mineplex.core.inventory.InventoryManager;
|
||||||
import mineplex.core.itemstack.ItemStackFactory;
|
import mineplex.core.itemstack.ItemStackFactory;
|
||||||
import mineplex.core.logger.Logger;
|
|
||||||
import mineplex.core.mount.MountManager;
|
import mineplex.core.mount.MountManager;
|
||||||
import mineplex.core.pet.PetManager;
|
import mineplex.core.pet.PetManager;
|
||||||
import mineplex.core.portal.Portal;
|
import mineplex.core.portal.Portal;
|
||||||
@ -410,12 +409,6 @@ public class HubManager extends MiniClientPlugin<HubClient>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void PlayerRespawn(PlayerRespawnEvent event)
|
|
||||||
{
|
|
||||||
event.setRespawnLocation(GetSpawn());
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR)
|
@EventHandler(priority = EventPriority.MONITOR)
|
||||||
public void OnChunkLoad(ChunkLoadEvent event)
|
public void OnChunkLoad(ChunkLoadEvent event)
|
||||||
{
|
{
|
||||||
@ -425,11 +418,7 @@ public class HubManager extends MiniClientPlugin<HubClient>
|
|||||||
{
|
{
|
||||||
if (((LivingEntity)entity).isCustomNameVisible() && ((LivingEntity)entity).getCustomName() != null)
|
if (((LivingEntity)entity).isCustomNameVisible() && ((LivingEntity)entity).getCustomName() != null)
|
||||||
{
|
{
|
||||||
if (ChatColor.stripColor(((LivingEntity)entity).getCustomName()).equalsIgnoreCase("Minekart"))
|
if (ChatColor.stripColor(((LivingEntity)entity).getCustomName()).equalsIgnoreCase("Block Hunt"))
|
||||||
{
|
|
||||||
_disguiseManager.disguise(new DisguisePlayer(entity, ChatColor.YELLOW + "MineKart"));
|
|
||||||
}
|
|
||||||
else if (ChatColor.stripColor(((LivingEntity)entity).getCustomName()).equalsIgnoreCase("Block Hunt"))
|
|
||||||
{
|
{
|
||||||
DisguiseSlime disguise = new DisguiseSlime(entity);
|
DisguiseSlime disguise = new DisguiseSlime(entity);
|
||||||
disguise.SetCustomNameVisible(true);
|
disguise.SetCustomNameVisible(true);
|
||||||
@ -476,27 +465,36 @@ public class HubManager extends MiniClientPlugin<HubClient>
|
|||||||
event.getPlayer().setOp(false);
|
event.getPlayer().setOp(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void PlayerRespawn(PlayerRespawnEvent event)
|
||||||
|
{
|
||||||
|
event.setRespawnLocation(GetSpawn().add(0, 10, 0));
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOW)
|
@EventHandler(priority = EventPriority.LOW)
|
||||||
public void PlayerJoin(PlayerJoinEvent event)
|
public void PlayerJoin(PlayerJoinEvent event)
|
||||||
{
|
{
|
||||||
try
|
Player player = event.getPlayer();
|
||||||
{
|
|
||||||
final Player player = event.getPlayer();
|
|
||||||
|
|
||||||
//Survival
|
|
||||||
player.setGameMode(GameMode.SURVIVAL);
|
|
||||||
|
|
||||||
//Public Message
|
//Public Message
|
||||||
event.setJoinMessage(null);
|
event.setJoinMessage(null);
|
||||||
|
|
||||||
//Teleport
|
//Teleport
|
||||||
player.teleport(GetSpawn());
|
player.teleport(GetSpawn().add(0, 10, 0));
|
||||||
|
|
||||||
|
//Survival
|
||||||
|
player.setGameMode(GameMode.SURVIVAL);
|
||||||
|
|
||||||
|
//Clear Inv
|
||||||
|
UtilInv.Clear(player);
|
||||||
|
|
||||||
//Allow Double Jump
|
//Allow Double Jump
|
||||||
player.setAllowFlight(true);
|
player.setAllowFlight(true);
|
||||||
|
|
||||||
UtilInv.Clear(player);
|
//Health
|
||||||
|
player.setHealth(20);
|
||||||
|
|
||||||
|
//Rules
|
||||||
player.getInventory().setItem(6, _ruleBook);
|
player.getInventory().setItem(6, _ruleBook);
|
||||||
|
|
||||||
//Scoreboard
|
//Scoreboard
|
||||||
@ -540,14 +538,14 @@ public class HubManager extends MiniClientPlugin<HubClient>
|
|||||||
//Add Self to Other
|
//Add Self to Other
|
||||||
otherPlayer.getScoreboard().getTeam(rankName).addPlayer(player);
|
otherPlayer.getScoreboard().getTeam(rankName).addPlayer(player);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
@EventHandler
|
||||||
|
public void PlayerDeath(PlayerDeathEvent event)
|
||||||
{
|
{
|
||||||
Logger.Instance.log(ex);
|
//XXX make this work > event.setKeepInventory(true);
|
||||||
System.out.println("[HubManager] Player Join exception");
|
event.getDrops().clear();
|
||||||
throw ex;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
@ -658,13 +656,14 @@ public class HubManager extends MiniClientPlugin<HubClient>
|
|||||||
@EventHandler
|
@EventHandler
|
||||||
public void FoodHealthUpdate(UpdateEvent event)
|
public void FoodHealthUpdate(UpdateEvent event)
|
||||||
{
|
{
|
||||||
if (event.getType() != UpdateType.SLOW)
|
if (event.getType() != UpdateType.SEC)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (Player player : UtilServer.getPlayers())
|
for (Player player : UtilServer.getPlayers())
|
||||||
{
|
{
|
||||||
player.setHealth(20);
|
|
||||||
player.setFoodLevel(20);
|
player.setFoodLevel(20);
|
||||||
|
player.setExhaustion(0f);
|
||||||
|
player.setSaturation(3f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -938,4 +937,6 @@ public class HubManager extends MiniClientPlugin<HubClient>
|
|||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -89,7 +89,6 @@ public class ParkourManager extends MiniPlugin
|
|||||||
}, 4000, new Location(Manager.GetSpawn().getWorld(), -93,67,38),
|
}, 4000, new Location(Manager.GetSpawn().getWorld(), -93,67,38),
|
||||||
new Location(Manager.GetSpawn().getWorld(), -86,100,42), new Location(Manager.GetSpawn().getWorld(), -120,50,-17)));
|
new Location(Manager.GetSpawn().getWorld(), -86,100,42), new Location(Manager.GetSpawn().getWorld(), -120,50,-17)));
|
||||||
|
|
||||||
/*
|
|
||||||
_parkour.add(new ParkourSnake("Snake Parkour", new String[]
|
_parkour.add(new ParkourSnake("Snake Parkour", new String[]
|
||||||
{
|
{
|
||||||
"This parkour requires incredible timing",
|
"This parkour requires incredible timing",
|
||||||
@ -97,7 +96,7 @@ public class ParkourManager extends MiniPlugin
|
|||||||
"by the devil as a cruel joke!"
|
"by the devil as a cruel joke!"
|
||||||
}, 8000, new Location(Manager.GetSpawn().getWorld(), 22,70,-54),
|
}, 8000, new Location(Manager.GetSpawn().getWorld(), 22,70,-54),
|
||||||
new Location(Manager.GetSpawn().getWorld(), 28,-50,-88), new Location(Manager.GetSpawn().getWorld(), -24,90,-46)));
|
new Location(Manager.GetSpawn().getWorld(), 28,-50,-88), new Location(Manager.GetSpawn().getWorld(), -24,90,-46)));
|
||||||
*/
|
|
||||||
_lavaParkourReturn = new Location(Manager.GetSpawn().getWorld(), -89.5,68,36.5);
|
_lavaParkourReturn = new Location(Manager.GetSpawn().getWorld(), -89.5,68,36.5);
|
||||||
_lavaParkourReturn.setYaw(90);
|
_lavaParkourReturn.setYaw(90);
|
||||||
|
|
||||||
|
@ -96,10 +96,10 @@ public class WorldManager extends MiniPlugin
|
|||||||
|
|
||||||
Location loc = Manager.GetSpawn();
|
Location loc = Manager.GetSpawn();
|
||||||
|
|
||||||
if (r > 0.75) loc.add(32, 0.5, 0);
|
if (r > 0.75) loc = new Location(Manager.GetSpawn().getWorld(), -9, 72, 42);
|
||||||
else if (r > 0.5) loc.add(0, 0.5, 32);
|
else if (r > 0.5) loc = new Location(Manager.GetSpawn().getWorld(), -36, 72, -28);
|
||||||
else if (r > 0.25) loc.add(-32, 0.5, 0);
|
else if (r > 0.25) loc = new Location(Manager.GetSpawn().getWorld(), 31, 72, -34);
|
||||||
else loc.add(0, 0.5, -32);
|
else loc = new Location(Manager.GetSpawn().getWorld(), 43, 72, 5);
|
||||||
|
|
||||||
//Spawn
|
//Spawn
|
||||||
if (Manager.Mode.equals("Halloween"))
|
if (Manager.Mode.equals("Halloween"))
|
||||||
|
@ -63,6 +63,7 @@ import mineplex.serverdata.MinecraftServer;
|
|||||||
public class ServerManager extends MiniPlugin
|
public class ServerManager extends MiniPlugin
|
||||||
{
|
{
|
||||||
private static final Long FREE_PORTAL_TIMER = 30000L;
|
private static final Long FREE_PORTAL_TIMER = 30000L;
|
||||||
|
private static final Long BETA_PORTAL_TIMER = 600000L;
|
||||||
|
|
||||||
private CoreClientManager _clientManager;
|
private CoreClientManager _clientManager;
|
||||||
private DonationManager _donationManager;
|
private DonationManager _donationManager;
|
||||||
@ -81,7 +82,7 @@ public class ServerManager extends MiniPlugin
|
|||||||
private NautHashMap<Vector, String> _serverPortalLocations = new NautHashMap<Vector, String>();
|
private NautHashMap<Vector, String> _serverPortalLocations = new NautHashMap<Vector, String>();
|
||||||
|
|
||||||
// Join Time for Free Players Timer
|
// Join Time for Free Players Timer
|
||||||
private NautHashMap<String, Long> _freeJoinTime = new NautHashMap<String, Long>();
|
private NautHashMap<String, Long> _joinTime = new NautHashMap<String, Long>();
|
||||||
|
|
||||||
private QueueShop _domShop;
|
private QueueShop _domShop;
|
||||||
private QuickShop _quickShop;
|
private QuickShop _quickShop;
|
||||||
@ -141,7 +142,7 @@ public class ServerManager extends MiniPlugin
|
|||||||
if (!Recharge.Instance.use(player, "Portal Server", 1000, false, false))
|
if (!Recharge.Instance.use(player, "Portal Server", 1000, false, false))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
long timeUntilPortal = getMillisecondsUntilPortal(player);
|
long timeUntilPortal = getMillisecondsUntilPortal(player, false);
|
||||||
if (!_hubManager.CanPortal(player) || timeUntilPortal > 0)
|
if (!_hubManager.CanPortal(player) || timeUntilPortal > 0)
|
||||||
{
|
{
|
||||||
if (timeUntilPortal > 0)
|
if (timeUntilPortal > 0)
|
||||||
@ -240,14 +241,14 @@ public class ServerManager extends MiniPlugin
|
|||||||
|
|
||||||
if (_clientManager.Get(event.getPlayer()).GetRank() == Rank.ALL)
|
if (_clientManager.Get(event.getPlayer()).GetRank() == Rank.ALL)
|
||||||
{
|
{
|
||||||
_freeJoinTime.put(event.getPlayer().getName(), System.currentTimeMillis());
|
_joinTime.put(event.getPlayer().getName(), System.currentTimeMillis());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void playerQuit(PlayerQuitEvent event)
|
public void playerQuit(PlayerQuitEvent event)
|
||||||
{
|
{
|
||||||
_freeJoinTime.remove(event.getPlayer().getName());
|
_joinTime.remove(event.getPlayer().getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOWEST)
|
@EventHandler(priority = EventPriority.LOWEST)
|
||||||
@ -263,20 +264,18 @@ public class ServerManager extends MiniPlugin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Long getMillisecondsUntilPortal(Player player)
|
public Long getMillisecondsUntilPortal(Player player, boolean beta)
|
||||||
{
|
{
|
||||||
// Party party = _partyManager.GetParty(player);
|
// Party party = _partyManager.GetParty(player);
|
||||||
long timeLeft = 0;
|
long timeLeft = 0;
|
||||||
|
|
||||||
if (_freeJoinTime.containsKey(player.getName()))
|
if (_joinTime.containsKey(player.getName()))
|
||||||
{
|
{
|
||||||
timeLeft = (_freeJoinTime.get(player.getName()) - System.currentTimeMillis()) + FREE_PORTAL_TIMER;
|
timeLeft = (_joinTime.get(player.getName()) - System.currentTimeMillis()) + (beta ? BETA_PORTAL_TIMER : FREE_PORTAL_TIMER);
|
||||||
|
|
||||||
if (timeLeft <= 0)
|
if (timeLeft <= 0)
|
||||||
{
|
|
||||||
_freeJoinTime.remove(player.getName());
|
|
||||||
timeLeft = 0;
|
timeLeft = 0;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// if (party != null)
|
// if (party != null)
|
||||||
// {
|
// {
|
||||||
|
@ -78,18 +78,18 @@ public class ServerNpcPage extends ShopPageBase<ServerManager, ServerNpcShop> im
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showClock(long milliseconds)
|
private void showClock(long milliseconds, boolean beta)
|
||||||
{
|
{
|
||||||
int seconds = (int) (milliseconds / 1000);
|
int seconds = (int) (milliseconds / 1000);
|
||||||
String timeLeft = UtilTime.convertString(milliseconds, 0, UtilTime.TimeUnit.SECONDS);
|
String timeLeft = UtilTime.convertString(milliseconds, 0, UtilTime.TimeUnit.FIT);
|
||||||
|
|
||||||
byte data = (byte) (milliseconds - (seconds * 1000) > 500 ? 15 : 14);
|
byte data = (byte) (milliseconds - (seconds * 1000) > 500 ? 15 : 14);
|
||||||
|
|
||||||
ShopItem item = new ShopItem(Material.WOOL, data, ChatColor.RESET + C.Bold + "Free Server Timer", null, new String[] {
|
ShopItem item = new ShopItem(Material.WOOL, data, ChatColor.RESET + C.Bold + (beta ? "Beta" : "Free") + " Server Timer", null, new String[] {
|
||||||
ChatColor.RESET + C.cGreen + timeLeft + " Remaining...",
|
ChatColor.RESET + C.cGreen + timeLeft + " Remaining...",
|
||||||
ChatColor.RESET + "",
|
ChatColor.RESET + "",
|
||||||
ChatColor.RESET + C.cYellow + "Free players must wait a short time",
|
ChatColor.RESET + C.cYellow + "Free players must wait a " + (beta ? "long" : "short") + " time",
|
||||||
ChatColor.RESET + C.cYellow + "to help lighten the load on our servers.",
|
ChatColor.RESET + C.cYellow + "to help lighten the load on our " + (beta ? "Beta" : "") + " servers.",
|
||||||
ChatColor.RESET + "",
|
ChatColor.RESET + "",
|
||||||
ChatColor.RESET + C.cAqua + "Ultra and Hero players have",
|
ChatColor.RESET + C.cAqua + "Ultra and Hero players have",
|
||||||
ChatColor.RESET + C.cAqua + "instant access to our servers!",
|
ChatColor.RESET + C.cAqua + "instant access to our servers!",
|
||||||
@ -186,10 +186,12 @@ public class ServerNpcPage extends ShopPageBase<ServerManager, ServerNpcShop> im
|
|||||||
int greenStartSlot = 18 + ((9 - serversToShow) / 2);
|
int greenStartSlot = 18 + ((9 - serversToShow) / 2);
|
||||||
boolean showGreen = true;
|
boolean showGreen = true;
|
||||||
|
|
||||||
long portalTime = Plugin.getMillisecondsUntilPortal(Player);
|
boolean beta = serverList.size() > 0 && serverList.get(0).Name.contains("BETA");
|
||||||
|
|
||||||
|
long portalTime = Plugin.getMillisecondsUntilPortal(Player, beta);
|
||||||
if (portalTime > 0)
|
if (portalTime > 0)
|
||||||
{
|
{
|
||||||
showClock(portalTime);
|
showClock(portalTime, beta);
|
||||||
showGreen = false;
|
showGreen = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,8 +32,8 @@ public class PartyTutorial extends Tutorial
|
|||||||
));
|
));
|
||||||
|
|
||||||
_phases.add(new TutorialPhase(
|
_phases.add(new TutorialPhase(
|
||||||
manager.GetSpawn().add(84, y+69, 10),
|
manager.GetSpawn().add(84, y+69, 9),
|
||||||
manager.GetSpawn().add(81, y+68.5, 10),
|
manager.GetSpawn().add(81, y+68.5, 9),
|
||||||
"Creating a Party",
|
"Creating a Party",
|
||||||
new String[]
|
new String[]
|
||||||
{
|
{
|
||||||
@ -47,8 +47,8 @@ public class PartyTutorial extends Tutorial
|
|||||||
));
|
));
|
||||||
|
|
||||||
_phases.add(new TutorialPhase(
|
_phases.add(new TutorialPhase(
|
||||||
manager.GetSpawn().add(84, y+69, 10),
|
manager.GetSpawn().add(84, y+69, 9),
|
||||||
manager.GetSpawn().add(81, y+68.5, 10),
|
manager.GetSpawn().add(81, y+68.5, 9),
|
||||||
"Inviting and Suggesting Players",
|
"Inviting and Suggesting Players",
|
||||||
new String[]
|
new String[]
|
||||||
{
|
{
|
||||||
@ -61,8 +61,8 @@ public class PartyTutorial extends Tutorial
|
|||||||
));
|
));
|
||||||
|
|
||||||
_phases.add(new TutorialPhase(
|
_phases.add(new TutorialPhase(
|
||||||
manager.GetSpawn().add(84, y+69, 10),
|
manager.GetSpawn().add(84, y+69, 9),
|
||||||
manager.GetSpawn().add(81, y+68.5, 10),
|
manager.GetSpawn().add(81, y+68.5, 9),
|
||||||
"Leaving Parties",
|
"Leaving Parties",
|
||||||
new String[]
|
new String[]
|
||||||
{
|
{
|
||||||
@ -73,8 +73,8 @@ public class PartyTutorial extends Tutorial
|
|||||||
));
|
));
|
||||||
|
|
||||||
_phases.add(new TutorialPhase(
|
_phases.add(new TutorialPhase(
|
||||||
manager.GetSpawn().add(84, y+69, 10),
|
manager.GetSpawn().add(84, y+69, 9),
|
||||||
manager.GetSpawn().add(81, y+68.5, 10),
|
manager.GetSpawn().add(81, y+68.5, 9),
|
||||||
"Kicking Players from Party",
|
"Kicking Players from Party",
|
||||||
new String[]
|
new String[]
|
||||||
{
|
{
|
||||||
@ -87,8 +87,8 @@ public class PartyTutorial extends Tutorial
|
|||||||
));
|
));
|
||||||
|
|
||||||
_phases.add(new TutorialPhase(
|
_phases.add(new TutorialPhase(
|
||||||
manager.GetSpawn().add(84, y+69, 10),
|
manager.GetSpawn().add(84, y+69, 9),
|
||||||
manager.GetSpawn().add(81, y+68.5, 10),
|
manager.GetSpawn().add(81, y+68.5, 9),
|
||||||
"Joining Games Together",
|
"Joining Games Together",
|
||||||
new String[]
|
new String[]
|
||||||
{
|
{
|
||||||
@ -103,8 +103,8 @@ public class PartyTutorial extends Tutorial
|
|||||||
));
|
));
|
||||||
|
|
||||||
_phases.add(new TutorialPhase(
|
_phases.add(new TutorialPhase(
|
||||||
manager.GetSpawn().add(84, y+69, 10),
|
manager.GetSpawn().add(84, y+69, 9),
|
||||||
manager.GetSpawn().add(81, y+68.5, 10),
|
manager.GetSpawn().add(81, y+68.5, 9),
|
||||||
"Party Chat",
|
"Party Chat",
|
||||||
new String[]
|
new String[]
|
||||||
{
|
{
|
||||||
@ -118,8 +118,8 @@ public class PartyTutorial extends Tutorial
|
|||||||
));
|
));
|
||||||
|
|
||||||
_phases.add(new TutorialPhase(
|
_phases.add(new TutorialPhase(
|
||||||
manager.GetSpawn(),
|
manager.GetSpawn().add(0, -2, 0),
|
||||||
manager.GetSpawn().add(0, y+0.5, 10),
|
manager.GetSpawn().add(0, -2.1, 5),
|
||||||
"End",
|
"End",
|
||||||
new String[]
|
new String[]
|
||||||
{
|
{
|
||||||
|
@ -132,8 +132,8 @@ public class WelcomeTutorial extends Tutorial
|
|||||||
|
|
||||||
//END
|
//END
|
||||||
_phases.add(new TutorialPhase(
|
_phases.add(new TutorialPhase(
|
||||||
manager.GetSpawn().add(0, -3, 0),
|
manager.GetSpawn().add(0, -2, 0),
|
||||||
manager.GetSpawn().add(0, -3.1, 5),
|
manager.GetSpawn().add(0, -2.1, 5),
|
||||||
"End",
|
"End",
|
||||||
new String[]
|
new String[]
|
||||||
{
|
{
|
||||||
|
@ -8,5 +8,9 @@
|
|||||||
<classpathentry kind="var" path="REPO_DIR/Plugins/Libraries/jedis-2.4.2.jar"/>
|
<classpathentry kind="var" path="REPO_DIR/Plugins/Libraries/jedis-2.4.2.jar"/>
|
||||||
<classpathentry combineaccessrules="false" kind="src" path="/Mineplex.ServerData"/>
|
<classpathentry combineaccessrules="false" kind="src" path="/Mineplex.ServerData"/>
|
||||||
<classpathentry combineaccessrules="false" kind="src" path="/Mineplex.Core.Common"/>
|
<classpathentry combineaccessrules="false" kind="src" path="/Mineplex.Core.Common"/>
|
||||||
|
<classpathentry kind="var" path="REPO_DIR/Plugins/Libraries/httpcore-4.2.jar"/>
|
||||||
|
<classpathentry kind="var" path="REPO_DIR/Plugins/Libraries/httpclient-4.2.jar"/>
|
||||||
|
<classpathentry kind="var" path="REPO_DIR/Plugins/Libraries/commons-codec-1.6.jar"/>
|
||||||
|
<classpathentry kind="var" path="REPO_DIR/Plugins/Libraries/gson-2.2.1.jar"/>
|
||||||
<classpathentry kind="output" path="bin"/>
|
<classpathentry kind="output" path="bin"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
@ -0,0 +1,16 @@
|
|||||||
|
package mineplex.staffServer.helpdesk;
|
||||||
|
|
||||||
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
|
import mineplex.core.MiniPlugin;
|
||||||
|
import mineplex.staffServer.helpdesk.repository.ApiGetCall;
|
||||||
|
|
||||||
|
public class HelpDeskManager extends MiniPlugin
|
||||||
|
{
|
||||||
|
public HelpDeskManager(JavaPlugin plugin)
|
||||||
|
{
|
||||||
|
super("Help Desk", plugin);
|
||||||
|
|
||||||
|
new ApiGetCall("https://mineplex.jitbit.com/helpdesk/api", "Tickets&");
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,29 @@
|
|||||||
|
package mineplex.staffServer.helpdesk;
|
||||||
|
|
||||||
|
public class ListTicketToken
|
||||||
|
{
|
||||||
|
public int IssueID;
|
||||||
|
public int Priority;
|
||||||
|
public int StatusID;
|
||||||
|
public String IssueDate;
|
||||||
|
public String Subject;
|
||||||
|
public String Status;
|
||||||
|
public boolean UpdatedByUser;
|
||||||
|
public boolean UpdatedByPerformer;
|
||||||
|
public int CategoryID;
|
||||||
|
public String UserName;
|
||||||
|
public String Technician;
|
||||||
|
public String FirstName;
|
||||||
|
public String LastName;
|
||||||
|
public String DueDate;
|
||||||
|
public String TechFirstName;
|
||||||
|
public String TechLastName;
|
||||||
|
public String LastUpdated;
|
||||||
|
public boolean UpdatedForTechView;
|
||||||
|
public int UserID;
|
||||||
|
public int CompanyID;
|
||||||
|
public String CompanyName;
|
||||||
|
public int SectionID;
|
||||||
|
public int AssignedToUserID;
|
||||||
|
public String Category;
|
||||||
|
}
|
@ -0,0 +1,22 @@
|
|||||||
|
package mineplex.staffServer.helpdesk;
|
||||||
|
|
||||||
|
public class TicketToken
|
||||||
|
{
|
||||||
|
public int TicketID;
|
||||||
|
public int UserID;
|
||||||
|
public int AssignedToUserID;
|
||||||
|
public String IssueDate;
|
||||||
|
public String Subject;
|
||||||
|
public String Body;
|
||||||
|
public int Priority;
|
||||||
|
public int StatusID;
|
||||||
|
public int CategoryID;
|
||||||
|
public String DueDate;
|
||||||
|
public String ResolvedDate;
|
||||||
|
public String StartDate;
|
||||||
|
public int TimeSpentInSeconds;
|
||||||
|
public boolean IsCurrentUserTechInThisCategory;
|
||||||
|
public boolean IsCurrentCategoryForTechsOnly;
|
||||||
|
public boolean SubmittedByCurrentUser;
|
||||||
|
public boolean IsInKb;
|
||||||
|
}
|
@ -0,0 +1,19 @@
|
|||||||
|
package mineplex.staffServer.helpdesk.repository;
|
||||||
|
|
||||||
|
import org.apache.http.client.methods.HttpDelete;
|
||||||
|
|
||||||
|
public class ApiDeleteCall extends HelpDeskApiCallBase
|
||||||
|
{
|
||||||
|
public ApiDeleteCall(String apiUrl, int domainId, String category)
|
||||||
|
{
|
||||||
|
super(apiUrl, domainId, category);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Execute()
|
||||||
|
{
|
||||||
|
HttpDelete request = new HttpDelete(ApiUrl + DomainId + Category);
|
||||||
|
System.out.println(request.getURI().toString());
|
||||||
|
|
||||||
|
System.out.println(execute(request));
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,128 @@
|
|||||||
|
package mineplex.staffServer.helpdesk.repository;
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
|
||||||
|
import org.apache.http.HttpResponse;
|
||||||
|
import org.apache.http.client.HttpClient;
|
||||||
|
import org.apache.http.client.methods.HttpGet;
|
||||||
|
import org.apache.http.conn.scheme.PlainSocketFactory;
|
||||||
|
import org.apache.http.conn.scheme.Scheme;
|
||||||
|
import org.apache.http.conn.scheme.SchemeRegistry;
|
||||||
|
import org.apache.http.impl.client.DefaultHttpClient;
|
||||||
|
import org.apache.http.impl.conn.PoolingClientConnectionManager;
|
||||||
|
|
||||||
|
public class ApiGetCall
|
||||||
|
{
|
||||||
|
protected String ApiUrl = "https://mineplex.jitbit.com/helpdesk/api";
|
||||||
|
protected String SecretKey = "?sharedSecret={WzG49S3L6spqt4}";
|
||||||
|
private String _action;
|
||||||
|
|
||||||
|
public ApiGetCall(String apiUrl, String action)
|
||||||
|
{
|
||||||
|
ApiUrl = apiUrl;
|
||||||
|
_action = action;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected String execute()
|
||||||
|
{
|
||||||
|
HttpGet request = new HttpGet(ApiUrl + SecretKey + "&" + _action);
|
||||||
|
|
||||||
|
SchemeRegistry schemeRegistry = new SchemeRegistry();
|
||||||
|
schemeRegistry.register(new Scheme("https", 80, PlainSocketFactory.getSocketFactory()));
|
||||||
|
|
||||||
|
PoolingClientConnectionManager connectionManager = new PoolingClientConnectionManager(schemeRegistry);
|
||||||
|
connectionManager.setMaxTotal(200);
|
||||||
|
connectionManager.setDefaultMaxPerRoute(20);
|
||||||
|
|
||||||
|
HttpClient httpClient = new DefaultHttpClient(connectionManager);
|
||||||
|
InputStream in = null;
|
||||||
|
String response = "";
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
HttpResponse httpResponse = httpClient.execute(request);
|
||||||
|
|
||||||
|
if (httpResponse != null)
|
||||||
|
{
|
||||||
|
in = httpResponse.getEntity().getContent();
|
||||||
|
response = convertStreamToString(in);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
System.out.println("HelpDeskApiCall Error:\n" + ex.getMessage());
|
||||||
|
|
||||||
|
for (StackTraceElement trace : ex.getStackTrace())
|
||||||
|
{
|
||||||
|
System.out.println(trace);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
httpClient.getConnectionManager().shutdown();
|
||||||
|
|
||||||
|
if (in != null)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
in.close();
|
||||||
|
}
|
||||||
|
catch (IOException e)
|
||||||
|
{
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected String convertStreamToString(InputStream is)
|
||||||
|
{
|
||||||
|
BufferedReader reader = new BufferedReader(new InputStreamReader(is));
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
|
||||||
|
String line = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
while ((line = reader.readLine()) != null)
|
||||||
|
{
|
||||||
|
sb.append(line + "\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (IOException e)
|
||||||
|
{
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
is.close();
|
||||||
|
}
|
||||||
|
catch (IOException e)
|
||||||
|
{
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return sb.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Execute()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
public <T> T Execute(Type returnType)
|
||||||
|
{
|
||||||
|
HttpGet request = new HttpGet(ApiUrl + DomainId + Category + _action);
|
||||||
|
|
||||||
|
String response = execute(request);
|
||||||
|
System.out.println(response);
|
||||||
|
return new Gson().fromJson(response, returnType);
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
}
|
@ -0,0 +1,79 @@
|
|||||||
|
package mineplex.staffServer.helpdesk.repository;
|
||||||
|
|
||||||
|
import java.lang.reflect.Type;
|
||||||
|
|
||||||
|
import org.apache.http.client.methods.HttpPost;
|
||||||
|
import org.apache.http.entity.StringEntity;
|
||||||
|
import org.apache.http.message.BasicHeader;
|
||||||
|
import org.apache.http.protocol.HTTP;
|
||||||
|
|
||||||
|
import com.google.gson.Gson;
|
||||||
|
|
||||||
|
public class ApiPostCall extends HelpDeskApiCallBase
|
||||||
|
{
|
||||||
|
private String _action;
|
||||||
|
|
||||||
|
public ApiPostCall(String apiUrl, int domainId, String category, String action)
|
||||||
|
{
|
||||||
|
super(apiUrl, domainId, category);
|
||||||
|
|
||||||
|
_action = action;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Execute(Object argument)
|
||||||
|
{
|
||||||
|
Gson gson = new Gson();
|
||||||
|
HttpPost request = new HttpPost(ApiUrl + DomainId + Category + _action);
|
||||||
|
|
||||||
|
System.out.println(request.getURI().toString());
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
StringEntity params = new StringEntity(gson.toJson(argument));
|
||||||
|
params.setContentType(new BasicHeader(HTTP.CONTENT_TYPE, "application/json"));
|
||||||
|
request.setEntity(params);
|
||||||
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
|
System.out.println("Error executing ApiPostCall(Object): \n" + exception.getMessage());
|
||||||
|
|
||||||
|
for (StackTraceElement trace : exception.getStackTrace())
|
||||||
|
{
|
||||||
|
System.out.println(trace);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
System.out.println(execute(request));
|
||||||
|
}
|
||||||
|
|
||||||
|
public <T> T Execute(Class<T> returnClass)
|
||||||
|
{
|
||||||
|
return Execute(returnClass, (Object)null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public <T> T Execute(Type returnType, Object argument)
|
||||||
|
{
|
||||||
|
Gson gson = new Gson();
|
||||||
|
HttpPost request = new HttpPost(ApiUrl + DomainId + Category + _action);
|
||||||
|
System.out.println(request.getURI().toString());
|
||||||
|
try
|
||||||
|
{
|
||||||
|
StringEntity params = new StringEntity(gson.toJson(argument));
|
||||||
|
params.setContentType(new BasicHeader(HTTP.CONTENT_TYPE, "application/json"));
|
||||||
|
request.setEntity(params);
|
||||||
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
|
System.out.println("Error executing ApiPostCall(Type, Object): \n" + exception.getMessage());
|
||||||
|
|
||||||
|
for (StackTraceElement trace : exception.getStackTrace())
|
||||||
|
{
|
||||||
|
System.out.println(trace);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
String response = execute(request);
|
||||||
|
System.out.println(response);
|
||||||
|
return new Gson().fromJson(response, returnType);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,80 @@
|
|||||||
|
package mineplex.staffServer.helpdesk.repository;
|
||||||
|
|
||||||
|
import java.lang.reflect.Type;
|
||||||
|
|
||||||
|
import org.apache.http.client.methods.HttpPost;
|
||||||
|
import org.apache.http.client.methods.HttpPut;
|
||||||
|
import org.apache.http.entity.StringEntity;
|
||||||
|
import org.apache.http.message.BasicHeader;
|
||||||
|
import org.apache.http.protocol.HTTP;
|
||||||
|
|
||||||
|
import com.google.gson.Gson;
|
||||||
|
|
||||||
|
public class ApiPutCall extends HelpDeskApiCallBase
|
||||||
|
{
|
||||||
|
private String _action;
|
||||||
|
|
||||||
|
public ApiPutCall(String apiUrl, int domainId, String category, String action)
|
||||||
|
{
|
||||||
|
super(apiUrl, domainId, category);
|
||||||
|
|
||||||
|
_action = action;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Execute(Object argument)
|
||||||
|
{
|
||||||
|
Gson gson = new Gson();
|
||||||
|
HttpPut request = new HttpPut(ApiUrl + DomainId + Category + _action);
|
||||||
|
|
||||||
|
System.out.println(request.getURI().toString());
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
StringEntity params = new StringEntity(gson.toJson(argument));
|
||||||
|
params.setContentType(new BasicHeader(HTTP.CONTENT_TYPE, "application/json"));
|
||||||
|
request.setEntity(params);
|
||||||
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
|
System.out.println("Error executing ApiPutCall(Object): \n" + exception.getMessage());
|
||||||
|
|
||||||
|
for (StackTraceElement trace : exception.getStackTrace())
|
||||||
|
{
|
||||||
|
System.out.println(trace);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
System.out.println(execute(request));
|
||||||
|
}
|
||||||
|
|
||||||
|
public <T> T Execute(Class<T> returnClass)
|
||||||
|
{
|
||||||
|
return Execute(returnClass, (Object)null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public <T> T Execute(Type returnType, Object argument)
|
||||||
|
{
|
||||||
|
Gson gson = new Gson();
|
||||||
|
HttpPut request = new HttpPut(ApiUrl + DomainId + Category + _action);
|
||||||
|
System.out.println(request.getURI().toString());
|
||||||
|
try
|
||||||
|
{
|
||||||
|
StringEntity params = new StringEntity(gson.toJson(argument));
|
||||||
|
params.setContentType(new BasicHeader(HTTP.CONTENT_TYPE, "application/json"));
|
||||||
|
request.setEntity(params);
|
||||||
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
|
System.out.println("Error executing ApiPutCall(Type, Object): \n" + exception.getMessage());
|
||||||
|
|
||||||
|
for (StackTraceElement trace : exception.getStackTrace())
|
||||||
|
{
|
||||||
|
System.out.println(trace);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
String response = execute(request);
|
||||||
|
System.out.println(response);
|
||||||
|
return new Gson().fromJson(response, returnType);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,128 @@
|
|||||||
|
package mineplex.staffServer.helpdesk.repository;
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Calendar;
|
||||||
|
import java.util.Locale;
|
||||||
|
import java.util.TimeZone;
|
||||||
|
|
||||||
|
import javax.crypto.Mac;
|
||||||
|
import javax.crypto.spec.SecretKeySpec;
|
||||||
|
|
||||||
|
import org.apache.commons.codec.binary.Hex;
|
||||||
|
import org.apache.http.HttpResponse;
|
||||||
|
import org.apache.http.client.HttpClient;
|
||||||
|
import org.apache.http.client.methods.HttpRequestBase;
|
||||||
|
import org.apache.http.conn.scheme.PlainSocketFactory;
|
||||||
|
import org.apache.http.conn.scheme.Scheme;
|
||||||
|
import org.apache.http.conn.scheme.SchemeRegistry;
|
||||||
|
import org.apache.http.impl.client.DefaultHttpClient;
|
||||||
|
import org.apache.http.impl.conn.PoolingClientConnectionManager;
|
||||||
|
|
||||||
|
public abstract class HelpDeskApiCallBase
|
||||||
|
{
|
||||||
|
protected String ApiUrl = "https://mineplex.jitbit.com/helpdesk/api";
|
||||||
|
protected int DomainId = 962728;
|
||||||
|
protected String Category = "";
|
||||||
|
|
||||||
|
public HelpDeskApiCallBase(String apiUrl, int domainId, String category)
|
||||||
|
{
|
||||||
|
ApiUrl = apiUrl;
|
||||||
|
DomainId = domainId;
|
||||||
|
Category = category;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected String execute(HttpRequestBase request)
|
||||||
|
{
|
||||||
|
SchemeRegistry schemeRegistry = new SchemeRegistry();
|
||||||
|
schemeRegistry.register(new Scheme("https", 80, PlainSocketFactory.getSocketFactory()));
|
||||||
|
|
||||||
|
PoolingClientConnectionManager connectionManager = new PoolingClientConnectionManager(schemeRegistry);
|
||||||
|
connectionManager.setMaxTotal(200);
|
||||||
|
connectionManager.setDefaultMaxPerRoute(20);
|
||||||
|
|
||||||
|
HttpClient httpClient = new DefaultHttpClient(connectionManager);
|
||||||
|
InputStream in = null;
|
||||||
|
String response = "";
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
HttpResponse httpResponse = httpClient.execute(request);
|
||||||
|
|
||||||
|
if (httpResponse != null)
|
||||||
|
{
|
||||||
|
in = httpResponse.getEntity().getContent();
|
||||||
|
response = convertStreamToString(in);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
System.out.println("HelpDeskApiCall Error:\n" + ex.getMessage());
|
||||||
|
|
||||||
|
for (StackTraceElement trace : ex.getStackTrace())
|
||||||
|
{
|
||||||
|
System.out.println(trace);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
httpClient.getConnectionManager().shutdown();
|
||||||
|
|
||||||
|
if (in != null)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
in.close();
|
||||||
|
}
|
||||||
|
catch (IOException e)
|
||||||
|
{
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected String getServerTime()
|
||||||
|
{
|
||||||
|
Calendar calendar = Calendar.getInstance();
|
||||||
|
SimpleDateFormat dateFormat = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss z", Locale.US);
|
||||||
|
dateFormat.setTimeZone(TimeZone.getTimeZone("GMT"));
|
||||||
|
return dateFormat.format(calendar.getTime());
|
||||||
|
}
|
||||||
|
|
||||||
|
protected String convertStreamToString(InputStream is)
|
||||||
|
{
|
||||||
|
BufferedReader reader = new BufferedReader(new InputStreamReader(is));
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
|
||||||
|
String line = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
while ((line = reader.readLine()) != null)
|
||||||
|
{
|
||||||
|
sb.append(line + "\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (IOException e)
|
||||||
|
{
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
is.close();
|
||||||
|
}
|
||||||
|
catch (IOException e)
|
||||||
|
{
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return sb.toString();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,6 @@
|
|||||||
|
package mineplex.staffServer.helpdesk.repository;
|
||||||
|
|
||||||
|
public class HelpDeskRepository
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
@ -7,7 +7,6 @@ import java.io.File;
|
|||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.FileWriter;
|
import java.io.FileWriter;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
import java.util.*;
|
|
||||||
|
|
||||||
import mineplex.core.account.CoreClientManager;
|
import mineplex.core.account.CoreClientManager;
|
||||||
import mineplex.core.antihack.AntiHack;
|
import mineplex.core.antihack.AntiHack;
|
||||||
@ -44,8 +43,8 @@ import mineplex.core.updater.Updater;
|
|||||||
import mineplex.minecraft.game.core.combat.CombatManager;
|
import mineplex.minecraft.game.core.combat.CombatManager;
|
||||||
import mineplex.minecraft.game.core.damage.DamageManager;
|
import mineplex.minecraft.game.core.damage.DamageManager;
|
||||||
import nautilus.game.arcade.game.GameServerConfig;
|
import nautilus.game.arcade.game.GameServerConfig;
|
||||||
|
|
||||||
import net.minecraft.server.v1_7_R4.*;
|
import net.minecraft.server.v1_7_R4.*;
|
||||||
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
@ -127,6 +126,8 @@ public class Arcade extends JavaPlugin
|
|||||||
|
|
||||||
//Updates
|
//Updates
|
||||||
getServer().getScheduler().scheduleSyncRepeatingTask(this, new Updater(this), 1, 1);
|
getServer().getScheduler().scheduleSyncRepeatingTask(this, new Updater(this), 1, 1);
|
||||||
|
|
||||||
|
MinecraftServer.getServer().getPropertyManager().setProperty("debug", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@ package nautilus.game.arcade;
|
|||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
|
||||||
import nautilus.game.arcade.addons.*;
|
import nautilus.game.arcade.addons.*;
|
||||||
@ -77,6 +78,7 @@ import mineplex.core.preferences.PreferencesManager;
|
|||||||
import mineplex.core.projectile.ProjectileManager;
|
import mineplex.core.projectile.ProjectileManager;
|
||||||
import mineplex.core.stats.StatsManager;
|
import mineplex.core.stats.StatsManager;
|
||||||
import mineplex.core.status.ServerStatusManager;
|
import mineplex.core.status.ServerStatusManager;
|
||||||
|
import mineplex.core.task.TaskManager;
|
||||||
import mineplex.core.teleport.Teleport;
|
import mineplex.core.teleport.Teleport;
|
||||||
import mineplex.core.timing.TimingManager;
|
import mineplex.core.timing.TimingManager;
|
||||||
|
|
||||||
@ -107,6 +109,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
|||||||
private GameGemManager _gameGemManager;
|
private GameGemManager _gameGemManager;
|
||||||
private GameManager _gameManager;
|
private GameManager _gameManager;
|
||||||
private GameLobbyManager _gameLobbyManager;
|
private GameLobbyManager _gameLobbyManager;
|
||||||
|
private GamePlayerManager _gamePlayerManager;
|
||||||
private GameWorldManager _gameWorldManager;
|
private GameWorldManager _gameWorldManager;
|
||||||
private ServerStatusManager _serverStatusManager;
|
private ServerStatusManager _serverStatusManager;
|
||||||
private InventoryManager _inventoryManager;
|
private InventoryManager _inventoryManager;
|
||||||
@ -118,6 +121,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
|||||||
private SkillFactory _skillFactory;
|
private SkillFactory _skillFactory;
|
||||||
private ClassShopManager _classShopManager;
|
private ClassShopManager _classShopManager;
|
||||||
private ClassCombatShop _classShop;
|
private ClassCombatShop _classShop;
|
||||||
|
private TaskManager _taskManager;
|
||||||
|
|
||||||
private EloManager _eloManager;
|
private EloManager _eloManager;
|
||||||
|
|
||||||
@ -130,6 +134,8 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
|||||||
// Games
|
// Games
|
||||||
private Game _game;
|
private Game _game;
|
||||||
|
|
||||||
|
private HashMap<String, String> _tournamentTeam = new HashMap<String, String>();
|
||||||
|
|
||||||
public ArcadeManager(Arcade plugin, ServerStatusManager serverStatusManager, GameServerConfig serverConfig,
|
public ArcadeManager(Arcade plugin, ServerStatusManager serverStatusManager, GameServerConfig serverConfig,
|
||||||
CoreClientManager clientManager, DonationManager donationManager, DamageManager damageManager,
|
CoreClientManager clientManager, DonationManager donationManager, DamageManager damageManager,
|
||||||
DisguiseManager disguiseManager, Creature creature, Teleport teleport, Blood blood, AntiStack antistack,
|
DisguiseManager disguiseManager, Creature creature, Teleport teleport, Blood blood, AntiStack antistack,
|
||||||
@ -204,6 +210,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
|||||||
}
|
}
|
||||||
|
|
||||||
_statsManager = new StatsManager(plugin);
|
_statsManager = new StatsManager(plugin);
|
||||||
|
_taskManager = new TaskManager(plugin, webAddress);
|
||||||
_achievementManager = new AchievementManager(_statsManager);
|
_achievementManager = new AchievementManager(_statsManager);
|
||||||
_inventoryManager = inventoryManager;
|
_inventoryManager = inventoryManager;
|
||||||
_cosmeticManager = cosmeticManager;
|
_cosmeticManager = cosmeticManager;
|
||||||
@ -222,7 +229,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
|||||||
_gameManager = new GameManager(this);
|
_gameManager = new GameManager(this);
|
||||||
_gameLobbyManager = new GameLobbyManager(this, packetHandler);
|
_gameLobbyManager = new GameLobbyManager(this, packetHandler);
|
||||||
new GameFlagManager(this);
|
new GameFlagManager(this);
|
||||||
new GamePlayerManager(this);
|
_gamePlayerManager = new GamePlayerManager(this);
|
||||||
new GameAchievementManager(this);
|
new GameAchievementManager(this);
|
||||||
_gameWorldManager = new GameWorldManager(this);
|
_gameWorldManager = new GameWorldManager(this);
|
||||||
new MiscManager(this);
|
new MiscManager(this);
|
||||||
@ -346,6 +353,11 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
|||||||
return _gameLobbyManager;
|
return _gameLobbyManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public TaskManager GetTaskManager()
|
||||||
|
{
|
||||||
|
return _taskManager;
|
||||||
|
}
|
||||||
|
|
||||||
public ArcadeShop GetShop()
|
public ArcadeShop GetShop()
|
||||||
{
|
{
|
||||||
return _arcadeShop;
|
return _arcadeShop;
|
||||||
@ -488,6 +500,8 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
|||||||
event.setQuitMessage(F.sys("Quit", GetColor(event.getPlayer()) + event.getPlayer().getName()));
|
event.setQuitMessage(F.sys("Quit", GetColor(event.getPlayer()) + event.getPlayer().getName()));
|
||||||
else
|
else
|
||||||
event.setQuitMessage(null);
|
event.setQuitMessage(null);
|
||||||
|
|
||||||
|
_tournamentTeam.remove(event.getPlayer().getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
public Game GetGame()
|
public Game GetGame()
|
||||||
@ -832,4 +846,37 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setTournamentTeam(Player player, GameTeam team)
|
||||||
|
{
|
||||||
|
_tournamentTeam.put(player.getName(), team.GetName());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void rejoinTournamentTeam(Player player)
|
||||||
|
{
|
||||||
|
if (_game == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (!_tournamentTeam.containsKey(player.getName()))
|
||||||
|
return;
|
||||||
|
|
||||||
|
GameTeam curPref = _game.GetTeamPreference(player);
|
||||||
|
if (curPref != null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
GameTeam curTeam = _game.GetTeam(player);
|
||||||
|
if (curTeam != null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
String teamName = _tournamentTeam.get(player.getName());
|
||||||
|
|
||||||
|
for (GameTeam team : _game.GetTeamList())
|
||||||
|
{
|
||||||
|
if (team.GetName().equalsIgnoreCase(teamName))
|
||||||
|
{
|
||||||
|
_gamePlayerManager.AddTeamPreference(_game, player, team);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -459,6 +459,10 @@ public abstract class Game implements Listener
|
|||||||
|
|
||||||
//Lobby Scoreboard
|
//Lobby Scoreboard
|
||||||
Manager.GetLobby().AddPlayerToScoreboards(player, team.GetName().toUpperCase());
|
Manager.GetLobby().AddPlayerToScoreboards(player, team.GetName().toUpperCase());
|
||||||
|
|
||||||
|
//Save Tournament Team
|
||||||
|
if (Manager.IsTournamentServer())
|
||||||
|
Manager.setTournamentTeam(player, team);
|
||||||
}
|
}
|
||||||
|
|
||||||
public GameTeam ChooseTeam(Player player)
|
public GameTeam ChooseTeam(Player player)
|
||||||
|
@ -6,6 +6,7 @@ import mineplex.core.achievement.Achievement;
|
|||||||
import mineplex.core.achievement.AchievementLog;
|
import mineplex.core.achievement.AchievementLog;
|
||||||
import mineplex.core.achievement.AchivementData;
|
import mineplex.core.achievement.AchivementData;
|
||||||
import mineplex.core.common.util.C;
|
import mineplex.core.common.util.C;
|
||||||
|
import mineplex.core.common.util.Callback;
|
||||||
import mineplex.core.common.util.F;
|
import mineplex.core.common.util.F;
|
||||||
import mineplex.core.common.util.NautHashMap;
|
import mineplex.core.common.util.NautHashMap;
|
||||||
import mineplex.core.common.util.UtilPlayer;
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
@ -88,7 +89,28 @@ public class GameAchievementManager implements Listener
|
|||||||
String nameLevel = F.elem(C.cGold + C.Bold + type.getName() + " " + ChatColor.RESET + C.cYellow + data.getLevel() + C.cGold + "/" + C.cYellow + type.getMaxLevel());
|
String nameLevel = F.elem(C.cGold + C.Bold + type.getName() + " " + ChatColor.RESET + C.cYellow + data.getLevel() + C.cGold + "/" + C.cYellow + type.getMaxLevel());
|
||||||
String progress = F.elem(C.cGreen + "+" + log.get(type).Amount);
|
String progress = F.elem(C.cGreen + "+" + log.get(type).Amount);
|
||||||
|
|
||||||
if (log.get(type).LevelUp)
|
//Completed Achievement
|
||||||
|
if (data.getLevel() == type.getMaxLevel())
|
||||||
|
{
|
||||||
|
//Finishing for the first time
|
||||||
|
if (!Manager.GetTaskManager().hasCompletedTask(player, type.getName()))
|
||||||
|
{
|
||||||
|
UtilPlayer.message(player, nameLevel + " " + progress +
|
||||||
|
" " + F.elem(C.cAqua + C.Bold + "COMPLETE!"));
|
||||||
|
|
||||||
|
player.playSound(player.getLocation(), Sound.LEVEL_UP, 1f, 1f);
|
||||||
|
|
||||||
|
//Set Completed
|
||||||
|
Manager.GetTaskManager().completedTask(player, type.getName());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
UtilPlayer.message(player, nameLevel + " " + progress +
|
||||||
|
" " + F.elem(C.cYellow + C.Bold + "Complete"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//Multi-Level Achievements
|
||||||
|
else if (log.get(type).LevelUp)
|
||||||
{
|
{
|
||||||
UtilPlayer.message(player, nameLevel + " " + progress +
|
UtilPlayer.message(player, nameLevel + " " + progress +
|
||||||
" " + F.elem(C.cAqua + C.Bold + "LEVEL UP!"));
|
" " + F.elem(C.cAqua + C.Bold + "LEVEL UP!"));
|
||||||
|
@ -911,13 +911,9 @@ public class GameFlagManager implements Listener
|
|||||||
Game game = Manager.GetGame();
|
Game game = Manager.GetGame();
|
||||||
if (game == null) return;
|
if (game == null) return;
|
||||||
|
|
||||||
if (event.getCause() != IgniteCause.SPREAD)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (game.WorldFireSpread)
|
if (game.WorldFireSpread)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (event.getBlock().getType() == Material.FIRE)
|
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -485,6 +485,22 @@ public class GameManager implements Listener
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void TeamTournamentAutoJoin(UpdateEvent event)
|
||||||
|
{
|
||||||
|
if (event.getType() != UpdateType.FAST)
|
||||||
|
return;
|
||||||
|
|
||||||
|
Game game = Manager.GetGame();
|
||||||
|
if (game == null) return;
|
||||||
|
|
||||||
|
if (game.GetState() != GameState.Recruit)
|
||||||
|
return;
|
||||||
|
|
||||||
|
for (Player player : UtilServer.getPlayers())
|
||||||
|
Manager.rejoinTournamentTeam(player);
|
||||||
|
}
|
||||||
|
|
||||||
public boolean PlayerAdd(Game game, Player player, GameTeam team)
|
public boolean PlayerAdd(Game game, Player player, GameTeam team)
|
||||||
{
|
{
|
||||||
if (team == null)
|
if (team == null)
|
||||||
|
@ -20,6 +20,8 @@ public class DamageDealtStatTracker extends StatTracker<Game>
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
getGame().AddStat(damager, "Damage Dealt", (int) Math.round(event.GetDamage()), false, false);
|
getGame().AddStat(damager, "Damage Dealt", (int) Math.round(event.GetDamage()), false, false);
|
||||||
|
|
||||||
|
if (getGame() != null && getGame().GetKit(damager) != null)
|
||||||
getGame().AddStat(damager, getGame().GetKit(damager).GetName() + " Damage Dealt", (int) Math.round(event.GetDamage()), false, false);
|
getGame().AddStat(damager, getGame().GetKit(damager).GetName() + " Damage Dealt", (int) Math.round(event.GetDamage()), false, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,8 @@ public class DamageTakenStatTracker extends StatTracker<Game>
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
getGame().AddStat(damagee, "Damage Taken", (int) Math.round(event.GetDamage()), false, false);
|
getGame().AddStat(damagee, "Damage Taken", (int) Math.round(event.GetDamage()), false, false);
|
||||||
|
|
||||||
|
if (getGame() != null && getGame().GetKit(damagee) != null)
|
||||||
getGame().AddStat(damagee, getGame().GetKit(damagee).GetName() + " Damage Taken", (int) Math.round(event.GetDamage()), false, false);
|
getGame().AddStat(damagee, getGame().GetKit(damagee).GetName() + " Damage Taken", (int) Math.round(event.GetDamage()), false, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user