Merge branches 'develop' and 'feature/report-v2' of github.com:Mineplex-LLC/Minecraft-PC into feature/report-v2
This commit is contained in:
commit
cb555a41ab
@ -45,21 +45,25 @@ public class Pair<L, R> implements Serializable {
|
||||
return getLeft().toString() + ":" + getRight().toString();
|
||||
}
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj)
|
||||
public boolean equals(Object o)
|
||||
{
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (!(obj instanceof Pair))
|
||||
return false;
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
|
||||
Pair localPair = (Pair) obj;
|
||||
Pair<?, ?> pair = (Pair<?, ?>) o;
|
||||
|
||||
if (getLeft() != null ? !getLeft().equals(localPair.getLeft()) : localPair.getLeft() != null)
|
||||
return false;
|
||||
if (getRight() != null ? !getRight().equals(localPair.getRight()) : localPair.getRight() != null)
|
||||
return false;
|
||||
return true;
|
||||
if (left != null ? !left.equals(pair.left) : pair.left != null) return false;
|
||||
return right != null ? right.equals(pair.right) : pair.right == null;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
int result = left != null ? left.hashCode() : 0;
|
||||
result = 31 * result + (right != null ? right.hashCode() : 0);
|
||||
return result;
|
||||
}
|
||||
}
|
@ -173,7 +173,17 @@ public class UtilInv
|
||||
return getItems(player, true, true, true);
|
||||
}
|
||||
|
||||
public static ArrayList<ItemStack> getItemsUncloned(Player player)
|
||||
{
|
||||
return getItems(player, true, true, true, false);
|
||||
}
|
||||
|
||||
public static ArrayList<ItemStack> getItems(Player player, boolean getArmor, boolean getCursor, boolean getCrafting)
|
||||
{
|
||||
return getItems(player, getArmor, getCursor, getCrafting, true);
|
||||
}
|
||||
|
||||
public static ArrayList<ItemStack> getItems(Player player, boolean getArmor, boolean getCursor, boolean getCrafting, boolean clone)
|
||||
{
|
||||
ArrayList<ItemStack> items = new ArrayList<ItemStack>();
|
||||
PlayerInventory inv = player.getInventory();
|
||||
@ -182,7 +192,7 @@ public class UtilInv
|
||||
{
|
||||
if (item != null && item.getType() != Material.AIR)
|
||||
{
|
||||
items.add(item.clone());
|
||||
items.add(clone ? item.clone() : item);
|
||||
}
|
||||
}
|
||||
|
||||
@ -192,7 +202,7 @@ public class UtilInv
|
||||
{
|
||||
if (item != null && item.getType() != Material.AIR)
|
||||
{
|
||||
items.add(item.clone());
|
||||
items.add(clone ? item.clone() : item);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -202,7 +212,7 @@ public class UtilInv
|
||||
ItemStack cursorItem = player.getItemOnCursor();
|
||||
|
||||
if (cursorItem != null && cursorItem.getType() != Material.AIR)
|
||||
items.add(cursorItem.clone());
|
||||
items.add(clone ? cursorItem.clone() : cursorItem);
|
||||
}
|
||||
|
||||
if (getCrafting)
|
||||
@ -215,7 +225,7 @@ public class UtilInv
|
||||
{
|
||||
if (item != null && item.getType() != Material.AIR)
|
||||
{
|
||||
items.add(item.clone());
|
||||
items.add(clone ? item.clone() : item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -8,51 +8,51 @@ import org.bukkit.inventory.ItemStack;
|
||||
public enum CountryFlag
|
||||
{
|
||||
|
||||
Brazil(DyeColor.GREEN, new Pattern(DyeColor.YELLOW, PatternType.RHOMBUS_MIDDLE), new Pattern(DyeColor.BLUE, PatternType.CIRCLE_MIDDLE)),
|
||||
Usa(DyeColor.RED, new Pattern(DyeColor.WHITE, PatternType.STRIPE_SMALL), new Pattern(DyeColor.BLUE, PatternType.SQUARE_TOP_RIGHT)),
|
||||
Canada(DyeColor.WHITE, new Pattern(DyeColor.RED, PatternType.STRIPE_TOP), new Pattern(DyeColor.RED, PatternType.STRIPE_BOTTOM),
|
||||
BRAZIL(DyeColor.GREEN, new Pattern(DyeColor.YELLOW, PatternType.RHOMBUS_MIDDLE), new Pattern(DyeColor.BLUE, PatternType.CIRCLE_MIDDLE)),
|
||||
USA(DyeColor.RED, new Pattern(DyeColor.WHITE, PatternType.STRIPE_SMALL), new Pattern(DyeColor.BLUE, PatternType.SQUARE_TOP_RIGHT)),
|
||||
CANADA(DyeColor.WHITE, new Pattern(DyeColor.RED, PatternType.STRIPE_TOP), new Pattern(DyeColor.RED, PatternType.STRIPE_BOTTOM),
|
||||
new Pattern(DyeColor.RED, PatternType.CIRCLE_MIDDLE)),
|
||||
Uk(DyeColor.BLUE, new Pattern(DyeColor.WHITE, PatternType.STRIPE_DOWNLEFT), new Pattern(DyeColor.WHITE, PatternType.STRIPE_DOWNRIGHT),
|
||||
UK(DyeColor.BLUE, new Pattern(DyeColor.WHITE, PatternType.STRIPE_DOWNLEFT), new Pattern(DyeColor.WHITE, PatternType.STRIPE_DOWNRIGHT),
|
||||
new Pattern(DyeColor.RED, PatternType.STRAIGHT_CROSS), new Pattern(DyeColor.RED, PatternType.CROSS)),
|
||||
Ireland(DyeColor.WHITE, new Pattern(DyeColor.LIME, PatternType.STRIPE_TOP), new Pattern(DyeColor.ORANGE, PatternType.STRIPE_BOTTOM)),
|
||||
Spain(DyeColor.YELLOW, new Pattern(DyeColor.RED, PatternType.STRIPE_LEFT), new Pattern(DyeColor.RED, PatternType.STRIPE_RIGHT)),
|
||||
Japan(DyeColor.WHITE, new Pattern(DyeColor.RED, PatternType.CIRCLE_MIDDLE)),
|
||||
South_Sudan(DyeColor.WHITE, new Pattern(DyeColor.RED, PatternType.STRIPE_LEFT), new Pattern(DyeColor.BLACK, PatternType.STRIPE_RIGHT),
|
||||
IRELAND(DyeColor.WHITE, new Pattern(DyeColor.LIME, PatternType.STRIPE_TOP), new Pattern(DyeColor.ORANGE, PatternType.STRIPE_BOTTOM)),
|
||||
SPAIN(DyeColor.YELLOW, new Pattern(DyeColor.RED, PatternType.STRIPE_LEFT), new Pattern(DyeColor.RED, PatternType.STRIPE_RIGHT)),
|
||||
JAPAN(DyeColor.WHITE, new Pattern(DyeColor.RED, PatternType.CIRCLE_MIDDLE)),
|
||||
SOUTH_SUDAN(DyeColor.WHITE, new Pattern(DyeColor.RED, PatternType.STRIPE_LEFT), new Pattern(DyeColor.BLACK, PatternType.STRIPE_RIGHT),
|
||||
new Pattern(DyeColor.GREEN, PatternType.TRIANGLE_BOTTOM)),
|
||||
Jamaica(DyeColor.GREEN, new Pattern(DyeColor.BLACK, PatternType.TRIANGLE_TOP), new Pattern(DyeColor.BLACK, PatternType.TRIANGLES_BOTTOM),
|
||||
JAMAICA(DyeColor.GREEN, new Pattern(DyeColor.BLACK, PatternType.TRIANGLE_TOP), new Pattern(DyeColor.BLACK, PatternType.TRIANGLES_BOTTOM),
|
||||
new Pattern(DyeColor.YELLOW, PatternType.CROSS)),
|
||||
Italy(DyeColor.WHITE, new Pattern(DyeColor.RED, PatternType.STRIPE_TOP), new Pattern(DyeColor.GREEN, PatternType.STRIPE_BOTTOM)),
|
||||
Senegal(DyeColor.YELLOW, new Pattern(DyeColor.RED, PatternType.STRIPE_TOP), new Pattern(DyeColor.GREEN, PatternType.STRIPE_BOTTOM),
|
||||
ITALY(DyeColor.WHITE, new Pattern(DyeColor.RED, PatternType.STRIPE_TOP), new Pattern(DyeColor.GREEN, PatternType.STRIPE_BOTTOM)),
|
||||
SENEGAL(DyeColor.YELLOW, new Pattern(DyeColor.RED, PatternType.STRIPE_TOP), new Pattern(DyeColor.GREEN, PatternType.STRIPE_BOTTOM),
|
||||
new Pattern(DyeColor.GREEN, PatternType.CIRCLE_MIDDLE)),
|
||||
France(DyeColor.WHITE, new Pattern(DyeColor.RED, PatternType.STRIPE_TOP), new Pattern(DyeColor.BLUE, PatternType.STRIPE_BOTTOM)),
|
||||
India(DyeColor.WHITE, new Pattern(DyeColor.ORANGE, PatternType.STRIPE_LEFT), new Pattern(DyeColor.GREEN, PatternType.STRIPE_RIGHT),
|
||||
FRANCE(DyeColor.WHITE, new Pattern(DyeColor.RED, PatternType.STRIPE_TOP), new Pattern(DyeColor.BLUE, PatternType.STRIPE_BOTTOM)),
|
||||
INDIA(DyeColor.WHITE, new Pattern(DyeColor.ORANGE, PatternType.STRIPE_LEFT), new Pattern(DyeColor.GREEN, PatternType.STRIPE_RIGHT),
|
||||
new Pattern(DyeColor.BLUE, PatternType.CIRCLE_MIDDLE)),
|
||||
Belgium(DyeColor.YELLOW, new Pattern(DyeColor.BLACK, PatternType.STRIPE_BOTTOM), new Pattern(DyeColor.RED, PatternType.STRIPE_TOP)),
|
||||
England(DyeColor.WHITE, new Pattern(DyeColor.RED, PatternType.STRAIGHT_CROSS)),
|
||||
Austria(DyeColor.RED, new Pattern(DyeColor.WHITE, PatternType.STRIPE_CENTER)),
|
||||
Armenia(DyeColor.RED, new Pattern(DyeColor.BLUE, PatternType.STRIPE_CENTER), new Pattern(DyeColor.ORANGE, PatternType.STRIPE_RIGHT)),
|
||||
Argentina(DyeColor.LIGHT_BLUE, new Pattern(DyeColor.WHITE, PatternType.STRIPE_CENTER), new Pattern(DyeColor.YELLOW, PatternType.CIRCLE_MIDDLE)),
|
||||
Greece(DyeColor.LIGHT_BLUE, new Pattern(DyeColor.WHITE, PatternType.STRIPE_SMALL), new Pattern(DyeColor.LIGHT_BLUE, PatternType.SQUARE_BOTTOM_LEFT)),
|
||||
Czech_Republic(DyeColor.WHITE, new Pattern(DyeColor.RED, PatternType.HALF_VERTICAL_MIRROR), new Pattern(DyeColor.BLUE, PatternType.TRIANGLE_BOTTOM)),
|
||||
Romania(DyeColor.YELLOW, new Pattern(DyeColor.BLUE, PatternType.STRIPE_BOTTOM), new Pattern(DyeColor.RED, PatternType.STRIPE_TOP)),
|
||||
Honduras(DyeColor.WHITE, new Pattern(DyeColor.BLUE, PatternType.STRIPE_LEFT), new Pattern(DyeColor.BLUE, PatternType.STRIPE_RIGHT)),
|
||||
Algeria(DyeColor.WHITE, new Pattern(DyeColor.LIME, PatternType.HALF_HORIZONTAL_MIRROR), new Pattern(DyeColor.RED, PatternType.CIRCLE_MIDDLE)),
|
||||
Portugal(DyeColor.RED, new Pattern(DyeColor.GREEN, PatternType.STRIPE_TOP), new Pattern(DyeColor.YELLOW, PatternType.CIRCLE_MIDDLE)),
|
||||
Bahrain(DyeColor.RED, new Pattern(DyeColor.WHITE, PatternType.TRIANGLES_BOTTOM)),
|
||||
Germany(DyeColor.RED, new Pattern(DyeColor.BLACK, PatternType.STRIPE_LEFT), new Pattern(DyeColor.YELLOW, PatternType.STRIPE_RIGHT)),
|
||||
Gabon(DyeColor.YELLOW, new Pattern(DyeColor.BLUE, PatternType.STRIPE_RIGHT), new Pattern(DyeColor.LIME, PatternType.STRIPE_LEFT)),
|
||||
Scotland(DyeColor.BLUE, new Pattern(DyeColor.WHITE, PatternType.CROSS)),
|
||||
Peru(DyeColor.WHITE, new Pattern(DyeColor.RED, PatternType.STRIPE_TOP), new Pattern(DyeColor.RED, PatternType.STRIPE_BOTTOM)),
|
||||
Tanzania(DyeColor.LIME, new Pattern(DyeColor.LIGHT_BLUE, PatternType.DIAGONAL_RIGHT), new Pattern(DyeColor.BLACK, PatternType.STRIPE_DOWNLEFT)),
|
||||
Morocco(DyeColor.RED, new Pattern(DyeColor.GREEN, PatternType.CIRCLE_MIDDLE)),
|
||||
Solomon_Islands(DyeColor.GREEN, new Pattern(DyeColor.BLUE, PatternType.DIAGONAL_LEFT_MIRROR), new Pattern(DyeColor.YELLOW, PatternType.STRIPE_DOWNRIGHT)),
|
||||
Switzerland(DyeColor.RED, new Pattern(DyeColor.WHITE, PatternType.STRAIGHT_CROSS), new Pattern(DyeColor.RED, PatternType.STRIPE_BOTTOM),
|
||||
BELGIUM(DyeColor.YELLOW, new Pattern(DyeColor.BLACK, PatternType.STRIPE_BOTTOM), new Pattern(DyeColor.RED, PatternType.STRIPE_TOP)),
|
||||
ENGLAND(DyeColor.WHITE, new Pattern(DyeColor.RED, PatternType.STRAIGHT_CROSS)),
|
||||
AUSTRIA(DyeColor.RED, new Pattern(DyeColor.WHITE, PatternType.STRIPE_CENTER)),
|
||||
ARMENIA(DyeColor.RED, new Pattern(DyeColor.BLUE, PatternType.STRIPE_CENTER), new Pattern(DyeColor.ORANGE, PatternType.STRIPE_RIGHT)),
|
||||
ARGENTINA(DyeColor.LIGHT_BLUE, new Pattern(DyeColor.WHITE, PatternType.STRIPE_CENTER), new Pattern(DyeColor.YELLOW, PatternType.CIRCLE_MIDDLE)),
|
||||
GREECE(DyeColor.LIGHT_BLUE, new Pattern(DyeColor.WHITE, PatternType.STRIPE_SMALL), new Pattern(DyeColor.LIGHT_BLUE, PatternType.SQUARE_BOTTOM_LEFT)),
|
||||
CZECH_REPUBLIC(DyeColor.WHITE, new Pattern(DyeColor.RED, PatternType.HALF_VERTICAL_MIRROR), new Pattern(DyeColor.BLUE, PatternType.TRIANGLE_BOTTOM)),
|
||||
ROMANIA(DyeColor.YELLOW, new Pattern(DyeColor.BLUE, PatternType.STRIPE_BOTTOM), new Pattern(DyeColor.RED, PatternType.STRIPE_TOP)),
|
||||
HONDURAS(DyeColor.WHITE, new Pattern(DyeColor.BLUE, PatternType.STRIPE_LEFT), new Pattern(DyeColor.BLUE, PatternType.STRIPE_RIGHT)),
|
||||
ALGERIA(DyeColor.WHITE, new Pattern(DyeColor.LIME, PatternType.HALF_HORIZONTAL_MIRROR), new Pattern(DyeColor.RED, PatternType.CIRCLE_MIDDLE)),
|
||||
PORTUGAL(DyeColor.RED, new Pattern(DyeColor.GREEN, PatternType.STRIPE_TOP), new Pattern(DyeColor.YELLOW, PatternType.CIRCLE_MIDDLE)),
|
||||
BAHRAIN(DyeColor.RED, new Pattern(DyeColor.WHITE, PatternType.TRIANGLES_BOTTOM)),
|
||||
GERMANY(DyeColor.RED, new Pattern(DyeColor.BLACK, PatternType.STRIPE_LEFT), new Pattern(DyeColor.YELLOW, PatternType.STRIPE_RIGHT)),
|
||||
GABON(DyeColor.YELLOW, new Pattern(DyeColor.BLUE, PatternType.STRIPE_RIGHT), new Pattern(DyeColor.LIME, PatternType.STRIPE_LEFT)),
|
||||
SCOTLAND(DyeColor.BLUE, new Pattern(DyeColor.WHITE, PatternType.CROSS)),
|
||||
PERU(DyeColor.WHITE, new Pattern(DyeColor.RED, PatternType.STRIPE_TOP), new Pattern(DyeColor.RED, PatternType.STRIPE_BOTTOM)),
|
||||
TANZANIA(DyeColor.LIME, new Pattern(DyeColor.LIGHT_BLUE, PatternType.DIAGONAL_RIGHT), new Pattern(DyeColor.BLACK, PatternType.STRIPE_DOWNLEFT)),
|
||||
MOROCCO(DyeColor.RED, new Pattern(DyeColor.GREEN, PatternType.CIRCLE_MIDDLE)),
|
||||
SOLOMON_ISLANDS(DyeColor.GREEN, new Pattern(DyeColor.BLUE, PatternType.DIAGONAL_LEFT_MIRROR), new Pattern(DyeColor.YELLOW, PatternType.STRIPE_DOWNRIGHT)),
|
||||
SWITZERLAND(DyeColor.RED, new Pattern(DyeColor.WHITE, PatternType.STRAIGHT_CROSS), new Pattern(DyeColor.RED, PatternType.STRIPE_BOTTOM),
|
||||
new Pattern(DyeColor.RED, PatternType.STRIPE_TOP)),
|
||||
Finland(DyeColor.BLUE, new Pattern(DyeColor.WHITE, PatternType.SQUARE_BOTTOM_LEFT), new Pattern(DyeColor.WHITE, PatternType.SQUARE_BOTTOM_RIGHT),
|
||||
FINLAND(DyeColor.BLUE, new Pattern(DyeColor.WHITE, PatternType.SQUARE_BOTTOM_LEFT), new Pattern(DyeColor.WHITE, PatternType.SQUARE_BOTTOM_RIGHT),
|
||||
new Pattern(DyeColor.WHITE, PatternType.HALF_HORIZONTAL), new Pattern(DyeColor.BLUE, PatternType.STRIPE_CENTER)),
|
||||
South_Africa(DyeColor.WHITE, new Pattern(DyeColor.BLUE, PatternType.HALF_VERTICAL_MIRROR), new Pattern(DyeColor.RED, PatternType.HALF_VERTICAL),
|
||||
SOUTH_AFRICA(DyeColor.WHITE, new Pattern(DyeColor.BLUE, PatternType.HALF_VERTICAL_MIRROR), new Pattern(DyeColor.RED, PatternType.HALF_VERTICAL),
|
||||
new Pattern(DyeColor.GREEN, PatternType.STRIPE_CENTER), new Pattern(DyeColor.BLACK, PatternType.TRIANGLE_BOTTOM)),
|
||||
Poland(DyeColor.RED, new Pattern(DyeColor.WHITE, PatternType.HALF_VERTICAL_MIRROR));
|
||||
POLAND(DyeColor.RED, new Pattern(DyeColor.WHITE, PatternType.HALF_VERTICAL_MIRROR));
|
||||
|
||||
private DyeColor _baseColor;
|
||||
private Pattern[] _patterns;
|
||||
|
@ -35,7 +35,7 @@ public abstract class MiniClientPlugin<DataType extends Object> extends MiniPlug
|
||||
synchronized (_clientDataLock)
|
||||
{
|
||||
if (!_clientData.containsKey(name))
|
||||
_clientData.put(name, AddPlayer(name));
|
||||
_clientData.put(name, addPlayer(name));
|
||||
|
||||
return _clientData.get(name);
|
||||
}
|
||||
@ -66,5 +66,5 @@ public abstract class MiniClientPlugin<DataType extends Object> extends MiniPlug
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract DataType AddPlayer(String player);
|
||||
protected abstract DataType addPlayer(String player);
|
||||
}
|
||||
|
@ -57,7 +57,14 @@ public class CoreClientManager extends MiniPlugin
|
||||
private static AtomicInteger _clientsConnecting = new AtomicInteger(0);
|
||||
private static AtomicInteger _clientsProcessing = new AtomicInteger(0);
|
||||
|
||||
private final Rank WHITELIST_BYPASS;
|
||||
|
||||
public CoreClientManager(JavaPlugin plugin, String webServer)
|
||||
{
|
||||
this(plugin, webServer, Rank.MODERATOR);
|
||||
}
|
||||
|
||||
public CoreClientManager(JavaPlugin plugin, String webServer, Rank whitelistBypass)
|
||||
{
|
||||
super("Client Manager", plugin);
|
||||
|
||||
@ -65,6 +72,7 @@ public class CoreClientManager extends MiniPlugin
|
||||
_repository = new AccountRepository(plugin, webServer);
|
||||
_clientList = new NautHashMap<String, CoreClient>();
|
||||
_duplicateLoginGlitchPreventionList = new HashSet<String>();
|
||||
WHITELIST_BYPASS = whitelistBypass;
|
||||
}
|
||||
|
||||
public AccountRepository getRepository()
|
||||
@ -195,7 +203,7 @@ public class CoreClientManager extends MiniPlugin
|
||||
_clientsProcessing.decrementAndGet();
|
||||
}
|
||||
|
||||
if (Bukkit.hasWhitelist() && !Get(event.getName()).GetRank().has(Rank.MODERATOR))
|
||||
if (Bukkit.hasWhitelist() && !Get(event.getName()).GetRank().has(WHITELIST_BYPASS))
|
||||
{
|
||||
for (OfflinePlayer player : Bukkit.getWhitelistedPlayers())
|
||||
{
|
||||
|
@ -67,7 +67,7 @@ public class BenefitManager extends MiniDbClientPlugin<BenefitData>
|
||||
}
|
||||
|
||||
@Override
|
||||
protected BenefitData AddPlayer(String player)
|
||||
protected BenefitData addPlayer(String player)
|
||||
{
|
||||
return new BenefitData();
|
||||
}
|
||||
|
@ -989,7 +989,7 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
|
||||
}
|
||||
|
||||
@Override
|
||||
protected BonusClientData AddPlayer(String player)
|
||||
protected BonusClientData addPlayer(String player)
|
||||
{
|
||||
return new BonusClientData();
|
||||
}
|
||||
|
@ -71,7 +71,7 @@ public class YoutubeButton implements GuiItem
|
||||
message = "Click here to visit our YouTube page!";
|
||||
}
|
||||
|
||||
new JsonMessage(C.cAquaB + message).click(ClickEvent.OPEN_URL, "https://www.youtube.com/mineplexgamesofficial").sendToPlayer(_player);
|
||||
new JsonMessage(C.cAquaB + message).click(ClickEvent.OPEN_URL, "https://www.youtube.com/embed/RW3sOmkiEG-A?list=UU1MtBclG_aHPd0nLmUupCKg&controls=0&showinfo=0").sendToPlayer(_player);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -6,6 +6,7 @@ import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.boosters.command.BoosterCommand;
|
||||
import mineplex.core.boosters.event.BoosterActivateEvent;
|
||||
import mineplex.core.boosters.event.BoosterExpireEvent;
|
||||
import mineplex.core.boosters.event.BoosterItemGiveEvent;
|
||||
import mineplex.core.boosters.event.BoosterUpdateEvent;
|
||||
import mineplex.core.boosters.gui.BoosterShop;
|
||||
import mineplex.core.boosters.redis.BoosterUpdateRepository;
|
||||
@ -14,6 +15,7 @@ import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.Callback;
|
||||
import mineplex.core.common.util.UtilGear;
|
||||
import mineplex.core.common.util.UtilInv;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.inventory.InventoryManager;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
@ -361,6 +363,11 @@ public class BoosterManager extends MiniPlugin
|
||||
{
|
||||
if (_giveInterfaceItem && !UtilGear.isMat(player.getInventory().getItem(INTERFACE_SLOT), Material.EMERALD))
|
||||
{
|
||||
BoosterItemGiveEvent event = new BoosterItemGiveEvent(player);
|
||||
UtilServer.CallEvent(event);
|
||||
if (event.isCancelled())
|
||||
return;
|
||||
|
||||
player.getInventory().setItem(INTERFACE_SLOT, INTERFACE_ITEM);
|
||||
|
||||
UtilInv.Update(player);
|
||||
|
@ -0,0 +1,48 @@
|
||||
package mineplex.core.boosters.event;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* Called when a player is about to receive a booster gem. If cancelled the player will not receive said gem
|
||||
*/
|
||||
public class BoosterItemGiveEvent extends Event implements Cancellable
|
||||
{
|
||||
private Player _player;
|
||||
private boolean _cancelled;
|
||||
|
||||
public BoosterItemGiveEvent(Player player)
|
||||
{
|
||||
this._player = player;
|
||||
}
|
||||
|
||||
public Player getPlayer()
|
||||
{
|
||||
return this._player;
|
||||
}
|
||||
|
||||
public boolean isCancelled()
|
||||
{
|
||||
return this._cancelled;
|
||||
}
|
||||
|
||||
public void setCancelled(boolean cancelled)
|
||||
{
|
||||
this._cancelled = cancelled;
|
||||
}
|
||||
|
||||
private static final HandlerList _handlers = new HandlerList();
|
||||
|
||||
private static HandlerList getHandlerList()
|
||||
{
|
||||
return _handlers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers()
|
||||
{
|
||||
return getHandlerList();
|
||||
}
|
||||
}
|
@ -110,7 +110,7 @@ public class BoosterTipManager extends MiniDbClientPlugin<PlayerTipData>
|
||||
}
|
||||
|
||||
@Override
|
||||
protected PlayerTipData AddPlayer(String player)
|
||||
protected PlayerTipData addPlayer(String player)
|
||||
{
|
||||
return new PlayerTipData();
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ public class FountainManager extends MiniPlugin
|
||||
|
||||
World world = Bukkit.getWorlds().get(0);//-43.5, 66, -38.5
|
||||
|
||||
int goal = !new File("eu.dat").exists() ? 300000000 : 5000000;
|
||||
int goal = !new File("eu.dat").exists() ? 200000000 : 20000000;
|
||||
_gemFountain = new Fountain(new Location(world, -32.5, 72, -23.5), new Location(world, -43.5, 67, -38.5),
|
||||
C.cGreen + "Gem Fountain", "GemFountain_01", goal, this, clientManager, donationManager, _hologramManager, _statsManager);
|
||||
}
|
||||
|
@ -180,7 +180,7 @@ public class CosmeticManager extends MiniPlugin
|
||||
{
|
||||
_gadgetManager.disableAll();
|
||||
_mountManager.DisableAll();
|
||||
_petManager.DisableAll();
|
||||
_petManager.disableAll();
|
||||
}
|
||||
|
||||
public void setHideParticles(boolean b)
|
||||
|
@ -8,7 +8,7 @@ public class PetSorter implements Comparator<Pet>
|
||||
{
|
||||
public int compare(Pet a, Pet b)
|
||||
{
|
||||
if (a.GetPetType().getTypeId() < b.GetPetType().getTypeId())
|
||||
if (a.getPetType().getTypeId() < b.getPetType().getTypeId())
|
||||
return -1;
|
||||
|
||||
return 1;
|
||||
|
@ -23,7 +23,7 @@ public class ActivatePetButton implements IButton
|
||||
public void onClick(Player player, ClickType clickType)
|
||||
{
|
||||
_page.playAcceptSound(player);
|
||||
_page.getPlugin().getPetManager().AddPetOwner(player, _pet.GetPetType(), player.getLocation());
|
||||
_page.getPlugin().getPetManager().addPetOwner(player, _pet.getPetType(), player.getLocation());
|
||||
_page.getShop().openPageForPlayer(player, new Menu(_page.getPlugin(), _page.getShop(), _page.getClientManager(), _page.getDonationManager(), player));
|
||||
}
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ public class DeactivatePetButton implements IButton
|
||||
public void onClick(Player player, ClickType clickType)
|
||||
{
|
||||
_page.playAcceptSound(player);
|
||||
_petManager.RemovePet(player, true);
|
||||
_petManager.removePet(player, true);
|
||||
_page.refresh();
|
||||
}
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ public class OpenPets implements IButton
|
||||
else
|
||||
{
|
||||
_menu.playAcceptSound(player);
|
||||
_menu.getPlugin().getPetManager().RemovePet(player, true);
|
||||
_menu.getPlugin().getPetManager().removePet(player, true);
|
||||
_menu.refresh();
|
||||
}
|
||||
}
|
||||
|
@ -4,7 +4,9 @@ import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.banner.CountryFlag;
|
||||
import mineplex.core.gadget.event.GadgetChangeEvent;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
@ -291,7 +293,7 @@ public class GadgetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
|
||||
{
|
||||
if (gadget.getCost(CurrencyType.TREASURE_SHARD) == -8)
|
||||
{
|
||||
gadgetItemStack = CountryFlag.Usa.getBanner();
|
||||
gadgetItemStack = CountryFlag.USA.getBanner();
|
||||
BannerMeta bannerMeta = (BannerMeta) gadgetItemStack.getItemMeta();
|
||||
bannerMeta.setDisplayName(C.cGreen + C.Bold + gadget.getName());
|
||||
bannerMeta.setLore(meta.getLore());
|
||||
@ -314,7 +316,7 @@ public class GadgetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
|
||||
{
|
||||
if (gadget.getCost(CurrencyType.TREASURE_SHARD) == -8)
|
||||
{
|
||||
gadgetItemStack = CountryFlag.Usa.getBanner();
|
||||
gadgetItemStack = CountryFlag.USA.getBanner();
|
||||
BannerMeta bannerMeta = (BannerMeta) gadgetItemStack.getItemMeta();
|
||||
bannerMeta.setDisplayName(C.cGreen + C.Bold + gadget.getName());
|
||||
bannerMeta.setLore(meta.getLore());
|
||||
@ -393,6 +395,9 @@ public class GadgetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
|
||||
|
||||
playAcceptSound(player);
|
||||
gadget.enable(player);
|
||||
GadgetChangeEvent gadgetChangeEvent = new GadgetChangeEvent(player, gadget,
|
||||
GadgetChangeEvent.GadgetState.ENABLED);
|
||||
UtilServer.getPluginManager().callEvent(gadgetChangeEvent);
|
||||
|
||||
refresh();
|
||||
}
|
||||
@ -409,6 +414,9 @@ public class GadgetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
|
||||
{
|
||||
playAcceptSound(player);
|
||||
gadget.disable(player);
|
||||
GadgetChangeEvent gadgetChangeEvent = new GadgetChangeEvent(player, gadget,
|
||||
GadgetChangeEvent.GadgetState.DISABLED);
|
||||
UtilServer.getPluginManager().callEvent(gadgetChangeEvent);
|
||||
refresh();
|
||||
}
|
||||
}
|
@ -100,7 +100,7 @@ public class Menu extends ShopPageBase<CosmeticManager, CosmeticShop>
|
||||
Mount<?> mountActive = getPlugin().getMountManager().getActive(getPlayer());
|
||||
for (Mount<?> mount : getPlugin().getMountManager().getMounts())
|
||||
{
|
||||
if (getDonationManager().Get(getPlayer()).OwnsUnknownPackage(mount.getName()) || mount.hasMount(getPlayer()))
|
||||
if (getDonationManager().Get(getPlayer().getName()).OwnsUnknownPackage(mount.getName()))
|
||||
{
|
||||
mountOwned++;
|
||||
}
|
||||
@ -110,17 +110,17 @@ public class Menu extends ShopPageBase<CosmeticManager, CosmeticShop>
|
||||
|
||||
int petOwned = 0;
|
||||
int petMax = 0;
|
||||
for (Pet pet : getPlugin().getPetManager().GetFactory().GetPets())
|
||||
for (Pet pet : getPlugin().getPetManager().getFactory().GetPets())
|
||||
{
|
||||
NautHashMap<EntityType, String> pets = getPlugin().getPetManager().Get(getPlayer()).GetPets();
|
||||
if (pets != null && pets.containsKey(pet.GetPetType()))
|
||||
NautHashMap<EntityType, String> pets = getPlugin().getPetManager().Get(getPlayer()).getPets();
|
||||
if (pets != null && pets.containsKey(pet.getPetType()))
|
||||
{
|
||||
petOwned++;
|
||||
}
|
||||
|
||||
petMax++;
|
||||
}
|
||||
Creature petActive = getPlugin().getPetManager().GetPet(getPlayer());
|
||||
Creature petActive = getPlugin().getPetManager().getPet(getPlayer());
|
||||
|
||||
GadgetType type = GadgetType.PARTICLE;
|
||||
String[] lore = getLore(ownedCount.get(type), maxCount.get(type), "Show everyone how cool you are with swirly particles that follow you when you walk!", "Visible Everywhere", enabled.get(type));
|
||||
|
@ -49,7 +49,7 @@ public class PetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
|
||||
{
|
||||
int slot = 19;
|
||||
|
||||
List<Pet> pets = new ArrayList<Pet>(getPlugin().getPetManager().GetFactory().GetPets());
|
||||
List<Pet> pets = new ArrayList<Pet>(getPlugin().getPetManager().getFactory().GetPets());
|
||||
|
||||
Collections.sort(pets, new PetSorter());
|
||||
|
||||
@ -61,7 +61,7 @@ public class PetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
|
||||
itemLore.add(C.cGray + "Your very own " + pet.getName() + "!");
|
||||
|
||||
//Chest Unlocks
|
||||
if (!getPlugin().getPetManager().Get(getPlayer()).GetPets().containsKey(pet.GetPetType()))
|
||||
if (!getPlugin().getPetManager().Get(getPlayer()).getPets().containsKey(pet.getPetType()))
|
||||
{
|
||||
if (pet.getCost(CurrencyType.TREASURE_SHARD) == -1)
|
||||
{
|
||||
@ -113,21 +113,21 @@ public class PetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
|
||||
}
|
||||
|
||||
//Owned
|
||||
if (getPlugin().getPetManager().Get(getPlayer()).GetPets().containsKey(pet.GetPetType()))
|
||||
if (getPlugin().getPetManager().Get(getPlayer()).getPets().containsKey(pet.getPetType()))
|
||||
{
|
||||
String petName = getPlugin().getPetManager().Get(getPlayer()).GetPets().get(pet.GetPetType());
|
||||
String petName = getPlugin().getPetManager().Get(getPlayer()).getPets().get(pet.getPetType());
|
||||
if (petName == null)
|
||||
{
|
||||
petName = pet.getName();
|
||||
}
|
||||
|
||||
if (getPlugin().getPetManager().hasActivePet(getPlayer().getName()) && getPlugin().getPetManager().getActivePet(getPlayer().getName()).getType() == pet.GetPetType())
|
||||
if (getPlugin().getPetManager().hasActivePet(getPlayer().getName()) && getPlugin().getPetManager().getActivePet(getPlayer().getName()).getType() == pet.getPetType())
|
||||
{
|
||||
itemLore.add(C.cBlack);
|
||||
itemLore.add(C.cGreen + "Click to Disable");
|
||||
|
||||
addButton(slot, new ShopItem(Material.MONSTER_EGG, (byte) pet.GetPetType().getTypeId(),
|
||||
pet.GetPetName() + " (" + C.cWhite + petName + C.cGreen + ")",
|
||||
addButton(slot, new ShopItem(Material.MONSTER_EGG, (byte) pet.getPetType().getTypeId(),
|
||||
pet.getPetName() + " (" + C.cWhite + petName + C.cGreen + ")",
|
||||
itemLore.toArray(new String[itemLore.size()]), 1, false, false), new DeactivatePetButton(this, getPlugin().getPetManager()));
|
||||
|
||||
addGlow(slot);
|
||||
@ -137,8 +137,8 @@ public class PetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
|
||||
itemLore.add(C.cBlack);
|
||||
itemLore.add(C.cGreen + "Click to Enable");
|
||||
|
||||
addButton(slot, new ShopItem(Material.MONSTER_EGG, (byte) pet.GetPetType().getTypeId(),
|
||||
pet.GetPetName() + " (" + C.cWhite + petName + C.cGreen + ")",
|
||||
addButton(slot, new ShopItem(Material.MONSTER_EGG, (byte) pet.getPetType().getTypeId(),
|
||||
pet.getPetName() + " (" + C.cWhite + petName + C.cGreen + ")",
|
||||
itemLore.toArray(new String[itemLore.size()]), 1, false, false), new ActivatePetButton(pet, this));
|
||||
}
|
||||
}
|
||||
@ -156,18 +156,18 @@ public class PetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
|
||||
itemLore.add(C.cBlack);
|
||||
itemLore.add(C.cGreen + "Click to Purchase");
|
||||
|
||||
addButton(slot, new ShopItem(Material.INK_SACK, (byte) 8, pet.GetPetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false), new PetButton(pet, this));
|
||||
addButton(slot, new ShopItem(Material.INK_SACK, (byte) 8, pet.getPetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false), new PetButton(pet, this));
|
||||
}
|
||||
else if (pet.getCost(CurrencyType.TREASURE_SHARD) > 0)
|
||||
{
|
||||
itemLore.add(C.cBlack);
|
||||
itemLore.add(C.cRed + "Not enough Treasure Shards.");
|
||||
|
||||
setItem(slot, new ShopItem(Material.INK_SACK, (byte)8, pet.GetPetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false));
|
||||
setItem(slot, new ShopItem(Material.INK_SACK, (byte)8, pet.getPetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false));
|
||||
}
|
||||
else
|
||||
{
|
||||
setItem(slot, new ShopItem(Material.INK_SACK, (byte)8, pet.GetPetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false));
|
||||
setItem(slot, new ShopItem(Material.INK_SACK, (byte)8, pet.getPetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false));
|
||||
}
|
||||
}
|
||||
|
||||
@ -178,7 +178,7 @@ public class PetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
|
||||
}
|
||||
|
||||
slot = 49;
|
||||
for (PetExtra petExtra : getPlugin().getPetManager().GetFactory().GetPetExtras())
|
||||
for (PetExtra petExtra : getPlugin().getPetManager().getFactory().GetPetExtras())
|
||||
{
|
||||
List<String> itemLore = new ArrayList<String>();
|
||||
|
||||
@ -233,7 +233,7 @@ public class PetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
|
||||
public void deactivatePet(Player player)
|
||||
{
|
||||
playAcceptSound(player);
|
||||
getPlugin().getPetManager().RemovePet(player, true);
|
||||
getPlugin().getPetManager().removePet(player, true);
|
||||
refresh();
|
||||
}
|
||||
}
|
@ -108,8 +108,8 @@ public class PetTagPage extends ShopPageBase<CosmeticManager, CosmeticShop>
|
||||
token.AccountId = PlayerCache.getInstance().getPlayer(getPlayer().getUniqueId()).getAccountId();
|
||||
|
||||
token.Name = getPlayer().getName();
|
||||
token.PetType = _pet.GetPetType().toString();
|
||||
token.PetId = _pet.GetPetType().ordinal();
|
||||
token.PetType = _pet.getPetType().toString();
|
||||
token.PetId = _pet.getPetType().ordinal();
|
||||
token.PetName = _tagName;
|
||||
|
||||
PetToken petToken = new PetToken();
|
||||
@ -117,16 +117,16 @@ public class PetTagPage extends ShopPageBase<CosmeticManager, CosmeticShop>
|
||||
|
||||
if (_petPurchase)
|
||||
{
|
||||
getPlugin().getPetManager().GetRepository().AddPet(token);
|
||||
getPlugin().getPetManager().addPetOwnerToQueue(getPlayer().getName(), _pet.GetPetType());
|
||||
getPlugin().getPetManager().getRepository().AddPet(token);
|
||||
getPlugin().getPetManager().addPetOwnerToQueue(getPlayer().getName(), _pet.getPetType());
|
||||
}
|
||||
else
|
||||
{
|
||||
getPlugin().getPetManager().GetRepository().UpdatePet(token);
|
||||
getPlugin().getPetManager().getRepository().UpdatePet(token);
|
||||
getPlugin().getPetManager().addRenamePetToQueue(getPlayer().getName(), token.PetName);
|
||||
}
|
||||
|
||||
getPlugin().getPetManager().Get(getPlayer()).GetPets().put(_pet.GetPetType(), token.PetName);
|
||||
getPlugin().getPetManager().Get(getPlayer()).getPets().put(_pet.getPetType(), token.PetName);
|
||||
|
||||
getShop().openPageForPlayer(getPlayer(), new Menu(getPlugin(), getShop(), getClientManager(), getDonationManager(), getPlayer()));
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ public class CustomDataManager extends MiniDbClientPlugin<PlayerCustomData>
|
||||
}
|
||||
|
||||
@Override
|
||||
protected PlayerCustomData AddPlayer(String player)
|
||||
protected PlayerCustomData addPlayer(String player)
|
||||
{
|
||||
return new PlayerCustomData(_repository);
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ public class DelayedTask extends MiniClientPlugin<DelayedTaskClient>
|
||||
}
|
||||
|
||||
@Override
|
||||
protected DelayedTaskClient AddPlayer(String player)
|
||||
protected DelayedTaskClient addPlayer(String player)
|
||||
{
|
||||
return new DelayedTaskClient(Bukkit.getPlayer(player));
|
||||
}
|
||||
|
@ -518,7 +518,7 @@ public class DonationManager extends MiniDbClientPlugin<Donor>
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Donor AddPlayer(String player)
|
||||
protected Donor addPlayer(String player)
|
||||
{
|
||||
return new Donor();
|
||||
}
|
||||
|
@ -114,7 +114,7 @@ public class EloManager extends MiniDbClientPlugin<EloClientData>
|
||||
}
|
||||
|
||||
@Override
|
||||
protected EloClientData AddPlayer(String player)
|
||||
protected EloClientData addPlayer(String player)
|
||||
{
|
||||
return new EloClientData();
|
||||
}
|
||||
|
@ -137,7 +137,7 @@ public class Energy extends MiniClientPlugin<ClientEnergy>
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ClientEnergy AddPlayer(String player)
|
||||
protected ClientEnergy addPlayer(String player)
|
||||
{
|
||||
return new ClientEnergy();
|
||||
}
|
||||
|
@ -106,7 +106,7 @@ public class FacebookManager extends MiniDbClientPlugin<FacebookClient>
|
||||
}
|
||||
|
||||
@Override
|
||||
protected FacebookClient AddPlayer(String player)
|
||||
protected FacebookClient addPlayer(String player)
|
||||
{
|
||||
return new FacebookClient(false);
|
||||
}
|
||||
|
@ -70,7 +70,7 @@ public class FriendManager extends MiniDbClientPlugin<FriendData>
|
||||
}
|
||||
|
||||
@Override
|
||||
protected FriendData AddPlayer(String player)
|
||||
protected FriendData addPlayer(String player)
|
||||
{
|
||||
return new FriendData();
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ import java.util.*;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
import mineplex.core.gadget.commands.LockCosmeticsCommand;
|
||||
import mineplex.core.gadget.event.GadgetChangeEvent;
|
||||
import mineplex.core.gadget.event.GadgetEnableEvent;
|
||||
import mineplex.core.gadget.gadgets.arrowtrail.freedom.ArrowTrailFreedom;
|
||||
import mineplex.core.gadget.gadgets.death.freedom.DeathFreedom;
|
||||
@ -660,10 +661,14 @@ public class GadgetManager extends MiniPlugin
|
||||
}
|
||||
}
|
||||
|
||||
public void disableAll(Player player, boolean callEvent)
|
||||
public void disableAll(Player player, boolean winRooms)
|
||||
{
|
||||
for (GadgetType gadgetType : _gadgets.keySet())
|
||||
{
|
||||
if (gadgetType == GadgetType.WIN_EFFECT && winRooms)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
for (Gadget gadget : _gadgets.get(gadgetType))
|
||||
{
|
||||
gadget.disable(player);
|
||||
@ -776,7 +781,9 @@ public class GadgetManager extends MiniPlugin
|
||||
@EventHandler
|
||||
public void onPlayerQuit(PlayerQuitEvent event)
|
||||
{
|
||||
saveGadgets(event.getPlayer());
|
||||
//saveGadgets(event.getPlayer());
|
||||
event.getPlayer().setWalkSpeed(0.2f);
|
||||
event.getPlayer().setFlySpeed(0.1f);
|
||||
disableAll(event.getPlayer(), false);
|
||||
_lastMove.remove(event.getPlayer());
|
||||
_playerActiveGadgetMap.remove(event.getPlayer());
|
||||
@ -914,89 +921,57 @@ public class GadgetManager extends MiniPlugin
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
private void saveGadgets(Player player)
|
||||
@EventHandler
|
||||
private void saveGadget(GadgetChangeEvent event)
|
||||
{
|
||||
if (player.getGameMode() == GameMode.SPECTATOR)
|
||||
return;
|
||||
Map<String, String> cache = new HashMap<>();
|
||||
for (Gadget gadget : getAllGadgets())
|
||||
Gadget gadget = event.getGadget();
|
||||
if (gadget != null)
|
||||
{
|
||||
String value = "disabled", key = "";
|
||||
GadgetType gadgetType = gadget.getGadgetType();
|
||||
if (gadget.ownsGadget(player))
|
||||
{
|
||||
switch (gadgetType)
|
||||
{
|
||||
case MUSIC_DISC:
|
||||
case ITEM:
|
||||
case MORPH:
|
||||
case BALLOON:
|
||||
break;
|
||||
case COSTUME:
|
||||
OutfitGadget outfitGadget = (OutfitGadget) gadget;
|
||||
String key = "activeCostume" + outfitGadget.getSlot().getDatabaseKey();
|
||||
if (cache.containsKey(key))
|
||||
continue;
|
||||
if (outfitGadget.isActive(player))
|
||||
cache.put(key, outfitGadget.getName());
|
||||
break;
|
||||
case GAME_MODIFIER:
|
||||
GameModifierGadget gameModifierGadget = (GameModifierGadget) gadget;
|
||||
if (gameModifierGadget.canAllowMultiple())
|
||||
{
|
||||
if (cache.containsKey(gadget.getName()))
|
||||
continue;
|
||||
cache.put(gadget.getName(), (gadget.isActive(player)) ? "enabled" : "disabled");
|
||||
} else
|
||||
{
|
||||
String dataKey = "activeModifier" + gameModifierGadget.getGameType().getName().replace(" ", "");
|
||||
if (cache.containsKey(dataKey))
|
||||
continue;
|
||||
if (gadget.isActive(player))
|
||||
cache.put(dataKey, gadget.getName());
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if (cache.containsKey(gadgetType.getDatabaseKey()))
|
||||
continue;
|
||||
if (gadget.isActive(player))
|
||||
cache.put(gadgetType.getDatabaseKey(), gadget.getName());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
cache = updateDefaultGadgets(cache);
|
||||
_userGadgetPersistence.save(player, cache);
|
||||
}
|
||||
|
||||
private Map<String, String> updateDefaultGadgets(Map<String, String> cache)
|
||||
{
|
||||
for (GadgetType gadgetType : GadgetType.values())
|
||||
{
|
||||
if (gadgetType == GadgetType.MUSIC_DISC || gadgetType == GadgetType.ITEM
|
||||
|| gadgetType == GadgetType.MORPH || gadgetType == GadgetType.BALLOON
|
||||
|| gadgetType == GadgetType.GAME_MODIFIER)
|
||||
continue;
|
||||
if (!cache.containsKey(gadgetType.getDatabaseKey()))
|
||||
switch (gadgetType)
|
||||
{
|
||||
String key = gadgetType.getDatabaseKey();
|
||||
if (gadgetType.equals(GadgetType.COSTUME))
|
||||
{
|
||||
for (ArmorSlot armorSlot : ArmorSlot.values())
|
||||
case MUSIC_DISC:
|
||||
case ITEM:
|
||||
case MORPH:
|
||||
case BALLOON:
|
||||
return;
|
||||
case COSTUME:
|
||||
OutfitGadget outfitGadget = (OutfitGadget) gadget;
|
||||
key = "activeCostume" + outfitGadget.getSlot().getDatabaseKey();
|
||||
if (event.getGadgetState() == GadgetChangeEvent.GadgetState.ENABLED)
|
||||
{
|
||||
key = "activeCostume" + armorSlot.getDatabaseKey();
|
||||
if (!cache.containsKey(key))
|
||||
value = outfitGadget.getName();
|
||||
}
|
||||
break;
|
||||
case GAME_MODIFIER:
|
||||
GameModifierGadget gameModifierGadget = (GameModifierGadget) gadget;
|
||||
if (gameModifierGadget.canAllowMultiple())
|
||||
{
|
||||
key = gameModifierGadget.getName();
|
||||
if (event.getGadgetState() == GadgetChangeEvent.GadgetState.ENABLED)
|
||||
{
|
||||
cache.put(key, "disabled");
|
||||
value = "enabled";
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
cache.put(key, "disabled");
|
||||
}
|
||||
else
|
||||
{
|
||||
key = "activeModifier" + gameModifierGadget.getGameType().getName().replace(" ", "");
|
||||
if (event.getGadgetState() == GadgetChangeEvent.GadgetState.ENABLED)
|
||||
{
|
||||
value = gameModifierGadget.getName();
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
key = gadgetType.getDatabaseKey();
|
||||
if (event.getGadgetState() == GadgetChangeEvent.GadgetState.ENABLED)
|
||||
{
|
||||
value = gadget.getName();
|
||||
}
|
||||
}
|
||||
_userGadgetPersistence.save(event.getPlayer(), key, value);
|
||||
}
|
||||
return cache;
|
||||
}
|
||||
|
||||
public boolean isKitModifierActive(KitModifier kitModifier, Player player)
|
||||
|
@ -2,12 +2,17 @@ package mineplex.core.gadget.commands;
|
||||
|
||||
import mineplex.core.command.CommandBase;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilText;
|
||||
import mineplex.core.gadget.GadgetManager;
|
||||
import mineplex.core.gadget.types.Gadget;
|
||||
import mineplex.core.gadget.types.GadgetType;
|
||||
import mineplex.core.inventory.ClientItem;
|
||||
import mineplex.core.inventory.data.Item;
|
||||
import mineplex.core.mount.Mount;
|
||||
import mineplex.core.pet.Pet;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@ -28,7 +33,7 @@ public class LockCosmeticsCommand extends CommandBase<GadgetManager>
|
||||
// Removes all cosmetic types
|
||||
if (args.length == 0)
|
||||
{
|
||||
addCosmetics(null, caller);
|
||||
lockCosmetics(null, caller);
|
||||
}
|
||||
// Removes specific type
|
||||
else
|
||||
@ -36,8 +41,16 @@ public class LockCosmeticsCommand extends CommandBase<GadgetManager>
|
||||
String type = args[0];
|
||||
if (type.equalsIgnoreCase("all"))
|
||||
{
|
||||
addCosmetics(null, caller);
|
||||
lockCosmetics(null, caller);
|
||||
}
|
||||
else if (type.equalsIgnoreCase("pet"))
|
||||
{
|
||||
lockPets(caller);
|
||||
}
|
||||
else if (type.equalsIgnoreCase("mount"))
|
||||
{
|
||||
lockMounts(caller);
|
||||
}
|
||||
else
|
||||
{
|
||||
GadgetType gadgetType = GadgetType.valueOf(type);
|
||||
@ -47,27 +60,74 @@ public class LockCosmeticsCommand extends CommandBase<GadgetManager>
|
||||
}
|
||||
else
|
||||
{
|
||||
addCosmetics(gadgetType, caller);
|
||||
lockCosmetics(gadgetType, caller);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void addCosmetics(GadgetType gadgetType, Player caller)
|
||||
private void lockCosmetics(GadgetType gadgetType, Player caller)
|
||||
{
|
||||
if (gadgetType == null)
|
||||
{
|
||||
for (GadgetType type : GadgetType.values())
|
||||
{
|
||||
addCosmetics(type, caller);
|
||||
lockCosmetics(type, caller);
|
||||
}
|
||||
lockMounts(caller);
|
||||
lockPets(caller);
|
||||
return;
|
||||
}
|
||||
int removed = 0;
|
||||
for (Gadget gadget : _plugin.getGadgets(gadgetType))
|
||||
{
|
||||
_plugin.getDonationManager().Get(caller.getName()).RemoveUnknownSalesPackagesOwned(gadget.getName());
|
||||
if (gadget.getGadgetType() == GadgetType.ITEM)
|
||||
continue;
|
||||
if (gadget.ownsGadget(caller))
|
||||
{
|
||||
Item clientItem = _plugin.getInventoryManager().getItem(gadget.getName());
|
||||
if (clientItem == null)
|
||||
continue;
|
||||
_plugin.getInventoryManager().Get(caller.getName()).removeItem(new ClientItem(clientItem, 1));
|
||||
removed++;
|
||||
}
|
||||
}
|
||||
UtilPlayer.message(caller, F.main("Cosmetics", "Removed all the " + gadgetType.name() + " cosmetics!"));
|
||||
UtilPlayer.message(caller, F.main("Cosmetics", "Removed all the " + gadgetType.name().toLowerCase()
|
||||
.replace("_", " ") + "! (Removed " + C.cRed + removed + C.cGray + " " +
|
||||
UtilText.plural("item", removed) + ")"));
|
||||
}
|
||||
|
||||
private void lockMounts(Player caller)
|
||||
{
|
||||
int removed = 0;
|
||||
for (Mount<?> mount : _plugin.getMountManager().getMounts())
|
||||
{
|
||||
if (mount.hasMount(caller))
|
||||
{
|
||||
Item clientItem = _plugin.getInventoryManager().getItem(mount.getName());
|
||||
if (clientItem == null)
|
||||
continue;
|
||||
_plugin.getInventoryManager().Get(caller.getName()).removeItem(new ClientItem(clientItem, 1));
|
||||
removed++;
|
||||
}
|
||||
}
|
||||
UtilPlayer.message(caller, F.main("Cosmetics", "Removed " + C.cRed + removed + C.cGray + " " +
|
||||
UtilText.plural("mount", removed) + "!"));
|
||||
}
|
||||
|
||||
private void lockPets(Player caller)
|
||||
{
|
||||
int removed = 0;
|
||||
for (Pet pet : _plugin.getPetManager().getFactory().GetPets())
|
||||
{
|
||||
if (_plugin.getPetManager().Get(caller).getPets().containsKey(pet.getPetType()))
|
||||
{
|
||||
_plugin.getPetManager().Get(caller).getPets().remove(pet.getPetType());
|
||||
removed++;
|
||||
}
|
||||
}
|
||||
UtilPlayer.message(caller, F.main("Cosmetics", "Removed " + C.cRed + removed + C.cGray + " " +
|
||||
UtilText.plural("pet", removed) + "!"));
|
||||
}
|
||||
}
|
@ -2,15 +2,15 @@ package mineplex.core.gadget.commands;
|
||||
|
||||
import mineplex.core.command.CommandBase;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilText;
|
||||
import mineplex.core.gadget.GadgetManager;
|
||||
import mineplex.core.gadget.types.Gadget;
|
||||
import mineplex.core.gadget.types.GadgetType;
|
||||
import mineplex.core.mount.Mount;
|
||||
import mineplex.core.mount.MountManager;
|
||||
import mineplex.core.pet.Pet;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class UnlockCosmeticsCommand extends CommandBase<GadgetManager>
|
||||
@ -40,6 +40,14 @@ public class UnlockCosmeticsCommand extends CommandBase<GadgetManager>
|
||||
{
|
||||
addCosmetics(null, caller);
|
||||
}
|
||||
else if (type.equalsIgnoreCase("pet"))
|
||||
{
|
||||
addPets(caller);
|
||||
}
|
||||
else if (type.equalsIgnoreCase("mount"))
|
||||
{
|
||||
addMounts(caller);
|
||||
}
|
||||
else
|
||||
{
|
||||
GadgetType gadgetType = GadgetType.valueOf(type);
|
||||
@ -64,12 +72,54 @@ public class UnlockCosmeticsCommand extends CommandBase<GadgetManager>
|
||||
{
|
||||
addCosmetics(type, caller);
|
||||
}
|
||||
addMounts(caller);
|
||||
addPets(caller);
|
||||
return;
|
||||
}
|
||||
int added = 0;
|
||||
int amount = 1;
|
||||
for (Gadget gadget : _plugin.getGadgets(gadgetType))
|
||||
{
|
||||
_plugin.getDonationManager().Get(caller.getName()).AddUnknownSalesPackagesOwned(gadget.getName());
|
||||
if (gadgetType == GadgetType.ITEM)
|
||||
amount = 20;
|
||||
if (!gadget.ownsGadget(caller))
|
||||
{
|
||||
_plugin.getInventoryManager().addItemToInventory(caller, gadget.getName(), amount);
|
||||
added++;
|
||||
}
|
||||
}
|
||||
UtilPlayer.message(caller, F.main("Cosmetics", "Added all the " + gadgetType.name() + " cosmetics!"));
|
||||
UtilPlayer.message(caller, F.main("Cosmetics", "Added all the " + gadgetType.name().toLowerCase()
|
||||
.replace("_", " ") + "! (Added " + C.cRed + added + C.cGray + " " +
|
||||
UtilText.plural("item", added) + ")"));
|
||||
}
|
||||
|
||||
private void addMounts(Player caller)
|
||||
{
|
||||
int added = 0;
|
||||
for (Mount<?> mount : _plugin.getMountManager().getMounts())
|
||||
{
|
||||
if (!mount.hasMount(caller))
|
||||
{
|
||||
_plugin.getInventoryManager().addItemToInventory(caller, mount.getName(), 1);
|
||||
added++;
|
||||
}
|
||||
}
|
||||
UtilPlayer.message(caller, F.main("Cosmetics", "Added " + C.cRed + added + C.cGray + " " +
|
||||
UtilText.plural("mount", added) + "!"));
|
||||
}
|
||||
|
||||
private void addPets(Player caller)
|
||||
{
|
||||
int added = 0;
|
||||
for (Pet pet : _plugin.getPetManager().getFactory().GetPets())
|
||||
{
|
||||
if (!_plugin.getPetManager().Get(caller).getPets().containsKey(pet.getPetType()))
|
||||
{
|
||||
_plugin.getPetManager().Get(caller).getPets().put(pet.getPetType(), pet.getName());
|
||||
added++;
|
||||
}
|
||||
}
|
||||
UtilPlayer.message(caller, F.main("Cosmetics", "Added " + C.cRed + added + C.cGray + " " +
|
||||
UtilText.plural("pet", added) + "!"));
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,60 @@
|
||||
package mineplex.core.gadget.event;
|
||||
|
||||
import mineplex.core.gadget.types.Gadget;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* Called when a player enables or disables a gadget manually,
|
||||
* allowing it to be saved when the player changes a gadget, instead of
|
||||
* when they quit or join a server
|
||||
*/
|
||||
public class GadgetChangeEvent extends Event
|
||||
{
|
||||
|
||||
public enum GadgetState
|
||||
{
|
||||
ENABLED,
|
||||
DISABLED
|
||||
}
|
||||
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
private final Player _player;
|
||||
private final Gadget _gadget;
|
||||
private final GadgetState _gadgetState;
|
||||
|
||||
public GadgetChangeEvent(Player player, Gadget gadget, GadgetState gadgetState)
|
||||
{
|
||||
_player = player;
|
||||
_gadget = gadget;
|
||||
_gadgetState = gadgetState;
|
||||
}
|
||||
|
||||
public Player getPlayer()
|
||||
{
|
||||
return _player;
|
||||
}
|
||||
|
||||
public Gadget getGadget()
|
||||
{
|
||||
return _gadget;
|
||||
}
|
||||
|
||||
public GadgetState getGadgetState()
|
||||
{
|
||||
return _gadgetState;
|
||||
}
|
||||
|
||||
public HandlerList getHandlers()
|
||||
{
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList()
|
||||
{
|
||||
return handlers;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,84 @@
|
||||
package mineplex.core.gadget.event;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
import mineplex.core.gadget.types.Gadget;
|
||||
|
||||
/**
|
||||
* This event is called when a gadget selects a location for a specific effect to be shown.
|
||||
*/
|
||||
public class GadgetSelectLocationEvent extends Event
|
||||
{
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
private Player _player;
|
||||
private Gadget _gadget;
|
||||
private Location _location;
|
||||
private boolean _showMessage = true;
|
||||
private boolean _cancelled = false;
|
||||
|
||||
public GadgetSelectLocationEvent(Player player, Gadget gadget, Location location)
|
||||
{
|
||||
_player = player;
|
||||
_gadget = gadget;
|
||||
_location = location;
|
||||
}
|
||||
|
||||
public HandlerList getHandlers()
|
||||
{
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList()
|
||||
{
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public Gadget getGadget()
|
||||
{
|
||||
return _gadget;
|
||||
}
|
||||
|
||||
public Player getPlayer()
|
||||
{
|
||||
return _player;
|
||||
}
|
||||
|
||||
public Location getLocation()
|
||||
{
|
||||
return _location;
|
||||
}
|
||||
|
||||
public void setCancelled(boolean cancel)
|
||||
{
|
||||
_cancelled = cancel;
|
||||
}
|
||||
|
||||
public boolean isCancelled()
|
||||
{
|
||||
return _cancelled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether or not a cancellation message should be displayed.
|
||||
*
|
||||
* @param showMessage True for the message to be shown and false for the message to be hidden/ignored.
|
||||
*/
|
||||
public void setShowMessage(boolean showMessage)
|
||||
{
|
||||
_showMessage = showMessage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether or not a cancellation message can be shown.
|
||||
*
|
||||
* @return True if the message can be shown and false if the message should be hidden/ignored.
|
||||
*/
|
||||
public boolean canShowMessage()
|
||||
{
|
||||
return _showMessage;
|
||||
}
|
||||
}
|
@ -117,7 +117,7 @@ public class ItemCoal extends ItemGadget
|
||||
}
|
||||
|
||||
//Coal Apparition
|
||||
if (!Manager.getPetManager().Get(player).GetPets().containsKey(EntityType.PIG_ZOMBIE))
|
||||
if (!Manager.getPetManager().Get(player).getPets().containsKey(EntityType.PIG_ZOMBIE))
|
||||
{
|
||||
goal = _pet;
|
||||
|
||||
|
@ -4,6 +4,7 @@ import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
@ -17,6 +18,7 @@ import org.bukkit.util.Vector;
|
||||
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.LineFormat;
|
||||
import mineplex.core.common.util.UtilAction;
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
@ -32,6 +34,7 @@ import mineplex.core.common.util.UtilEvent.ActionType;
|
||||
import mineplex.core.disguise.disguises.DisguiseBase;
|
||||
import mineplex.core.disguise.disguises.DisguiseGuardian;
|
||||
import mineplex.core.gadget.GadgetManager;
|
||||
import mineplex.core.gadget.event.GadgetSelectLocationEvent;
|
||||
import mineplex.core.gadget.types.MorphGadget;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.recharge.RechargedEvent;
|
||||
@ -105,6 +108,19 @@ public class MorphTitan extends MorphGadget
|
||||
|
||||
Location loc = player.getTargetBlock(ignore, 64).getLocation().add(0.5, 0.5, 0.5);
|
||||
|
||||
GadgetSelectLocationEvent gadgetSelectLocationEvent = new GadgetSelectLocationEvent(player, this, loc);
|
||||
Bukkit.getServer().getPluginManager().callEvent(gadgetSelectLocationEvent);
|
||||
|
||||
if (gadgetSelectLocationEvent.isCancelled())
|
||||
{
|
||||
if (gadgetSelectLocationEvent.canShowMessage())
|
||||
{
|
||||
UtilPlayer.message(player, F.main("Gadget", "You cannot use the laser on this area!"));
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
ArmorStand stand = loc.getWorld().spawn(loc, ArmorStand.class);
|
||||
|
||||
stand.setVisible(false);
|
||||
|
@ -146,7 +146,7 @@ public class WinEffectLavaTrap extends WinEffectGadget
|
||||
Location loc = getBaseLocation().add(UtilAlg.getRight(dir).multiply(5)).add(0, 2, 0).subtract(dir);
|
||||
loc.setDirection(getBaseLocation().subtract(loc).toVector());
|
||||
|
||||
teleport(loc);
|
||||
super.teleport(loc);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -2,11 +2,11 @@ package mineplex.core.gadget.types;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.*;
|
||||
|
||||
import mineplex.core.common.util.*;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.block.BlockFace;
|
||||
@ -14,7 +14,10 @@ import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
|
||||
import org.bukkit.entity.ArmorStand;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
import org.bukkit.event.entity.FoodLevelChangeEvent;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
import org.bukkit.event.vehicle.VehicleExitEvent;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
@ -26,6 +29,7 @@ import mineplex.core.disguise.disguises.DisguisePlayer;
|
||||
import mineplex.core.gadget.GadgetManager;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.bukkit.util.Vector;
|
||||
import org.spigotmc.event.entity.EntityDismountEvent;
|
||||
|
||||
/**
|
||||
* A wrapper for different win effects
|
||||
@ -51,8 +55,8 @@ public abstract class WinEffectGadget extends Gadget
|
||||
protected List<Player> _nonTeam;
|
||||
/** All players on the team that didn't win + spectators which were not in the game at all. */
|
||||
protected List<Player> _other;
|
||||
/** All locked players */
|
||||
protected List<Player> _locked;
|
||||
/** All the players that were teleported to the winroom */
|
||||
protected List<Player> _allPlayers;
|
||||
|
||||
/**
|
||||
* @param manager The normal GadgetManager
|
||||
@ -90,55 +94,10 @@ public abstract class WinEffectGadget extends Gadget
|
||||
this._finish = _start + 1000*12;
|
||||
play();
|
||||
}
|
||||
|
||||
/**
|
||||
* Lock the player. Disabling any jump or walk movement
|
||||
* @param p The player to lock in place
|
||||
*/
|
||||
public void lockPlayer(Player p)
|
||||
{
|
||||
_locked.add(p);
|
||||
p.setWalkSpeed(0);
|
||||
p.setFlySpeed(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Unlock the player, allowing the player to walk and jump as normal again.
|
||||
* @param p The player to unlock
|
||||
*/
|
||||
public void unlockPlayer(Player p)
|
||||
{
|
||||
if (_locked.contains(p))
|
||||
_locked.remove(p);
|
||||
p.setWalkSpeed(0.2f);
|
||||
p.setFlySpeed(0.1f);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onMove(PlayerMoveEvent event)
|
||||
{
|
||||
for(PotionEffect p : event.getPlayer().getActivePotionEffects())
|
||||
{
|
||||
if(p.getType().equals(PotionEffectType.JUMP))
|
||||
{
|
||||
if(p.getAmplifier() == 250)
|
||||
{
|
||||
if(event.getTo().clone().subtract(event.getFrom()).lengthSquared() > 0)
|
||||
{
|
||||
Location loc = event.getPlayer().getLocation().getBlock().getLocation().add(0.5, 0, 0.5);
|
||||
loc.setDirection(event.getTo().getDirection());
|
||||
event.setTo(loc);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void runFinish()
|
||||
{
|
||||
finish();
|
||||
UtilServer.getPlayersCollection().forEach(p -> {unlockPlayer(p); UtilPlayer.showForAll(p); });
|
||||
_player = null;
|
||||
_baseLocation = null;
|
||||
_team.clear();
|
||||
@ -147,8 +106,8 @@ public abstract class WinEffectGadget extends Gadget
|
||||
_nonTeam = null;
|
||||
_other.clear();
|
||||
_other = null;
|
||||
_locked.clear();
|
||||
_locked = null;
|
||||
_allPlayers.clear();
|
||||
_allPlayers = null;
|
||||
// Loads gadgets back when players are teleported to the arcade hub, after the win effect
|
||||
for (Player player : UtilServer.getPlayers())
|
||||
{
|
||||
@ -221,7 +180,8 @@ public abstract class WinEffectGadget extends Gadget
|
||||
_other.remove(player);
|
||||
_other.removeAll(team);
|
||||
|
||||
_locked = new ArrayList<>();
|
||||
_allPlayers = new ArrayList<>();
|
||||
_allPlayers.addAll(UtilServer.getPlayersCollection());
|
||||
|
||||
this._start = System.currentTimeMillis();
|
||||
this._baseLocation = loc.clone();
|
||||
@ -245,32 +205,64 @@ public abstract class WinEffectGadget extends Gadget
|
||||
*/
|
||||
public void teleport(Location loc)
|
||||
{
|
||||
loc.getBlock().setType(Material.AIR);
|
||||
loc.getBlock().getRelative(BlockFace.UP).setType(Material.AIR);
|
||||
loc.getBlock().getRelative(BlockFace.DOWN).setType(Material.BARRIER);
|
||||
loc.getBlock().getRelative(BlockFace.EAST).getRelative(BlockFace.UP).setType(Material.BARRIER);
|
||||
loc.getBlock().getRelative(BlockFace.WEST).getRelative(BlockFace.UP).setType(Material.BARRIER);
|
||||
loc.getBlock().getRelative(BlockFace.NORTH).getRelative(BlockFace.UP).setType(Material.BARRIER);
|
||||
loc.getBlock().getRelative(BlockFace.SOUTH).getRelative(BlockFace.UP).setType(Material.BARRIER);
|
||||
loc.clone().add(0, 2, 0).getBlock().setType(Material.BARRIER);
|
||||
createBarriers(loc);
|
||||
|
||||
BukkitRunnable bRunnable = new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
for(Player p : UtilServer.getPlayers()) {
|
||||
lockPlayer(p);
|
||||
UtilPlayer.hideFromAll(p);
|
||||
p.teleport(loc);
|
||||
p.setGameMode(GameMode.ADVENTURE);
|
||||
p.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, 10 * 20, 1, false, false));
|
||||
p.getInventory().clear();
|
||||
p.teleport(loc.clone().add(.5, 0, .5));
|
||||
p.setAllowFlight(false);
|
||||
Manager.disableAll(p, false);
|
||||
p.setHealth(p.getMaxHealth());
|
||||
p.setFoodLevel(20);
|
||||
Manager.disableAll(p, true);
|
||||
}
|
||||
}
|
||||
};
|
||||
bRunnable.runTaskLater(UtilServer.getPlugin(), 10l);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Updates players inventory
|
||||
* @param event
|
||||
*/
|
||||
@EventHandler
|
||||
public void onUpdate(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.TICK)
|
||||
return;
|
||||
|
||||
if (!isRunning())
|
||||
return;
|
||||
|
||||
for (Player player : _allPlayers)
|
||||
{
|
||||
player.getInventory().clear();
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onFoodLevelChange(FoodLevelChangeEvent event)
|
||||
{
|
||||
if (isRunning())
|
||||
{
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerDamage(EntityDamageEvent event)
|
||||
{
|
||||
if (isRunning())
|
||||
{
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the win room, by default this will paste the scheamtic. Do any major setup here. This is called before the players are
|
||||
* teleported.
|
||||
@ -357,4 +349,69 @@ public abstract class WinEffectGadget extends Gadget
|
||||
}
|
||||
}
|
||||
|
||||
private void createBarriers(Location baseLocation)
|
||||
{
|
||||
// FLOOR
|
||||
Location floorBase = baseLocation.clone().subtract(0, 1, 0);
|
||||
setBarrierBlock(floorBase);
|
||||
setBarrierBlock(floorBase.clone().add(1, 0, 0));
|
||||
setBarrierBlock(floorBase.clone().add(0, 0, 1));
|
||||
setBarrierBlock(floorBase.clone().subtract(1, 0, 0));
|
||||
setBarrierBlock(floorBase.clone().subtract(0, 0, 1));
|
||||
setBarrierBlock(floorBase.clone().add(1, 0, 1));
|
||||
setBarrierBlock(floorBase.clone().add(1, 0, -1));
|
||||
setBarrierBlock(floorBase.clone().add(-1, 0, 1));
|
||||
setBarrierBlock(floorBase.clone().subtract(1, 0, 1));
|
||||
|
||||
// WALLS
|
||||
floorBase.add(0, 2, 0);
|
||||
setBarrierBlock(floorBase.clone().add(2, 0, 0));
|
||||
setBarrierBlock(floorBase.clone().add(2, 0, 1));
|
||||
setBarrierBlock(floorBase.clone().add(2, 0, -1));
|
||||
|
||||
setBarrierBlock(floorBase.clone().subtract(2, 0, 0));
|
||||
setBarrierBlock(floorBase.clone().subtract(2, 0, 1));
|
||||
setBarrierBlock(floorBase.clone().subtract(2, 0, -1));
|
||||
|
||||
setBarrierBlock(floorBase.clone().add(0, 0, 2));
|
||||
setBarrierBlock(floorBase.clone().add(1, 0, 2));
|
||||
setBarrierBlock(floorBase.clone().add(-1, 0, 2));
|
||||
|
||||
setBarrierBlock(floorBase.clone().subtract(0, 0, 2));
|
||||
setBarrierBlock(floorBase.clone().subtract(1, 0, 2));
|
||||
setBarrierBlock(floorBase.clone().subtract(-1, 0, 2));
|
||||
|
||||
// CEILING
|
||||
floorBase.add(0, 2, 0);
|
||||
setBarrierBlock(floorBase);
|
||||
setBarrierBlock(floorBase.clone().add(1, 0, 0));
|
||||
setBarrierBlock(floorBase.clone().add(0, 0, 1));
|
||||
setBarrierBlock(floorBase.clone().subtract(1, 0, 0));
|
||||
setBarrierBlock(floorBase.clone().subtract(0, 0, 1));
|
||||
setBarrierBlock(floorBase.clone().add(1, 0, 1));
|
||||
setBarrierBlock(floorBase.clone().add(1, 0, -1));
|
||||
setBarrierBlock(floorBase.clone().add(-1, 0, 1));
|
||||
setBarrierBlock(floorBase.clone().subtract(1, 0, 1));
|
||||
|
||||
// CHANGES MIDDLE TO AIR
|
||||
floorBase.subtract(1, 3, 1);
|
||||
for (int x = 0; x < 3; x++)
|
||||
{
|
||||
for (int y = 0; y < 3; y++)
|
||||
{
|
||||
for (int z = 0; z < 3; z++)
|
||||
{
|
||||
floorBase.clone().add(x, y, z).getBlock().setType(Material.AIR);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void setBarrierBlock(Location blockLocation)
|
||||
{
|
||||
if (blockLocation.getBlock().getType() == Material.AIR)
|
||||
blockLocation.getBlock().setType(Material.BARRIER);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -173,7 +173,7 @@ public class GiveawayManager extends MiniDbClientPlugin<PlayerGiveawayData>
|
||||
}
|
||||
|
||||
@Override
|
||||
protected PlayerGiveawayData AddPlayer(String player)
|
||||
protected PlayerGiveawayData addPlayer(String player)
|
||||
{
|
||||
return new PlayerGiveawayData();
|
||||
}
|
||||
|
@ -80,7 +80,7 @@ public class IgnoreManager extends MiniDbClientPlugin<IgnoreData>
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IgnoreData AddPlayer(String player)
|
||||
protected IgnoreData addPlayer(String player)
|
||||
{
|
||||
return new IgnoreData();
|
||||
}
|
||||
|
@ -191,7 +191,7 @@ public class IncognitoManager extends MiniDbClientPlugin<IncognitoClient>
|
||||
UtilPlayer.message(player, " ");
|
||||
}
|
||||
|
||||
protected IncognitoClient AddPlayer(String player)
|
||||
protected IncognitoClient addPlayer(String player)
|
||||
{
|
||||
return new IncognitoClient();
|
||||
}
|
||||
|
@ -342,7 +342,7 @@ public class InventoryManager extends MiniDbClientPlugin<ClientInventory>
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ClientInventory AddPlayer(String player)
|
||||
protected ClientInventory addPlayer(String player)
|
||||
{
|
||||
return new ClientInventory();
|
||||
}
|
||||
|
@ -87,7 +87,7 @@ public class MessageManager extends MiniClientPlugin<ClientMessage>
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ClientMessage AddPlayer(String player)
|
||||
protected ClientMessage addPlayer(String player)
|
||||
{
|
||||
Set(player, new ClientMessage());
|
||||
return Get(player);
|
||||
|
@ -40,7 +40,7 @@ public class Movement extends MiniClientPlugin<ClientMovement>
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ClientMovement AddPlayer(String player)
|
||||
protected ClientMovement addPlayer(String player)
|
||||
{
|
||||
return new ClientMovement();
|
||||
}
|
||||
|
@ -1,12 +1,8 @@
|
||||
package mineplex.core.packethandler;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import com.mineplex.spigot.PacketProcessor;
|
||||
import mineplex.core.MiniPlugin;
|
||||
import net.minecraft.server.v1_8_R3.Packet;
|
||||
|
||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
@ -15,16 +11,22 @@ import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import com.mineplex.spigot.PacketProcessor;
|
||||
|
||||
import mineplex.core.MiniPlugin;
|
||||
import mineplex.core.common.util.NautHashMap;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
import java.util.TreeMap;
|
||||
|
||||
public class PacketHandler extends MiniPlugin
|
||||
{
|
||||
private NautHashMap<Player, PacketVerifier> _playerVerifierMap = new NautHashMap<Player, PacketVerifier>();
|
||||
private HashMap<Class, ArrayList<IPacketHandler>> _forceMainThread = new HashMap<Class, ArrayList<IPacketHandler>>();
|
||||
private HashMap<Class, ArrayList<IPacketHandler>> _packetHandlers = new HashMap<Class, ArrayList<IPacketHandler>>();
|
||||
private Map<Player, PacketVerifier> _playerVerifierMap = new HashMap<>();
|
||||
|
||||
private Map<Class<? extends Packet>, Set<IPacketHandler>> _forceMainThread = new HashMap<>();
|
||||
private Map<Class<? extends Packet>, Map<ListenerPriority, List<IPacketHandler>>> _packetHandlers = new HashMap<>();
|
||||
|
||||
public PacketHandler(JavaPlugin plugin)
|
||||
{
|
||||
@ -40,18 +42,6 @@ public class PacketHandler extends MiniPlugin
|
||||
.get(event.getPlayer()));
|
||||
}
|
||||
|
||||
public boolean handlePacket(Player player, Packet packet)
|
||||
{
|
||||
if (!_playerVerifierMap.containsKey(player))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
PacketVerifier verifier = _playerVerifierMap.get(player);
|
||||
|
||||
return handlePacket(new PacketInfo(player, packet, verifier));
|
||||
}
|
||||
|
||||
public boolean handlePacket(PacketInfo packetInfo)
|
||||
{
|
||||
if (!_packetHandlers.containsKey(packetInfo.getPacket().getClass()))
|
||||
@ -60,15 +50,18 @@ public class PacketHandler extends MiniPlugin
|
||||
return true;
|
||||
}
|
||||
|
||||
for (IPacketHandler handler : _packetHandlers.get(packetInfo.getPacket().getClass()))
|
||||
for (Entry<ListenerPriority, List<IPacketHandler>> entry : _packetHandlers.get(packetInfo.getPacket().getClass()).entrySet())
|
||||
{
|
||||
try
|
||||
for (IPacketHandler handler : entry.getValue())
|
||||
{
|
||||
handler.handle(packetInfo);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ex.printStackTrace();
|
||||
try
|
||||
{
|
||||
handler.handle(packetInfo);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -90,72 +83,106 @@ public class PacketHandler extends MiniPlugin
|
||||
@SafeVarargs
|
||||
public final void addPacketHandler(IPacketHandler packetHandler, Class<? extends Packet>... packetsToListen)
|
||||
{
|
||||
if (packetsToListen.length == 0)
|
||||
{
|
||||
throw new IllegalArgumentException("When registering a new packet listener, add the packets its going to listen to");
|
||||
}
|
||||
|
||||
addPacketHandler(packetHandler, false, packetsToListen);
|
||||
addPacketHandler(packetHandler, ListenerPriority.NORMAL, false, packetsToListen);
|
||||
}
|
||||
|
||||
/**
|
||||
* This should only be used for incoming packets
|
||||
*/
|
||||
public void addPacketHandler(IPacketHandler packetHandler, boolean forceMainThread,
|
||||
Class<? extends Packet>... packetsToListen)
|
||||
@SafeVarargs
|
||||
public final void addPacketHandler(IPacketHandler packetHandler, boolean forceMainThread, Class<? extends Packet>... packetsToListen)
|
||||
{
|
||||
if (packetsToListen.length == 0)
|
||||
{
|
||||
throw new IllegalArgumentException("When registering a new packet listener, add the packets its going to listen to");
|
||||
}
|
||||
|
||||
for (Class c : packetsToListen)
|
||||
addPacketHandler(packetHandler, ListenerPriority.NORMAL, forceMainThread, packetsToListen);
|
||||
}
|
||||
|
||||
@SafeVarargs
|
||||
public final void addPacketHandler(IPacketHandler packetHandler, ListenerPriority priority, Class<? extends Packet>... packetsToListen)
|
||||
{
|
||||
if (packetsToListen.length == 0)
|
||||
{
|
||||
throw new IllegalArgumentException("When registering a new packet listener, add the packets its going to listen to");
|
||||
}
|
||||
|
||||
addPacketHandler(packetHandler, priority, false, packetsToListen);
|
||||
}
|
||||
|
||||
/**
|
||||
* This should only be used for incoming packets
|
||||
*/
|
||||
@SafeVarargs
|
||||
public final void addPacketHandler(IPacketHandler packetHandler, ListenerPriority priority, boolean forceMainThread,
|
||||
Class<? extends Packet>... packetsToListen)
|
||||
{
|
||||
if (packetsToListen.length == 0)
|
||||
{
|
||||
throw new IllegalArgumentException("When registering a new packet listener, add the packets its going to listen to");
|
||||
}
|
||||
|
||||
for (Class<? extends Packet> c : packetsToListen)
|
||||
{
|
||||
if (forceMainThread)
|
||||
{
|
||||
if (!_forceMainThread.containsKey(c))
|
||||
{
|
||||
_forceMainThread.put(c, new ArrayList());
|
||||
}
|
||||
|
||||
_forceMainThread.get(c).add(packetHandler);
|
||||
_forceMainThread
|
||||
.computeIfAbsent(c, key -> new HashSet<>())
|
||||
.add(packetHandler);
|
||||
}
|
||||
|
||||
if (!_packetHandlers.containsKey(c))
|
||||
{
|
||||
_packetHandlers.put(c, new ArrayList());
|
||||
}
|
||||
_packetHandlers
|
||||
.computeIfAbsent(c, key -> new TreeMap<>())
|
||||
.computeIfAbsent(priority, key -> new ArrayList<>())
|
||||
.add(packetHandler);
|
||||
|
||||
_packetHandlers.get(c).add(packetHandler);
|
||||
PacketProcessor.addPacket(c, forceMainThread || _forceMainThread.containsKey(c));
|
||||
}
|
||||
}
|
||||
|
||||
public void removePacketHandler(IPacketHandler packetHandler)
|
||||
{
|
||||
Iterator<Entry<Class, ArrayList<IPacketHandler>>> itel = _packetHandlers.entrySet().iterator();
|
||||
Iterator<Entry<Class<? extends Packet>, Map<ListenerPriority, List<IPacketHandler>>>> itel = _packetHandlers.entrySet().iterator();
|
||||
|
||||
while (itel.hasNext())
|
||||
{
|
||||
Entry<Class, ArrayList<IPacketHandler>> entry = itel.next();
|
||||
Entry<Class<? extends Packet>, Map<ListenerPriority, List<IPacketHandler>>> entry = itel.next();
|
||||
|
||||
if (entry.getValue().remove(packetHandler))
|
||||
Set<ListenerPriority> removedFrom = new HashSet<>();
|
||||
|
||||
for (Entry<ListenerPriority, List<IPacketHandler>> ent : entry.getValue().entrySet())
|
||||
{
|
||||
if (_forceMainThread.containsKey(entry.getKey()) && _forceMainThread.get(entry.getKey()).remove(packetHandler))
|
||||
if (ent.getValue().remove(packetHandler))
|
||||
{
|
||||
if (_forceMainThread.get(entry.getKey()).isEmpty())
|
||||
{
|
||||
_forceMainThread.remove(entry.getKey());
|
||||
PacketProcessor.addPacket(entry.getKey(), false);
|
||||
}
|
||||
removedFrom.add(ent.getKey());
|
||||
}
|
||||
}
|
||||
|
||||
if (entry.getValue().isEmpty())
|
||||
for (ListenerPriority priority : removedFrom)
|
||||
{
|
||||
if (entry.getValue().get(priority).isEmpty())
|
||||
{
|
||||
PacketProcessor.removePacket(entry.getKey());
|
||||
itel.remove();
|
||||
entry.getValue().remove(priority);
|
||||
}
|
||||
}
|
||||
|
||||
if (_forceMainThread.containsKey(entry.getKey()) && _forceMainThread.get(entry.getKey()).remove(packetHandler))
|
||||
{
|
||||
if (_forceMainThread.get(entry.getKey()).isEmpty())
|
||||
{
|
||||
_forceMainThread.remove(entry.getKey());
|
||||
PacketProcessor.addPacket(entry.getKey(), false);
|
||||
}
|
||||
}
|
||||
|
||||
if (entry.getValue().isEmpty())
|
||||
{
|
||||
PacketProcessor.removePacket(entry.getKey());
|
||||
itel.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public enum ListenerPriority
|
||||
{
|
||||
HIGH, NORMAL, LOW
|
||||
}
|
||||
}
|
||||
|
@ -24,17 +24,17 @@ public class Pet extends SalesPackageBase
|
||||
KnownPackage = false;
|
||||
}
|
||||
|
||||
public EntityType GetPetType()
|
||||
public EntityType getPetType()
|
||||
{
|
||||
return _petType;
|
||||
}
|
||||
|
||||
public void Update(PetSalesToken petToken)
|
||||
public void update(PetSalesToken petToken)
|
||||
{
|
||||
_name = petToken.Name;
|
||||
}
|
||||
|
||||
public String GetPetName()
|
||||
public String getPetName()
|
||||
{
|
||||
return _name;
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ public class PetClient
|
||||
private NautHashMap<EntityType, String> _pets;
|
||||
private int _petNameTagCount;
|
||||
|
||||
public void Load(ClientPetToken token)
|
||||
public void load(ClientPetToken token)
|
||||
{
|
||||
_pets = new NautHashMap<EntityType, String>();
|
||||
|
||||
@ -26,7 +26,7 @@ public class PetClient
|
||||
_petNameTagCount = Math.max(0, token.PetNameTagCount);
|
||||
}
|
||||
|
||||
public NautHashMap<EntityType, String> GetPets()
|
||||
public NautHashMap<EntityType, String> getPets()
|
||||
{
|
||||
return _pets;
|
||||
}
|
||||
|
@ -128,7 +128,7 @@ public class PetManager extends MiniClientPlugin<PetClient>
|
||||
|
||||
if (player != null && player.isOnline())
|
||||
{
|
||||
AddPetOwner(player, _petOwnerQueue.get(playerName), player.getLocation());
|
||||
addPetOwner(player, _petOwnerQueue.get(playerName), player.getLocation());
|
||||
}
|
||||
}
|
||||
|
||||
@ -160,24 +160,24 @@ public class PetManager extends MiniClientPlugin<PetClient>
|
||||
|
||||
if (rank.has(Rank.LEGEND))
|
||||
{
|
||||
if (!Get(p).GetPets().containsKey(EntityType.WITHER))
|
||||
Get(p).GetPets().put(EntityType.WITHER, "Widder");
|
||||
if (!Get(p).getPets().containsKey(EntityType.WITHER))
|
||||
Get(p).getPets().put(EntityType.WITHER, "Widder");
|
||||
}
|
||||
|
||||
if (rank.has(Rank.TITAN))
|
||||
{
|
||||
if (!Get(p).GetPets().containsKey(EntityType.SKELETON))
|
||||
Get(p).GetPets().put(EntityType.SKELETON, "Guardian");
|
||||
if (!Get(p).getPets().containsKey(EntityType.SKELETON))
|
||||
Get(p).getPets().put(EntityType.SKELETON, "Guardian");
|
||||
}
|
||||
}
|
||||
|
||||
public void AddPetOwner(Player player, EntityType entityType, Location location)
|
||||
public void addPetOwner(Player player, EntityType entityType, Location location)
|
||||
{
|
||||
if (_activePetOwners.containsKey(player.getName()))
|
||||
{
|
||||
if (_activePetOwners.get(player.getName()).getType() != entityType)
|
||||
{
|
||||
RemovePet(player, true);
|
||||
removePet(player, true);
|
||||
}
|
||||
else
|
||||
return;
|
||||
@ -214,10 +214,10 @@ public class PetManager extends MiniClientPlugin<PetClient>
|
||||
}
|
||||
|
||||
//Named Pet
|
||||
if (Get(player).GetPets().get(entityType) != null && Get(player).GetPets().get(entityType).length() > 0)
|
||||
if (Get(player).getPets().get(entityType) != null && Get(player).getPets().get(entityType).length() > 0)
|
||||
{
|
||||
//pet.setCustomNameVisible(true);
|
||||
pet.setCustomName(Get(player).GetPets().get(entityType));
|
||||
pet.setCustomName(Get(player).getPets().get(entityType));
|
||||
}
|
||||
|
||||
if (pet instanceof Zombie)
|
||||
@ -245,9 +245,9 @@ public class PetManager extends MiniClientPlugin<PetClient>
|
||||
|
||||
DisguiseGuardian disguise = new DisguiseGuardian(pet);
|
||||
|
||||
if (Get(player).GetPets().get(entityType) != null && Get(player).GetPets().get(entityType).length() > 0)
|
||||
if (Get(player).getPets().get(entityType) != null && Get(player).getPets().get(entityType).length() > 0)
|
||||
{
|
||||
disguise.setName(Get(player).GetPets().get(entityType));
|
||||
disguise.setName(Get(player).getPets().get(entityType));
|
||||
}
|
||||
|
||||
_disguiseManager.disguise(disguise);
|
||||
@ -265,12 +265,12 @@ public class PetManager extends MiniClientPlugin<PetClient>
|
||||
UtilEnt.Vegetate(pet);
|
||||
}
|
||||
|
||||
public Creature GetPet(Player player)
|
||||
public Creature getPet(Player player)
|
||||
{
|
||||
return _activePetOwners.get(player.getName());
|
||||
}
|
||||
|
||||
public void RemovePet(final Player player, boolean removeOwner)
|
||||
public void removePet(final Player player, boolean removeOwner)
|
||||
{
|
||||
if (_activePetOwners.containsKey(player.getName()))
|
||||
{
|
||||
@ -303,7 +303,7 @@ public class PetManager extends MiniClientPlugin<PetClient>
|
||||
@EventHandler
|
||||
public void onPlayerQuit(PlayerQuitEvent event)
|
||||
{
|
||||
RemovePet(event.getPlayer(), true);
|
||||
removePet(event.getPlayer(), true);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@ -336,7 +336,7 @@ public class PetManager extends MiniClientPlugin<PetClient>
|
||||
|
||||
if (player != null && player.isOnline())
|
||||
{
|
||||
RemovePet(player, true);
|
||||
removePet(player, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -438,25 +438,25 @@ public class PetManager extends MiniClientPlugin<PetClient>
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void OnClientWebResponse(ClientWebResponseEvent event)
|
||||
public void onClientWebResponse(ClientWebResponseEvent event)
|
||||
{
|
||||
ClientPetTokenWrapper token = new Gson().fromJson(event.GetResponse(), ClientPetTokenWrapper.class);
|
||||
|
||||
Get(token.Name).Load(token.DonorToken);
|
||||
Get(token.Name).load(token.DonorToken);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected PetClient AddPlayer(String player)
|
||||
protected PetClient addPlayer(String player)
|
||||
{
|
||||
return new PetClient();
|
||||
}
|
||||
|
||||
public PetFactory GetFactory()
|
||||
public PetFactory getFactory()
|
||||
{
|
||||
return _petFactory;
|
||||
}
|
||||
|
||||
public PetRepository GetRepository()
|
||||
public PetRepository getRepository()
|
||||
{
|
||||
return _repository;
|
||||
}
|
||||
@ -471,15 +471,15 @@ public class PetManager extends MiniClientPlugin<PetClient>
|
||||
return _activePetOwners.get(name);
|
||||
}
|
||||
|
||||
public void DisableAll()
|
||||
public void disableAll()
|
||||
{
|
||||
for (Player player : UtilServer.getPlayers())
|
||||
RemovePet(player, true);
|
||||
removePet(player, true);
|
||||
}
|
||||
|
||||
public void DisableAll(Player player)
|
||||
public void disableAll(Player player)
|
||||
{
|
||||
RemovePet(player, true);
|
||||
removePet(player, true);
|
||||
}
|
||||
|
||||
public Collection<Creature> getPets()
|
||||
|
@ -51,7 +51,7 @@ public class PollManager extends MiniDbClientPlugin<PlayerPollData>
|
||||
}
|
||||
|
||||
@Override
|
||||
protected PlayerPollData AddPlayer(String player)
|
||||
protected PlayerPollData addPlayer(String player)
|
||||
{
|
||||
return new PlayerPollData();
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ public class PreferencesManager extends MiniDbClientPlugin<UserPreferences>
|
||||
}
|
||||
|
||||
@Override
|
||||
protected UserPreferences AddPlayer(String player)
|
||||
protected UserPreferences addPlayer(String player)
|
||||
{
|
||||
return new UserPreferences();
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ public class KitProgressionManager extends MiniClientPlugin<PlayerKit>
|
||||
|
||||
|
||||
@Override
|
||||
protected PlayerKit AddPlayer(String player)
|
||||
protected PlayerKit addPlayer(String player)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
@ -864,7 +864,7 @@ public class RewardManager
|
||||
{
|
||||
if (!displayName.contains("Uncle Sam"))
|
||||
{
|
||||
display = CountryFlag.Usa.getBanner();
|
||||
display = CountryFlag.USA.getBanner();
|
||||
}
|
||||
}
|
||||
UnknownPackageReward reward =
|
||||
@ -929,7 +929,7 @@ public class RewardManager
|
||||
|
||||
public PetReward addPetReward(Type type, EntityType entityType, RewardRarity rarity, int weight, int shards)
|
||||
{
|
||||
Pet pet = _petManager.GetFactory().getPet(entityType);
|
||||
Pet pet = _petManager.getFactory().getPet(entityType);
|
||||
PetReward reward = new PetReward(_petManager, _inventoryManager, _donationManager,
|
||||
pet.getName() + " Pet", pet.getName(), entityType, rarity, weight, shards);
|
||||
addReward(type, reward);
|
||||
|
@ -50,8 +50,8 @@ public class PetReward extends UnknownPackageReward
|
||||
PetToken petToken = new PetToken();
|
||||
petToken.PetType = token.PetType;
|
||||
|
||||
_petManager.GetRepository().AddPet(token);
|
||||
_petManager.Get(player).GetPets().put(_petEntity, token.PetName);
|
||||
_petManager.getRepository().AddPet(token);
|
||||
_petManager.Get(player).getPets().put(_petEntity, token.PetName);
|
||||
|
||||
_inventoryManager.addItemToInventory(player, _petEntity.toString(), 1);
|
||||
|
||||
@ -67,6 +67,6 @@ public class PetReward extends UnknownPackageReward
|
||||
return false;
|
||||
}
|
||||
|
||||
return !_petManager.Get(player).GetPets().containsKey(_petEntity);
|
||||
return !_petManager.Get(player).getPets().containsKey(_petEntity);
|
||||
}
|
||||
}
|
||||
|
@ -307,7 +307,7 @@ public class StatsManager extends MiniDbClientPlugin<PlayerStats>
|
||||
}
|
||||
|
||||
@Override
|
||||
protected PlayerStats AddPlayer(String player)
|
||||
protected PlayerStats addPlayer(String player)
|
||||
{
|
||||
return new PlayerStats();
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ public class TaskManager extends MiniDbClientPlugin<TaskClient>
|
||||
}
|
||||
|
||||
@Override
|
||||
protected TaskClient AddPlayer(String playerName)
|
||||
protected TaskClient addPlayer(String playerName)
|
||||
{
|
||||
return new TaskClient();
|
||||
}
|
||||
|
@ -80,7 +80,7 @@ public class TournamentManager extends MiniDbClientPlugin<ClientTournamentData>
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ClientTournamentData AddPlayer(String player)
|
||||
protected ClientTournamentData addPlayer(String player)
|
||||
{
|
||||
return new ClientTournamentData();
|
||||
}
|
||||
|
@ -40,6 +40,19 @@ public class BuyChestButton implements IButton
|
||||
@Override
|
||||
public void onClick(final Player player, ClickType clickType)
|
||||
{
|
||||
if (_chestType == TreasureType.FREEDOM)
|
||||
{
|
||||
if (!_page.getPlugin().hasItemsToGivePlayer(_chestType.getRewardPool(), player))
|
||||
{
|
||||
player.sendMessage(F.main("Treasure", "You seem to have all treasures for this chest unlocked already!"));
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
player.sendMessage(F.main("Treasure", "This chest is no longer available for purchases!"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (!_page.getPlugin().hasItemsToGivePlayer(TreasureType.ILLUMINATED.getRewardPool(), player)
|
||||
&& _chestType == TreasureType.ILLUMINATED)
|
||||
{
|
||||
|
@ -13,6 +13,7 @@ import mineplex.core.gadget.types.Gadget;
|
||||
import mineplex.core.gadget.types.GadgetType;
|
||||
import mineplex.core.mount.Mount;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.DyeColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
@ -166,13 +167,11 @@ public class TreasurePage extends ShopPageBase<TreasureManager, TreasureShop>
|
||||
freedomLore.add(C.cGray + "carved this chest himself from the wood");
|
||||
freedomLore.add(C.cGray + "of the apple tree he cut down...");
|
||||
freedomLore.add(" ");
|
||||
if (freedomCount > 0)
|
||||
if (freedomCount > 0 && !hasAllFreedomItems(getPlayer()))
|
||||
freedomLore.add(ChatColor.RESET + C.cGreen + "Click to Open!");
|
||||
else
|
||||
{
|
||||
freedomLore.add(ChatColor.RESET + "Click to craft for " + C.cAqua + "35000 Treasure Shards");
|
||||
freedomLore.add(" ");
|
||||
freedomLore.add(ChatColor.RESET + "or Purchase at: " + C.cYellow + "www.mineplex.com/shop");
|
||||
freedomLore.add(C.cRed + "This item is no longer available!");
|
||||
}
|
||||
freedomLore.add(" ");
|
||||
freedomLore.add(ChatColor.RESET + C.cGreen + getFreedomUnlockedAmount(getPlayer()) + "/7 Unlocked");
|
||||
@ -188,8 +187,13 @@ public class TreasurePage extends ShopPageBase<TreasureManager, TreasureShop>
|
||||
addItem(40, shards);
|
||||
|
||||
addChest(11, christmas, TreasureType.CHRISTMAS, christmasCount);
|
||||
if (!hasAllFreedomItems(getPlayer()))
|
||||
if (!hasAllFreedomItems(getPlayer()) && freedomCount >= 1)
|
||||
addChest(13, freedom, TreasureType.FREEDOM, freedomCount);
|
||||
else
|
||||
{
|
||||
freedom = new ShopItem(Material.INK_SACK, DyeColor.SILVER.getData(), C.cRed + C.Bold + "Freedom " + C.cBlue + C.Bold + "Treasure", freedomLore.toArray(new String[0]), 0, true, false);
|
||||
addChest(13, freedom, TreasureType.FREEDOM, freedomCount);
|
||||
}
|
||||
addChest(15, illuminated, TreasureType.ILLUMINATED, illuminatedCount);
|
||||
addChest(20, basic, TreasureType.OLD, basicCount);
|
||||
addChest(22, heroic, TreasureType.ANCIENT, heroicCount);
|
||||
|
@ -2,7 +2,10 @@ package mineplex.core.youtube;
|
||||
|
||||
import mineplex.core.MiniDbClientPlugin;
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
@ -14,6 +17,7 @@ import java.time.ZonedDateTime;
|
||||
|
||||
public class YoutubeManager extends MiniDbClientPlugin<YoutubeClient>
|
||||
{
|
||||
private static final int REWARD_MESSAGE_DELAY_SECONDS = 30;
|
||||
private final YoutubeRepository _repository;
|
||||
private final DonationManager _donationManager;
|
||||
|
||||
@ -48,7 +52,11 @@ public class YoutubeManager extends MiniDbClientPlugin<YoutubeClient>
|
||||
}
|
||||
YoutubeClient client = Get(player);
|
||||
client.setClickDate(ZonedDateTime.now(ZoneOffset.UTC).toLocalDate());
|
||||
_repository.attemptYoutube(player, client, () -> _donationManager.RewardCoinsLater("YouTube", player, 250));
|
||||
_repository.attemptYoutube(player, client, () ->
|
||||
{
|
||||
_donationManager.RewardCoinsLater("YouTube", player, 250);
|
||||
Bukkit.getScheduler().runTaskLater(getClientManager().getPlugin(), () -> UtilPlayer.message(player, F.main("Carl", "Rewarded " + F.elem("250 Treasure Shards") + " for watching the YouTube video")), REWARD_MESSAGE_DELAY_SECONDS * 20L);
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -68,7 +76,7 @@ public class YoutubeManager extends MiniDbClientPlugin<YoutubeClient>
|
||||
}
|
||||
|
||||
@Override
|
||||
protected YoutubeClient AddPlayer(String player)
|
||||
protected YoutubeClient addPlayer(String player)
|
||||
{
|
||||
return new YoutubeClient(null);
|
||||
}
|
||||
|
@ -89,11 +89,14 @@ import mineplex.minecraft.game.classcombat.shop.ClassCombatShop;
|
||||
import mineplex.minecraft.game.classcombat.shop.ClassShopManager;
|
||||
import mineplex.minecraft.game.core.IRelation;
|
||||
import mineplex.minecraft.game.core.combat.CombatManager;
|
||||
import mineplex.minecraft.game.core.condition.Condition;
|
||||
import mineplex.minecraft.game.core.condition.ConditionManager;
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
import mineplex.minecraft.game.core.damage.DamageManager;
|
||||
import mineplex.minecraft.game.core.fire.Fire;
|
||||
import mineplex.minecraft.game.core.mechanics.Weapon;
|
||||
import mineplex.serverdata.commands.ServerCommandManager;
|
||||
import net.md_5.bungee.api.ChatColor;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
@ -321,6 +324,19 @@ public class ClansManager extends MiniClientPlugin<ClientClan>implements IRelati
|
||||
Material targetType = event.getTargetBlock().getType();
|
||||
event.setCancelled(targetType == Material.POTATO || targetType == Material.CARROT);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void on(CustomDamageEvent event)
|
||||
{
|
||||
if (event.GetCause() == EntityDamageEvent.DamageCause.CUSTOM
|
||||
&& event.GetDamageInitial() == 0.1
|
||||
&& event.GetDamageePlayer() != null)
|
||||
{
|
||||
Condition poisonShock = _condition.GetActiveCondition(event.GetDamageePlayer(), Condition.ConditionType.POISON_SHOCK);
|
||||
if (poisonShock != null)
|
||||
event.SetIgnoreArmor(true);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
_worldEvent.setFactory(skillManager);
|
||||
@ -984,7 +1000,7 @@ public class ClansManager extends MiniClientPlugin<ClientClan>implements IRelati
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ClientClan AddPlayer(String player)
|
||||
protected ClientClan addPlayer(String player)
|
||||
{
|
||||
return new ClientClan();
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package mineplex.game.clans.clans.commands;
|
||||
|
||||
import mineplex.game.clans.clans.ClansManager;
|
||||
import mineplex.minecraft.game.classcombat.Skill.Global.Recharge;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.command.CommandBase;
|
||||
@ -29,6 +30,11 @@ public class KillCommand extends CommandBase<DamageManager>
|
||||
UtilPlayer.message(caller, F.main("Clans", "You cannot use this command whilst in the tutorial."));
|
||||
return;
|
||||
}
|
||||
if (mineplex.core.recharge.Recharge.Instance.use(caller, "Suicide", 5000, false, false))
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "Please wait a bit before suiciding"));
|
||||
return;
|
||||
}
|
||||
|
||||
UtilPlayer.message(caller, F.main("Clans", "You have imploded."));
|
||||
|
||||
|
@ -62,7 +62,7 @@ public class ClanWhoPage extends ClanPageBase
|
||||
|
||||
// Basic Clan Info
|
||||
lore.add(C.Reset + C.cYellow + "Founder " + C.cWhite + _lookupClan.getDesc());
|
||||
lore.add(C.Reset + C.cYellow + "Formed " + C.cWhite + UtilTime.convertString(System.currentTimeMillis() - _lookupClan.getDateCreated().getTime(), 1, UtilTime.TimeUnit.FIT));
|
||||
lore.add(C.Reset + C.cYellow + "Formed " + C.cWhite + UtilTime.convertString(System.currentTimeMillis() - _lookupClan.getDateCreated().getTime(), 1, UtilTime.TimeUnit.FIT) + " ago on " + UtilTime.when(_lookupClan.getDateCreated().getTime()));
|
||||
lore.add(C.Reset + C.cYellow + "Members " + C.cWhite + _lookupClan.getOnlinePlayerCount() + "/" + _lookupClan.getMembers().size());
|
||||
lore.add(C.Reset + C.cYellow + "Territory " + C.cWhite + _lookupClan.getClaims() + "/" + _lookupClan.getClaimsMax());
|
||||
lore.add(C.Reset + C.cYellow + "TNT Protection " + C.cWhite + _lookupClan.getProtected());
|
||||
|
@ -204,7 +204,7 @@ public class MurderManager extends MiniClientPlugin<ClientMurder>
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ClientMurder AddPlayer(String player)
|
||||
protected ClientMurder addPlayer(String player)
|
||||
{
|
||||
return new ClientMurder();
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ public class Playtime extends MiniClientPlugin<PlayingClient>
|
||||
@EventHandler
|
||||
public void onPlayerJoin(PlayerJoinEvent event)
|
||||
{
|
||||
Set(event.getPlayer(), AddPlayer(event.getPlayer().getName()));
|
||||
Set(event.getPlayer(), addPlayer(event.getPlayer().getName()));
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@ -73,7 +73,7 @@ public class Playtime extends MiniClientPlugin<PlayingClient>
|
||||
}
|
||||
|
||||
@Override
|
||||
protected PlayingClient AddPlayer(String player)
|
||||
protected PlayingClient addPlayer(String player)
|
||||
{
|
||||
return new PlayingClient(Bukkit.getPlayer(player), TaskManager.Instance);
|
||||
}
|
||||
|
@ -58,7 +58,10 @@ public class SafeLog extends MiniPlugin
|
||||
|
||||
if (!isSafeLog)
|
||||
{
|
||||
NPCManager.getInstance().spawnLogoutNpc(player);
|
||||
if (!_clansManager.getIncognitoManager().Get(player).Status)
|
||||
{
|
||||
NPCManager.getInstance().spawnLogoutNpc(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6,6 +6,9 @@ import java.util.UUID;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftItem;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.inventory.CraftItemFactory;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.inventory.CraftItemStack;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
@ -105,7 +108,7 @@ public class CustomItem implements Listener
|
||||
|
||||
public ItemStack toItemStack(int amount)
|
||||
{
|
||||
ItemStack item = new ItemStack(_material, amount);
|
||||
ItemStack item = CraftItemStack.asCraftMirror(CraftItemStack.asNMSCopy(new ItemStack(_material, amount)));
|
||||
update(item);
|
||||
|
||||
if (_dullEnchantment)
|
||||
|
@ -2,6 +2,8 @@ package mineplex.game.clans.items;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.EnumSet;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
@ -86,21 +88,6 @@ import net.minecraft.server.v1_8_R3.PacketPlayOutWindowItems;
|
||||
*/
|
||||
public class GearManager extends MiniPlugin implements IPacketHandler, Runnable
|
||||
{
|
||||
private static final Field UNHANDLED_TAGS_FIELD;
|
||||
|
||||
static
|
||||
{
|
||||
try
|
||||
{
|
||||
UNHANDLED_TAGS_FIELD = Class.forName("org.bukkit.craftbukkit.v1_8_R3.inventory.CraftMetaItem").getDeclaredField("unhandledTags");
|
||||
UNHANDLED_TAGS_FIELD.setAccessible(true);
|
||||
}
|
||||
catch (Throwable t)
|
||||
{
|
||||
throw new RuntimeException("Error getting unhandledTags field", t);
|
||||
}
|
||||
}
|
||||
|
||||
private static final String ITEM_SERIALIZATION_TAG = "-JSON-";
|
||||
private static final Gson GSON;
|
||||
|
||||
@ -626,7 +613,7 @@ public class GearManager extends MiniPlugin implements IPacketHandler, Runnable
|
||||
return null;
|
||||
}
|
||||
|
||||
CraftItemStack originalItem = CraftItemStack.asCraftMirror(item);
|
||||
CraftItemStack originalItem = CraftItemStack.asCraftMirror(item.cloneItemStack());
|
||||
ItemMeta originalMeta = originalItem.getItemMeta();
|
||||
|
||||
// No need to modify item packets with no lore
|
||||
@ -680,7 +667,7 @@ public class GearManager extends MiniPlugin implements IPacketHandler, Runnable
|
||||
List<String> cleansed = new ArrayList<>();
|
||||
for (String s : input)
|
||||
{
|
||||
if (!s.startsWith(ITEM_SERIALIZATION_TAG))
|
||||
if (s.startsWith(ITEM_SERIALIZATION_TAG))
|
||||
{
|
||||
cleansed.add(s);
|
||||
}
|
||||
@ -697,40 +684,35 @@ public class GearManager extends MiniPlugin implements IPacketHandler, Runnable
|
||||
// This will not be persistent if the ItemStack is a block and placed then picked up
|
||||
private static Map<String, NBTBase> getUnhandledTags(ItemStack itemStack)
|
||||
{
|
||||
ItemMeta itemMeta = itemStack.getItemMeta();
|
||||
if (itemMeta == null)
|
||||
net.minecraft.server.v1_8_R3.ItemStack handle = ((CraftItemStack) itemStack).getHandle();
|
||||
if (handle == null)
|
||||
return Collections.emptyMap();
|
||||
|
||||
NBTTagCompound tag = handle.getTag();
|
||||
|
||||
if (tag == null)
|
||||
return Collections.emptyMap();
|
||||
|
||||
Map<String, NBTBase> unhandled = new HashMap<>();
|
||||
for (String name : tag.c())
|
||||
{
|
||||
return null;
|
||||
unhandled.put(name, tag.get(name));
|
||||
}
|
||||
try
|
||||
{
|
||||
return (Map<String, NBTBase>) UNHANDLED_TAGS_FIELD.get(itemMeta);
|
||||
}
|
||||
catch (IllegalAccessException e)
|
||||
{
|
||||
System.out.println("Could not get unhandledTags");
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
return unhandled;
|
||||
}
|
||||
|
||||
private static void saveUnhandledTags(ItemStack itemStack, Map<String, NBTBase> map)
|
||||
{
|
||||
ItemMeta itemMeta = itemStack.getItemMeta();
|
||||
if (itemMeta == null)
|
||||
net.minecraft.server.v1_8_R3.ItemStack handle = ((CraftItemStack) itemStack).getHandle();
|
||||
NBTTagCompound tag = handle.getTag();
|
||||
|
||||
if (tag != null)
|
||||
{
|
||||
return;
|
||||
for (String name : map.keySet())
|
||||
{
|
||||
tag.set(name, map.get(name));
|
||||
}
|
||||
}
|
||||
try
|
||||
{
|
||||
UNHANDLED_TAGS_FIELD.set(itemMeta, map);
|
||||
}
|
||||
catch (IllegalAccessException e)
|
||||
{
|
||||
System.out.println("Could not get unhandledTags");
|
||||
e.printStackTrace();
|
||||
}
|
||||
itemStack.setItemMeta(itemMeta);
|
||||
}
|
||||
|
||||
public static void save(ItemStack itemStack, boolean remove)
|
||||
@ -743,7 +725,7 @@ public class GearManager extends MiniPlugin implements IPacketHandler, Runnable
|
||||
saveUnhandledTags(itemStack, data);
|
||||
if (remove)
|
||||
{
|
||||
_customItemCache.remove(item);
|
||||
_customItemCache.remove(UUID.fromString(item._uuid));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -16,6 +16,7 @@ import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.event.entity.EntityShootBowEvent;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||
import org.bukkit.event.player.PlayerGameModeChangeEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.player.PlayerItemHeldEvent;
|
||||
@ -44,7 +45,7 @@ public class ItemListener implements Listener, Runnable
|
||||
public ItemListener(JavaPlugin plugin)
|
||||
{
|
||||
_plugin = plugin;
|
||||
_plugin.getServer().getScheduler().runTaskTimer(_plugin, this, 20 * 60 * 5, 0);
|
||||
_plugin.getServer().getScheduler().runTaskTimer(_plugin, this, 0, 20 * 60 * 5);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -65,7 +66,7 @@ public class ItemListener implements Listener, Runnable
|
||||
|
||||
private void save(Player player, boolean remove)
|
||||
{
|
||||
for (ItemStack item : UtilInv.getItems(player))
|
||||
for (ItemStack item : UtilInv.getItemsUncloned(player))
|
||||
{
|
||||
GearManager.save(item, remove);
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
|
||||
public class LegendaryItem extends CustomItem
|
||||
{
|
||||
private final long BLOCK_COOLDOWN = 200L; // Right clicking activates right click for 200ms
|
||||
private static final long BLOCK_COOLDOWN = 200L; // Right clicking activates right click for 200ms
|
||||
|
||||
protected long _lastBlock; // Timestamp of last block from wielder
|
||||
|
||||
|
@ -135,6 +135,7 @@ public class HubManager extends MiniClientPlugin<HubClient>
|
||||
private IncognitoManager _incognito;
|
||||
private ValentinesManager _valentinesManager;
|
||||
private BonusManager _bonusManager;
|
||||
private JumpManager _jumpManager;
|
||||
// private HalloweenSpookinessManager _halloweenManager;
|
||||
// private TrickOrTreatManager _trickOrTreatManager;
|
||||
|
||||
@ -181,7 +182,7 @@ public class HubManager extends MiniClientPlugin<HubClient>
|
||||
_parkour = new ParkourManager(this, donationManager, taskManager);
|
||||
|
||||
new WorldManager(this);
|
||||
new JumpManager(this);
|
||||
_jumpManager = new JumpManager(this);
|
||||
//new TournamentInviter(this);
|
||||
|
||||
|
||||
@ -786,7 +787,7 @@ public class HubManager extends MiniClientPlugin<HubClient>
|
||||
}
|
||||
|
||||
@Override
|
||||
protected HubClient AddPlayer(String player)
|
||||
protected HubClient addPlayer(String player)
|
||||
{
|
||||
return new HubClient(player);
|
||||
}
|
||||
@ -1072,4 +1073,9 @@ public class HubManager extends MiniClientPlugin<HubClient>
|
||||
{
|
||||
return _incognito;
|
||||
}
|
||||
|
||||
public JumpManager getJumpManager()
|
||||
{
|
||||
return _jumpManager;
|
||||
}
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ public class MailManager extends MiniClientPlugin<PlayerMailData> implements Not
|
||||
}
|
||||
|
||||
@Override
|
||||
protected PlayerMailData AddPlayer(String player)
|
||||
protected PlayerMailData addPlayer(String player)
|
||||
{
|
||||
return new PlayerMailData();
|
||||
}
|
||||
|
@ -1,11 +1,13 @@
|
||||
package mineplex.hub.modules;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import java.util.HashSet;
|
||||
|
||||
import org.bukkit.Effect;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.event.player.PlayerToggleFlightEvent;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
@ -28,6 +30,7 @@ import mineplex.hub.HubManager;
|
||||
public class JumpManager extends MiniPlugin
|
||||
{
|
||||
public HubManager Manager;
|
||||
private HashSet<String> _preparedDoubleJump = new HashSet<>();
|
||||
|
||||
public JumpManager(HubManager manager)
|
||||
{
|
||||
@ -66,8 +69,9 @@ public class JumpManager extends MiniPlugin
|
||||
vec.setY(Math.abs(vec.getY()));
|
||||
|
||||
//Velocity
|
||||
_preparedDoubleJump.add(player.getName());
|
||||
UtilAction.velocity(player, vec, 1.4, false, 0, 0.2, 1, true);
|
||||
|
||||
|
||||
//Sound
|
||||
player.playEffect(player.getLocation(), Effect.BLAZE_SHOOT, 0);
|
||||
|
||||
@ -105,8 +109,20 @@ public class JumpManager extends MiniPlugin
|
||||
{
|
||||
player.setAllowFlight(true);
|
||||
player.setFlying(false);
|
||||
_preparedDoubleJump.remove(player.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerQuit(PlayerQuitEvent event)
|
||||
{
|
||||
_preparedDoubleJump.remove(event.getPlayer().getName());
|
||||
}
|
||||
|
||||
public boolean hasDoubleJumped(Player player)
|
||||
{
|
||||
return _preparedDoubleJump.contains(player.getName());
|
||||
}
|
||||
}
|
||||
|
@ -197,7 +197,7 @@ public class KothManager extends MiniPlugin
|
||||
|
||||
Manager.GetGadget().disableAll(player, outfit);
|
||||
Manager.GetMount().DisableAll(player);
|
||||
Manager.getPetManager().DisableAll(player);
|
||||
Manager.getPetManager().disableAll(player);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -3,9 +3,9 @@ package mineplex.hub.modules;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.EntityEffect;
|
||||
import org.bukkit.FireworkEffect.Type;
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Bat;
|
||||
@ -20,9 +20,10 @@ import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.event.player.PlayerVelocityEvent;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import mineplex.core.MiniPlugin;
|
||||
import mineplex.core.MiniPlugin;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilAction;
|
||||
@ -37,8 +38,10 @@ import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilTextMiddle;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.event.StackerEvent;
|
||||
import mineplex.core.gadget.GadgetManager;
|
||||
import mineplex.core.gadget.event.GadgetEnableEvent;
|
||||
import mineplex.core.gadget.event.GadgetSelectLocationEvent;
|
||||
import mineplex.core.gadget.gadgets.outfit.OutfitTeam;
|
||||
import mineplex.core.gadget.types.Gadget;
|
||||
import mineplex.core.gadget.types.GadgetType;
|
||||
@ -50,8 +53,8 @@ import mineplex.hub.HubManager;
|
||||
|
||||
public class SoccerManager extends MiniPlugin
|
||||
{
|
||||
public HubManager Manager;
|
||||
|
||||
private HubManager _hubManager;
|
||||
|
||||
private HashSet<Player> _active = new HashSet<Player>();
|
||||
|
||||
private ArrayList<OutfitTeam> _teamArmor = new ArrayList<OutfitTeam>();
|
||||
@ -71,10 +74,10 @@ public class SoccerManager extends MiniPlugin
|
||||
private Location _cornerBlueGoalA;
|
||||
private Location _cornerBlueGoalB;
|
||||
|
||||
int _blueGoals = 0;
|
||||
int _redGoals = 0;
|
||||
private int _blueGoals = 0;
|
||||
private int _redGoals = 0;
|
||||
|
||||
int _insideGoalTicks = 0;
|
||||
private int _insideGoalTicks = 0;
|
||||
|
||||
private Slime _ball;
|
||||
private Vector _ballVel;
|
||||
@ -89,29 +92,29 @@ public class SoccerManager extends MiniPlugin
|
||||
protected Location _lastLoc;
|
||||
protected ArrayList<Vector> _velHistory = new ArrayList<Vector>();
|
||||
|
||||
public SoccerManager(HubManager manager, GadgetManager gadgets)
|
||||
public SoccerManager(HubManager hubManager, GadgetManager gadgetManager)
|
||||
{
|
||||
super("Football Manager", manager.getPlugin());
|
||||
super("Football Manager", hubManager.getPlugin());
|
||||
|
||||
Manager = manager;
|
||||
_hubManager = hubManager;
|
||||
|
||||
_cornerFieldPlayerA = new Location(hubManager.GetSpawn().getWorld(), 28.5,70,-27.5);
|
||||
_cornerFieldPlayerB = new Location(hubManager.GetSpawn().getWorld(), 50.5,100,-65.5);
|
||||
|
||||
_cornerFieldPlayerA = new Location(Manager.GetSpawn().getWorld(), 28.5,70,-27.5);
|
||||
_cornerFieldPlayerB = new Location(Manager.GetSpawn().getWorld(), 50.5,100,-65.5);
|
||||
_cornerGoalPlayerA = new Location(hubManager.GetSpawn().getWorld(), 35.5,70,-24.5);
|
||||
_cornerGoalPlayerB = new Location(hubManager.GetSpawn().getWorld(), 43.5,100,-68.5);
|
||||
|
||||
_cornerGoalPlayerA = new Location(Manager.GetSpawn().getWorld(), 35.5,70,-24.5);
|
||||
_cornerGoalPlayerB = new Location(Manager.GetSpawn().getWorld(), 43.5,100,-68.5);
|
||||
_cornerFieldA = new Location(hubManager.GetSpawn().getWorld(), 29.75,70,-28.75);
|
||||
_cornerFieldB = new Location(hubManager.GetSpawn().getWorld(), 49.25,100,-64.25);
|
||||
|
||||
_cornerFieldA = new Location(Manager.GetSpawn().getWorld(), 29.75,70,-28.75);
|
||||
_cornerFieldB = new Location(Manager.GetSpawn().getWorld(), 49.25,100,-64.25);
|
||||
_cornerRedGoalA = new Location(hubManager.GetSpawn().getWorld(), 36.75,70,-64.25);
|
||||
_cornerRedGoalB = new Location(hubManager.GetSpawn().getWorld(), 42.25,73.5,-67.25);
|
||||
|
||||
_cornerRedGoalA = new Location(Manager.GetSpawn().getWorld(), 36.75,70,-64.25);
|
||||
_cornerRedGoalB = new Location(Manager.GetSpawn().getWorld(), 42.25,73.5,-67.25);
|
||||
|
||||
_cornerBlueGoalA = new Location(Manager.GetSpawn().getWorld(), 36.75,70,-25.75);
|
||||
_cornerBlueGoalB = new Location(Manager.GetSpawn().getWorld(), 42.25,73.5,-28.75);
|
||||
_cornerBlueGoalA = new Location(hubManager.GetSpawn().getWorld(), 36.75,70,-25.75);
|
||||
_cornerBlueGoalB = new Location(hubManager.GetSpawn().getWorld(), 42.25,73.5,-28.75);
|
||||
|
||||
//Store Gadgets
|
||||
for (Gadget gadget : gadgets.getGadgets(GadgetType.COSTUME))
|
||||
for (Gadget gadget : gadgetManager.getGadgets(GadgetType.COSTUME))
|
||||
{
|
||||
if (gadget instanceof OutfitTeam)
|
||||
{
|
||||
@ -352,7 +355,7 @@ public class SoccerManager extends MiniPlugin
|
||||
return UtilAlg.inBoundingBox(entity.getLocation(), _cornerFieldPlayerA, _cornerFieldPlayerB) ||
|
||||
UtilAlg.inBoundingBox(entity.getLocation(), _cornerGoalPlayerA, _cornerGoalPlayerB);
|
||||
}
|
||||
|
||||
|
||||
@EventHandler
|
||||
public void clean(UpdateEvent event)
|
||||
{
|
||||
@ -470,9 +473,9 @@ public class SoccerManager extends MiniPlugin
|
||||
outfit.add("Team Pants");
|
||||
outfit.add("Team Boots");
|
||||
|
||||
Manager.GetGadget().disableAll(player, outfit);
|
||||
Manager.GetMount().DisableAll(player);
|
||||
Manager.getPetManager().DisableAll(player);
|
||||
_hubManager.GetGadget().disableAll(player, outfit);
|
||||
_hubManager.GetMount().DisableAll(player);
|
||||
_hubManager.getPetManager().disableAll(player);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -481,11 +484,11 @@ public class SoccerManager extends MiniPlugin
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isSoccerMode(Player player)
|
||||
public boolean isSoccerMode(Entity entity)
|
||||
{
|
||||
return _active.contains(player);
|
||||
return _active.contains(entity);
|
||||
}
|
||||
|
||||
|
||||
@EventHandler
|
||||
public void disableGadgets(GadgetEnableEvent event)
|
||||
{
|
||||
@ -510,6 +513,35 @@ public class SoccerManager extends MiniPlugin
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void disableStacker(StackerEvent event)
|
||||
{
|
||||
if (isSoccerMode(event.getEntity()))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void disableGuardianLazer(GadgetSelectLocationEvent event)
|
||||
{
|
||||
if (UtilAlg.inBoundingBox(event.getLocation(), _cornerFieldA, _cornerFieldB))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void disableVelocity(PlayerVelocityEvent event)
|
||||
{
|
||||
// Disable velocity but allow double jumping.
|
||||
|
||||
if (isSoccerMode(event.getPlayer()) && !_hubManager.getJumpManager().hasDoubleJumped(event.getPlayer()))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void playerQuit(PlayerQuitEvent event)
|
||||
{
|
||||
|
@ -948,7 +948,7 @@ public class ServerManager extends MiniDbClientPlugin<SimpleClanToken> implement
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SimpleClanToken AddPlayer(String player)
|
||||
protected SimpleClanToken addPlayer(String player)
|
||||
{
|
||||
return new SimpleClanToken();
|
||||
}
|
||||
|
@ -322,7 +322,7 @@ public class ClassManager extends MiniClientPlugin<ClientClass> implements IClas
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ClientClass AddPlayer(String player)
|
||||
protected ClientClass addPlayer(String player)
|
||||
{
|
||||
return new ClientClass(this, _skillFactory, _itemFactory, _clientManager.Get(player), _donationManager.Get(player), null);
|
||||
}
|
||||
|
@ -402,6 +402,18 @@ public class ConditionManager extends MiniPlugin
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean HasCondition(LivingEntity target, ConditionType type)
|
||||
{
|
||||
if (!_conditions.containsKey(target))
|
||||
return false;
|
||||
|
||||
for (Condition cond : _conditions.get(target))
|
||||
if (type == null || cond.GetType() == type)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public WeakHashMap<LivingEntity, LinkedList<ConditionActive>> GetActiveConditions()
|
||||
{
|
||||
|
@ -3,6 +3,9 @@ package mineplex.minecraft.game.core.damage;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import mineplex.core.MiniPlugin;
|
||||
@ -57,6 +60,9 @@ public class DamageManager extends MiniPlugin
|
||||
public boolean DisableDamageChanges = false;
|
||||
|
||||
private boolean _enabled = true;
|
||||
|
||||
private final HashMap<String, Integer> _protectionTypeModifiers = new HashMap<String, Integer>();
|
||||
private final HashMap<String, DamageCause[]> _protectionCauses = new HashMap<String, DamageCause[]>();
|
||||
|
||||
public DamageManager(JavaPlugin plugin, CombatManager combatManager, NpcManager npcManager, DisguiseManager disguiseManager, ConditionManager conditionManager)
|
||||
{
|
||||
@ -79,6 +85,102 @@ public class DamageManager extends MiniPlugin
|
||||
}
|
||||
|
||||
registerEvents(new NpcProtectListener(npcManager));
|
||||
|
||||
_protectionTypeModifiers.put(Enchantment.PROTECTION_ENVIRONMENTAL.getName(), 1);
|
||||
_protectionTypeModifiers.put(Enchantment.PROTECTION_FIRE.getName(), 2);
|
||||
_protectionTypeModifiers.put(Enchantment.PROTECTION_EXPLOSIONS.getName(), 2);
|
||||
_protectionTypeModifiers.put(Enchantment.PROTECTION_PROJECTILE.getName(), 2);
|
||||
_protectionTypeModifiers.put(Enchantment.PROTECTION_FALL.getName(), 3);
|
||||
|
||||
_protectionCauses.put(Enchantment.PROTECTION_ENVIRONMENTAL.getName(), new DamageCause[] {DamageCause.BLOCK_EXPLOSION, DamageCause.CONTACT, DamageCause.CUSTOM, DamageCause.DROWNING, DamageCause.ENTITY_ATTACK, DamageCause.ENTITY_EXPLOSION, DamageCause.FALL, DamageCause.FALLING_BLOCK, DamageCause.FIRE, DamageCause.FIRE_TICK, DamageCause.LAVA, DamageCause.LIGHTNING, DamageCause.PROJECTILE, DamageCause.SUFFOCATION, DamageCause.THORNS});
|
||||
_protectionCauses.put(Enchantment.PROTECTION_FIRE.getName(), new DamageCause[] {DamageCause.FIRE, DamageCause.FIRE_TICK, DamageCause.LAVA});
|
||||
_protectionCauses.put(Enchantment.PROTECTION_EXPLOSIONS.getName(), new DamageCause[] {DamageCause.BLOCK_EXPLOSION, DamageCause.ENTITY_EXPLOSION});
|
||||
_protectionCauses.put(Enchantment.PROTECTION_PROJECTILE.getName(), new DamageCause[] {DamageCause.PROJECTILE});
|
||||
_protectionCauses.put(Enchantment.PROTECTION_FALL.getName(), new DamageCause[] {DamageCause.FALL});
|
||||
}
|
||||
|
||||
private int getHighestLevel(Enchantment ench, ItemStack[] items)
|
||||
{
|
||||
int level = 0;
|
||||
|
||||
for (ItemStack item : items)
|
||||
{
|
||||
if (item == null && item.getType() == Material.AIR)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (!item.containsEnchantment(ench))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (item.getEnchantmentLevel(ench) <= level)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
level = item.getEnchantmentLevel(ench);
|
||||
}
|
||||
|
||||
return level;
|
||||
}
|
||||
|
||||
private int getTotalEPF(Enchantment ench, ItemStack[] items)
|
||||
{
|
||||
if (!_protectionTypeModifiers.containsKey(ench.getName()))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
if (!_protectionCauses.containsKey(ench.getName()))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int epf = 0;
|
||||
|
||||
for (ItemStack item : items)
|
||||
{
|
||||
if (item == null || item.getType() == Material.AIR)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (!item.containsEnchantment(ench))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (item.getEnchantmentLevel(ench) <= 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
epf += (item.getEnchantmentLevel(ench) * _protectionTypeModifiers.get(ench.getName()));
|
||||
}
|
||||
|
||||
return Math.min(20, epf);
|
||||
}
|
||||
|
||||
private double getTotalEnchantReduction(ItemStack[] armor, DamageCause cause)
|
||||
{
|
||||
int epf = 0;
|
||||
|
||||
for (Enchantment ench : Enchantment.values())
|
||||
{
|
||||
if (!_protectionTypeModifiers.containsKey(ench.getName()))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (!_protectionCauses.containsKey(ench.getName()))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (!Arrays.asList(_protectionCauses.get(ench.getName())).contains(cause))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
epf += getTotalEPF(ench, armor);
|
||||
}
|
||||
|
||||
epf = Math.max(0, Math.min(20, epf));
|
||||
return new BigDecimal(1).subtract(new BigDecimal(epf).divide(new BigDecimal(25))).doubleValue();
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
@ -129,6 +231,9 @@ public class DamageManager extends MiniPlugin
|
||||
@EventHandler
|
||||
public void onEntityCombust(EntityCombustByEntityEvent event)
|
||||
{
|
||||
if (!_enabled)
|
||||
return;
|
||||
|
||||
if (!(event.getCombuster() instanceof Player || event.getCombuster() instanceof Arrow))
|
||||
return;
|
||||
|
||||
@ -273,35 +378,9 @@ public class DamageManager extends MiniPlugin
|
||||
Player damagee = event.GetDamageePlayer();
|
||||
if (damagee != null)
|
||||
{
|
||||
for (ItemStack stack : damagee.getInventory().getArmorContents())
|
||||
if (getTotalEnchantReduction(damagee.getInventory().getArmorContents(), event.GetCause()) > 0)
|
||||
{
|
||||
if (stack == null)
|
||||
continue;
|
||||
|
||||
Map<Enchantment, Integer> enchants = stack.getEnchantments();
|
||||
for (Enchantment e : enchants.keySet())
|
||||
{
|
||||
if (e.equals(Enchantment.PROTECTION_ENVIRONMENTAL))
|
||||
event.AddMod("Ench Prot", damagee.getName(), 0.5 * (double)enchants.get(e), false);
|
||||
|
||||
else if (e.equals(Enchantment.PROTECTION_FIRE) &&
|
||||
event.GetCause() == DamageCause.FIRE &&
|
||||
event.GetCause() == DamageCause.FIRE_TICK &&
|
||||
event.GetCause() == DamageCause.LAVA)
|
||||
event.AddMod("Ench Prot", damagee.getName(), 0.5 * (double)enchants.get(e), false);
|
||||
|
||||
else if (e.equals(Enchantment.PROTECTION_FALL) &&
|
||||
event.GetCause() == DamageCause.FALL)
|
||||
event.AddMod("Ench Prot", damagee.getName(), 0.5 * (double)enchants.get(e), false);
|
||||
|
||||
else if (e.equals(Enchantment.PROTECTION_EXPLOSIONS) &&
|
||||
event.GetCause() == DamageCause.ENTITY_EXPLOSION)
|
||||
event.AddMod("Ench Prot", damagee.getName(), 0.5 * (double)enchants.get(e), false);
|
||||
|
||||
else if (e.equals(Enchantment.PROTECTION_PROJECTILE) &&
|
||||
event.GetCause() == DamageCause.PROJECTILE)
|
||||
event.AddMod("Ench Prot", damagee.getName(), 0.5 * (double)enchants.get(e), false);
|
||||
}
|
||||
event.AddMult("Ench Prot", damagee.getName(), getTotalEnchantReduction(damagee.getInventory().getArmorContents(), event.GetCause()), false);
|
||||
}
|
||||
}
|
||||
|
||||
@ -324,8 +403,15 @@ public class DamageManager extends MiniPlugin
|
||||
|
||||
else if (e.equals(Enchantment.FIRE_ASPECT))
|
||||
if (_conditionManager != null)
|
||||
{
|
||||
double reduce = 0;
|
||||
if (damagee != null)
|
||||
{
|
||||
reduce = (15 * getHighestLevel(Enchantment.PROTECTION_FIRE, damagee.getInventory().getArmorContents())) * (4 * (double)enchants.get(e));
|
||||
}
|
||||
_conditionManager.Factory().Ignite("Ench Fire", event.GetDamageeEntity(), damager,
|
||||
4 * (double)enchants.get(e), false, false);
|
||||
(4 * (double)enchants.get(e)) - reduce, false, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -7,6 +7,7 @@ import mineplex.core.achievement.AchievementManager;
|
||||
import mineplex.core.antihack.AntiHack;
|
||||
import mineplex.core.chat.Chat;
|
||||
import mineplex.core.command.CommandCenter;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.creature.Creature;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.elo.EloManager;
|
||||
@ -48,7 +49,7 @@ public class StaffServer extends JavaPlugin
|
||||
|
||||
//Static Modules
|
||||
CommandCenter.Initialize(this);
|
||||
CoreClientManager clientManager = new CoreClientManager(this, webServerAddress);
|
||||
CoreClientManager clientManager = new CoreClientManager(this, webServerAddress, Rank.DEVELOPER);
|
||||
CommandCenter.Instance.setClientManager(clientManager);
|
||||
Recharge.Initialize(this);
|
||||
|
||||
@ -83,15 +84,15 @@ public class StaffServer extends JavaPlugin
|
||||
((CraftServer)getServer()).getHandle().addWhitelist(new GameProfile(UUID.fromString("cf1b629c-cc55-4eb4-be9e-3ca86dfc7b9d"), "mannalou"));
|
||||
((CraftServer)getServer()).getHandle().addWhitelist(new GameProfile(UUID.fromString("04a484d0-93e0-4777-a70c-808046917e3a"), "EvilEsther"));
|
||||
((CraftServer)getServer()).getHandle().addWhitelist(new GameProfile(UUID.fromString("adaa7613-6683-400f-baf8-7272c04b2cb4"), "Timmy48081_"));
|
||||
((CraftServer)getServer()).getHandle().addWhitelist(new GameProfile(UUID.fromString("57791647-93b1-4980-8835-7fddadd20eb8"), "xTheOnlyOreOx"));
|
||||
((CraftServer)getServer()).getHandle().addWhitelist(new GameProfile(UUID.fromString("231fb752-9556-489b-8428-f47c7598e061"), "Nuclear_Poptart"));
|
||||
((CraftServer)getServer()).getHandle().addWhitelist(new GameProfile(UUID.fromString("efaf9a17-2304-4f42-8433-421523c308dc"), "B2_mp"));
|
||||
((CraftServer)getServer()).getHandle().addWhitelist(new GameProfile(UUID.fromString("492ff708-fe76-4c5a-b9ed-a747b5fa20a0"), "Cherdy8s"));
|
||||
((CraftServer)getServer()).getHandle().addWhitelist(new GameProfile(UUID.fromString("cf85f470-5248-4978-8208-435736fa136e"), "RustyRoo"));
|
||||
((CraftServer)getServer()).getHandle().addWhitelist(new GameProfile(UUID.fromString("6edf17d5-6bb2-4ed9-92e9-bed8e96fff68"), "BlueBeetleHD"));
|
||||
|
||||
|
||||
((CraftServer)getServer()).getHandle().addOp(new GameProfile(UUID.fromString("377bdea3-badc-448d-81c1-65db43b17ea4"), "Strutt20"));
|
||||
((CraftServer)getServer()).getHandle().addOp(new GameProfile(UUID.fromString("efaf9a17-2304-4f42-8433-421523c308dc"), "B2_mp"));
|
||||
((CraftServer)getServer()).getHandle().addOp(new GameProfile(UUID.fromString("cf85f470-5248-4978-8208-435736fa136e"), "RustyRoo"));
|
||||
((CraftServer)getServer()).getHandle().addOp(new GameProfile(UUID.fromString("6edf17d5-6bb2-4ed9-92e9-bed8e96fff68"), "BlueBeetleHD"));
|
||||
|
||||
new ProfileCacheManager(this);
|
||||
}
|
||||
|
@ -57,9 +57,9 @@ public class CustomerSupport extends MiniPlugin implements ResultSetCallable
|
||||
@EventHandler
|
||||
public void Join(PlayerJoinEvent event)
|
||||
{
|
||||
if (!_clientManager.Get(event.getPlayer()).GetRank().has(Rank.MODERATOR))
|
||||
if (!_clientManager.Get(event.getPlayer()).GetRank().has(Rank.SUPPORT))
|
||||
{
|
||||
event.getPlayer().kickPlayer("Only for staff.");
|
||||
event.getPlayer().kickPlayer("Only for support staff.");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -119,7 +119,7 @@ public class CustomerSupport extends MiniPlugin implements ResultSetCallable
|
||||
caller.sendMessage(C.cDGreen + C.Strike + "=============================================");
|
||||
caller.sendMessage(C.cBlue + "Name: " + C.cYellow + playerName);
|
||||
caller.sendMessage(C.cBlue + "Rank: " + C.cYellow + (client.GetRank() == null ? C.cRed + "Error rank null!" : (client.GetRank().Name.isEmpty() ? "Regular" : client.GetRank().Name)));
|
||||
caller.sendMessage(C.cBlue + "Coins: " + C.cYellow + donor.getCoins());
|
||||
caller.sendMessage(C.cBlue + "Shards: " + C.cYellow + donor.getCoins());
|
||||
caller.sendMessage(C.cBlue + "Gems: " + C.cYellow + donor.GetGems());
|
||||
|
||||
int enjinCoinsReceived = 0;
|
||||
@ -234,7 +234,7 @@ public class CustomerSupport extends MiniPlugin implements ResultSetCallable
|
||||
}
|
||||
|
||||
// Strutt20 asked me to remove some stuff from the menu
|
||||
caller.sendMessage(C.cBlue + "Enjin Coin Total Received: " + C.cYellow + enjinCoinsReceived);
|
||||
caller.sendMessage(C.cBlue + "Enjin Shard Total Received: " + C.cYellow + enjinCoinsReceived);
|
||||
caller.sendMessage(C.cBlue + "Old Chests Received: " + C.cYellow + oldChestsReceived);
|
||||
caller.sendMessage(C.cBlue + "Ancient Chests Received: " + C.cYellow + ancientChestsReceived);
|
||||
caller.sendMessage(C.cBlue + "Mythical Chests Received: " + C.cYellow + mythicalChestsReceived);
|
||||
|
@ -94,7 +94,7 @@ public class SalesPackageManager extends MiniPlugin
|
||||
|
||||
public void displaySalesPackages(Player caller, String playerName)
|
||||
{
|
||||
JsonMessage coinBuilder = new JsonMessage("Coins : ").color("blue");
|
||||
JsonMessage coinBuilder = new JsonMessage("Shards : ").color("blue");
|
||||
JsonMessage packageBuilder = new JsonMessage("Rank Packages : ").color("blue");
|
||||
JsonMessage chestBuilder = new JsonMessage("Chest Packages : ").color("blue");
|
||||
|
||||
@ -104,7 +104,7 @@ public class SalesPackageManager extends MiniPlugin
|
||||
{
|
||||
coinBuilder = coinBuilder.extra("[").color("gray").extra(salesPackage.getName()).color("green").click("run_command", "/display " + playerName + " " + salesPackage.getName()).extra("] ").color("gray");
|
||||
}
|
||||
else if (salesPackage instanceof MythicalChest || salesPackage instanceof AncientChest || salesPackage instanceof OldChest || salesPackage instanceof IlluminatedChest)
|
||||
else if (salesPackage instanceof MythicalChest || salesPackage instanceof AncientChest || salesPackage instanceof OldChest || salesPackage instanceof IlluminatedChest || salesPackage instanceof FreedomChest)
|
||||
{
|
||||
chestBuilder = chestBuilder.extra("[").color("gray").extra(salesPackage.getName()).color("green").click("run_command", "/display " + playerName + " " + salesPackage.getName()).extra("] ").color("gray");
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ public class CoinCommand extends CommandBase<SalesPackageManager>
|
||||
{
|
||||
public CoinCommand(SalesPackageManager plugin)
|
||||
{
|
||||
super(plugin, Rank.MODERATOR, "coin");
|
||||
super(plugin, Rank.MODERATOR, "coin", "shard", "shards");
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -43,11 +43,11 @@ public class CoinCommand extends CommandBase<SalesPackageManager>
|
||||
{
|
||||
if (completed)
|
||||
{
|
||||
caller.sendMessage(F.main(Plugin.getName(), "Added " + amount + " coins to " + playerName + "'s account!"));
|
||||
caller.sendMessage(F.main(Plugin.getName(), "Added " + amount + " shards to " + playerName + "'s account!"));
|
||||
}
|
||||
else
|
||||
{
|
||||
UtilPlayer.message(caller, F.main(Plugin.getName(), "There was an error giving " + F.elem(amount + "Coins") + " to " + F.name(playerName) + "."));
|
||||
UtilPlayer.message(caller, F.main(Plugin.getName(), "There was an error giving " + F.elem(amount + "Shards") + " to " + F.name(playerName) + "."));
|
||||
}
|
||||
}
|
||||
}, caller.getName(), playerName, client.getAccountId(), amount);
|
||||
|
@ -10,13 +10,13 @@ public class Coins extends SalesPackageBase
|
||||
|
||||
public Coins(SalesPackageManager manager, int amount)
|
||||
{
|
||||
super(manager, amount + " Coins");
|
||||
super(manager, amount + " Shards");
|
||||
|
||||
_amount = amount;
|
||||
}
|
||||
public void displayToAgent(Player agent, String playerName)
|
||||
{
|
||||
addButton(agent, "/sales coin " + playerName + " " + _amount, _amount + " Coins.");
|
||||
addButton(agent, "/sales coin " + playerName + " " + _amount, _amount + " Shards.");
|
||||
agent.sendMessage(" ");
|
||||
addBackButton(agent, playerName);
|
||||
}
|
||||
|
@ -19,5 +19,9 @@
|
||||
<artifactId>mineplex-minecraft-game-classcombat</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>nocheatplus</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
@ -172,6 +172,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
||||
private KitProgressionManager _kitProgressionManager;
|
||||
private ProgressingKitManager _progressionKitManager;
|
||||
private BoosterManager _boosterManager;
|
||||
private GameSpectatorManager _spectatorManager;
|
||||
|
||||
private IncognitoManager _incognitoManager;
|
||||
|
||||
@ -290,7 +291,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
||||
YoutubeManager youtubeManager = new YoutubeManager(plugin, clientManager, donationManager);
|
||||
_bonusManager = new BonusManager(plugin, clientManager, serverStatusManager, donationManager, pollManager , npcManager, hologramManager, statsManager, _inventoryManager, petManager, facebookManager, youtubeManager, _cosmeticManager.getGadgetManager(), boosterManager);
|
||||
new GameLootManager(this, petManager, _bonusManager.getRewardManager());
|
||||
new GameSpectatorManager(this);
|
||||
_spectatorManager = new GameSpectatorManager(this);
|
||||
_gameWorldManager = new GameWorldManager(this);
|
||||
new MiscManager(this);
|
||||
_hologramManager = hologramManager;
|
||||
@ -1705,4 +1706,9 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
||||
{
|
||||
return _kitProgressionManager;
|
||||
}
|
||||
|
||||
public GameSpectatorManager getGameSpectatorManager()
|
||||
{
|
||||
return _spectatorManager;
|
||||
}
|
||||
}
|
||||
|
@ -22,6 +22,7 @@ import nautilus.game.arcade.events.GameStateChangeEvent;
|
||||
import nautilus.game.arcade.events.PlayerGameRespawnEvent;
|
||||
import nautilus.game.arcade.events.PlayerStateChangeEvent;
|
||||
import nautilus.game.arcade.game.GameTeam.PlayerState;
|
||||
import nautilus.game.arcade.game.modules.Module;
|
||||
import nautilus.game.arcade.kit.*;
|
||||
import nautilus.game.arcade.managers.GameLobbyManager;
|
||||
import nautilus.game.arcade.managers.chat.ChatStatData;
|
||||
@ -311,8 +312,6 @@ public abstract class Game implements Listener
|
||||
|
||||
public boolean AllowEntitySpectate = true;
|
||||
|
||||
public boolean PlayerTeamSelection = false;
|
||||
|
||||
public boolean TeamMode = false;
|
||||
|
||||
public boolean TeamPerSpawn = false;
|
||||
@ -332,6 +331,8 @@ public abstract class Game implements Listener
|
||||
private NautHashMap<Player, Player> _teamReqs = new NautHashMap<Player, Player>();
|
||||
public WinEffectManager WinEffectManager = new WinEffectManager();
|
||||
|
||||
private Map<Class<? extends Module>, Module> _modules = new HashMap<>();
|
||||
|
||||
public Game(ArcadeManager manager, GameType gameType, Kit[] kits, String[] gameDesc)
|
||||
{
|
||||
Manager = manager;
|
||||
@ -418,6 +419,20 @@ public abstract class Game implements Listener
|
||||
System.out.println("Loading " + GetName() + "...");
|
||||
}
|
||||
|
||||
public void registerModule(Module module)
|
||||
{
|
||||
if (!_modules.containsKey(module.getClass()))
|
||||
{
|
||||
module.initialize(this);
|
||||
_modules.put(module.getClass(), module);
|
||||
UtilServer.RegisterEvents(module);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new IllegalStateException("Module " + module.getClass() + " is already registered");
|
||||
}
|
||||
}
|
||||
|
||||
public void setKits(Kit[] kits)
|
||||
{
|
||||
_kits = kits;
|
||||
@ -917,7 +932,7 @@ public abstract class Game implements Listener
|
||||
if (GetKit(player) == null)
|
||||
return false;
|
||||
|
||||
return GetKit(player).equals(kit);
|
||||
return GetKit(player).GetName().equals(kit.GetName());
|
||||
}
|
||||
|
||||
public boolean SetPlayerState(Player player, PlayerState state)
|
||||
@ -1897,157 +1912,6 @@ public abstract class Game implements Listener
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void teamSelectInteract(PlayerInteractEntityEvent event)
|
||||
{
|
||||
if (!PlayerTeamSelection)
|
||||
return;
|
||||
|
||||
if (GetState() != GameState.Recruit)
|
||||
return;
|
||||
|
||||
if (event.getRightClicked() == null)
|
||||
return;
|
||||
|
||||
if (!(event.getRightClicked() instanceof Player))
|
||||
return;
|
||||
|
||||
Player player = event.getPlayer();
|
||||
|
||||
//Observer
|
||||
if (Manager.IsObserver(player))
|
||||
{
|
||||
UtilPlayer.message(player, F.main("Game", "Spectators cannot partake in games."));
|
||||
return;
|
||||
}
|
||||
|
||||
selectTeamMate(player, (Player) event.getRightClicked());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void teamSelectCommand(PlayerCommandPreprocessEvent event)
|
||||
{
|
||||
if (!PlayerTeamSelection)
|
||||
return;
|
||||
|
||||
if (GetState() != GameState.Recruit)
|
||||
return;
|
||||
|
||||
if (!event.getMessage().toLowerCase().startsWith("/team "))
|
||||
return;
|
||||
|
||||
event.setCancelled(true);
|
||||
|
||||
Player target = UtilPlayer.searchOnline(event.getPlayer(), event.getMessage().split(" ")[1],
|
||||
true);
|
||||
if (target == null)
|
||||
return;
|
||||
|
||||
//Observer
|
||||
if (Manager.IsObserver(event.getPlayer()))
|
||||
{
|
||||
UtilPlayer.message(event.getPlayer(),
|
||||
F.main("Game", "Spectators cannot partake in games."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.getPlayer().equals(target))
|
||||
return;
|
||||
|
||||
selectTeamMate(event.getPlayer(), target);
|
||||
}
|
||||
|
||||
public void selectTeamMate(Player player, Player ally)
|
||||
{
|
||||
//Accept Invite
|
||||
if (_teamReqs.containsKey(ally) && _teamReqs.get(ally).equals(player))
|
||||
{
|
||||
//Remove Prefs
|
||||
_teamReqs.remove(player);
|
||||
_teamReqs.remove(ally);
|
||||
|
||||
//Inform
|
||||
UtilPlayer.message(player,
|
||||
F.main("Game", "You accepted " + ally.getName() + "'s Team Request!"));
|
||||
UtilPlayer.message(ally,
|
||||
F.main("Game", player.getName() + " accepted your Team Request!"));
|
||||
|
||||
//Leave Old Teams
|
||||
if (GetTeam(player) != null)
|
||||
GetTeam(player).DisbandTeam();
|
||||
|
||||
if (GetTeam(ally) != null)
|
||||
GetTeam(ally).DisbandTeam();
|
||||
|
||||
//Get Team
|
||||
GameTeam team = getEmptyTeam();
|
||||
if (team == null)
|
||||
return;
|
||||
|
||||
//Join Team
|
||||
SetPlayerTeam(player, team, true);
|
||||
SetPlayerTeam(ally, team, true);
|
||||
}
|
||||
//Send Invite
|
||||
else
|
||||
{
|
||||
//Already on Team with Target
|
||||
if (GetTeam(player) != null)
|
||||
if (GetTeam(player).HasPlayer(ally))
|
||||
return;
|
||||
|
||||
//Inform Player
|
||||
UtilPlayer.message(player,
|
||||
F.main("Game", "You sent a Team Request to " + ally.getName() + "!"));
|
||||
|
||||
//Inform Target
|
||||
if (Recharge.Instance.use(player, "Team Req " + ally.getName(), 2000, false, false))
|
||||
{
|
||||
UtilPlayer.message(ally,
|
||||
F.main("Game", player.getName() + " sent you a Team Request!"));
|
||||
UtilPlayer.message(ally, F.main("Game",
|
||||
"Type " + F.elem("/team " + player.getName()) + " to accept!"));
|
||||
}
|
||||
|
||||
//Add Pref
|
||||
_teamReqs.put(player, ally);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void teamQuit(PlayerQuitEvent event)
|
||||
{
|
||||
if (!PlayerTeamSelection)
|
||||
return;
|
||||
|
||||
if (GetState() != GameState.Recruit)
|
||||
return;
|
||||
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (GetTeam(player) != null)
|
||||
GetTeam(player).DisbandTeam();
|
||||
|
||||
Iterator<Player> teamIter = _teamReqs.keySet().iterator();
|
||||
while (teamIter.hasNext())
|
||||
{
|
||||
Player sender = teamIter.next();
|
||||
if (sender.equals(player) || _teamReqs.get(sender).equals(player))
|
||||
teamIter.remove();
|
||||
}
|
||||
}
|
||||
|
||||
public GameTeam getEmptyTeam()
|
||||
{
|
||||
for (GameTeam team : GetTeamList())
|
||||
{
|
||||
if (team.GetPlayers(false).isEmpty())
|
||||
return team;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void CustomTeamGeneration(GameStateChangeEvent event)
|
||||
{
|
||||
@ -2271,4 +2135,17 @@ public abstract class Game implements Listener
|
||||
{
|
||||
}
|
||||
|
||||
public void cleanupModules()
|
||||
{
|
||||
for (Module module : this._modules.values())
|
||||
{
|
||||
module.cleanup();
|
||||
HandlerList.unregisterAll(module);
|
||||
}
|
||||
}
|
||||
|
||||
public <T extends Module> T getModule(Class<T> clazz)
|
||||
{
|
||||
return clazz.cast(_modules.get(clazz));
|
||||
}
|
||||
}
|
||||
|
@ -24,6 +24,7 @@ import org.bukkit.Location;
|
||||
import org.bukkit.entity.Creature;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scoreboard.Team;
|
||||
|
||||
public class GameTeam
|
||||
{
|
||||
@ -192,7 +193,11 @@ public class GameTeam
|
||||
{
|
||||
for(Player other : UtilServer.getPlayers())
|
||||
{
|
||||
other.getScoreboard().getTeam(Host.Manager.GetClients().Get(player).GetRank().Name + _name.toUpperCase()).removePlayer(player);
|
||||
Team team = other.getScoreboard().getTeam(Host.Manager.GetClients().Get(player).GetRank().Name + _name.toUpperCase());
|
||||
if (team != null)
|
||||
{
|
||||
team.removePlayer(player);
|
||||
}
|
||||
other.getScoreboard().getTeam(Host.Manager.GetClients().Get(player).GetRank().Name).addPlayer(player);
|
||||
}
|
||||
UtilPlayer.message(player, F.main("Team", _color + C.Bold + getDisplayName() + " Team was disbanded."));
|
||||
@ -268,11 +273,18 @@ public class GameTeam
|
||||
return GetColor() + "§l" + GetName();
|
||||
}
|
||||
|
||||
public void SpawnTeleport(Player player)
|
||||
{
|
||||
public Location SpawnTeleport(Player player)
|
||||
{
|
||||
Location l = GetSpawn();
|
||||
player.teleport(l);
|
||||
return l;
|
||||
}
|
||||
|
||||
public void SpawnTeleport(Player player, Location location)
|
||||
{
|
||||
player.leaveVehicle();
|
||||
player.eject();
|
||||
player.teleport(GetSpawn());
|
||||
player.teleport(location);
|
||||
}
|
||||
|
||||
public void SpawnTeleport()
|
||||
|
@ -1505,6 +1505,11 @@ public class Build extends Game
|
||||
{
|
||||
Player player = ((Player) event.getWhoClicked());
|
||||
|
||||
if (_buildGameState == 2 || _buildGameState == 3)
|
||||
{
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
if (IsLive() && IsAlive(player))
|
||||
{
|
||||
BuildData buildData = _data.get(player);
|
||||
|
@ -5,6 +5,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import nautilus.game.arcade.game.modules.TeamModule;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Sound;
|
||||
@ -40,7 +41,9 @@ public class TeamBuild extends Build
|
||||
super(manager, GameType.Brawl);
|
||||
|
||||
TeamMode = true;
|
||||
PlayerTeamSelection = true;
|
||||
|
||||
registerModule(new TeamModule());
|
||||
|
||||
TeamPerSpawn = true;
|
||||
FillTeamsInOrderToCount = 2;
|
||||
|
||||
|
@ -632,8 +632,15 @@ public class DragonEscape extends SoloGame
|
||||
@EventHandler
|
||||
public void onPlayerInteract(PlayerInteractEvent event)
|
||||
{
|
||||
if (!IsLive())
|
||||
return;
|
||||
|
||||
if (event.getClickedBlock() == null)
|
||||
return;
|
||||
|
||||
if(event.getClickedBlock().getType() != Material.TRAP_DOOR)
|
||||
return;
|
||||
|
||||
// Stops players using trap doors in game.
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ public class HotbarInventory
|
||||
{
|
||||
Inventory inv = UtilServer.getServer().createInventory(null, 36, "Hotbar Editor");
|
||||
|
||||
for (int slot : Arrays.asList(0, 1, 2, 3, 4, 5, 6, 7, 8, 18, 19, 20, 21, 22, 23, 24, 25, 26))
|
||||
for (int slot : Arrays.asList(0, 1, 2, 3, 4, 5, 6, 7, 8, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 31, 33, 34, 35))
|
||||
{
|
||||
inv.setItem(slot, getGlass(slot));
|
||||
}
|
||||
|
@ -8,12 +8,21 @@ import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.inventory.InventoryAction;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.event.inventory.InventoryDragEvent;
|
||||
import org.bukkit.event.inventory.InventoryMoveItemEvent;
|
||||
import org.bukkit.event.player.PlayerDropItemEvent;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.PlayerInventory;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.UtilInv;
|
||||
import mineplex.core.common.util.UtilItem;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.itemstack.ItemBuilder;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
|
||||
/**
|
||||
* Created by William (WilliamTiger).
|
||||
@ -27,7 +36,7 @@ public class HotbarPageListener implements Listener
|
||||
{
|
||||
_editor = editor;
|
||||
}
|
||||
|
||||
|
||||
@EventHandler
|
||||
public void onClick(InventoryClickEvent e)
|
||||
{
|
||||
@ -140,4 +149,51 @@ public class HotbarPageListener implements Listener
|
||||
|
||||
i.remove();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void updateInv(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.FASTER)
|
||||
return;
|
||||
|
||||
for (Player player : UtilServer.GetPlayers())
|
||||
{
|
||||
if (player.getOpenInventory() == null)
|
||||
continue;
|
||||
|
||||
if (player.getOpenInventory().getTopInventory() == null)
|
||||
continue;
|
||||
|
||||
if (!player.getOpenInventory().getTopInventory().getName().equals("Hotbar Editor"))
|
||||
continue;
|
||||
|
||||
for (Material mat : new Material[]{Material.DIAMOND_SWORD, Material.BOW, Material.FISHING_ROD, Material.ARROW})
|
||||
{
|
||||
boolean founditem = false;
|
||||
for (ItemStack item : player.getOpenInventory().getTopInventory().getContents())
|
||||
{
|
||||
if (item != null && item.getType() == mat)
|
||||
{
|
||||
founditem = true;
|
||||
}
|
||||
}
|
||||
if (player.getItemOnCursor() != null)
|
||||
{
|
||||
if (player.getItemOnCursor().getType() == mat)
|
||||
founditem = true;
|
||||
}
|
||||
|
||||
if (!founditem)
|
||||
{
|
||||
player.getOpenInventory().getTopInventory().addItem(new ItemStack(mat));
|
||||
}
|
||||
|
||||
|
||||
if (UtilInv.contains(player, null, mat, (byte) 0, 1, false, true, false))
|
||||
{
|
||||
UtilInv.removeAll(player, mat, (byte) 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -7,6 +7,7 @@ import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilEvent;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.common.util.UtilEvent.ActionType;
|
||||
import mineplex.core.common.util.UtilInv;
|
||||
import nautilus.game.arcade.game.games.lobbers.events.TNTThrowEvent;
|
||||
@ -76,6 +77,11 @@ public class PerkWaller extends Perk
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Recharge.Instance.usable(event.getPlayer(), "Waller"))
|
||||
return;
|
||||
|
||||
Recharge.Instance.use(event.getPlayer(), "Waller", 100, false, false);
|
||||
|
||||
UtilInv.remove(event.getPlayer(), Material.STONE_SPADE, (byte) 0, 1);
|
||||
|
||||
_wallBlocks.addAll(buildWall(event.getClickedBlock().getLocation(), event.getPlayer().getLocation().getYaw()));
|
||||
|
@ -2138,7 +2138,13 @@ public class MineStrike extends TeamGame
|
||||
team.SpawnTeleport(false);
|
||||
|
||||
//Revive Dead Players
|
||||
for (Player player : GetPlayers(false))
|
||||
for (Player player : GetPlayers(false))
|
||||
{
|
||||
if (Manager.isVanished(player))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!IsAlive(player))
|
||||
{
|
||||
SetPlayerState(player, PlayerState.IN);
|
||||
@ -2156,6 +2162,7 @@ public class MineStrike extends TeamGame
|
||||
if (GetKit(player) != null)
|
||||
GetKit(player).ApplyKit(player);
|
||||
}
|
||||
}
|
||||
|
||||
//Remove Scope
|
||||
for (Player player : GetPlayers(false))
|
||||
@ -2319,6 +2326,11 @@ public class MineStrike extends TeamGame
|
||||
if (GetState() == GameState.Recruit || GetState() == GameState.Loading)
|
||||
return;
|
||||
|
||||
if (Manager.isVanished(event.getPlayer()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//Target Team
|
||||
GameTeam targetTeam = null;
|
||||
if (GetTeamList().get(0).GetPlayers(false).size() < GetTeamList().get(1).GetPlayers(false).size())
|
||||
|
@ -52,7 +52,13 @@ public class HighExplosive extends Grenade
|
||||
continue;
|
||||
|
||||
// Damage Event
|
||||
game.Manager.GetDamage().NewDamageEvent(player, _thrower, null, ent.getLocation(),
|
||||
Player damager = null;
|
||||
if (game.IsAlive(_thrower))
|
||||
{
|
||||
damager = _thrower;
|
||||
}
|
||||
|
||||
game.Manager.GetDamage().NewDamageEvent(player, damager, null, ent.getLocation(),
|
||||
DamageCause.CUSTOM, 1 + (players.get(player) * 18),
|
||||
true, true, false, _thrower.getName(), getName());
|
||||
|
||||
|
@ -331,7 +331,7 @@ public class Gun extends StrikeItem
|
||||
{
|
||||
new BukkitRunnable() {
|
||||
public void run() {
|
||||
PlayerStats remoteStats = game.getArcadeManager().GetStatsManager().Get(player);;
|
||||
PlayerStats remoteStats = game.getArcadeManager().GetStatsManager().Get(player);
|
||||
_kills = (int) remoteStats.getStat(game.GetName() + "." + getStatNameKills(true));
|
||||
|
||||
Player owner = UtilPlayer.searchExact(getOwnerName());
|
||||
|
@ -48,6 +48,8 @@ import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
import org.bukkit.event.entity.EntityRegainHealthEvent;
|
||||
import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||
import org.bukkit.scoreboard.Team;
|
||||
|
||||
public class MonsterMaze extends SoloGame
|
||||
@ -60,6 +62,9 @@ public class MonsterMaze extends SoloGame
|
||||
private Location _center;
|
||||
|
||||
private HashMap<Player, Long> _launched = new HashMap<Player, Long>();
|
||||
|
||||
private static final int JUMP_POTION_AMPLIFIER = -10;
|
||||
private int _potionMult = JUMP_POTION_AMPLIFIER;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public MonsterMaze(ArcadeManager manager)
|
||||
@ -260,6 +265,36 @@ public class MonsterMaze extends SoloGame
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onDebug(PlayerCommandPreprocessEvent event)
|
||||
{
|
||||
if (!event.getPlayer().isOp())
|
||||
return;
|
||||
|
||||
if (event.getMessage().toLowerCase().contains("/setmult "))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
Integer mult = Integer.parseInt(event.getMessage().toLowerCase().replace("/setmult ", ""));
|
||||
_potionMult = mult;
|
||||
|
||||
for (Player pl : GetPlayers(true))
|
||||
{
|
||||
Manager.GetCondition().Clean(pl);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onBreakJumper(InventoryClickEvent event)
|
||||
{
|
||||
if (!InProgress())
|
||||
return;
|
||||
if (!IsAlive(event.getWhoClicked()))
|
||||
return;
|
||||
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void PotionEffects(UpdateEvent event)
|
||||
{
|
||||
@ -276,7 +311,7 @@ public class MonsterMaze extends SoloGame
|
||||
else
|
||||
{
|
||||
if (!Manager.GetCondition().HasCondition(pl, ConditionType.JUMP, null))
|
||||
Manager.GetCondition().Factory().Jump("No jumping", pl, null, 9999999, 250, true, false, false);
|
||||
Manager.GetCondition().Factory().Jump("No jumping", pl, null, 9999999, _potionMult, true, false, false);
|
||||
}
|
||||
|
||||
// if (!Manager.GetCondition().HasCondition(pl, ConditionType.INVISIBILITY, null))
|
||||
|
@ -42,7 +42,7 @@ public class KitJumper extends ProgressingKit
|
||||
@Override
|
||||
public void GiveItems(Player player)
|
||||
{
|
||||
player.getInventory().setItem(4, PLAYER_ITEMS[4]);
|
||||
player.getInventory().setItem(8, PLAYER_ITEMS[8]);
|
||||
player.getInventory().setItem(4, PLAYER_ITEMS[0]);
|
||||
player.getInventory().setItem(8, PLAYER_ITEMS[1]);
|
||||
}
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilInv;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.itemstack.ItemBuilder;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.game.Game.GameState;
|
||||
@ -11,6 +12,7 @@ import nautilus.game.arcade.kit.KitAvailability;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
import nautilus.game.arcade.kit.ProgressingKit;
|
||||
import nautilus.game.arcade.kit.perks.PerkArrowRebound;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -31,7 +33,7 @@ public class KitEnchanter extends ProgressingKit
|
||||
private static final ItemStack IN_HAND = new ItemStack(Material.BOW);
|
||||
|
||||
private static final ItemStack[] PLAYER_ITEMS = {
|
||||
ItemStackFactory.Instance.CreateStack(Material.STONE_SWORD),
|
||||
new ItemBuilder(Material.STONE_SWORD).setGlow(true).build(),
|
||||
ItemStackFactory.Instance.CreateStack(Material.BOW)
|
||||
};
|
||||
|
||||
|
@ -31,7 +31,7 @@ public class KitLeaper extends ProgressingKit
|
||||
private static final ItemStack IN_HAND = new ItemStack(Material.STONE_SWORD);
|
||||
|
||||
private static final ItemStack[] PLAYER_ITEMS = {
|
||||
ItemStackFactory.Instance.CreateStack(Material.IRON_AXE),
|
||||
ItemStackFactory.Instance.CreateStack(Material.STONE_SWORD),
|
||||
ItemStackFactory.Instance.CreateStack(Material.BOW)
|
||||
};
|
||||
|
||||
|
@ -674,8 +674,7 @@ public abstract class Skywars extends Game
|
||||
Player player = e.getPlayer();
|
||||
if (is.getType() == Material.TNT)
|
||||
{
|
||||
e.setCancelled(true);
|
||||
_tntGen.pickup(player, e.getItem());
|
||||
e.setCancelled(_tntGen.pickup(player, e.getItem()));
|
||||
}
|
||||
}
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user