Merge remote-tracking branch 'origin/master'
Conflicts: Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java
This commit is contained in:
commit
f1fbc21570
@ -238,10 +238,12 @@ public class UtilBlock
|
||||
blockUseSet.add((byte)69); //Lever
|
||||
blockUseSet.add((byte)71); //Iron Door
|
||||
blockUseSet.add((byte)77); //Button
|
||||
blockUseSet.add((byte)85); //Fence (stupid minecraft)
|
||||
blockUseSet.add((byte)93); //Repeater
|
||||
blockUseSet.add((byte)94); //Repeater
|
||||
blockUseSet.add((byte)96); //Trapdoor
|
||||
blockUseSet.add((byte)107); //Fence Gate
|
||||
blockUseSet.add((byte)113); //Nether Fence (stupid minecraft)
|
||||
blockUseSet.add((byte)116); //Enchantment Table
|
||||
blockUseSet.add((byte)117); //Brewing Stand
|
||||
blockUseSet.add((byte)130); //Ender Chest
|
||||
@ -249,6 +251,22 @@ public class UtilBlock
|
||||
blockUseSet.add((byte)146); //Trapped Chest
|
||||
blockUseSet.add((byte)154); //Hopper
|
||||
blockUseSet.add((byte)158); //Dropper
|
||||
|
||||
blockUseSet.add((byte)184); //Fences/Gates
|
||||
blockUseSet.add((byte)185); //Fences/Gates
|
||||
blockUseSet.add((byte)186); //Fences/Gates
|
||||
blockUseSet.add((byte)187); //Fences/Gates
|
||||
blockUseSet.add((byte)188); //Fences/Gates
|
||||
blockUseSet.add((byte)189); //Fences/Gates
|
||||
blockUseSet.add((byte)190); //Fences/Gates
|
||||
blockUseSet.add((byte)191); //Fences/Gates
|
||||
blockUseSet.add((byte)192); //Fences/Gates
|
||||
|
||||
blockUseSet.add((byte)193); //Wood Doors
|
||||
blockUseSet.add((byte)194); //Wood Doors
|
||||
blockUseSet.add((byte)195); //Wood Doors
|
||||
blockUseSet.add((byte)196); //Wood Doors
|
||||
blockUseSet.add((byte)197); //Wood Doors
|
||||
}
|
||||
|
||||
return blockUseSet.contains(block);
|
||||
|
@ -0,0 +1,121 @@
|
||||
package mineplex.core.common.util;
|
||||
|
||||
import java.util.HashSet;
|
||||
|
||||
public class UtilInput
|
||||
{
|
||||
//Valid Chars
|
||||
protected static HashSet<Character> validSet = new HashSet<Character>();
|
||||
protected static HashSet<String> filterSet = new HashSet<String>();
|
||||
|
||||
public static boolean valid(String input)
|
||||
{
|
||||
if (validSet.isEmpty())
|
||||
addChars();
|
||||
|
||||
for (char cur : input.toCharArray())
|
||||
if (!validSet.contains(cur))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static String filter(String input)
|
||||
{
|
||||
if (filterSet.isEmpty())
|
||||
addDictionary();
|
||||
|
||||
for (String cur : filterSet)
|
||||
{
|
||||
if (input.equalsIgnoreCase(cur))
|
||||
{
|
||||
String out = "" + input.charAt(0);
|
||||
while (out.length() < input.length())
|
||||
out += '*';
|
||||
return out;
|
||||
}
|
||||
}
|
||||
|
||||
return input;
|
||||
}
|
||||
|
||||
public static void addDictionary()
|
||||
{
|
||||
filterSet.add("fuck");
|
||||
filterSet.add("shit");
|
||||
filterSet.add("cunt");
|
||||
filterSet.add("ass");
|
||||
filterSet.add("asshole");
|
||||
filterSet.add("faggot");
|
||||
filterSet.add("fag");
|
||||
filterSet.add("gay");
|
||||
}
|
||||
|
||||
public static void addChars()
|
||||
{
|
||||
validSet.add('1');
|
||||
validSet.add('2');
|
||||
validSet.add('3');
|
||||
validSet.add('4');
|
||||
validSet.add('5');
|
||||
validSet.add('6');
|
||||
validSet.add('7');
|
||||
validSet.add('8');
|
||||
validSet.add('9');
|
||||
validSet.add('0');
|
||||
|
||||
validSet.add('a');
|
||||
validSet.add('b');
|
||||
validSet.add('c');
|
||||
validSet.add('d');
|
||||
validSet.add('e');
|
||||
validSet.add('f');
|
||||
validSet.add('g');
|
||||
validSet.add('h');
|
||||
validSet.add('i');
|
||||
validSet.add('j');
|
||||
validSet.add('k');
|
||||
validSet.add('l');
|
||||
validSet.add('m');
|
||||
validSet.add('n');
|
||||
validSet.add('o');
|
||||
validSet.add('p');
|
||||
validSet.add('q');
|
||||
validSet.add('r');
|
||||
validSet.add('s');
|
||||
validSet.add('t');
|
||||
validSet.add('u');
|
||||
validSet.add('v');
|
||||
validSet.add('w');
|
||||
validSet.add('x');
|
||||
validSet.add('y');
|
||||
validSet.add('z');
|
||||
|
||||
validSet.add('A');
|
||||
validSet.add('B');
|
||||
validSet.add('C');
|
||||
validSet.add('D');
|
||||
validSet.add('E');
|
||||
validSet.add('F');
|
||||
validSet.add('G');
|
||||
validSet.add('H');
|
||||
validSet.add('I');
|
||||
validSet.add('J');
|
||||
validSet.add('K');
|
||||
validSet.add('L');
|
||||
validSet.add('M');
|
||||
validSet.add('N');
|
||||
validSet.add('O');
|
||||
validSet.add('P');
|
||||
validSet.add('Q');
|
||||
validSet.add('R');
|
||||
validSet.add('S');
|
||||
validSet.add('T');
|
||||
validSet.add('U');
|
||||
validSet.add('V');
|
||||
validSet.add('W');
|
||||
validSet.add('X');
|
||||
validSet.add('Y');
|
||||
validSet.add('Z');
|
||||
}
|
||||
}
|
@ -67,5 +67,5 @@ public class UtilTextBottom
|
||||
display((prefix == null ? "" : prefix + ChatColor.RESET + " ") + progressBar + (suffix == null ? "" : ChatColor.RESET + " " + suffix), players);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,123 +0,0 @@
|
||||
package mineplex.core;
|
||||
|
||||
import java.util.HashSet;
|
||||
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.account.event.RetrieveClientInformationEvent;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.NautHashMap;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.inventory.InventoryManager;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
public class RankBenefitsGiver9000 extends MiniPlugin
|
||||
{
|
||||
private CoreClientManager _clientManager;
|
||||
private InventoryManager _inventoryManager;
|
||||
private RankBenefitsGiver9000Repository _repository;
|
||||
|
||||
private NautHashMap<String, String> _playersNeedingBenefit = new NautHashMap<String, String>();
|
||||
|
||||
public RankBenefitsGiver9000(JavaPlugin plugin, CoreClientManager clientManager, InventoryManager inventoryManager)
|
||||
{
|
||||
super("RankBenefitsGiver9000", plugin);
|
||||
|
||||
_clientManager = clientManager;
|
||||
_inventoryManager = inventoryManager;
|
||||
_repository = new RankBenefitsGiver9000Repository(plugin);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void loadPlayer(RetrieveClientInformationEvent event)
|
||||
{
|
||||
boolean treasureUpdate = false;
|
||||
boolean horrorUpdate = false;
|
||||
|
||||
for (String benefit : _repository.retrievePlayerBenefits(event.getUniqueId().toString()))
|
||||
{
|
||||
if (benefit.equalsIgnoreCase("TreasureUpdate"))
|
||||
treasureUpdate = true;
|
||||
|
||||
if (benefit.equalsIgnoreCase("HalloweenHorror"))
|
||||
horrorUpdate = true;
|
||||
}
|
||||
|
||||
if (!horrorUpdate)
|
||||
{
|
||||
_playersNeedingBenefit.put(event.getPlayerName(), "Horror");
|
||||
}
|
||||
|
||||
if (!treasureUpdate)
|
||||
{
|
||||
_playersNeedingBenefit.put(event.getPlayerName(), "Treasure");
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void giveBenefit(final PlayerJoinEvent event)
|
||||
{
|
||||
if (!_playersNeedingBenefit.containsKey(event.getPlayer().getName()))
|
||||
return;
|
||||
|
||||
if (_playersNeedingBenefit.get(event.getPlayer().getName()).contains("Horror"))
|
||||
{
|
||||
_inventoryManager.addItemToInventory(event.getPlayer(), "Treasure", "Treasure Key", 2);
|
||||
|
||||
Bukkit.getServer().getScheduler().runTaskAsynchronously(GetPlugin(), new Runnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
_repository.addBenefit(event.getPlayer().getUniqueId().toString(), "HalloweenHorror");
|
||||
}
|
||||
});
|
||||
|
||||
Bukkit.getServer().getScheduler().runTaskLater(GetPlugin(), new Runnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
UtilPlayer.message(event.getPlayer(), C.cPurple + C.Strike + "=============================================");
|
||||
UtilPlayer.message(event.getPlayer(), "");
|
||||
UtilPlayer.message(event.getPlayer(), C.cGold + C.Strike + "HAPPY HALLOWEEN");
|
||||
UtilPlayer.message(event.getPlayer(), "You received 2 Treasure Keys!");
|
||||
UtilPlayer.message(event.getPlayer(), "");
|
||||
UtilPlayer.message(event.getPlayer(), C.cPurple + C.Strike + "=============================================");
|
||||
}
|
||||
}, 5L);
|
||||
}
|
||||
else if (_playersNeedingBenefit.get(event.getPlayer().getName()).contains("Treasure"))
|
||||
{
|
||||
if (_clientManager.Get(event.getPlayer()).GetRank() == Rank.ALL)
|
||||
{
|
||||
_inventoryManager.addItemToInventory(event.getPlayer(), "Utility", "Treasure Chest", 1);
|
||||
_inventoryManager.addItemToInventory(event.getPlayer(), "Treasure", "Treasure Key", 1);
|
||||
}
|
||||
else if (_clientManager.Get(event.getPlayer()).GetRank() == Rank.ULTRA)
|
||||
{
|
||||
_inventoryManager.addItemToInventory(event.getPlayer(), "Utility", "Treasure Chest", 20);
|
||||
_inventoryManager.addItemToInventory(event.getPlayer(), "Treasure", "Treasure Key", 5);
|
||||
}
|
||||
else
|
||||
{
|
||||
_inventoryManager.addItemToInventory(event.getPlayer(), "Utility", "Treasure Chest", 40);
|
||||
_inventoryManager.addItemToInventory(event.getPlayer(), "Treasure", "Treasure Key", 10);
|
||||
}
|
||||
|
||||
Bukkit.getServer().getScheduler().runTaskAsynchronously(GetPlugin(), new Runnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
_repository.addBenefit(event.getPlayer().getUniqueId().toString(), "TreasureUpdate");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
_playersNeedingBenefit.remove(event.getPlayer().getName());
|
||||
}
|
||||
}
|
@ -239,6 +239,7 @@ public class CoreClientManager extends MiniPlugin
|
||||
Gson gson = new Gson();
|
||||
|
||||
final RetrieveClientInformationEvent clientInformationEvent = new RetrieveClientInformationEvent(client.GetPlayerName(), uuid);
|
||||
clientInformationEvent.incrementProcessingCount();
|
||||
|
||||
Bukkit.getServer().getScheduler().runTaskAsynchronously(GetPlugin(), new Runnable()
|
||||
{
|
||||
@ -247,6 +248,7 @@ public class CoreClientManager extends MiniPlugin
|
||||
_repository.login(uuid.toString(), client.GetPlayerName());
|
||||
|
||||
Bukkit.getServer().getPluginManager().callEvent(clientInformationEvent);
|
||||
clientInformationEvent.decreaseProcessingCount();
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -50,7 +50,7 @@ public class UpdateRank extends CommandBase<CoreClientManager>
|
||||
|
||||
final Rank rank = tempRank;
|
||||
|
||||
if (rank == Rank.MODERATOR || rank == Rank.HELPER || rank == Rank.ALL || rank == Rank.MAPDEV || rank == Rank.SNR_MODERATOR)
|
||||
if ((rank == Rank.YOUTUBE && Plugin.Get(caller).GetRank().Has(Rank.OWNER)) || rank == Rank.MODERATOR || rank == Rank.HELPER || rank == Rank.ALL || rank == Rank.MAPDEV || rank == Rank.SNR_MODERATOR)
|
||||
{
|
||||
Plugin.getRepository().MatchPlayerName(new Callback<List<String>>()
|
||||
{
|
||||
|
@ -279,7 +279,7 @@ public enum Achievement
|
||||
|
||||
SUPER_PAINTBALL_SPEEDRUNNER("Speedrunner", 1000,
|
||||
new String[]{"Super Paintball.Speedrunner"},
|
||||
new String[]{"Win a game in 20 seconds"},
|
||||
new String[]{"Win a game in 30 seconds"},
|
||||
new int[]{1},
|
||||
AchievementCategory.SUPER_PAINTBALL),
|
||||
|
||||
@ -323,7 +323,7 @@ public enum Achievement
|
||||
|
||||
SNAKE_CANNIBAL("Cannibal", 1600,
|
||||
new String[]{"Snake.Cannibal"},
|
||||
new String[]{"Kill 8 players in a single game"},
|
||||
new String[]{"Kill 6 players in a single game"},
|
||||
new int[]{1},
|
||||
AchievementCategory.SNAKE),
|
||||
|
||||
@ -519,7 +519,7 @@ public enum Achievement
|
||||
|
||||
MICRO_BATTLE_ANNIHILATION("Annihilation", 1200,
|
||||
new String[]{"Micro Battle.Annihilation"},
|
||||
new String[]{"Kill 12 players in one game"},
|
||||
new String[]{"Kill 8 players in one game"},
|
||||
new int[]{1},
|
||||
AchievementCategory.MICRO_BATTLE),
|
||||
|
||||
|
@ -0,0 +1,8 @@
|
||||
package mineplex.core.benefit;
|
||||
|
||||
import java.util.HashSet;
|
||||
|
||||
public class PlayerBenefit
|
||||
{
|
||||
public HashSet<String> Benefits = new HashSet<String>();
|
||||
}
|
@ -0,0 +1,82 @@
|
||||
package mineplex.core.benefit;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import mineplex.core.MiniClientPlugin;
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.account.event.RetrieveClientInformationEvent;
|
||||
import mineplex.core.benefit.benefits.BenefitBase;
|
||||
import mineplex.core.benefit.benefits.Thanksgiving2014;
|
||||
import mineplex.core.common.util.Callback;
|
||||
import mineplex.core.inventory.InventoryManager;
|
||||
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
public class RankBenefitsGiver9000 extends MiniClientPlugin<PlayerBenefit>
|
||||
{
|
||||
private RankBenefitsGiver9000Repository _repository;
|
||||
|
||||
private List<BenefitBase> _benefits = new ArrayList<BenefitBase>();
|
||||
|
||||
public RankBenefitsGiver9000(JavaPlugin plugin, CoreClientManager clientManager, InventoryManager inventoryManager)
|
||||
{
|
||||
super("RankBenefitsGiver9000", plugin);
|
||||
|
||||
_repository = new RankBenefitsGiver9000Repository(plugin);
|
||||
|
||||
_benefits.add(new Thanksgiving2014(plugin, _repository, inventoryManager));
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void giveBenefit(final PlayerJoinEvent event)
|
||||
{
|
||||
for (final BenefitBase benefit : _benefits)
|
||||
{
|
||||
if (!Get(event.getPlayer()).Benefits.contains(benefit.getName()))
|
||||
{
|
||||
|
||||
benefit.recordBenefit(event.getPlayer(), new Callback<Boolean>()
|
||||
{
|
||||
public void run(Boolean success)
|
||||
{
|
||||
if (success)
|
||||
{
|
||||
benefit.rewardPlayer(event.getPlayer());
|
||||
}
|
||||
else
|
||||
System.out.println("Benefit reward failed for " + event.getPlayer().getName());
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected PlayerBenefit AddPlayer(String player)
|
||||
{
|
||||
return new PlayerBenefit();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void loadClientInformation(final RetrieveClientInformationEvent event)
|
||||
{
|
||||
event.incrementProcessingCount();
|
||||
|
||||
runAsync(new Runnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
for (String benefit : _repository.retrievePlayerBenefits(event.getUniqueId().toString()))
|
||||
{
|
||||
Get(event.getPlayerName()).Benefits.add(benefit);
|
||||
}
|
||||
|
||||
event.decreaseProcessingCount();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
@ -1,16 +1,14 @@
|
||||
package mineplex.core;
|
||||
package mineplex.core.benefit;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import mineplex.core.database.DBPool;
|
||||
import mineplex.core.database.RepositoryBase;
|
||||
import mineplex.core.database.ResultSetCallable;
|
||||
import mineplex.core.database.column.ColumnVarChar;
|
||||
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
public class RankBenefitsGiver9000Repository extends RepositoryBase
|
||||
@ -54,8 +52,8 @@ public class RankBenefitsGiver9000Repository extends RepositoryBase
|
||||
return benefits;
|
||||
}
|
||||
|
||||
public void addBenefit(String uuid, String benefit)
|
||||
public boolean addBenefit(String uuid, String benefit)
|
||||
{
|
||||
executeUpdate(INSERT_BENEFIT, new ColumnVarChar("uuid", 100, uuid), new ColumnVarChar("benefit", 100, benefit));
|
||||
return executeUpdate(INSERT_BENEFIT, new ColumnVarChar("uuid", 100, uuid), new ColumnVarChar("benefit", 100, benefit)) > 0;
|
||||
}
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
package mineplex.core.benefit.benefits;
|
||||
|
||||
import mineplex.core.benefit.RankBenefitsGiver9000Repository;
|
||||
import mineplex.core.common.util.Callback;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
public abstract class BenefitBase
|
||||
{
|
||||
private JavaPlugin _plugin;
|
||||
private String _name;
|
||||
private RankBenefitsGiver9000Repository _repository;
|
||||
|
||||
protected BenefitBase(JavaPlugin plugin, String name, RankBenefitsGiver9000Repository repository)
|
||||
{
|
||||
_plugin = plugin;
|
||||
_name = name;
|
||||
_repository = repository;
|
||||
}
|
||||
|
||||
public JavaPlugin getPlugin()
|
||||
{
|
||||
return _plugin;
|
||||
}
|
||||
|
||||
public RankBenefitsGiver9000Repository getRepository()
|
||||
{
|
||||
return _repository;
|
||||
}
|
||||
|
||||
public abstract void rewardPlayer(Player player);
|
||||
|
||||
public void recordBenefit(final Player player, final Callback<Boolean> callback)
|
||||
{
|
||||
Bukkit.getServer().getScheduler().runTaskAsynchronously(_plugin, new Runnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
boolean success = _repository.addBenefit(player.getUniqueId().toString(), _name);
|
||||
|
||||
callback.run(success);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return _name;
|
||||
}
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
package mineplex.core.benefit.benefits;
|
||||
|
||||
import mineplex.core.benefit.RankBenefitsGiver9000Repository;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.Callback;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.inventory.InventoryManager;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
public class Thanksgiving2014 extends BenefitBase
|
||||
{
|
||||
private InventoryManager _inventoryManager;
|
||||
|
||||
public Thanksgiving2014(JavaPlugin plugin, RankBenefitsGiver9000Repository repository, InventoryManager inventoryManager)
|
||||
{
|
||||
super(plugin, "Thanksgiving2014", repository);
|
||||
|
||||
_inventoryManager = inventoryManager;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void rewardPlayer(final Player player)
|
||||
{
|
||||
_inventoryManager.addItemToInventory(new Callback<Boolean>()
|
||||
{
|
||||
public void run(Boolean success)
|
||||
{
|
||||
if (success)
|
||||
{
|
||||
UtilPlayer.message(player, C.cPurple + C.Strike + "=============================================");
|
||||
UtilPlayer.message(player, "");
|
||||
UtilPlayer.message(player, C.cGold + "HAPPY THANKSGIVING");
|
||||
UtilPlayer.message(player, "You received 1 Treasure Key!");
|
||||
UtilPlayer.message(player, "");
|
||||
UtilPlayer.message(player, C.cPurple + C.Strike + "=============================================");
|
||||
}
|
||||
}
|
||||
}, player, "Treasure", "Treasure Key", 1);
|
||||
}
|
||||
}
|
@ -117,7 +117,7 @@ public class GadgetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
Plugin.getInventoryManager().addItemToInventory(Player, gadget.getGadgetType().name(), gadget.GetName(), (gadget instanceof ItemGadget ? ((ItemGadget)gadget).getAmmo().getQuantity() : gadget.getQuantity()));
|
||||
Plugin.getInventoryManager().addItemToInventory(null, Player, gadget.getGadgetType().name(), gadget.GetName(), (gadget instanceof ItemGadget ? ((ItemGadget)gadget).getAmmo().getQuantity() : gadget.getQuantity()));
|
||||
Refresh();
|
||||
}
|
||||
}, this, (gadget instanceof ItemGadget ? ((ItemGadget)gadget).getAmmo() : gadget), CurrencyType.Coins, Player));
|
||||
|
@ -133,7 +133,7 @@ public class Menu extends ShopPageBase<CosmeticManager, CosmeticShop>
|
||||
Bukkit.getServer().getPluginManager().callEvent(boosterEvent);
|
||||
|
||||
if (!boosterEvent.isCancelled())
|
||||
Plugin.getInventoryManager().addItemToInventory(Player, "Utility", "Gem Booster", -1);
|
||||
Plugin.getInventoryManager().addItemToInventory(null, Player, "Utility", "Gem Booster", -1);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -262,7 +262,7 @@ public class Menu extends ShopPageBase<CosmeticManager, CosmeticShop>
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
Plugin.getInventoryManager().addItemToInventory(Player, "Utility", "Gem Booster", 20);
|
||||
Plugin.getInventoryManager().addItemToInventory(null, Player, "Utility", "Gem Booster", 20);
|
||||
Shop.OpenPageForPlayer(Player, new Menu(Plugin, Shop, ClientManager, DonationManager, Player));
|
||||
}
|
||||
}, null, gemBoosterItem, CurrencyType.Coins, Player));
|
||||
@ -322,7 +322,7 @@ public class Menu extends ShopPageBase<CosmeticManager, CosmeticShop>
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
Plugin.getInventoryManager().addItemToInventory(Player, "Treasure", "Treasure Key", 1);
|
||||
Plugin.getInventoryManager().addItemToInventory(null, Player, "Treasure", "Treasure Key", 1);
|
||||
Refresh();
|
||||
}
|
||||
}, this, new TreasureKey(), CurrencyType.Coins, Player));
|
||||
|
@ -92,7 +92,7 @@ public class MountPage extends ShopPageBase<CosmeticManager, CosmeticShop>
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
Plugin.getInventoryManager().addItemToInventory(Player, "Mount", mount.GetName(), 1);
|
||||
Plugin.getInventoryManager().addItemToInventory(null, Player, "Mount", mount.GetName(), 1);
|
||||
Refresh();
|
||||
}
|
||||
}, this, mount, CurrencyType.Coins, Player));
|
||||
|
@ -103,7 +103,7 @@ public class PetTagPage extends ShopPageBase<CosmeticManager, CosmeticShop>
|
||||
|
||||
Plugin.getPetManager().Get(Player).GetPets().put(_pet.GetPetType(), token.PetName);
|
||||
|
||||
Plugin.getInventoryManager().addItemToInventory(Player, "Pet", _pet.GetPetType().toString(), 1);
|
||||
Plugin.getInventoryManager().addItemToInventory(null, Player, "Pet", _pet.GetPetType().toString(), 1);
|
||||
Shop.OpenPageForPlayer(Player, new Menu(Plugin, Shop, ClientManager, DonationManager, Player));
|
||||
}
|
||||
}, null, _petPurchase ? _pet : tag, CurrencyType.Coins, Player));
|
||||
|
@ -77,6 +77,11 @@ public abstract class RepositoryBase implements Listener
|
||||
}
|
||||
|
||||
protected int executeUpdate(String query, Column<?>...columns)
|
||||
{
|
||||
return executeUpdate(query, null, columns);
|
||||
}
|
||||
|
||||
protected int executeUpdate(String query, ResultSetCallable callable, Column<?>...columns)
|
||||
{
|
||||
PreparedStatement preparedStatement = null;
|
||||
|
||||
@ -95,6 +100,9 @@ public abstract class RepositoryBase implements Listener
|
||||
}
|
||||
|
||||
affectedRows = preparedStatement.executeUpdate();
|
||||
|
||||
if (callable != null)
|
||||
callable.processResultSet(preparedStatement.getGeneratedKeys());
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
|
@ -113,11 +113,12 @@ public class DisguiseManager extends MiniPlugin implements IPacketHandler
|
||||
return _spawnPacketMap.get(entity.getEntityId());
|
||||
}
|
||||
|
||||
public void addViewerToDisguise(DisguiseBase disguise, Player player)
|
||||
public void addViewerToDisguise(DisguiseBase disguise, Player player, boolean reapply)
|
||||
{
|
||||
_disguisePlayerMap.get(disguise).add(player);
|
||||
|
||||
reApplyDisguise(disguise, player);
|
||||
if (reapply)
|
||||
reApplyDisguise(disguise, player);
|
||||
}
|
||||
|
||||
public void removeViewerToDisguise(DisguiseBase disguise, Player player)
|
||||
@ -151,6 +152,9 @@ public class DisguiseManager extends MiniPlugin implements IPacketHandler
|
||||
_spawnPacketMap.put(disguise.GetEntityId(), disguise);
|
||||
_disguisePlayerMap.put(disguise, new HashSet<Player>());
|
||||
|
||||
for (Player player : players)
|
||||
addViewerToDisguise(disguise, player, false);
|
||||
|
||||
if (disguise.GetEntity() instanceof Player && disguise instanceof DisguisePlayer)
|
||||
{
|
||||
if (!((Player)disguise.GetEntity()).getName().equalsIgnoreCase(((DisguisePlayer)disguise).getName()))
|
||||
|
@ -336,8 +336,8 @@ public class Explosion extends MiniPlugin
|
||||
if (blocks.get(cur).getValue() == 0 || blocks.get(cur).getValue() == 3)
|
||||
continue;
|
||||
|
||||
double chance = 0.2 + (double)_explosionBlocks.size()/(double)120;
|
||||
if (Math.random() > Math.min(0.95, chance))
|
||||
double chance = 0.2 + (double)_explosionBlocks.size()/(double)80;
|
||||
if (Math.random() > Math.min(0.98, chance))
|
||||
{
|
||||
FallingBlock fall = cur.getWorld().spawnFallingBlock(cur.getLocation().add(0.5, 0.5, 0.5), blocks.get(cur).getKey(), blocks.get(cur).getValue());
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
package mineplex.core.gadget.gadgets;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
|
||||
import org.bukkit.Effect;
|
||||
@ -34,7 +34,7 @@ import mineplex.core.updater.event.UpdateEvent;
|
||||
|
||||
public class ItemMelonLauncher extends ItemGadget implements IThrown
|
||||
{
|
||||
private HashSet<Item> _melon = new HashSet<Item>();
|
||||
private ArrayList<Item> _melon = new ArrayList<Item>();
|
||||
|
||||
public ItemMelonLauncher(GadgetManager manager)
|
||||
{
|
||||
@ -145,5 +145,11 @@ public class ItemMelonLauncher extends ItemGadget implements IThrown
|
||||
melon.remove();
|
||||
}
|
||||
}
|
||||
|
||||
while (_melon.size() > 60)
|
||||
{
|
||||
Item item = _melon.remove(0);
|
||||
item.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -9,6 +9,7 @@ import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import mineplex.core.MiniClientPlugin;
|
||||
import mineplex.core.account.event.RetrieveClientInformationEvent;
|
||||
import mineplex.core.common.util.Callback;
|
||||
import mineplex.core.common.util.NautHashMap;
|
||||
import mineplex.core.inventory.command.GiveItemCommand;
|
||||
import mineplex.core.inventory.data.Category;
|
||||
@ -66,14 +67,32 @@ public class InventoryManager extends MiniClientPlugin<ClientInventory>
|
||||
}
|
||||
}
|
||||
|
||||
public void addItemToInventory(Player player, String category, String item, int count)
|
||||
public void addItemToInventory(final Player player, String category, final String item, final int count)
|
||||
{
|
||||
if (_items.containsKey(item))
|
||||
addItemToInventory(null, player, category, item, count);
|
||||
}
|
||||
|
||||
public void addItemToInventory(final Callback<Boolean> callback, final Player player, String category, final String item, final int count)
|
||||
{
|
||||
addItemToInventoryForOffline(new Callback<Boolean>()
|
||||
{
|
||||
Get(player).addItem(new ClientItem(_items.get(item), count));
|
||||
}
|
||||
|
||||
addItemToInventoryForOffline(player.getUniqueId().toString(), category, item, count);
|
||||
public void run(Boolean success)
|
||||
{
|
||||
if (success)
|
||||
{
|
||||
if (_items.containsKey(item))
|
||||
{
|
||||
Get(player).addItem(new ClientItem(_items.get(item), count));
|
||||
}
|
||||
System.out.println("Add item to Inventory succeeded.");
|
||||
}
|
||||
else
|
||||
System.out.println("Add item to Inventory FAILED for " + player.getName());
|
||||
|
||||
if (callback != null)
|
||||
callback.run(success);
|
||||
}
|
||||
}, player.getUniqueId().toString(), category, item, count);
|
||||
}
|
||||
|
||||
public Item getItem(String itemName)
|
||||
@ -93,7 +112,7 @@ public class InventoryManager extends MiniClientPlugin<ClientInventory>
|
||||
return item;
|
||||
}
|
||||
|
||||
public void addItemToInventoryForOffline(final String uuidString, final String category, final String item, final int count)
|
||||
public void addItemToInventoryForOffline(final Callback<Boolean> callback, final String uuidString, final String category, final String item, final int count)
|
||||
{
|
||||
Bukkit.getServer().getScheduler().runTaskAsynchronously(GetPlugin(), new Runnable()
|
||||
{
|
||||
@ -123,7 +142,18 @@ public class InventoryManager extends MiniClientPlugin<ClientInventory>
|
||||
|
||||
synchronized (_inventoryLock)
|
||||
{
|
||||
_repository.incrementClientInventoryItem(uuidString, _items.get(item).Id, count);
|
||||
final boolean success = _repository.incrementClientInventoryItem(uuidString, _items.get(item).Id, count);
|
||||
|
||||
if (callback != null)
|
||||
{
|
||||
Bukkit.getServer().getScheduler().runTask(GetPlugin(), new Runnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
callback.run(success);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -6,6 +6,7 @@ import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.command.CommandBase;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.util.Callback;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UUIDFetcher;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
@ -23,7 +24,7 @@ public class GiveItemCommand extends CommandBase<InventoryManager>
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Execute(Player caller, String[] args)
|
||||
public void Execute(final Player caller, String[] args)
|
||||
{
|
||||
if (args == null || args.length < 3)
|
||||
{
|
||||
@ -33,13 +34,15 @@ public class GiveItemCommand extends CommandBase<InventoryManager>
|
||||
|
||||
final String playerName = args[0];
|
||||
final int amount = Integer.parseInt(args[1]);
|
||||
String itemName = "";
|
||||
String itemNameTemp = "";
|
||||
for (int i = 2; i < args.length; i++)
|
||||
{
|
||||
itemName += args[i] + " ";
|
||||
itemNameTemp += args[i] + " ";
|
||||
}
|
||||
|
||||
itemName = itemName.trim();
|
||||
itemNameTemp = itemNameTemp.trim();
|
||||
|
||||
final String itemName = itemNameTemp;
|
||||
|
||||
Item item = Plugin.getItem(itemName);
|
||||
Player player = UtilPlayer.searchExact(playerName);
|
||||
@ -59,8 +62,13 @@ public class GiveItemCommand extends CommandBase<InventoryManager>
|
||||
UUID uuid = UUIDFetcher.getUUIDOf(playerName);
|
||||
if (uuid != null)
|
||||
{
|
||||
Plugin.addItemToInventoryForOffline(uuid.toString(), item.Category, item.Name, amount);
|
||||
UtilPlayer.message(caller, F.main("Item", "You gave " + F.elem(amount + " " + itemName) + " to offline player " + F.name(playerName)));
|
||||
Plugin.addItemToInventoryForOffline(new Callback<Boolean>()
|
||||
{
|
||||
public void run (Boolean success)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Item", "You gave " + F.elem(amount + " " + itemName) + " to offline player " + F.name(playerName)));
|
||||
}
|
||||
}, uuid.toString(), item.Category, item.Name, amount);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -93,9 +93,9 @@ public class InventoryRepository extends RepositoryBase
|
||||
return items;
|
||||
}
|
||||
|
||||
public void incrementClientInventoryItem(String uuid, int itemId, int count)
|
||||
public boolean incrementClientInventoryItem(String uuid, int itemId, int count)
|
||||
{
|
||||
executeUpdate(INSERT_CLIENT_INVENTORY, new ColumnInt("itemid", itemId), new ColumnInt("count", count), new ColumnVarChar("uuid", 100, uuid));
|
||||
return executeUpdate(INSERT_CLIENT_INVENTORY, new ColumnInt("itemid", itemId), new ColumnInt("count", count), new ColumnVarChar("uuid", 100, uuid)) > 0;
|
||||
}
|
||||
|
||||
public ClientInventory loadClientInformation(String uuid)
|
||||
|
@ -857,9 +857,12 @@ public class ItemStackFactory extends MiniPlugin
|
||||
stack.setItemMeta(itemMeta);
|
||||
|
||||
//Unbreakable
|
||||
ItemMeta meta = stack.getItemMeta();
|
||||
meta.spigot().setUnbreakable(true);
|
||||
stack.setItemMeta(meta);
|
||||
if (stack.getType().getMaxDurability() > 1)
|
||||
{
|
||||
ItemMeta meta = stack.getItemMeta();
|
||||
meta.spigot().setUnbreakable(true);
|
||||
stack.setItemMeta(meta);
|
||||
}
|
||||
|
||||
return stack;
|
||||
}
|
||||
|
@ -153,6 +153,12 @@ public class Enjin extends MiniPlugin implements CommandExecutor
|
||||
playerUUID = UUIDFetcher.getUUIDOf(name);
|
||||
}
|
||||
|
||||
if (playerUUID == null)
|
||||
{
|
||||
System.out.println("[" + _dateFormat.format(new Date()) + "] ERROR processing " + name + ", no UUID.");
|
||||
return true;
|
||||
}
|
||||
|
||||
_cachedUUIDs.put(name, new AbstractMap.SimpleEntry<UUID, Long>(playerUUID, System.currentTimeMillis() + 240000));
|
||||
|
||||
if (args.length == 3 && args[0].equalsIgnoreCase("gem"))
|
||||
|
@ -37,6 +37,7 @@ public class ClanInfo
|
||||
}
|
||||
}
|
||||
|
||||
private int _id = -1;
|
||||
private String _name = "";
|
||||
private String _desc = "";
|
||||
private Location _home = null;
|
||||
@ -64,6 +65,7 @@ public class ClanInfo
|
||||
{
|
||||
Clans = clans;
|
||||
|
||||
_id = token.Id;
|
||||
_name = token.Name;
|
||||
_desc = token.Description;
|
||||
|
||||
@ -370,4 +372,9 @@ public class ClanInfo
|
||||
{
|
||||
return _admin;
|
||||
}
|
||||
|
||||
public int getId()
|
||||
{
|
||||
return _id;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,695 @@
|
||||
package mineplex.game.clans.clans;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import mineplex.core.account.CoreClient;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilInput;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilWorld;
|
||||
import mineplex.game.clans.clans.ClanInfo.Role;
|
||||
import mineplex.game.clans.clans.repository.ClanTerritory;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class ClansAdmin
|
||||
{
|
||||
private ClansManager Clans;
|
||||
|
||||
public ClansAdmin(ClansManager clans)
|
||||
{
|
||||
Clans = clans;
|
||||
}
|
||||
|
||||
public void command(Player caller, String[] args)
|
||||
{
|
||||
if (args.length == 1)
|
||||
help(caller);
|
||||
|
||||
else if (args[1].equalsIgnoreCase("help") || args[1].equalsIgnoreCase("h"))
|
||||
help(caller);
|
||||
|
||||
else if (args[1].equalsIgnoreCase("set") || args[1].equalsIgnoreCase("mimic"))
|
||||
setMimic(caller, args);
|
||||
|
||||
else if (args[1].equalsIgnoreCase("create"))
|
||||
create(caller, args);
|
||||
|
||||
else if (args[1].equalsIgnoreCase("disband") || args[1].equalsIgnoreCase("delete") || args[1].equalsIgnoreCase("d"))
|
||||
delete(caller, args);
|
||||
|
||||
else if (args[1].equalsIgnoreCase("invite") || args[1].equalsIgnoreCase("i"))
|
||||
invite(caller, args);
|
||||
|
||||
else if (args[1].equalsIgnoreCase("promote"))
|
||||
promote(caller, args);
|
||||
|
||||
else if (args[1].equalsIgnoreCase("demote"))
|
||||
demote(caller, args);
|
||||
|
||||
else if (args[1].equalsIgnoreCase("kick") || args[1].equalsIgnoreCase("k"))
|
||||
kick(caller, args);
|
||||
|
||||
else if (args[1].equalsIgnoreCase("ally") || args[1].equalsIgnoreCase("a"))
|
||||
ally(caller, args);
|
||||
|
||||
else if (args[1].equalsIgnoreCase("trust"))
|
||||
trust(caller, args);
|
||||
|
||||
else if (args[0].equalsIgnoreCase("neutral") || args[0].equalsIgnoreCase("neut") || args[0].equalsIgnoreCase("n"))
|
||||
neutral(caller, args);
|
||||
|
||||
else if (args[1].equalsIgnoreCase("claim") || args[1].equalsIgnoreCase("c"))
|
||||
claim(caller);
|
||||
|
||||
else if (args[1].equalsIgnoreCase("unclaim") || args[1].equalsIgnoreCase("uc"))
|
||||
unclaim(caller, args);
|
||||
|
||||
else if (args[1].equalsIgnoreCase("home") || args[1].equalsIgnoreCase("h"))
|
||||
home(caller, args);
|
||||
|
||||
else if (args[1].equalsIgnoreCase("safe"))
|
||||
safe(caller);
|
||||
|
||||
else if (args[1].equalsIgnoreCase("autoclaim"))
|
||||
autoclaim(caller);
|
||||
|
||||
else
|
||||
help(caller);
|
||||
}
|
||||
|
||||
private void help(Player caller)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans Admin", "Admin Commands List;"));
|
||||
|
||||
UtilPlayer.message(caller, F.help("/c x create <clan>", "Create Admin Clan", Rank.ADMIN));
|
||||
|
||||
UtilPlayer.message(caller, F.help("/c x set <clan>", "Set Mimic Clan", Rank.ALL));
|
||||
|
||||
UtilPlayer.message(caller, F.help("/c x home (set)", "Teleport to Mimic Home", Rank.ADMIN));
|
||||
UtilPlayer.message(caller, F.help("/c x invite <player>", "Invite Player to Mimic", Rank.ADMIN));
|
||||
UtilPlayer.message(caller, F.help("/c x promote <player>", "Promote Player in Mimic", Rank.ADMIN));
|
||||
UtilPlayer.message(caller, F.help("/c x demote <player>", "Demote Player in Mimic", Rank.ADMIN));
|
||||
UtilPlayer.message(caller, F.help("/c x kick <player>", "Kick Player from Mimic", Rank.ADMIN));
|
||||
UtilPlayer.message(caller, F.help("/c x ally <clan>", "Send Alliance to Mimic", Rank.ADMIN));
|
||||
UtilPlayer.message(caller, F.help("/c x trust <clan>", "Give Trust to Clan", Rank.ADMIN));
|
||||
UtilPlayer.message(caller, F.help("/c x neutral <clan>", "Set Neutrality", Rank.ADMIN));
|
||||
UtilPlayer.message(caller, F.help("/c x enemy <clan>", "Start Invasion", Rank.ADMIN));
|
||||
UtilPlayer.message(caller, F.help("/c x claim", "Claim Territory for Mimic", Rank.ADMIN));
|
||||
UtilPlayer.message(caller, F.help("/c x unclaim (all)", "Unclaim Territory for Mimic", Rank.ADMIN));
|
||||
UtilPlayer.message(caller, F.help("/c x delete", "Delete Mimic Clan", Rank.ADMIN));
|
||||
UtilPlayer.message(caller, F.help("/c x autoclaim", "AutoClaim for Mimic Clan", Rank.ADMIN));
|
||||
UtilPlayer.message(caller, F.main("Mimic Clan", Clans.Get(caller).getMimic()));
|
||||
}
|
||||
|
||||
private void autoclaim(Player caller)
|
||||
{
|
||||
Clans.Get(caller).setAutoClaim(!Clans.Get(caller).isAutoClaim());
|
||||
|
||||
UtilPlayer.message(caller, F.main("Clans Admin", F.oo("Auto Claim", Clans.Get(caller).isAutoClaim())));
|
||||
}
|
||||
|
||||
public void setMimic(Player caller, String[] args)
|
||||
{
|
||||
if (args.length < 3)
|
||||
{
|
||||
if (Clans.Get(caller).getMimic().length() > 0)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans Admin", "You are no longer mimicing " + F.elem("Clan " + Clans.Get(caller).getMimic()) + "."));
|
||||
Clans.Get(caller).setMimic("");
|
||||
}
|
||||
else
|
||||
UtilPlayer.message(caller, F.main("Clans Admin", "You did not input a Clan/Player."));
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
ClanInfo clan = Clans.getClanUtility().searchClanPlayer(caller, args[2], true);
|
||||
|
||||
if (clan == null)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans Admin", "Invalid Clan/Player."));
|
||||
return;
|
||||
}
|
||||
|
||||
//Set Mimic
|
||||
Clans.Get(caller).setMimic(clan.getName());
|
||||
|
||||
//Inform
|
||||
UtilPlayer.message(caller, F.main("Clans Admin", "You are mimicing " + F.elem("Clan " + clan.getName()) + "."));
|
||||
}
|
||||
|
||||
public ClanInfo getMimic(Player caller, boolean inform)
|
||||
{
|
||||
String mimic = Clans.Get(caller).getMimic();
|
||||
|
||||
if (mimic.length() == 0)
|
||||
return null;
|
||||
|
||||
ClanInfo clan = Clans.getClanUtility().searchClanPlayer(caller, mimic, true);
|
||||
|
||||
if (clan == null)
|
||||
{
|
||||
if (inform)
|
||||
UtilPlayer.message(caller, F.main("Clans Admin", "You are not mimicing a Clan."));
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
return clan;
|
||||
}
|
||||
|
||||
public void create(Player caller, String[] args)
|
||||
{
|
||||
if (args.length < 3)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans Admin", "You did not input a Clan name."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!UtilInput.valid(args[2]))
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans Admin", "Invalid characters in Clan name."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (args[2].length() < Clans.getNameMin())
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans Admin", "Clan name too short. Minimum length is " + (Clans.getNameMin()) + "."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (args[2].length() > Clans.getNameMax())
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans Admin", "Clan name too long. Maximum length is + " + (Clans.getNameMax()) + "."));
|
||||
return;
|
||||
}
|
||||
|
||||
for (String cur : Clans.CCommand().denyClan)
|
||||
{
|
||||
if (cur.equalsIgnoreCase(args[2]))
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans Admin", "Clan name cannot be a Clan command."));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
for (String cur : Clans.getAll())
|
||||
{
|
||||
if (cur.equalsIgnoreCase(args[2]))
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans Admin", "Clan name cannot be a Player name."));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (Clans.getClan(args[2]) != null)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans Admin", F.elem("Clan " + args[2]) + " already exists."));
|
||||
return;
|
||||
}
|
||||
|
||||
//Inform
|
||||
UtilServer.broadcast(F.main("Clans Admin", caller.getName() + " formed " + F.elem("Admin Clan " + args[2]) + "."));
|
||||
|
||||
// Create and Join
|
||||
Clans.getClanDataAccess().create(caller.getName(), args[2], true);
|
||||
|
||||
// Set Mimic
|
||||
Clans.Get(caller).setMimic(args[2]);
|
||||
|
||||
// Inform
|
||||
UtilPlayer.message(caller, F.main("Clans Admin", "You are mimicing Clan " + args[2] + "."));
|
||||
}
|
||||
|
||||
public void delete(Player caller, String[] args)
|
||||
{
|
||||
ClanInfo clan = getMimic(caller, true);
|
||||
|
||||
if (clan == null)
|
||||
return;
|
||||
|
||||
//Task
|
||||
Clans.getClanDataAccess().delete(clan);
|
||||
|
||||
//Inform
|
||||
UtilServer.broadcast(F.main("Clans Admin", caller.getName() + " disbanded " + F.elem("Clan " + clan.getName()) + "."));
|
||||
}
|
||||
|
||||
public void invite(Player caller, String[] args)
|
||||
{
|
||||
ClanInfo clan = getMimic(caller, true);
|
||||
|
||||
if (clan == null)
|
||||
return;
|
||||
|
||||
if (args.length < 3)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans Admin", "You did not input an invitee."));
|
||||
return;
|
||||
}
|
||||
|
||||
Player target = UtilPlayer.searchOnline(caller, args[2], true);
|
||||
if (target == null)
|
||||
return;
|
||||
|
||||
if (target.getName().equals(caller.getName()))
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans Admin", "You cannot invite yourself."));
|
||||
return;
|
||||
}
|
||||
|
||||
//Inform
|
||||
clan.inform(caller.getName() + " invited " + target.getName() + " to join Clan " + clan.getName() + ".", caller.getName());
|
||||
UtilPlayer.message(caller, F.main("Clans Admin", "You invited " + target.getName() + " to join " + F.elem("Clan " + clan.getName()) + "."));
|
||||
UtilPlayer.message(target, F.main("Clans Admin", caller.getName() + " invited you to join " + F.elem("Clan " + clan.getName()) + "."));
|
||||
|
||||
//Task
|
||||
Clans.getClanDataAccess().invite(clan, target.getName(), caller.getName());
|
||||
}
|
||||
|
||||
public void promote(Player caller, String[] args)
|
||||
{
|
||||
ClanInfo clan = getMimic(caller, true);
|
||||
|
||||
if (clan == null)
|
||||
return;
|
||||
|
||||
if (args.length < 3)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans Admin", "You did not input player to promote."));
|
||||
return;
|
||||
}
|
||||
|
||||
String target = UtilPlayer.searchCollection(caller, args[2], clan.getMembers().keySet(), "Clan Member", true);
|
||||
|
||||
if (target == null)
|
||||
return;
|
||||
|
||||
if (clan.getMembers().get(target) == Role.LEADER)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans Admin", "You cannot promote " + F.name(target) + " any further."));
|
||||
return;
|
||||
}
|
||||
|
||||
//Task
|
||||
String newRank = "?";
|
||||
if (clan.getMembers().get(target) == Role.RECRUIT)
|
||||
{
|
||||
Clans.getClanDataAccess().role(clan, target, Role.MEMBER);
|
||||
newRank = "Member";
|
||||
}
|
||||
else if (clan.getMembers().get(target) == Role.MEMBER)
|
||||
{
|
||||
Clans.getClanDataAccess().role(clan, target, Role.ADMIN);
|
||||
newRank = "Admin";
|
||||
}
|
||||
else if (clan.getMembers().get(target) == Role.ADMIN)
|
||||
{
|
||||
Clans.getClanDataAccess().role(clan, target, Role.LEADER);
|
||||
newRank = "Leader";
|
||||
}
|
||||
|
||||
//Inform
|
||||
UtilPlayer.message(caller, F.main("Clans Admin", "You promoted " + target + " to " + newRank + " in Mimic Clan."));
|
||||
clan.inform(caller.getName() + " promoted " + target + " to " + newRank + ".", null);
|
||||
}
|
||||
|
||||
public void demote(Player caller, String[] args)
|
||||
{
|
||||
ClanInfo clan = getMimic(caller, true);
|
||||
|
||||
if (clan == null)
|
||||
return;
|
||||
|
||||
if (args.length < 3)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans Admin", "You did not input player to demote."));
|
||||
return;
|
||||
}
|
||||
|
||||
String target = UtilPlayer.searchCollection(caller, args[2], clan.getMembers().keySet(), "Clan Member", true);
|
||||
if (target == null)
|
||||
return;
|
||||
|
||||
if (clan.getMembers().get(target) == Role.RECRUIT)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans Admin", "You cannot demote " + F.name(target) + " any further."));
|
||||
return;
|
||||
}
|
||||
|
||||
//Task
|
||||
String newRank = "?";
|
||||
if (clan.getMembers().get(target) == Role.MEMBER)
|
||||
{
|
||||
Clans.getClanDataAccess().role(clan, target, Role.RECRUIT);
|
||||
newRank = "Recruit";
|
||||
}
|
||||
else if (clan.getMembers().get(target) == Role.ADMIN)
|
||||
{
|
||||
Clans.getClanDataAccess().role(clan, target, Role.MEMBER);
|
||||
newRank = "Member";
|
||||
}
|
||||
else if (clan.getMembers().get(target) == Role.LEADER)
|
||||
{
|
||||
Clans.getClanDataAccess().role(clan, target, Role.ADMIN);
|
||||
newRank = "Admin";
|
||||
}
|
||||
|
||||
//Inform
|
||||
UtilPlayer.message(caller, F.main("Clans Admin", "You demoted " + target + " to " + newRank + " in Mimic Clan."));
|
||||
clan.inform(F.main("Clans Admin", caller.getName() + " demoted " + target + " to " + newRank + "."), null);
|
||||
}
|
||||
|
||||
public void kick(Player caller, String[] args)
|
||||
{
|
||||
ClanInfo clan = getMimic(caller, true);
|
||||
|
||||
if (clan == null)
|
||||
return;
|
||||
|
||||
if (args.length < 3)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans Admin", "You did not input a Player to kick."));
|
||||
return;
|
||||
}
|
||||
|
||||
String targetName = UtilPlayer.searchCollection(caller, args[2], clan.getMembers().keySet(), "Clan Member", true);
|
||||
|
||||
if (targetName == null)
|
||||
return;
|
||||
|
||||
//Task
|
||||
Clans.getClanDataAccess().leave(clan, targetName);
|
||||
|
||||
//Inform
|
||||
UtilPlayer.message(UtilPlayer.searchOnline(null, targetName, false), F.main("Clans Admin", caller.getName() + " kicked you from " + F.elem("Clan " + clan.getName()) + "."));
|
||||
UtilPlayer.message(caller, F.main("Clans Admin", "You kicked " + targetName + " from your Clan."));
|
||||
clan.inform(F.main("Clans Admin", caller.getName() + " kicked " + targetName + " from your Clan."), caller.getName());
|
||||
}
|
||||
|
||||
public void ally(Player caller, String[] args)
|
||||
{
|
||||
ClanInfo cA = getMimic(caller, true);
|
||||
|
||||
if (cA == null)
|
||||
return;
|
||||
|
||||
if (args.length < 3)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans Admin", "You did not input a Clan to ally."));
|
||||
return;
|
||||
}
|
||||
|
||||
ClanInfo cB = Clans.getClanUtility().searchClanPlayer(caller, args[2], true);
|
||||
|
||||
if (cB == null)
|
||||
return;
|
||||
|
||||
if (cA.isSelf(cB.getName()))
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans Admin", "You cannot ally with yourself."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (cA.isAlly(cB.getName()))
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans Admin", "You are already allies with " + F.elem("Clan " + cB.getName()) + "."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (cB.isRequested(cA.getName()))
|
||||
{
|
||||
//Task
|
||||
Clans.getClanDataAccess().ally(cA, cB, caller.getName());
|
||||
|
||||
//Inform
|
||||
UtilPlayer.message(caller, F.main("Clans Admin", "You accepted alliance with Clan " + cB.getName() + "."));
|
||||
cA.inform(caller.getName() + " accepted alliance with Clan " + cB.getName() + ".", caller.getName());
|
||||
cB.inform("Clan " + cA.getName() + " has accepted alliance with you.", null);
|
||||
}
|
||||
else
|
||||
{
|
||||
//Task
|
||||
Clans.getClanDataAccess().requestAlly(cA, cB, caller.getName());
|
||||
|
||||
//Inform
|
||||
UtilPlayer.message(caller, F.main("Clans Admin", "You requested alliance with Clan " + cB.getName() + "."));
|
||||
cA.inform(caller.getName() + " has requested alliance with Clan " + cB.getName() + ".", caller.getName());
|
||||
cB.inform("Clan " + cA.getName() + " has requested alliance with you.", null);
|
||||
}
|
||||
}
|
||||
|
||||
public void trust(Player caller, String[] args)
|
||||
{
|
||||
ClanInfo cA = getMimic(caller, true);
|
||||
|
||||
if (cA == null)
|
||||
return;
|
||||
|
||||
if (args.length < 3)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans Admin", "You did not input a Clan to enemy."));
|
||||
return;
|
||||
}
|
||||
|
||||
ClanInfo cB = Clans.getClanUtility().searchClanPlayer(caller, args[2], true);
|
||||
|
||||
if (cB == null)
|
||||
return;
|
||||
|
||||
if (!cA.isAlly(cB.getName()))
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans Admin", "You cannot give trust to enemies."));
|
||||
return;
|
||||
}
|
||||
|
||||
//Task
|
||||
if (Clans.getClanDataAccess().trust(cA, cB, caller.getName()))
|
||||
{
|
||||
//Inform
|
||||
UtilPlayer.message(caller, F.main("Clans Admin", "You gave trust to Clan " + cB.getName() + "."));
|
||||
cA.inform(caller.getName() + " has given trust to Clan " + cB.getName() + ".", caller.getName());
|
||||
cB.inform("Clan " + cA.getName() + " has given trust to you.", null);
|
||||
}
|
||||
else
|
||||
{
|
||||
//Inform
|
||||
UtilPlayer.message(caller, F.main("Clans Admin", "You revoked trust to Clan " + cB.getName() + "."));
|
||||
cA.inform(caller.getName() + " has revoked trust to Clan " + cB.getName() + ".", caller.getName());
|
||||
cB.inform("Clan " + cA.getName() + " has revoked trust to you.", null);
|
||||
}
|
||||
}
|
||||
|
||||
public void neutral(Player caller, String[] args)
|
||||
{
|
||||
ClanInfo cA = getMimic(caller, true);
|
||||
|
||||
if (cA == null)
|
||||
return;
|
||||
|
||||
if (args.length < 2)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You did not input a Clan to set neutrality with."));
|
||||
return;
|
||||
}
|
||||
|
||||
ClanInfo cB = Clans.getClanUtility().searchClanPlayer(caller, args[1], true);
|
||||
|
||||
if (cB == null)
|
||||
return;
|
||||
|
||||
if (cB.isSelf(cA.getName()))
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You prefer to think of yourself positively..."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (cB.isNeutral(cA.getName()))
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You are already neutral with " + F.elem("Clan " + cB.getName()) + "."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (cB.isAlly(cA.getName()))
|
||||
{
|
||||
//Task
|
||||
Clans.getClanDataAccess().neutral(cA, cB, caller.getName(), true);
|
||||
|
||||
//Inform
|
||||
UtilPlayer.message(caller, F.main("Clans", "You revoked alliance with " + F.elem("Clan " + cB.getName()) + "."));
|
||||
cA.inform(F.name(caller.getName()) + " revoked alliance with " + F.elem("Clan " + cB.getName()) + ".", caller.getName());
|
||||
cB.inform(F.elem("Clan " + cA.getName()) + " has revoked alliance with you.", null);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
public void claim(Player caller)
|
||||
{
|
||||
ClanInfo clientClan = getMimic(caller, true);
|
||||
|
||||
if (clientClan == null)
|
||||
return;
|
||||
|
||||
if (clientClan.getClaims() >= clientClan.getClaimsMax())
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans Admin", "Your Clan cannot claim more Territory."));
|
||||
return;
|
||||
}
|
||||
|
||||
String chunk = UtilWorld.chunkToStr(caller.getLocation().getChunk());
|
||||
ClanInfo ownerClan = Clans.getClanUtility().getOwner(caller.getLocation());
|
||||
|
||||
//Already Claimed
|
||||
if (ownerClan != null)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans Admin", "This Territory is claimed by " +
|
||||
Clans.getClanUtility().mRel(Clans.getClanUtility().relPC(caller.getName(), ownerClan), ownerClan.getName(), true) + "."));
|
||||
return;
|
||||
}
|
||||
|
||||
//Task
|
||||
Clans.getClanDataAccess().claim(clientClan.getName(), chunk, caller.getName(), false);
|
||||
|
||||
//Inform
|
||||
UtilPlayer.message(caller, F.main("Clans Admin", "You claimed Territory " + F.elem(UtilWorld.chunkToStrClean(caller.getLocation().getChunk())) + "."));
|
||||
clientClan.inform(caller.getName() + " claimed Territory " + F.elem(UtilWorld.chunkToStrClean(caller.getLocation().getChunk())) + ".", caller.getName());
|
||||
}
|
||||
|
||||
public void unclaim(Player caller, String args[])
|
||||
{
|
||||
if (args.length > 2)
|
||||
{
|
||||
if (args[2].equalsIgnoreCase("all") || args[2].equalsIgnoreCase("a"))
|
||||
{
|
||||
unclaimall(caller);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
ClanInfo clientClan = getMimic(caller, true);
|
||||
|
||||
if (clientClan == null)
|
||||
return;
|
||||
|
||||
String chunk = UtilWorld.chunkToStr(caller.getLocation().getChunk());
|
||||
ClanInfo ownerClan = Clans.getClanUtility().getOwner(caller.getLocation());
|
||||
|
||||
//Not Claimed
|
||||
if (ownerClan == null)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans Admin", "Territory is not claimed."));
|
||||
return;
|
||||
}
|
||||
|
||||
//Task
|
||||
Clans.getClanDataAccess().unclaim(chunk, caller.getName(), true);
|
||||
|
||||
//Inform
|
||||
UtilPlayer.message(caller, F.main("Clans Admin", "You unclaimed Territory " + F.elem(UtilWorld.chunkToStrClean(caller.getLocation().getChunk())) + "."));
|
||||
ownerClan.inform(caller.getName() + " unclaimed Territory " + F.elem(UtilWorld.chunkToStrClean(caller.getLocation().getChunk())) + ".", caller.getName());
|
||||
}
|
||||
|
||||
public void unclaimall(Player caller)
|
||||
{
|
||||
ClanInfo clientClan = getMimic(caller, true);
|
||||
|
||||
if (clientClan == null)
|
||||
return;
|
||||
|
||||
//Unclaim
|
||||
ArrayList<String> toUnclaim = new ArrayList<String>();
|
||||
|
||||
for (String chunk : clientClan.getClaimSet())
|
||||
toUnclaim.add(chunk);
|
||||
|
||||
for (String chunk : toUnclaim)
|
||||
Clans.getClanDataAccess().unclaim(chunk, caller.getName(), true);
|
||||
|
||||
//Inform
|
||||
UtilPlayer.message(caller, F.main("Clans Admin", "You unclaimed all your Clans Territory."));
|
||||
clientClan.inform(caller.getName() + " unclaimed all your Clans Territory.", caller.getName());
|
||||
}
|
||||
|
||||
public void home(Player caller, String[] args)
|
||||
{
|
||||
if (args.length > 2)
|
||||
{
|
||||
if (args[2].equalsIgnoreCase("set") || args[2].equalsIgnoreCase("s"))
|
||||
{
|
||||
homeSet(caller);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
ClanInfo clan = getMimic(caller, true);
|
||||
|
||||
if (clan == null)
|
||||
return;
|
||||
|
||||
if (clan.getHome() == null)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans Admin", "Your Clan has not set a Home."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!clan.getClaimSet().contains(UtilWorld.chunkToStr(clan.getHome().getChunk())))
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans Admin", "Your Clan has lost its Home Territory."));
|
||||
return;
|
||||
}
|
||||
|
||||
//Do
|
||||
Clans.getTeleport().TP(caller, clan.getHome());
|
||||
|
||||
//Inform
|
||||
UtilPlayer.message(caller, F.main("Clans Admin", "You teleported to your Clan Home " + UtilWorld.locToStrClean(caller.getLocation()) + "."));
|
||||
}
|
||||
|
||||
public void homeSet(Player caller)
|
||||
{
|
||||
ClanInfo clan = getMimic(caller, true);
|
||||
|
||||
if (clan == null)
|
||||
return;
|
||||
|
||||
if (Clans.getClanUtility().getOwner(caller.getLocation()) == null)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans Admin", "You must set your Clan Home in your own Territory."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Clans.getClanUtility().getOwner(caller.getLocation()).isSelf(clan.getName()))
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans Admin", "You must set your Clan Home in your own Territory."));
|
||||
return;
|
||||
}
|
||||
|
||||
//Task
|
||||
Clans.getClanDataAccess().home(clan, caller.getLocation(), caller.getName());
|
||||
|
||||
//Inform
|
||||
UtilPlayer.message(caller, F.main("Clans Admin", "You set Clan Home to " + UtilWorld.locToStrClean(caller.getLocation()) + "."));
|
||||
clan.inform(caller.getName() + " set Clan Home to " + UtilWorld.locToStrClean(caller.getLocation()) + ".", caller.getName());
|
||||
}
|
||||
|
||||
public void safe(Player caller)
|
||||
{
|
||||
ClanTerritory claim = Clans.getClanUtility().getClaim(caller.getLocation());
|
||||
|
||||
if (claim == null)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans Admin", "You can only Safe Zone on Claimed Territory."));
|
||||
return;
|
||||
}
|
||||
|
||||
//Set
|
||||
Clans.getClanDataAccess().safe(claim, caller.getName());
|
||||
|
||||
//Inform
|
||||
UtilPlayer.message(caller, F.main("Clans Admin", "Territory Safe Zone: " + F.tf(claim.Safe)));
|
||||
}
|
||||
}
|
@ -7,7 +7,6 @@ import org.bukkit.Location;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
|
||||
import mineplex.core.account.CoreClient;
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.common.util.UtilWorld;
|
||||
import mineplex.game.clans.clans.ClanInfo.Role;
|
||||
@ -92,7 +91,7 @@ public class ClansDataAccessLayer
|
||||
clan.getInviterMap().remove(player);
|
||||
|
||||
//Save
|
||||
_repository.addMember(clan.getName(), player);
|
||||
_repository.addMember(clan.getId(), player, role.toString());
|
||||
|
||||
//Log
|
||||
_manager.log("Added [" + player + "] to [" + clan.getName() + "].");
|
||||
@ -108,7 +107,7 @@ public class ClansDataAccessLayer
|
||||
_manager.getClanMemberMap().remove(player);
|
||||
|
||||
//Save
|
||||
_repository.removeMember(clan.getName(), player);
|
||||
_repository.removeMember(clan.getId(), player);
|
||||
|
||||
//Log
|
||||
_manager.log("Removed [" + player + "] from [" + clan.getName() + "].");
|
||||
@ -120,7 +119,7 @@ public class ClansDataAccessLayer
|
||||
clan.getMembers().put(player, role);
|
||||
|
||||
//Save
|
||||
_repository.updateMember(clan.getName(), player, role);
|
||||
_repository.updateMember(clan.getId(), player, role.toString());
|
||||
|
||||
//Log
|
||||
_manager.log("Removed [" + player + "] from [" + clan.getName() + "].");
|
||||
@ -154,8 +153,8 @@ public class ClansDataAccessLayer
|
||||
cB.getAllyMap().put(cA.getName(), false);
|
||||
|
||||
//Save
|
||||
_manager.CRepo().EditClan(cA.GetToken());
|
||||
_manager.CRepo().EditClan(cB.GetToken());
|
||||
_repository.addClanRelationship(cA.getId(), cB.getId(), true);
|
||||
_repository.addClanRelationship(cB.getId(), cA.getId(), true);
|
||||
|
||||
//Log
|
||||
_manager.log("Added Ally for [" + cB.getName() + "] and [" + cA.getName() + "] by [" + player + "].");
|
||||
@ -172,16 +171,8 @@ public class ClansDataAccessLayer
|
||||
cA.getAllyMap().put(cB.getName(), trust);
|
||||
|
||||
//Save
|
||||
_manager.CRepo().EditClan(cA.GetToken());
|
||||
_manager.CRepo().EditClan(cB.GetToken());
|
||||
|
||||
//Update Relations
|
||||
for (String cur : cA.getMembers().keySet())
|
||||
_manager.getClanUtility().updateRelations(cur);
|
||||
|
||||
//Update Relations
|
||||
for (String cur : cB.getMembers().keySet())
|
||||
_manager.getClanUtility().updateRelations(cur);
|
||||
_repository.updateClanRelationship(cA.getId(), cB.getId(), true);
|
||||
_repository.updateClanRelationship(cB.getId(), cA.getId(), true);
|
||||
|
||||
//Log
|
||||
_manager.log("Gave Trust [" + trust + "] to [" + cB.getName() + "] for [" + cA.getName() + "] by [" + player + "].");
|
||||
@ -196,21 +187,14 @@ public class ClansDataAccessLayer
|
||||
cB.getAllyMap().remove(cA.getName());
|
||||
|
||||
//Save
|
||||
_manager.CRepo().EditClan(cA.GetToken());
|
||||
_manager.CRepo().EditClan(cB.GetToken());
|
||||
|
||||
//Update Relations
|
||||
for (String cur : cA.getMembers().keySet())
|
||||
_manager.getClanUtility().updateRelations(cur);
|
||||
|
||||
//Update Relations
|
||||
for (String cur : cB.getMembers().keySet())
|
||||
_manager.getClanUtility().updateRelations(cur);
|
||||
_repository.removeClanRelationship(cA.getId(), cB.getId());
|
||||
_repository.removeClanRelationship(cB.getId(), cA.getId());
|
||||
|
||||
//Log
|
||||
_manager.log("Added Neutral between [" + cA.getName() + "] and [" + cB.getName() + "] by [" + player + "].");
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public boolean claim(String name, String chunk, String player, boolean safe)
|
||||
{
|
||||
if (!_manager.getClanMap().containsKey(name))
|
||||
@ -223,16 +207,18 @@ public class ClansDataAccessLayer
|
||||
unclaim(chunk, player, false);
|
||||
|
||||
//Memory
|
||||
ClanTerritory claim = new ClanTerritory(_manager, name, chunk, safe);
|
||||
ClanTerritory claim = new ClanTerritory();
|
||||
claim.Owner = name;
|
||||
claim.Safe = safe;
|
||||
clan.getClaimSet().add(chunk);
|
||||
_manager.getClaimMap().put(chunk, claim);
|
||||
|
||||
//Save
|
||||
_manager.CRepo().EditClan(clan.GetToken());
|
||||
_repository.addTerritoryClaim(clan.getId(), chunk, safe);
|
||||
|
||||
//Visual
|
||||
Chunk c = UtilWorld.strToChunk(chunk);
|
||||
if (!clan.IsAdmin())
|
||||
if (!clan.isAdmin())
|
||||
for (int i = 0 ; i < 3 ; i++)
|
||||
for (int x=0 ; x < 16 ; x++)
|
||||
for (int z=0 ; z < 16 ; z++)
|
||||
@ -241,7 +227,7 @@ public class ClansDataAccessLayer
|
||||
Block down = UtilBlock.getHighest(c.getWorld(), c.getBlock(x, 0, z).getX(), c.getBlock(x, 0, z).getZ()).getRelative(BlockFace.DOWN);
|
||||
|
||||
if (down.getTypeId() == 1 || down.getTypeId() == 2 || down.getTypeId() == 3 || down.getTypeId() == 12 || down.getTypeId() == 8)
|
||||
_manager.BlockRestore().Add(down, 89, (byte)0, 180000);
|
||||
_manager.getBlockRestore().Add(down, 89, (byte)0, 180000);
|
||||
}
|
||||
|
||||
//Log
|
||||
@ -272,10 +258,10 @@ public class ClansDataAccessLayer
|
||||
clan.getClaimSet().remove(chunk);
|
||||
|
||||
//Save
|
||||
_manager.CRepo().EditClan(clan.GetToken());
|
||||
_repository.removeTerritoryClaim(clan.getId(), chunk);
|
||||
|
||||
//Register
|
||||
_manager.getUnclaimMap().put(chunk, System.currentTimeMillis());
|
||||
// _manager.getUnclaimMap().put(chunk, System.currentTimeMillis());
|
||||
|
||||
//Log
|
||||
_manager.log("Removed Claim for [" + clan.getName() + "] at [" + chunk + "] by [" + player + "].");
|
||||
@ -286,10 +272,10 @@ public class ClansDataAccessLayer
|
||||
public void home(ClanInfo clan, Location loc, String player)
|
||||
{
|
||||
//Memory
|
||||
clan.SetHome(loc);
|
||||
clan.setHome(loc);
|
||||
|
||||
//Save
|
||||
_manager.CRepo().EditClan(clan.GetToken());
|
||||
_repository.updateClan(clan.getId(), clan.getName(), clan.getDesc(), UtilWorld.locToStr(clan.getHome()), clan.isAdmin(), clan.getLastOnline());
|
||||
|
||||
//Log
|
||||
_manager.log("Set Home for [" + clan.getName() + "] to " + UtilWorld.locToStrClean(loc) + " by [" + player + "].");
|
||||
@ -301,9 +287,9 @@ public class ClansDataAccessLayer
|
||||
claim.Safe = !claim.Safe;
|
||||
|
||||
//Save
|
||||
_manager.CRepo().EditClan(_manager.getClan(claim.Owner).GetToken());
|
||||
_repository.updateTerritoryClaim(claim.Chunk, claim.Safe);
|
||||
|
||||
//Log
|
||||
_manager.log("Safe Zone at [" + claim.chunk + "] set to [" + claim.Safe + "] by [" + player + "].");
|
||||
_manager.log("Safe Zone at [" + claim.Chunk + "] set to [" + claim.Safe + "] by [" + player + "].");
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,251 @@
|
||||
package mineplex.game.clans.clans;
|
||||
|
||||
import java.util.LinkedList;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilWorld;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.game.clans.clans.ClansUtility.ClanRelation;
|
||||
import mineplex.game.clans.clans.repository.ClanTerritory;
|
||||
|
||||
import org.bukkit.Chunk;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World.Environment;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
|
||||
public class ClansDisplay
|
||||
{
|
||||
private ClansManager Clans;
|
||||
|
||||
public ClansDisplay(ClansManager clans)
|
||||
{
|
||||
Clans = clans;
|
||||
}
|
||||
|
||||
public void Update(Player player)
|
||||
{
|
||||
if (player.getWorld().getEnvironment() != Environment.NORMAL)
|
||||
return;
|
||||
|
||||
ClientClan client = Clans.Get(player);
|
||||
if (client == null) return;
|
||||
|
||||
//Same Chunk
|
||||
if (client.getTerritory().equals(UtilWorld.chunkToStr(player.getLocation().getChunk())))
|
||||
return;
|
||||
|
||||
//Update Territory
|
||||
client.setTerritory(UtilWorld.chunkToStr(player.getLocation().getChunk()));
|
||||
|
||||
//AutoClaim
|
||||
if (client.isAutoClaim())
|
||||
Clans.getClanAdmin().claim(player);
|
||||
|
||||
//Map
|
||||
String owner = "?";
|
||||
ClanInfo ownerClan = Clans.getClanUtility().getOwner(player.getLocation());
|
||||
if (ownerClan != null)
|
||||
owner = ownerClan.getName();
|
||||
|
||||
boolean safe = Clans.getClanUtility().isSafe(player);
|
||||
|
||||
if (!client.isMapOn())
|
||||
{
|
||||
boolean showChange = false;
|
||||
|
||||
//Owner Change
|
||||
if (!client.getOwner().equals(owner))
|
||||
{
|
||||
client.setOwner(owner);
|
||||
showChange = true;
|
||||
}
|
||||
|
||||
//Safe Change
|
||||
if (safe != client.isSafe())
|
||||
{
|
||||
client.setSafe(safe);
|
||||
showChange = true;
|
||||
}
|
||||
|
||||
if (showChange)
|
||||
displayOwner(player);
|
||||
}
|
||||
else
|
||||
{
|
||||
displayOwner(player);
|
||||
displayMap(player);
|
||||
}
|
||||
}
|
||||
|
||||
public void displayOwner(Player player)
|
||||
{
|
||||
//Name
|
||||
String ownerString = C.xWilderness + "Wilderness";
|
||||
|
||||
ClanTerritory claim = Clans.getClanUtility().getClaim(player.getLocation());
|
||||
String append = "";
|
||||
if (claim != null)
|
||||
{
|
||||
//Relation
|
||||
ClanRelation relation = Clans.getClanUtility().relPT(player.getName(), claim.Chunk);
|
||||
|
||||
//Name
|
||||
ownerString = Clans.getClanUtility().mRel(relation, claim.Owner, false);
|
||||
|
||||
//Trust
|
||||
if (relation == ClanRelation.ALLY_TRUST)
|
||||
append = C.mBody + "(" + C.mElem + "Trusted" + C.mBody + ")";
|
||||
}
|
||||
|
||||
UtilPlayer.message(player, F.main("Clans", ownerString + " " + append));
|
||||
}
|
||||
|
||||
public int width = 8;
|
||||
public int height = 4;
|
||||
|
||||
public void displayMap(Player player)
|
||||
{
|
||||
if (player.getWorld().getEnvironment().equals(Environment.NETHER))
|
||||
return;
|
||||
|
||||
//Get Local
|
||||
LinkedList<String> local = mLocalMap(player, player.getLocation().getChunk(), true);
|
||||
|
||||
//Get Home
|
||||
LinkedList<String> home = null;
|
||||
|
||||
if (player.getItemInHand().getType() == Material.MAP)
|
||||
{
|
||||
ClanInfo clan = Clans.getClanUtility().getClanByPlayer(player);
|
||||
if (clan != null)
|
||||
if (clan.getHome() != null)
|
||||
home = mLocalMap(player, clan.getHome().getChunk(), false);
|
||||
}
|
||||
|
||||
//Display
|
||||
if (home == null || local.size() != home.size())
|
||||
UtilPlayer.message(player, local);
|
||||
|
||||
else
|
||||
for (int i = 0 ; i < local.size() ; i++)
|
||||
UtilPlayer.message(player, local.get(i) + " " + home.get(i));
|
||||
}
|
||||
|
||||
public LinkedList<String> mLocalMap(Player player, Chunk chunk, boolean local)
|
||||
{
|
||||
if (chunk == null)
|
||||
return null;
|
||||
|
||||
LinkedList<String> localMap = new LinkedList<String>();
|
||||
|
||||
for (int i=(chunk.getX()-height) ; i <= (chunk.getX()+height) ; i++)
|
||||
{
|
||||
String output = C.xNone + "<";
|
||||
|
||||
for (int j=(chunk.getZ()+width) ; j >= (chunk.getZ()-width) ; j--)
|
||||
{
|
||||
Chunk curChunk = player.getWorld().getChunkAt(i, j);
|
||||
|
||||
//Count Players
|
||||
int pCount = 0;
|
||||
if (player.getItemInHand().getType() == Material.MAP)
|
||||
{
|
||||
for (Player cur : UtilServer.getPlayers())
|
||||
if (cur.getLocation().getChunk().toString().equals(curChunk.toString()))
|
||||
pCount++;
|
||||
}
|
||||
|
||||
//Get Data
|
||||
ClanInfo curOwner = Clans.getClanUtility().getOwner(UtilWorld.chunkToStr(curChunk));
|
||||
ClanTerritory curClaim = Clans.getClanUtility().getClaim(UtilWorld.chunkToStr(curChunk));
|
||||
|
||||
//Add Icon
|
||||
if (i == chunk.getX() && j == chunk.getZ())
|
||||
output += getMapIcon(Clans.getClanUtility().relPC(player.getName(), curOwner), curClaim, curOwner, curChunk, pCount, true, local);
|
||||
else
|
||||
output += getMapIcon(Clans.getClanUtility().relPC(player.getName(), curOwner), curClaim, curOwner, curChunk, pCount, false, local);
|
||||
}
|
||||
|
||||
output += ">";
|
||||
|
||||
//Send
|
||||
localMap.add(output);
|
||||
}
|
||||
|
||||
return localMap;
|
||||
}
|
||||
|
||||
public String getMapIcon(ClanRelation relation, ClanTerritory claim, ClanInfo owner, Chunk chunk, int players, boolean mid, boolean local)
|
||||
{
|
||||
if (players > 9)
|
||||
players = 9;
|
||||
|
||||
if (mid && local)
|
||||
{
|
||||
if (players > 0) return "" + C.cWhite + players;
|
||||
else return "" + C.cWhite + "X";
|
||||
}
|
||||
|
||||
if (owner == null || claim == null)
|
||||
{
|
||||
if (players > 0) return "" + C.xNone + players;
|
||||
else return "" + C.xNone + "-";
|
||||
}
|
||||
|
||||
if (claim.Safe)
|
||||
{
|
||||
if (players > 0) return "" + C.xSafe + players;
|
||||
else return "" + C.xSafe + "S";
|
||||
}
|
||||
|
||||
if (owner.isAdmin())
|
||||
{
|
||||
if (players > 0) return "" + C.xAdmin + players;
|
||||
else return "" + C.xAdmin + "+";
|
||||
}
|
||||
|
||||
|
||||
if (relation == ClanRelation.SELF)
|
||||
{
|
||||
if (players > 0) return "" + C.xSelf + players;
|
||||
else if (Clans.getClanUtility().isChunkHome(owner, chunk)) return "" + C.xSelf + "H";
|
||||
else return "" + C.xSelf + "#";
|
||||
}
|
||||
|
||||
if (relation == ClanRelation.ALLY)
|
||||
{
|
||||
if (players > 0) return "" + C.xAlly + players;
|
||||
else if (Clans.getClanUtility().isChunkHome(owner, chunk)) return "" + C.xAlly + "H";
|
||||
else return "" + C.xAlly + "#";
|
||||
}
|
||||
|
||||
if (relation == ClanRelation.ALLY_TRUST)
|
||||
{
|
||||
if (players > 0) return "" + C.xdAlly + players;
|
||||
else if (Clans.getClanUtility().isChunkHome(owner, chunk)) return "" + C.xdAlly + "H";
|
||||
else return "" + C.xdAlly + "#";
|
||||
}
|
||||
|
||||
if (players > 0) return "" + C.xEnemy + players;
|
||||
else if (Clans.getClanUtility().isChunkHome(owner, chunk)) return "" + C.xEnemy + "H";
|
||||
else return "" + C.xEnemy + "#";
|
||||
}
|
||||
|
||||
public void handleInteract(PlayerInteractEvent event)
|
||||
{
|
||||
if (event.getPlayer().getItemInHand().getType() != Material.MAP)
|
||||
return;
|
||||
|
||||
if (!Recharge.Instance.use(event.getPlayer(), "Clan Map", 500, false, false))
|
||||
return;
|
||||
|
||||
displayOwner(event.getPlayer());
|
||||
displayMap(event.getPlayer());
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -24,6 +24,7 @@ import mineplex.core.MiniClientPlugin;
|
||||
import mineplex.core.MiniPlugin;
|
||||
import mineplex.core.account.CoreClient;
|
||||
import mineplex.core.account.event.RetrieveClientInformationEvent;
|
||||
import mineplex.core.blockrestore.BlockRestore;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.NautHashMap;
|
||||
@ -33,6 +34,7 @@ import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.common.util.UtilEvent.ActionType;
|
||||
import mineplex.core.common.util.UtilTime.TimeUnit;
|
||||
import mineplex.core.creature.event.CreatureSpawnCustomEvent;
|
||||
import mineplex.core.teleport.Teleport;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.game.clans.clans.repository.ClanTerritory;
|
||||
@ -43,6 +45,11 @@ public class ClansManager extends MiniClientPlugin<ClientClan>
|
||||
{
|
||||
private CombatManager _combatManager;
|
||||
private ClansUtility _clanUtility;
|
||||
private ClansDataAccessLayer _clanDataAccess;
|
||||
private ClansDisplay _clanDisplay;
|
||||
private ClansAdmin _clanAdmin;
|
||||
private BlockRestore _blockRestore;
|
||||
private Teleport _teleport;
|
||||
|
||||
private int _dominanceLimit = 16;
|
||||
private int _inviteExpire = 2;
|
||||
@ -57,12 +64,17 @@ public class ClansManager extends MiniClientPlugin<ClientClan>
|
||||
private NautHashMap<String, ClanTerritory> _claimMap = new NautHashMap<String, ClanTerritory>();
|
||||
private NautHashMap<String, Long> _unclaimMap = new NautHashMap<String, Long>();
|
||||
|
||||
public ClansManager(JavaPlugin plugin, CombatManager combatManager)
|
||||
public ClansManager(JavaPlugin plugin, CombatManager combatManager, BlockRestore blockRestore, Teleport teleport)
|
||||
{
|
||||
super("Clans Manager", plugin);
|
||||
|
||||
_combatManager = combatManager;
|
||||
_clanUtility = new ClansUtility(this);
|
||||
_blockRestore = blockRestore;
|
||||
_teleport = teleport;
|
||||
_clanDataAccess = new ClansDataAccessLayer(this);
|
||||
_clanDisplay = new ClansDisplay(this);
|
||||
_clanAdmin = new ClansAdmin(this);
|
||||
}
|
||||
|
||||
public int getInviteExpire()
|
||||
@ -111,11 +123,6 @@ public class ClansManager extends MiniClientPlugin<ClientClan>
|
||||
CCommand().command(caller, args);
|
||||
}
|
||||
|
||||
public ClansClan getClan(String name)
|
||||
{
|
||||
return GetClanMap().get(name);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void Update(UpdateEvent event)
|
||||
{
|
||||
@ -402,4 +409,34 @@ public class ClansManager extends MiniClientPlugin<ClientClan>
|
||||
protected void loadClientInformation(RetrieveClientInformationEvent event)
|
||||
{
|
||||
}
|
||||
|
||||
public BlockRestore getBlockRestore()
|
||||
{
|
||||
return _blockRestore;
|
||||
}
|
||||
|
||||
public ClansDataAccessLayer getClanDataAccess()
|
||||
{
|
||||
return _clanDataAccess;
|
||||
}
|
||||
|
||||
public Teleport getTeleport()
|
||||
{
|
||||
return _teleport;
|
||||
}
|
||||
|
||||
public ClansDisplay getClanDisplay()
|
||||
{
|
||||
return _clanDisplay;
|
||||
}
|
||||
|
||||
public NautHashMap<String, Long> getUnclaimMap()
|
||||
{
|
||||
return _unclaimMap;
|
||||
}
|
||||
|
||||
public ClansAdmin getClanAdmin()
|
||||
{
|
||||
return _clanAdmin;
|
||||
}
|
||||
}
|
||||
|
@ -9,6 +9,12 @@ public class ClientClan
|
||||
private boolean _canJoin;
|
||||
private long _joinDelay;
|
||||
|
||||
private String _territory;
|
||||
private boolean _autoClaim;
|
||||
private String _owner;
|
||||
private boolean _safe;
|
||||
private String _mimic;
|
||||
|
||||
public boolean isAllyChat()
|
||||
{
|
||||
return _allyChat;
|
||||
@ -48,4 +54,54 @@ public class ClientClan
|
||||
{
|
||||
return _joinDelay;
|
||||
}
|
||||
|
||||
public String getTerritory()
|
||||
{
|
||||
return _territory;
|
||||
}
|
||||
|
||||
public void setTerritory(String territory)
|
||||
{
|
||||
_territory = territory;
|
||||
}
|
||||
|
||||
public boolean isAutoClaim()
|
||||
{
|
||||
return _autoClaim;
|
||||
}
|
||||
|
||||
public String getOwner()
|
||||
{
|
||||
return _owner;
|
||||
}
|
||||
|
||||
public void setOwner(String owner)
|
||||
{
|
||||
_owner = owner;
|
||||
}
|
||||
|
||||
public boolean isSafe()
|
||||
{
|
||||
return _safe;
|
||||
}
|
||||
|
||||
public void setSafe(boolean safe)
|
||||
{
|
||||
_safe = safe;
|
||||
}
|
||||
|
||||
public void setAutoClaim(boolean autoclaim)
|
||||
{
|
||||
_autoClaim = autoclaim;
|
||||
}
|
||||
|
||||
public void setMimic(String mimic)
|
||||
{
|
||||
_mimic = mimic;
|
||||
}
|
||||
|
||||
public String getMimic()
|
||||
{
|
||||
return _mimic;
|
||||
}
|
||||
}
|
||||
|
@ -5,11 +5,11 @@ import java.util.ArrayList;
|
||||
import org.bukkit.Chunk;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.account.CoreClient;
|
||||
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.UtilInput;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
@ -50,7 +50,7 @@ public class ClansCommand extends CommandBase<ClansManager>
|
||||
help(caller);
|
||||
|
||||
else if (args[0].equalsIgnoreCase("admin") || args[0].equalsIgnoreCase("x"))
|
||||
Plugin.CAdmin().command(caller, args);
|
||||
Plugin.getClanAdmin().command(caller, args);
|
||||
|
||||
else if (args[0].equalsIgnoreCase("create"))
|
||||
create(caller, args);
|
||||
@ -204,7 +204,7 @@ public class ClansCommand extends CommandBase<ClansManager>
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Plugin.Util().Input().valid(args[1]))
|
||||
if (!UtilInput.valid(args[1]))
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "Invalid characters in Clan name."));
|
||||
return;
|
||||
@ -243,8 +243,10 @@ public class ClansCommand extends CommandBase<ClansManager>
|
||||
//Inform
|
||||
UtilServer.broadcast(F.main("Clans", F.name(caller.getName()) + " formed " + F.elem("Clan " + args[1]) + "."));
|
||||
|
||||
//Create and Join
|
||||
Plugin.CTask().join(Plugin.CTask().create(caller.getName(), args[1], false), caller.getName(), Role.LEADER);
|
||||
|
||||
ClanInfo clan = Plugin.getClanDataAccess().create(caller.getName(), args[1], false);
|
||||
|
||||
Plugin.getClanDataAccess().join(clan, caller.getName(), Role.LEADER);
|
||||
}
|
||||
|
||||
public void delete(Player caller, String[] args)
|
||||
@ -264,7 +266,7 @@ public class ClansCommand extends CommandBase<ClansManager>
|
||||
}
|
||||
|
||||
//Task
|
||||
Plugin.CTask().delete(clan);
|
||||
Plugin.getClanDataAccess().delete(clan);
|
||||
|
||||
//Inform
|
||||
UtilServer.broadcast(F.main("Clans", F.name(caller.getName()) + " disbanded " + F.elem("Clan " + clan.getName()) + "."));
|
||||
@ -310,7 +312,7 @@ public class ClansCommand extends CommandBase<ClansManager>
|
||||
UtilPlayer.message(target, F.main("Clans", "Type " + F.elem("/c join " + clan.getName()) + " to accept!"));
|
||||
|
||||
//Task
|
||||
Plugin.CTask().invite(clan, target.getName(), caller.getName());
|
||||
Plugin.getClanDataAccess().invite(clan, target.getName(), caller.getName());
|
||||
}
|
||||
|
||||
public void join(Player caller, String[] args)
|
||||
@ -337,7 +339,7 @@ public class ClansCommand extends CommandBase<ClansManager>
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Plugin.Util().Input().valid(args[1]))
|
||||
if (!UtilInput.valid(args[1]))
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "Invalid characters in Clan name."));
|
||||
return;
|
||||
@ -354,7 +356,7 @@ public class ClansCommand extends CommandBase<ClansManager>
|
||||
}
|
||||
|
||||
//Task
|
||||
Plugin.CTask().join(clan, caller.getName(), Role.RECRUIT);
|
||||
Plugin.getClanDataAccess().join(clan, caller.getName(), Role.RECRUIT);
|
||||
|
||||
//Inform
|
||||
UtilPlayer.message(caller, F.main("Clans", "You joined " + F.elem("Clan " + clan.getName()) + "."));
|
||||
@ -384,7 +386,7 @@ public class ClansCommand extends CommandBase<ClansManager>
|
||||
UtilPlayer.message(caller, F.main("Clans", "You left " + F.elem("Clan " + clan.getName()) + "."));
|
||||
|
||||
//Task
|
||||
Plugin.CTask().leave(clan, caller.getName());
|
||||
Plugin.getClanDataAccess().leave(clan, caller.getName());
|
||||
|
||||
//Inform
|
||||
clan.inform(F.name(caller.getName()) + " has left your Clan.", null);
|
||||
@ -432,7 +434,7 @@ public class ClansCommand extends CommandBase<ClansManager>
|
||||
|
||||
|
||||
//Task
|
||||
Plugin.CTask().leave(clan, target);
|
||||
Plugin.getClanDataAccess().leave(clan, target);
|
||||
|
||||
//Inform
|
||||
UtilPlayer.message(UtilPlayer.searchOnline(null, target, false), F.main("Clans", F.name(caller.getName()) + " kicked you from " + F.elem("Clan " + clan.getName()) + "."));
|
||||
@ -477,21 +479,21 @@ public class ClansCommand extends CommandBase<ClansManager>
|
||||
String newRank = "?";
|
||||
if (clan.getMembers().get(target) == Role.RECRUIT)
|
||||
{
|
||||
Plugin.CTask().role(clan, target, Role.MEMBER);
|
||||
Plugin.getClanDataAccess().role(clan, target, Role.MEMBER);
|
||||
newRank = "Member";
|
||||
}
|
||||
else if (clan.getMembers().get(target) == Role.MEMBER)
|
||||
{
|
||||
Plugin.CTask().role(clan, target, Role.ADMIN);
|
||||
Plugin.getClanDataAccess().role(clan, target, Role.ADMIN);
|
||||
newRank = "Admin";
|
||||
}
|
||||
else if (clan.getMembers().get(target) == Role.ADMIN)
|
||||
{
|
||||
Plugin.CTask().role(clan, target, Role.LEADER);
|
||||
Plugin.getClanDataAccess().role(clan, target, Role.LEADER);
|
||||
newRank = "Leader";
|
||||
|
||||
//Give Leader
|
||||
Plugin.CTask().role(clan, caller.getName(), Role.ADMIN);
|
||||
Plugin.getClanDataAccess().role(clan, caller.getName(), Role.ADMIN);
|
||||
}
|
||||
|
||||
//Inform
|
||||
@ -541,12 +543,12 @@ public class ClansCommand extends CommandBase<ClansManager>
|
||||
String newRank = "?";
|
||||
if (clan.getMembers().get(target) == Role.MEMBER)
|
||||
{
|
||||
Plugin.CTask().role(clan, target, Role.RECRUIT);
|
||||
Plugin.getClanDataAccess().role(clan, target, Role.RECRUIT);
|
||||
newRank = "Recruit";
|
||||
}
|
||||
else if (clan.getMembers().get(target) == Role.ADMIN)
|
||||
{
|
||||
Plugin.CTask().role(clan, target, Role.MEMBER);
|
||||
Plugin.getClanDataAccess().role(clan, target, Role.MEMBER);
|
||||
newRank = "Member";
|
||||
}
|
||||
|
||||
@ -608,7 +610,7 @@ public class ClansCommand extends CommandBase<ClansManager>
|
||||
if (cB.isRequested(cA.getName()))
|
||||
{
|
||||
//Task
|
||||
Plugin.CTask().ally(cA, cB, caller.getName());
|
||||
Plugin.getClanDataAccess().ally(cA, cB, caller.getName());
|
||||
|
||||
//Inform
|
||||
UtilPlayer.message(caller, F.main("Clans", "You accepted alliance with " + F.elem("Clan " + cB.getName()) + "."));
|
||||
@ -618,7 +620,7 @@ public class ClansCommand extends CommandBase<ClansManager>
|
||||
else
|
||||
{
|
||||
//Task
|
||||
Plugin.CTask().requestAlly(cA, cB, caller.getName());
|
||||
Plugin.getClanDataAccess().requestAlly(cA, cB, caller.getName());
|
||||
|
||||
//Inform
|
||||
UtilPlayer.message(caller, F.main("Clans", "You requested alliance with " + F.elem("Clan " + cB.getName()) + "."));
|
||||
@ -661,7 +663,7 @@ public class ClansCommand extends CommandBase<ClansManager>
|
||||
}
|
||||
|
||||
//Task
|
||||
if (Plugin.CTask().trust(cA, cB, caller.getName()))
|
||||
if (Plugin.getClanDataAccess().trust(cA, cB, caller.getName()))
|
||||
{
|
||||
//Inform
|
||||
UtilPlayer.message(caller, F.main("Clans", "You gave trust to " + F.elem("Clan " + cB.getName()) + "."));
|
||||
@ -719,7 +721,7 @@ public class ClansCommand extends CommandBase<ClansManager>
|
||||
if (cB.isAlly(cA.getName()))
|
||||
{
|
||||
//Task
|
||||
Plugin.CTask().neutral(cA, cB, caller.getName(), true);
|
||||
Plugin.getClanDataAccess().neutral(cA, cB, caller.getName(), true);
|
||||
|
||||
//Inform
|
||||
UtilPlayer.message(caller, F.main("Clans", "You revoked alliance with " + F.elem("Clan " + cB.getName()) + "."));
|
||||
@ -864,7 +866,7 @@ public class ClansCommand extends CommandBase<ClansManager>
|
||||
return;
|
||||
|
||||
//Task
|
||||
Plugin.CTask().claim(clan.getName(), chunk, caller.getName(), false);
|
||||
Plugin.getClanDataAccess().claim(clan.getName(), chunk, caller.getName(), false);
|
||||
|
||||
//Inform
|
||||
UtilPlayer.message(caller, F.main("Clans", "You claimed Territory " + F.elem(UtilWorld.chunkToStrClean(caller.getLocation().getChunk())) + "."));
|
||||
@ -936,7 +938,7 @@ public class ClansCommand extends CommandBase<ClansManager>
|
||||
}
|
||||
|
||||
//Task
|
||||
Plugin.CTask().unclaim(chunk, caller.getName(), true);
|
||||
Plugin.getClanDataAccess().unclaim(chunk, caller.getName(), true);
|
||||
|
||||
//Inform
|
||||
UtilPlayer.message(caller, F.main("Clans", "You unclaimed Territory " + F.elem(UtilWorld.chunkToStrClean(caller.getLocation().getChunk())) + "."));
|
||||
@ -964,7 +966,7 @@ public class ClansCommand extends CommandBase<ClansManager>
|
||||
F.elem(ownerClan.getName()) + " at " + F.elem(UtilWorld.locToStrClean(caller.getLocation())) + "."));
|
||||
|
||||
//Unclaim
|
||||
Plugin.CTask().unclaim(UtilWorld.chunkToStr(caller.getLocation().getChunk()), caller.getName(), true);
|
||||
Plugin.getClanDataAccess().unclaim(UtilWorld.chunkToStr(caller.getLocation().getChunk()), caller.getName(), true);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -992,7 +994,7 @@ public class ClansCommand extends CommandBase<ClansManager>
|
||||
toUnclaim.add(chunk);
|
||||
|
||||
for (String chunk : toUnclaim)
|
||||
Plugin.CTask().unclaim(chunk, caller.getName(), true);
|
||||
Plugin.getClanDataAccess().unclaim(chunk, caller.getName(), true);
|
||||
|
||||
//Inform
|
||||
UtilPlayer.message(caller, F.main("Clans", "You unclaimed all your Clans Territory."));
|
||||
@ -1013,8 +1015,8 @@ public class ClansCommand extends CommandBase<ClansManager>
|
||||
}
|
||||
|
||||
//Display
|
||||
Plugin.CDisplay().displayOwner(caller);
|
||||
Plugin.CDisplay().displayMap(caller);
|
||||
Plugin.getClanDisplay().displayOwner(caller);
|
||||
Plugin.getClanDisplay().displayMap(caller);
|
||||
}
|
||||
|
||||
public void home(Player caller, String[] args)
|
||||
@ -1075,7 +1077,7 @@ public class ClansCommand extends CommandBase<ClansManager>
|
||||
return;
|
||||
|
||||
//Do
|
||||
Plugin.Teleport().TP(caller, clan.GetHome());
|
||||
Plugin.getTeleport().TP(caller, clan.getHome());
|
||||
|
||||
//Inform
|
||||
UtilPlayer.message(caller, F.main("Clans", "You teleported to your Clan Home " + UtilWorld.locToStrClean(caller.getLocation()) + "."));
|
||||
@ -1110,7 +1112,7 @@ public class ClansCommand extends CommandBase<ClansManager>
|
||||
}
|
||||
|
||||
//Task
|
||||
Plugin.CTask().home(clan, caller.getLocation(), caller.getName());
|
||||
Plugin.getClanDataAccess().home(clan, caller.getLocation(), caller.getName());
|
||||
|
||||
//Inform
|
||||
UtilPlayer.message(caller, F.main("Clans", "You set Clan Home to " + UtilWorld.locToStrClean(caller.getLocation()) + "."));
|
||||
|
@ -9,6 +9,9 @@ import org.bukkit.plugin.java.JavaPlugin;
|
||||
import mineplex.core.common.util.NautHashMap;
|
||||
import mineplex.core.database.RepositoryBase;
|
||||
import mineplex.core.database.ResultSetCallable;
|
||||
import mineplex.core.database.column.ColumnBoolean;
|
||||
import mineplex.core.database.column.ColumnInt;
|
||||
import mineplex.core.database.column.ColumnLong;
|
||||
import mineplex.core.database.column.ColumnVarChar;
|
||||
import mineplex.game.clans.clans.repository.tokens.ClanAllianceToken;
|
||||
import mineplex.game.clans.clans.repository.tokens.ClanMemberToken;
|
||||
@ -26,6 +29,24 @@ public class ClanRepository extends RepositoryBase
|
||||
private static String RETRIEVE_CLAN_MEMBER_INFO = "SELECT c.name, a.name, role FROM accountClan AS ac INNER JOIN accounts AS a ON a.id = ac.accountId INNER JOIN clans AS c on c.id = ac.clanId;";
|
||||
private static String RETRIEVE_CLAN_ALLIANCE_INFO = "SELECT c.name, cOther.name, ca.trusted FROM clanAlliances AS ca INNER JOIN clans AS c ON c.id = ca.clanId INNER JOIN clans as cOther ON cOther.id = ca.otherClanId;";
|
||||
|
||||
private static String DELETE_CLAN_MEMBER = "DELETE FROM accountClan INNER JOIN accounts ON accounts.id = accountClan.accountId WHERE clans.id = ? AND accounts.name = ?;";
|
||||
private static String DELETE_CLAN_MEMBERS = "DELETE FROM accountClan INNER JOIN clans ON clans.id = accountClan.clanId WHERE clans.name = ?;";
|
||||
private static String DELETE_CLAN_TERRITORY = "DELETE FROM clanTerritory WHERE clanId = ? AND serverName = ? AND chunk = ?;";
|
||||
private static String DELETE_CLAN_TERRITORIES = "DELETE FROM clanTerritory INNER JOIN clans ON clans.id = clanTerritory.clanId WHERE clans.name = ?;";
|
||||
private static String DELETE_CLAN_ALLIANCE = "DELETE FROM clanAlliances WHERE clanId = ? AND otherClanId = ?;";
|
||||
private static String DELETE_CLAN_ALLIANCES = "DELETE FROM clanAlliances INNER JOIN clans ON clans.id = clanAlliances.clanId WHERE clans.name = ?;";
|
||||
private static String DELETE_CLAN = "DELETE FROM clans WHERE name = ?;";
|
||||
|
||||
private static String ADD_CLAN = "INSERT INTO clans (name, description, home, admin, dateCreated, lastOnline) VALUES (?, ?, ?, ?, now(), now());";
|
||||
private static String ADD_CLAN_MEMBER = "INSERT INTO accountClan (accountId, clanId, clanRole) SELECT accounts.id, ?, ? FROM accounts WHERE accounts.name = ?;";
|
||||
private static String ADD_CLAN_ALLIANCE = "INSERT INTO clanAlliances (clandId, otherClanId, trusted) VALUES (?, ?, ?);";
|
||||
private static String ADD_CLAN_TERRITORY = "INSERT INTO clanTerritory (clanId, serverName, chunk, safe) VALUES (?, ?, ?, ?);";
|
||||
|
||||
private static String UPDATE_CLAN = "UPDATE clans SET name = ?, desc = ?, home = ?, admin = ?, lastOnline = ? WHERE id = ?;";
|
||||
private static String UPDATE_CLAN_MEMBER = "UPDATE AC SET clanRole = ? FROM accountClan AS AC INNER JOIN accounts ON accounts.id = accountClan.accountId WHERE clans.id = ? AND accounts.name = ?;";
|
||||
private static String UPDATE_CLAN_ALLIANCE = "UPDATE clanAlliances SET trusted = ? WHERE clanId = ? AND otherClanId = ?;";
|
||||
private static String UPDATE_CLAN_TERRITORY = "UPDATE clanTerritory SET safe = ? WHERE serverName = ? AND chunk = ?;";
|
||||
|
||||
private String _serverName;
|
||||
|
||||
public ClanRepository(JavaPlugin plugin, String serverName)
|
||||
@ -130,4 +151,79 @@ public class ClanRepository extends RepositoryBase
|
||||
protected void update()
|
||||
{
|
||||
}
|
||||
|
||||
public void deleteClan(String name)
|
||||
{
|
||||
executeUpdate(DELETE_CLAN_MEMBERS, new ColumnVarChar("name", 100, name));
|
||||
executeUpdate(DELETE_CLAN_TERRITORIES, new ColumnVarChar("name", 100, name));
|
||||
executeUpdate(DELETE_CLAN_ALLIANCES, new ColumnVarChar("name", 100, name));
|
||||
executeUpdate(DELETE_CLAN, new ColumnVarChar("name", 100, name));
|
||||
}
|
||||
|
||||
public void addClan(final ClanToken token)
|
||||
{
|
||||
executeUpdate(ADD_CLAN, new ResultSetCallable()
|
||||
{
|
||||
@Override
|
||||
public void processResultSet(ResultSet resultSet) throws SQLException
|
||||
{
|
||||
while (resultSet.next())
|
||||
{
|
||||
executeUpdate(ADD_CLAN_MEMBER, new ColumnInt("clanid", resultSet.getInt(0)), new ColumnVarChar("clanRole", 100, token.Members.get(0).ClanRole), new ColumnVarChar("name", 100, token.Members.get(0).Name));
|
||||
}
|
||||
}
|
||||
|
||||
}, new ColumnVarChar("name", 100, token.Name), new ColumnVarChar("description", 100, token.Description), new ColumnVarChar("home", 100, token.Home), new ColumnBoolean("admin", token.Admin));
|
||||
|
||||
}
|
||||
|
||||
public void addMember(int clanId, String playerName, String role)
|
||||
{
|
||||
executeUpdate(ADD_CLAN_MEMBER, new ColumnInt("clanid", clanId), new ColumnVarChar("clanRole", 100, role), new ColumnVarChar("name", 100, playerName));
|
||||
}
|
||||
|
||||
public void removeMember(int clanId, String playerName)
|
||||
{
|
||||
executeUpdate(DELETE_CLAN_MEMBER, new ColumnInt("clanid", clanId), new ColumnVarChar("name", 100, playerName));
|
||||
}
|
||||
|
||||
public void updateMember(int clanId, String playerName, String role)
|
||||
{
|
||||
executeUpdate(UPDATE_CLAN_MEMBER, new ColumnInt("clanid", clanId), new ColumnVarChar("clanRole", 100, role), new ColumnVarChar("name", 100, playerName));
|
||||
}
|
||||
|
||||
public void addClanRelationship(int clanId, int otherClanId, boolean trusted)
|
||||
{
|
||||
executeUpdate(ADD_CLAN_ALLIANCE, new ColumnInt("clanid", clanId), new ColumnInt("otherClanId", otherClanId), new ColumnBoolean("trusted", trusted));
|
||||
}
|
||||
|
||||
public void updateClanRelationship(int clanId, int otherClanId, boolean trusted)
|
||||
{
|
||||
executeUpdate(UPDATE_CLAN_ALLIANCE, new ColumnInt("clanid", clanId), new ColumnInt("otherClanId", otherClanId), new ColumnBoolean("trusted", trusted));
|
||||
}
|
||||
|
||||
public void removeClanRelationship(int clanId, int otherClanId)
|
||||
{
|
||||
executeUpdate(DELETE_CLAN_ALLIANCE, new ColumnInt("clanid", clanId), new ColumnInt("otherClanId", otherClanId));
|
||||
}
|
||||
|
||||
public void addTerritoryClaim(int clanId, String chunk, boolean safe)
|
||||
{
|
||||
executeUpdate(ADD_CLAN_TERRITORY, new ColumnInt("clanId", clanId), new ColumnVarChar("serverName", 100, _serverName), new ColumnVarChar("chunk", 100, chunk), new ColumnBoolean("safe", safe));
|
||||
}
|
||||
|
||||
public void removeTerritoryClaim(int clanId, String chunk)
|
||||
{
|
||||
executeUpdate(DELETE_CLAN_TERRITORY, new ColumnInt("clanId", clanId), new ColumnVarChar("serverName", 100, _serverName), new ColumnVarChar("chunk", 100, chunk));
|
||||
}
|
||||
|
||||
public void updateClan(int clanId, String name, String desc, String home, boolean admin, long lastOnline)
|
||||
{
|
||||
executeUpdate(UPDATE_CLAN, new ColumnVarChar("name", 100, name), new ColumnVarChar("desc", 100, desc), new ColumnVarChar("home", 100, home), new ColumnBoolean("admin", admin), new ColumnLong("lastOnline", lastOnline), new ColumnInt("clanId", clanId));
|
||||
}
|
||||
|
||||
public void updateTerritoryClaim(String chunk, boolean safe)
|
||||
{
|
||||
executeUpdate(UPDATE_CLAN_TERRITORY, new ColumnBoolean("safe", safe), new ColumnVarChar("serverName", 100, _serverName), new ColumnVarChar("chunk", 100, chunk));
|
||||
}
|
||||
}
|
||||
|
@ -4,4 +4,5 @@ public class ClanTerritory
|
||||
{
|
||||
public boolean Safe;
|
||||
public String Owner;
|
||||
public String Chunk;
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import mineplex.core.CustomTagFix;
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.achievement.AchievementManager;
|
||||
import mineplex.core.antihack.AntiHack;
|
||||
import mineplex.core.blockrestore.BlockRestore;
|
||||
import mineplex.core.chat.Chat;
|
||||
@ -31,6 +32,7 @@ import mineplex.core.punish.Punish;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.serverConfig.ServerConfiguration;
|
||||
import mineplex.core.spawn.Spawn;
|
||||
import mineplex.core.stats.StatsManager;
|
||||
import mineplex.core.status.ServerStatusManager;
|
||||
import mineplex.core.task.TaskManager;
|
||||
import mineplex.core.teleport.Teleport;
|
||||
@ -92,13 +94,14 @@ public class Hub extends JavaPlugin implements IRelation
|
||||
|
||||
//Main Modules
|
||||
ServerStatusManager serverStatusManager = new ServerStatusManager(this, new LagMeter(this, clientManager));
|
||||
//new FriendManager(this, packetHandler);
|
||||
PartyManager partyManager = new PartyManager(this, clientManager, preferenceManager);
|
||||
Portal portal = new Portal(this, serverStatusManager.getCurrentServerName());
|
||||
AntiHack.Initialize(this, punish, portal, preferenceManager, clientManager);
|
||||
PacketHandler packetHandler = new PacketHandler(this);
|
||||
DisguiseManager disguiseManager = new DisguiseManager(this, packetHandler);
|
||||
HubManager hubManager = new HubManager(this, new BlockRestore(this), clientManager, donationManager, new ConditionManager(this), disguiseManager, new TaskManager(this, webServerAddress), portal, partyManager, preferenceManager, petManager, pollManager);
|
||||
StatsManager statsManager = new StatsManager(this);
|
||||
AchievementManager achievementManager = new AchievementManager(statsManager, clientManager, donationManager);
|
||||
HubManager hubManager = new HubManager(this, new BlockRestore(this), clientManager, donationManager, new ConditionManager(this), disguiseManager, new TaskManager(this, webServerAddress), portal, partyManager, preferenceManager, petManager, pollManager, statsManager, achievementManager);
|
||||
|
||||
QueueManager queueManager = new QueueManager(this, clientManager, donationManager, new EloManager(this), partyManager);
|
||||
|
||||
@ -124,7 +127,7 @@ public class Hub extends JavaPlugin implements IRelation
|
||||
SkillFactory skillManager = new SkillFactory(this, damage, this, combatManager, conditionManager, throwManager, disguiseManager, blockRestore, fire, new Movement(this), teleport, energy, webServerAddress);
|
||||
ClassManager classManager = new ClassManager(this, clientManager, donationManager, skillManager, itemFactory, webServerAddress);
|
||||
|
||||
ClassShopManager shopManager = new ClassShopManager(this, classManager, skillManager, itemFactory);
|
||||
ClassShopManager shopManager = new ClassShopManager(this, classManager, skillManager, itemFactory, achievementManager, clientManager);
|
||||
|
||||
new ClassCombatShop(shopManager, clientManager, donationManager, "Brute", classManager.GetClass("Brute"));
|
||||
new ClassCombatShop(shopManager, clientManager, donationManager, "Mage", classManager.GetClass("Mage"));
|
||||
|
@ -40,12 +40,11 @@ import org.bukkit.scoreboard.Objective;
|
||||
import org.bukkit.scoreboard.Scoreboard;
|
||||
|
||||
import mineplex.core.MiniClientPlugin;
|
||||
import mineplex.core.RankBenefitsGiver9000;
|
||||
import mineplex.core.account.CoreClient;
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.account.event.RetrieveClientInformationEvent;
|
||||
import mineplex.core.achievement.Achievement;
|
||||
import mineplex.core.achievement.AchievementManager;
|
||||
import mineplex.core.benefit.RankBenefitsGiver9000;
|
||||
import mineplex.core.blockrestore.BlockRestore;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.util.C;
|
||||
@ -145,7 +144,7 @@ public class HubManager extends MiniClientPlugin<HubClient>
|
||||
//Admin
|
||||
private boolean _gadgetsEnabled = true;
|
||||
|
||||
public HubManager(JavaPlugin plugin, BlockRestore blockRestore, CoreClientManager clientManager, DonationManager donationManager, ConditionManager conditionManager, DisguiseManager disguiseManager, TaskManager taskManager, Portal portal, PartyManager partyManager, PreferencesManager preferences, PetManager petManager, PollManager pollManager)
|
||||
public HubManager(JavaPlugin plugin, BlockRestore blockRestore, CoreClientManager clientManager, DonationManager donationManager, ConditionManager conditionManager, DisguiseManager disguiseManager, TaskManager taskManager, Portal portal, PartyManager partyManager, PreferencesManager preferences, PetManager petManager, PollManager pollManager, StatsManager statsManager, AchievementManager achievementManager)
|
||||
{
|
||||
super("Hub Manager", plugin);
|
||||
|
||||
@ -187,8 +186,8 @@ public class HubManager extends MiniClientPlugin<HubClient>
|
||||
_forcefieldManager = new ForcefieldManager(this);
|
||||
addCommand(new ForcefieldRadius(_forcefieldManager));
|
||||
|
||||
_statsManager = new StatsManager(plugin);
|
||||
_achievementManager = new AchievementManager(_statsManager, _clientManager, _donationManager);
|
||||
_statsManager = statsManager;
|
||||
_achievementManager = achievementManager;
|
||||
_achievementManager.setGiveInterfaceItem(true);
|
||||
|
||||
((CraftWorld)Bukkit.getWorlds().get(0)).getHandle().pvpMode = true;
|
||||
|
@ -145,6 +145,8 @@ public class ServerManager extends MiniPlugin
|
||||
long timeUntilPortal = getMillisecondsUntilPortal(player, false);
|
||||
if (!_hubManager.CanPortal(player) || timeUntilPortal > 0)
|
||||
{
|
||||
player.closeInventory();
|
||||
|
||||
if (timeUntilPortal > 0)
|
||||
{
|
||||
player.playSound(player.getEyeLocation(), Sound.CHICKEN_EGG_POP, 2, 2);
|
||||
|
@ -29,6 +29,7 @@ public enum GameType
|
||||
SurvivalGames("Survival Games"),
|
||||
SurvivalGamesTeams("Survival Games Teams"),
|
||||
Micro("Micro Battle"),
|
||||
MineStrike("MineStrike"),
|
||||
MineWare("MineWare"),
|
||||
MilkCow("Milk the Cow"),
|
||||
Paintball("Super Paintball"),
|
||||
@ -49,6 +50,7 @@ public enum GameType
|
||||
Tug("Tug of Wool"),
|
||||
TurfWars("Turf Wars"),
|
||||
UHC("Ultra Hardcore"),
|
||||
WitherAssault("Wither Assault"),
|
||||
ZombieSurvival("Zombie Survival"),
|
||||
None("None");
|
||||
|
||||
|
@ -98,7 +98,6 @@ public class ClientClass
|
||||
else
|
||||
skillTokenUsage += swordSkill.GetTokenCost() * buildToken.SwordSkillLevel;
|
||||
}
|
||||
|
||||
|
||||
if (!buildToken.AxeSkill.isEmpty())
|
||||
{
|
||||
@ -139,9 +138,7 @@ public class ClientClass
|
||||
else
|
||||
skillTokenUsage += globalPassive.GetTokenCost() * buildToken.GlobalPassiveSkillLevel;
|
||||
}
|
||||
|
||||
boolean allEmpty = true;
|
||||
|
||||
|
||||
for (SlotToken slotToken : buildToken.Slots)
|
||||
{
|
||||
if (slotToken == null)
|
||||
@ -153,45 +150,43 @@ public class ClientClass
|
||||
if (slotToken.Material.isEmpty())
|
||||
continue;
|
||||
|
||||
allEmpty = false;
|
||||
|
||||
//itemTokenUsage += _itemFactory.GetItem(slotToken.Name).getTokenCost();
|
||||
itemTokenUsage += _itemFactory.GetItem(slotToken.Name.equalsIgnoreCase("Cobweb") ? "Web" : slotToken.Name).getTokenCost();
|
||||
}
|
||||
|
||||
//itemTokenUsage += buildToken.ItemTokens;
|
||||
//skillTokenUsage += buildToken.SkillTokens;
|
||||
itemTokenUsage += buildToken.ItemTokens;
|
||||
skillTokenUsage += buildToken.SkillTokens;
|
||||
|
||||
/*
|
||||
if (itemTokenUsage > CustomBuildToken.MAX_ITEM_TOKENS || skillTokenUsage > CustomBuildToken.MAX_SKILL_TOKENS)
|
||||
{
|
||||
System.out.println(buildToken.PvpClass + " " + buildToken.CustomBuildId + "'s item tokens :" + itemTokenUsage + " skill tokens :" + skillTokenUsage);
|
||||
continue;
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
if (allEmpty)
|
||||
{
|
||||
buildToken.SkillTokens = CustomBuildToken.MAX_SKILL_TOKENS;
|
||||
buildToken.ItemTokens = CustomBuildToken.MAX_ITEM_TOKENS;
|
||||
|
||||
if (!buildToken.SwordSkill.isEmpty() && !ValidSkill(buildToken.SwordSkill, swordSkill, SkillType.Sword))
|
||||
if (!buildToken.SwordSkill.isEmpty() && ValidSkill(buildToken.SwordSkill, swordSkill, SkillType.Sword))
|
||||
buildToken.SkillTokens -= swordSkill.GetTokenCost();
|
||||
|
||||
if (!buildToken.AxeSkill.isEmpty() && !ValidSkill(buildToken.AxeSkill, axeSkill, SkillType.Axe))
|
||||
if (!buildToken.AxeSkill.isEmpty() && ValidSkill(buildToken.AxeSkill, axeSkill, SkillType.Axe))
|
||||
buildToken.SkillTokens -= axeSkill.GetTokenCost();
|
||||
|
||||
if (!buildToken.BowSkill.isEmpty() && !ValidSkill(buildToken.BowSkill, bowSkill, SkillType.Bow))
|
||||
if (!buildToken.BowSkill.isEmpty() && ValidSkill(buildToken.BowSkill, bowSkill, SkillType.Bow))
|
||||
buildToken.SkillTokens -= bowSkill.GetTokenCost();
|
||||
|
||||
if (!buildToken.ClassPassiveASkill.isEmpty() && !ValidSkill(buildToken.ClassPassiveASkill, classPassiveASkill, SkillType.PassiveA))
|
||||
if (!buildToken.ClassPassiveASkill.isEmpty() && ValidSkill(buildToken.ClassPassiveASkill, classPassiveASkill, SkillType.PassiveA))
|
||||
buildToken.SkillTokens -= classPassiveASkill.GetTokenCost();
|
||||
|
||||
if (!buildToken.ClassPassiveBSkill.isEmpty() && !ValidSkill(buildToken.ClassPassiveBSkill, classPassiveBSkill, SkillType.PassiveB))
|
||||
if (!buildToken.ClassPassiveBSkill.isEmpty() && ValidSkill(buildToken.ClassPassiveBSkill, classPassiveBSkill, SkillType.PassiveB))
|
||||
buildToken.SkillTokens -= classPassiveBSkill.GetTokenCost();
|
||||
|
||||
if (!buildToken.GlobalPassiveSkill.isEmpty() && !ValidSkill(buildToken.GlobalPassiveSkill, globalPassive, SkillType.GlobalPassive))
|
||||
if (!buildToken.GlobalPassiveSkill.isEmpty() && ValidSkill(buildToken.GlobalPassiveSkill, globalPassive, SkillType.GlobalPassive))
|
||||
buildToken.SkillTokens -= globalPassive.GetTokenCost();
|
||||
}
|
||||
*/
|
||||
|
||||
_customBuilds.get(pvpClass).put(buildToken.CustomBuildNumber, buildToken);
|
||||
}
|
||||
|
@ -80,7 +80,7 @@ public class CustomBuildToken
|
||||
}
|
||||
else
|
||||
{
|
||||
Slots.set(7, new SlotToken("Cobweb", Material.WEB, 3));
|
||||
Slots.set(7, new SlotToken("Web", Material.WEB, 3));
|
||||
}
|
||||
|
||||
Slots.set(8, new SlotToken());
|
||||
|
@ -1,17 +1,23 @@
|
||||
package mineplex.minecraft.game.classcombat.Skill.Assassin;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.util.com.mojang.authlib.GameProfile;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Skeleton;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.block.Action;
|
||||
import org.bukkit.event.entity.EntityDeathEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.event.entity.ItemSpawnEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
|
||||
@ -19,12 +25,15 @@ import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilAction;
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||
import mineplex.core.common.util.UtilWorld;
|
||||
import mineplex.core.disguise.disguises.DisguisePlayer;
|
||||
import mineplex.minecraft.game.classcombat.Skill.SkillActive;
|
||||
import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
|
||||
@ -51,21 +60,26 @@ public class Illusion extends SkillActive
|
||||
|
||||
SetDesc(new String[]
|
||||
{
|
||||
"Block to go invisible, and create an",
|
||||
"Hold Block to go invisible and create an",
|
||||
"illusion of yourself that runs towards",
|
||||
"your target location.",
|
||||
"",
|
||||
"Invisibility ends if you release Block",
|
||||
"or your Illusion is killed.",
|
||||
"",
|
||||
"Lasts up to #2#2 seconds.",
|
||||
"Illusion lasts up to #2#2 seconds.",
|
||||
"",
|
||||
"Gives Slow 2 for up to 4 seconds",
|
||||
"to nearby players upon ending."
|
||||
});
|
||||
|
||||
setAchievementSkill(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String GetEnergyString()
|
||||
{
|
||||
return "Energy: #30#-5 and #10#-2 per Second";
|
||||
return "Energy: #40#-3 and #12#-0.5 per Second";
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -100,10 +114,20 @@ public class Illusion extends SkillActive
|
||||
skel.getEquipment().setLeggings(player.getInventory().getLeggings());
|
||||
skel.getEquipment().setBoots(player.getInventory().getBoots());
|
||||
skel.getEquipment().setItemInHand(Math.random() > 0.5 ? player.getItemInHand() : new ItemStack(Material.IRON_AXE));
|
||||
|
||||
//Get in range
|
||||
ArrayList<Player> inRange = new ArrayList<Player>();
|
||||
for (Player other : UtilServer.getPlayers())
|
||||
if (UtilMath.offset2d(skel, other) < 70)
|
||||
inRange.add(other);
|
||||
|
||||
Player[] disguiseList = new Player[inRange.size()];
|
||||
for (int i=0 ; i<inRange.size() ; i++)
|
||||
disguiseList[i] = inRange.get(i);
|
||||
|
||||
//Disguise
|
||||
DisguisePlayer disguise = new DisguisePlayer(skel, ((CraftPlayer)player).getHandle().getProfile());
|
||||
Factory.Disguise().disguise(disguise);
|
||||
Factory.Disguise().disguise(disguise, disguiseList);
|
||||
|
||||
//Invis
|
||||
Factory.Condition().Factory().Cloak(GetName(), player, player, 2 + 2*level, false, true);
|
||||
@ -115,7 +139,7 @@ public class Illusion extends SkillActive
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void Energy(UpdateEvent event)
|
||||
public void update(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.TICK)
|
||||
return;
|
||||
@ -129,7 +153,7 @@ public class Illusion extends SkillActive
|
||||
|
||||
if (Factory.Condition().GetActiveCondition(cur, ConditionType.CLOAK) == null ||
|
||||
!cur.isBlocking() ||
|
||||
!Factory.Energy().Use(cur, GetName(), 0.5 - (getLevel(cur) * 0.1), true, true) ||
|
||||
!Factory.Energy().Use(cur, GetName(), 0.6 - (getLevel(cur) * 0.025), true, true) ||
|
||||
skel == null ||
|
||||
!skel.isValid())
|
||||
{
|
||||
@ -150,7 +174,7 @@ public class Illusion extends SkillActive
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void illusionDeath(EntityDeathEvent event)
|
||||
{
|
||||
if (_active.containsValue(event.getEntity()))
|
||||
@ -159,21 +183,36 @@ public class Illusion extends SkillActive
|
||||
event.getEntity().remove();
|
||||
}
|
||||
}
|
||||
|
||||
private void end(Player cur)
|
||||
|
||||
private void end(Player player)
|
||||
{
|
||||
Factory.Condition().EndCondition(cur, null, GetName());
|
||||
Factory.Condition().EndCondition(player, null, GetName());
|
||||
|
||||
Skeleton skel = _active.remove(cur);
|
||||
Skeleton skel = _active.remove(player);
|
||||
if (skel == null)
|
||||
return;
|
||||
|
||||
//Ploop
|
||||
|
||||
//Level
|
||||
int level = getLevel(player);
|
||||
|
||||
//Blind
|
||||
HashMap<LivingEntity, Double> targets = UtilEnt.getInRadius(skel.getLocation(), 6d + 0.5 * level);
|
||||
for (LivingEntity cur : targets.keySet())
|
||||
{
|
||||
if (cur.equals(player))
|
||||
continue;
|
||||
|
||||
//Condition
|
||||
Factory.Condition().Factory().Slow(GetName(), cur, player, 4 * targets.get(cur), 1, false, false, false, false);
|
||||
}
|
||||
|
||||
//Effect
|
||||
UtilParticle.PlayParticle(ParticleType.LARGE_SMOKE, skel.getLocation().add(0, 1, 0), 0.3f, 0.3f, 0.3f, 0.06f, 30);
|
||||
|
||||
for (int i=0 ; i<2 ; i++)
|
||||
skel.getWorld().playSound(skel.getLocation(), Sound.FIZZ, 2f, 0.4f);
|
||||
|
||||
skel.getEquipment().clear();
|
||||
skel.remove();
|
||||
}
|
||||
|
||||
|
@ -22,7 +22,7 @@ public class CripplingBlow extends Skill
|
||||
|
||||
SetDesc(new String[]
|
||||
{
|
||||
"Your powerflow axe blows give",
|
||||
"Your powerful axe attacks give",
|
||||
"targets Slow 1 for 1.5 second,",
|
||||
"as well as no knockback."
|
||||
});
|
||||
@ -53,7 +53,7 @@ public class CripplingBlow extends Skill
|
||||
if (level == 0) return;
|
||||
|
||||
//Stun
|
||||
Factory.Condition().Factory().Slow(GetName(), damagee, damager, 0.5 + 0.5 * 1, 1, false, true, false, true);
|
||||
Factory.Condition().Factory().Slow(GetName(), damagee, damager, 0.5 + 0.5 * 1, 0, false, true, false, true);
|
||||
|
||||
//Damage
|
||||
event.AddMod(damager.getName(), GetName(), 0, true);
|
||||
|
@ -37,4 +37,6 @@ public interface ISkill
|
||||
|
||||
Integer GetSalesPackageId();
|
||||
int getMaxLevel();
|
||||
|
||||
boolean isAchievementSkill();
|
||||
}
|
||||
|
@ -0,0 +1,236 @@
|
||||
package mineplex.minecraft.game.classcombat.Skill.Knight;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
|
||||
import org.bukkit.Effect;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Item;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.block.Action;
|
||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.event.player.PlayerPickupItemEvent;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
|
||||
import mineplex.core.antistack.AntiStack;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilAction;
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.common.util.UtilInv;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.projectile.IThrown;
|
||||
import mineplex.core.projectile.ProjectileUser;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.minecraft.game.classcombat.Skill.SkillActive;
|
||||
import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
|
||||
|
||||
public class AxeThrow extends SkillActive implements IThrown
|
||||
{
|
||||
private HashMap<Item, Player> _thrown = new HashMap<Item, Player>();
|
||||
|
||||
public AxeThrow(SkillFactory skills, String name, ClassType classType, SkillType skillType,
|
||||
int cost, int levels,
|
||||
int energy, int energyMod,
|
||||
long recharge, long rechargeMod, boolean rechargeInform,
|
||||
Material[] itemArray,
|
||||
Action[] actionArray)
|
||||
{
|
||||
super(skills, name, classType, skillType,
|
||||
cost, levels,
|
||||
energy, energyMod,
|
||||
recharge, rechargeMod, rechargeInform,
|
||||
itemArray,
|
||||
actionArray);
|
||||
|
||||
SetDesc(new String[]
|
||||
{
|
||||
"Throw your axe with #0.7#0.1 velocity, ",
|
||||
"dealing #6.5#0.5 damage.",
|
||||
"",
|
||||
"You pull your axe back to you when it",
|
||||
"collides with anything.",
|
||||
"",
|
||||
"Your axe is returned to you if you do",
|
||||
"not pick it up within #20#-2 seconds."
|
||||
});
|
||||
|
||||
setAchievementSkill(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean CustomCheck(Player player, int level)
|
||||
{
|
||||
if (player.getLocation().getBlock().getTypeId() == 8 || player.getLocation().getBlock().getTypeId() == 9)
|
||||
{
|
||||
UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water."));
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Skill(Player player, int level)
|
||||
{
|
||||
//Inform
|
||||
UtilPlayer.message(player, F.main("Game", "You used " + F.skill(GetName()) + "."));
|
||||
|
||||
//Throw
|
||||
Item item = player.getWorld().dropItem(player.getEyeLocation(), player.getItemInHand());
|
||||
UtilAction.velocity(item, player.getLocation().getDirection(), 0.7 + 0.1 * level, false, 0, 0.2, 10, true);
|
||||
|
||||
player.setItemInHand(null);
|
||||
|
||||
//Projectile
|
||||
Factory.Projectile().AddThrow(item, player, this, -1, true, true, true, false, 2.5d);
|
||||
|
||||
//Store
|
||||
_thrown.put(item, player);
|
||||
|
||||
//Inform
|
||||
UtilPlayer.message(player, F.main(GetClassType().name(), "You used " + F.skill(GetName(level)) + "."));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Collide(LivingEntity target, Block block, ProjectileUser data)
|
||||
{
|
||||
Rebound(data.GetThrower(), data.GetThrown());
|
||||
|
||||
if (target == null)
|
||||
return;
|
||||
|
||||
int level = getLevel(data.GetThrower());
|
||||
if (level <= 0)
|
||||
return;
|
||||
|
||||
double damage = 6.5 + 0.5 * level;
|
||||
|
||||
//Damage Event
|
||||
Factory.Damage().NewDamageEvent(target, data.GetThrower(), null,
|
||||
DamageCause.CUSTOM, damage, true, true, false,
|
||||
UtilEnt.getName(data.GetThrower()), GetName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Idle(ProjectileUser data)
|
||||
{
|
||||
Rebound(data.GetThrower(), data.GetThrown());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Expire(ProjectileUser data)
|
||||
{
|
||||
Rebound(data.GetThrower(), data.GetThrown());
|
||||
}
|
||||
|
||||
public void Rebound(LivingEntity player, Entity ent)
|
||||
{
|
||||
ent.getWorld().playSound(ent.getLocation(), Sound.ZOMBIE_WOOD, 0.6f, 0.5f);
|
||||
|
||||
double mult = 0.5 + (0.6 * (UtilMath.offset(player.getLocation(), ent.getLocation())/16d));
|
||||
|
||||
//Velocity
|
||||
ent.setVelocity(player.getLocation().toVector().subtract(ent.getLocation().toVector()).normalize().add(new Vector(0, 0.4, 0)).multiply(mult));
|
||||
|
||||
//Ticks
|
||||
if (ent instanceof Item)
|
||||
((Item)ent).setPickupDelay(5);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void pickup(PlayerPickupItemEvent event)
|
||||
{
|
||||
if (!_thrown.containsKey(event.getItem()))
|
||||
return;
|
||||
|
||||
event.setCancelled(true);
|
||||
|
||||
Player player = _thrown.remove(event.getItem());
|
||||
|
||||
AntiStack.removeUID(event.getItem());
|
||||
player.getInventory().addItem(event.getItem().getItemStack());
|
||||
|
||||
UtilInv.Update(event.getPlayer());
|
||||
|
||||
event.getItem().remove();
|
||||
|
||||
player.playSound(player.getLocation(), Sound.CHICKEN_EGG_POP, 1f, 1f);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void timeout(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.FAST)
|
||||
return;
|
||||
|
||||
Iterator<Item> itemIterator = _thrown.keySet().iterator();
|
||||
|
||||
while (itemIterator.hasNext())
|
||||
{
|
||||
Item item = itemIterator.next();
|
||||
|
||||
Player player = _thrown.get(item);
|
||||
if (!player.isOnline())
|
||||
{
|
||||
item.remove();
|
||||
itemIterator.remove();
|
||||
continue;
|
||||
}
|
||||
|
||||
int level = getLevel(player);
|
||||
|
||||
if (item.getTicksLived() > 400 - level * 40)
|
||||
{
|
||||
AntiStack.removeUID(item);
|
||||
_thrown.get(item).getInventory().addItem(item.getItemStack());
|
||||
item.remove();
|
||||
itemIterator.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void death(PlayerDeathEvent event)
|
||||
{
|
||||
Iterator<Item> i = _thrown.keySet().iterator();
|
||||
|
||||
while (i.hasNext())
|
||||
{
|
||||
Item item = i.next();
|
||||
Player player = _thrown.get(item);
|
||||
|
||||
if (player.equals(event.getEntity()))
|
||||
{
|
||||
i.remove();
|
||||
item.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Reset(Player player)
|
||||
{
|
||||
Iterator<Item> i = _thrown.keySet().iterator();
|
||||
|
||||
while (i.hasNext())
|
||||
{
|
||||
Item item = i.next();
|
||||
Player thrower = _thrown.get(item);
|
||||
|
||||
if (player.equals(thrower))
|
||||
{
|
||||
i.remove();
|
||||
item.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -9,6 +9,8 @@ import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
|
||||
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
@ -71,13 +73,19 @@ public class Deflection extends Skill
|
||||
if (!Recharge.Instance.use(cur, GetName(), 5000 - (1000 * level), false, false))
|
||||
continue;
|
||||
|
||||
int max = 2 + (1 * level);
|
||||
|
||||
int charge = 1;
|
||||
if (_charges.containsKey(cur))
|
||||
charge += _charges.get(cur);
|
||||
|
||||
charge = Math.min(2 + (1 * level), charge);
|
||||
|
||||
_charges.put(cur, charge);
|
||||
if (charge <= max)
|
||||
{
|
||||
_charges.put(cur, charge);
|
||||
|
||||
//Inform
|
||||
UtilPlayer.message(cur, F.main(GetClassType().name(), "Deflection Charges: " + F.elem(charge+"")));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -9,7 +9,9 @@ import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
|
||||
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilGear;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
@ -76,14 +78,20 @@ public class Swordsmanship extends Skill
|
||||
|
||||
if (!Recharge.Instance.use(cur, GetName(), 5000 - (1000 * level), false, false))
|
||||
continue;
|
||||
|
||||
int max = level;
|
||||
|
||||
int charge = 1;
|
||||
if (_charges.containsKey(cur))
|
||||
charge += _charges.get(cur);
|
||||
|
||||
charge = Math.min(level, charge);
|
||||
|
||||
_charges.put(cur, charge);
|
||||
if (charge <= max)
|
||||
{
|
||||
_charges.put(cur, charge);
|
||||
|
||||
//Inform
|
||||
UtilPlayer.message(cur, F.main(GetClassType().name(), "Swordsmanship Charges: " + F.elem(charge+"")));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -44,7 +44,7 @@ public class ArcticArmor extends Skill
|
||||
"",
|
||||
"Create a freezing area around you",
|
||||
"in a #3#1 Block radius. Allies inside",
|
||||
"this area receive Protection 1.",
|
||||
"this area receive Protection 2.",
|
||||
"",
|
||||
"You are permanently immune to the",
|
||||
"Slowing effect of snow."
|
||||
|
@ -68,7 +68,7 @@ public class Rupture extends SkillActiveCharge
|
||||
"",
|
||||
"Release Block to release the rupture,",
|
||||
"causing earth and players to fly upward,",
|
||||
"dealing up to #3#1 inital damage."
|
||||
"dealing up to #4#1 inital damage."
|
||||
|
||||
});
|
||||
}
|
||||
|
@ -0,0 +1,146 @@
|
||||
package mineplex.minecraft.game.classcombat.Skill.Mage;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.NautHashMap;
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.common.util.UtilFirework;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||
import mineplex.minecraft.game.classcombat.Skill.SkillChargeSword;
|
||||
import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.FireworkEffect.Type;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
|
||||
public class StaticLazer extends SkillChargeSword
|
||||
{
|
||||
public StaticLazer(SkillFactory skills, String name,
|
||||
ClassType classType, SkillType skillType,
|
||||
int cost, int maxLevel)
|
||||
{
|
||||
super(skills, name, classType, skillType, cost, maxLevel,
|
||||
0.012f, 0.008f,
|
||||
12000, -1000, true, true,
|
||||
false, true);
|
||||
|
||||
SetDesc(new String[]
|
||||
{
|
||||
"Hold Block to charge static electricity.",
|
||||
"Release Block to fire static lazer.",
|
||||
"",
|
||||
GetChargeString(),
|
||||
"Taking damage cancels charge.",
|
||||
"",
|
||||
"Deals up to #7#1 damage and travels",
|
||||
"up to #20#10 blocks.",
|
||||
});
|
||||
|
||||
_fireOnFull = true;
|
||||
setAchievementSkill(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String GetRechargeString()
|
||||
{
|
||||
return "Recharge: " + "#12#-1 Seconds";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void DoSkillCustom(Player player, float charge)
|
||||
{
|
||||
int level = getLevel(player);
|
||||
if (level <= 0)
|
||||
return;
|
||||
|
||||
//Action
|
||||
double curRange = 0;
|
||||
while (curRange <= 20 + 10 * level)
|
||||
{
|
||||
Location newTarget = player.getEyeLocation().add(player.getLocation().getDirection().multiply(curRange));
|
||||
|
||||
//Hit Player
|
||||
HashMap<LivingEntity, Double> hits = UtilEnt.getInRadius(newTarget, 2);
|
||||
hits.remove(player);
|
||||
if (!hits.isEmpty())
|
||||
break;
|
||||
|
||||
//Hit Block
|
||||
if (!UtilBlock.airFoliage(newTarget.getBlock()))
|
||||
break;
|
||||
|
||||
//Progress Forwards
|
||||
curRange += 0.2;
|
||||
|
||||
//Smoke Trail
|
||||
UtilParticle.PlayParticle(ParticleType.FIREWORKS_SPARK, newTarget, 0, 0, 0, 0, 1);
|
||||
}
|
||||
|
||||
//Destination
|
||||
Location target = player.getLocation().add(player.getLocation().getDirection().multiply(curRange));
|
||||
|
||||
UtilParticle.PlayParticle(ParticleType.EXPLODE, target, 0, 0, 0, 0, 1);
|
||||
|
||||
//Firework
|
||||
UtilFirework.playFirework(player.getLocation().add(player.getLocation().getDirection().multiply(Math.max(0, curRange - 0.6))), Type.BURST, Color.WHITE, false, false);
|
||||
|
||||
HashMap<LivingEntity, Double> hit = UtilEnt.getInRadius(target.subtract(0, 1, 0), 6);
|
||||
for (LivingEntity other : hit.keySet())
|
||||
{
|
||||
if (other.equals(player))
|
||||
continue;
|
||||
|
||||
//Damage Event
|
||||
Factory.Damage().NewDamageEvent(other, player, null,
|
||||
DamageCause.CUSTOM, (2 + (5 + level) * hit.get(other)) * charge, true, true, false,
|
||||
player.getName(), GetName());
|
||||
|
||||
}
|
||||
|
||||
//Inform
|
||||
UtilPlayer.message(player, F.main(GetClassType().name(), "You used " + F.skill(GetName(getLevel(player))) + "."));
|
||||
|
||||
//Effect
|
||||
player.getWorld().playSound(player.getEyeLocation(), Sound.ZOMBIE_REMEDY, 0.5f + player.getExp(), 1.75f - charge);
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.NORMAL)
|
||||
public void damageCancelCharge(CustomDamageEvent event)
|
||||
{
|
||||
if (event.IsCancelled())
|
||||
return;
|
||||
|
||||
//Damagee
|
||||
Player damagee = event.GetDamageePlayer();
|
||||
if (damagee == null) return;
|
||||
|
||||
if (_charge.remove(damagee) == null)
|
||||
return;
|
||||
|
||||
//Inform
|
||||
UtilPlayer.message(damagee, F.main(GetClassType().name(), F.skill(GetName()) + " was interrupted."));
|
||||
|
||||
//Effect
|
||||
damagee.getWorld().playSound(damagee.getLocation(), Sound.ZOMBIE_REMEDY, 0.5f, 3f);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Reset(Player player)
|
||||
{
|
||||
_charge.remove(player);
|
||||
}
|
||||
}
|
@ -33,7 +33,7 @@ public class Void extends Skill
|
||||
"Drop Axe/Sword to Toggle.",
|
||||
"",
|
||||
"While in void form, you receive",
|
||||
"Slow 3, take no knockback and",
|
||||
"Slow 2, take no knockback and",
|
||||
"use no energy to swing weapons.",
|
||||
"",
|
||||
"Reduces incoming damage by #1#1 , but",
|
||||
|
@ -0,0 +1,254 @@
|
||||
package mineplex.minecraft.game.classcombat.Skill.Ranger;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Arrow;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Projectile;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.block.Action;
|
||||
import org.bukkit.event.entity.EntityShootBowEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.event.entity.ProjectileHitEvent;
|
||||
|
||||
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilAction;
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||
import mineplex.minecraft.game.classcombat.Skill.SkillActive;
|
||||
import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
|
||||
public class ExplosiveShot extends SkillActive
|
||||
{
|
||||
private HashSet<Arrow> _arrows = new HashSet<Arrow>();
|
||||
private HashSet<Player> _active = new HashSet<Player>();
|
||||
|
||||
public ExplosiveShot(SkillFactory skills, String name, ClassType classType, SkillType skillType,
|
||||
int cost, int levels,
|
||||
int energy, int energyMod,
|
||||
long recharge, long rechargeMod, boolean rechargeInform,
|
||||
Material[] itemArray,
|
||||
Action[] actionArray)
|
||||
{
|
||||
super(skills, name, classType, skillType,
|
||||
cost, levels,
|
||||
energy, energyMod,
|
||||
recharge, rechargeMod, rechargeInform,
|
||||
itemArray,
|
||||
actionArray);
|
||||
|
||||
SetDesc(new String[]
|
||||
{
|
||||
"Prepare an explosive shot;",
|
||||
"Your next arrow will explode on",
|
||||
"impact, dealing up to 12 damage",
|
||||
"and knockback. ",
|
||||
" ",
|
||||
"Explosion radius of #5#1",
|
||||
});
|
||||
|
||||
setAchievementSkill(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean CustomCheck(Player player, int level)
|
||||
{
|
||||
if (player.getLocation().getBlock().getTypeId() == 8 || player.getLocation().getBlock().getTypeId() == 9)
|
||||
{
|
||||
UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water."));
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Skill(Player player, int level)
|
||||
{
|
||||
//Action
|
||||
_active.add(player);
|
||||
|
||||
//Inform
|
||||
UtilPlayer.message(player, F.main(GetClassType().name(), "You prepared " + F.skill(GetName(level)) + "."));
|
||||
|
||||
//Effect
|
||||
player.getWorld().playSound(player.getLocation(), Sound.BLAZE_BREATH, 2.5f, 2.0f);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void BowShoot(EntityShootBowEvent event)
|
||||
{
|
||||
if (!(event.getEntity() instanceof Player))
|
||||
return;
|
||||
|
||||
if (!(event.getProjectile() instanceof Arrow))
|
||||
return;
|
||||
|
||||
Player player = (Player)event.getEntity();
|
||||
|
||||
if (!_active.remove(player))
|
||||
return;
|
||||
|
||||
//Inform
|
||||
UtilPlayer.message(player, F.main(GetClassType().name(), "You fired " + F.skill(GetName(getLevel(player))) + "."));
|
||||
|
||||
_arrows.add((Arrow)event.getProjectile());
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void hitEntityTrigger(CustomDamageEvent event)
|
||||
{
|
||||
if (event.IsCancelled())
|
||||
return;
|
||||
|
||||
if (event.GetCause() != DamageCause.PROJECTILE)
|
||||
return;
|
||||
|
||||
Projectile projectile = event.GetProjectile();
|
||||
if (projectile == null)
|
||||
return;
|
||||
|
||||
if (!_arrows.remove(event.GetProjectile()))
|
||||
return;
|
||||
|
||||
event.SetCancelled(GetName());
|
||||
|
||||
Location loc = event.GetDamageeEntity().getLocation().subtract(event.GetProjectile().getVelocity().normalize().multiply(0.1));
|
||||
|
||||
trigger((Arrow)event.GetProjectile(), loc);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void hitBlockTrigger(ProjectileHitEvent event)
|
||||
{
|
||||
Projectile proj = event.getEntity();
|
||||
|
||||
if (!_arrows.contains(proj))
|
||||
return;
|
||||
|
||||
if (proj.getShooter() == null)
|
||||
return;
|
||||
|
||||
if (!(proj.getShooter() instanceof Player))
|
||||
return;
|
||||
|
||||
Player damager = (Player)proj.getShooter();
|
||||
int level = getLevel(damager);
|
||||
if (level == 0) return;
|
||||
|
||||
final Arrow arrow = (Arrow)proj;
|
||||
|
||||
Factory.GetPlugin().getServer().getScheduler().scheduleSyncDelayedTask(Factory.GetPlugin(), new Runnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
try
|
||||
{
|
||||
//If it hasnt already triggered (via damage)
|
||||
if (_arrows.remove(arrow))
|
||||
trigger(arrow, arrow.getLocation());
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}, 0);
|
||||
|
||||
//Remove
|
||||
proj.remove();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void cleanTrigger(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.SEC)
|
||||
return;
|
||||
|
||||
for (Iterator<Arrow> arrowIterator = _arrows.iterator(); arrowIterator.hasNext();)
|
||||
{
|
||||
Arrow arrow = arrowIterator.next();
|
||||
|
||||
if (arrow.isDead() || !arrow.isValid() || arrow.isOnGround() || arrow.getTicksLived() > 60)
|
||||
{
|
||||
arrowIterator.remove();
|
||||
trigger(arrow, arrow.getLocation());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void trigger(Arrow arrow, Location loc)
|
||||
{
|
||||
if (arrow == null)
|
||||
return;
|
||||
|
||||
if (arrow.getShooter() == null || !(arrow.getShooter() instanceof Player))
|
||||
{
|
||||
arrow.remove();
|
||||
return;
|
||||
}
|
||||
|
||||
Player player = (Player)arrow.getShooter();
|
||||
|
||||
//Level
|
||||
int level = getLevel(player);
|
||||
if (level == 0)
|
||||
return;
|
||||
|
||||
//Velocity Players
|
||||
HashMap<Player,Double> hitMap = UtilPlayer.getInRadius(loc, 5 + (level));
|
||||
for (Player cur : hitMap.keySet())
|
||||
{
|
||||
double range = hitMap.get(cur);
|
||||
|
||||
//Condition
|
||||
Factory.Condition().Factory().Falling(GetName(), cur, player, 6, false, true);
|
||||
|
||||
//Damage Event
|
||||
Factory.Damage().NewDamageEvent(cur, player, null,
|
||||
DamageCause.CUSTOM, 2 + 10 * range, false, true, false,
|
||||
player.getName(), GetName());
|
||||
|
||||
//Velocity
|
||||
UtilAction.velocity(cur, UtilAlg.getTrajectory2d(loc, cur.getLocation().add(0, 1, 0)),
|
||||
0.4 + 1 * range, false, 0, 0.2 + 0.6 * range, 1.2, true);
|
||||
|
||||
//Inform
|
||||
if (cur instanceof Player)
|
||||
UtilPlayer.message((Player)cur, F.main(GetClassType().name(), F.name(player.getName()) +" hit you with " + F.skill(GetName(level)) + "."));
|
||||
}
|
||||
|
||||
UtilParticle.PlayParticle(ParticleType.HUGE_EXPLOSION, loc, 0, 0, 0, 0, 1);
|
||||
loc.getWorld().playSound(loc, Sound.EXPLODE, 2f, 0.75f);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void particle(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.TICK)
|
||||
return;
|
||||
|
||||
for (Entity ent : _arrows)
|
||||
UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, ent.getLocation(), 0, 0, 0, 0, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Reset(Player player)
|
||||
{
|
||||
_active.remove(player);
|
||||
}
|
||||
}
|
@ -50,8 +50,6 @@ public class Longshot extends Skill
|
||||
|
||||
//Save
|
||||
_arrows.put(event.getProjectile(), event.getProjectile().getLocation());
|
||||
|
||||
System.out.println("FIRING!");
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
|
@ -48,8 +48,8 @@ public class NapalmShot extends SkillActive
|
||||
SetDesc(new String[]
|
||||
{
|
||||
"Prepare a napalm shot;",
|
||||
"Your next arrow will explode on",
|
||||
"impact, releasing #8#8 flames."
|
||||
"Your next arrow will burst into",
|
||||
"#8#8 flames on impact."
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -46,7 +46,7 @@ public class PinDown extends SkillActive
|
||||
SetDesc(new String[]
|
||||
{
|
||||
"Instantly fire an arrow, giving",
|
||||
"target Slow 3 for #3#1 seconds."
|
||||
"target Slow 4 for #3#1 seconds."
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -78,7 +78,7 @@ public class WolfsFury extends SkillActive
|
||||
_active.put(player, System.currentTimeMillis() + 8000);
|
||||
|
||||
//Condition
|
||||
Factory.Condition().Factory().Strength(GetName(), player, player, 2 + 2*level, level-1, false, true, true);
|
||||
Factory.Condition().Factory().Strength(GetName(), player, player, 2 + 2*level, 2, false, true, true);
|
||||
|
||||
//Inform
|
||||
UtilPlayer.message(player, F.main(GetClassType().name(), "You used " + F.skill(GetName(level)) + "."));
|
||||
@ -133,6 +133,9 @@ public class WolfsFury extends SkillActive
|
||||
|
||||
int level = getLevel(damager);
|
||||
if (level == 0) return;
|
||||
|
||||
if (!_active.containsKey(damager))
|
||||
return;
|
||||
|
||||
//Remove Swing
|
||||
_swing.remove(damager);
|
||||
|
@ -39,6 +39,8 @@ public abstract class Skill implements ISkill, Listener
|
||||
|
||||
private boolean _free;
|
||||
private NautHashMap<Player, Integer> _users;
|
||||
|
||||
private boolean _isAchievementSkill = false;
|
||||
|
||||
public SkillFactory Factory;
|
||||
|
||||
@ -327,4 +329,15 @@ public abstract class Skill implements ISkill, Listener
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void setAchievementSkill(boolean var)
|
||||
{
|
||||
_isAchievementSkill = var;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAchievementSkill()
|
||||
{
|
||||
return _isAchievementSkill;
|
||||
}
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ public class SkillCharge extends Skill
|
||||
|
||||
protected float _rateBase;
|
||||
protected float _rateBoost;
|
||||
|
||||
|
||||
public SkillCharge(SkillFactory skills, String name, ClassType classType,
|
||||
SkillType skillType, int cost, int maxLevel,
|
||||
float base, float boost)
|
||||
|
@ -5,7 +5,9 @@ import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
|
||||
import mineplex.minecraft.game.classcombat.Skill.event.SkillTriggerEvent;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
@ -21,6 +23,8 @@ public abstract class SkillChargeSword extends SkillCharge implements Listener
|
||||
protected boolean _rechargeInform = false;
|
||||
protected boolean _rechargeAttach = false;
|
||||
|
||||
protected boolean _fireOnFull = false;
|
||||
|
||||
public SkillChargeSword(SkillFactory skills, String name, ClassType classType,
|
||||
SkillType skillType, int cost, int maxLevel,
|
||||
float base, float boost,
|
||||
@ -56,13 +60,31 @@ public abstract class SkillChargeSword extends SkillCharge implements Listener
|
||||
if (!_canChargeInWater && cur.getLocation().getBlock().isLiquid())
|
||||
continue;
|
||||
|
||||
//Check Allowed
|
||||
SkillTriggerEvent triggerEvent = new SkillTriggerEvent(cur, GetName(), GetClassType());
|
||||
Bukkit.getServer().getPluginManager().callEvent(triggerEvent);
|
||||
|
||||
if (triggerEvent.IsCancelled())
|
||||
continue;
|
||||
|
||||
//Recharged Check (uses recharge upon activation)
|
||||
if (!_charge.containsKey(cur))
|
||||
if (!Recharge.Instance.usable(cur, GetName()))
|
||||
continue;
|
||||
|
||||
//Charge
|
||||
Charge(cur);
|
||||
if (Charge(cur) && _fireOnFull)
|
||||
{
|
||||
//Action
|
||||
float charge = _charge.remove(cur);
|
||||
|
||||
//Set Recharge
|
||||
Recharge.Instance.recharge(cur, GetName());
|
||||
Recharge.Instance.use(cur, GetName(), _recharge + (getLevel(cur) * _rechargePerLevel), true, true);
|
||||
|
||||
DoSkill(cur, charge);
|
||||
}
|
||||
|
||||
}
|
||||
//Release Charge
|
||||
else if (_charge.containsKey(cur))
|
||||
|
@ -167,13 +167,13 @@ public class SkillFactory extends MiniPlugin implements ISkillFactory
|
||||
0, 0, true,
|
||||
new Material[] {Material.IRON_SWORD, Material.GOLD_SWORD, Material.DIAMOND_SWORD},
|
||||
new Action[] {Action.RIGHT_CLICK_AIR, Action.RIGHT_CLICK_BLOCK}));
|
||||
//
|
||||
// AddSkill(new Illusion(this, "Illusion", ClassType.Assassin, SkillType.Sword,
|
||||
// 1, 4,
|
||||
// 30, -5,
|
||||
// 0, 0, true,
|
||||
// new Material[] {Material.IRON_SWORD, Material.GOLD_SWORD, Material.DIAMOND_SWORD},
|
||||
// new Action[] {Action.RIGHT_CLICK_AIR, Action.RIGHT_CLICK_BLOCK}));
|
||||
|
||||
AddSkill(new Illusion(this, "Illusion", ClassType.Assassin, SkillType.Sword,
|
||||
1, 4,
|
||||
40, -3,
|
||||
40000, -3000, true,
|
||||
new Material[] {Material.IRON_SWORD, Material.GOLD_SWORD, Material.DIAMOND_SWORD},
|
||||
new Action[] {Action.RIGHT_CLICK_AIR, Action.RIGHT_CLICK_BLOCK}));
|
||||
|
||||
//Axe
|
||||
AddSkill(new Blink(this, "Blink", ClassType.Assassin, SkillType.Axe,
|
||||
@ -327,6 +327,13 @@ public class SkillFactory extends MiniPlugin implements ISkillFactory
|
||||
8000, -1000, true,
|
||||
new Material[] {Material.IRON_AXE, Material.GOLD_AXE, Material.DIAMOND_AXE},
|
||||
new Action[] {Action.RIGHT_CLICK_AIR, Action.RIGHT_CLICK_BLOCK}));
|
||||
|
||||
AddSkill(new AxeThrow(this, "Roped Axe Throw", ClassType.Knight, SkillType.Axe,
|
||||
1, 5,
|
||||
0, 0,
|
||||
3000, -450, true,
|
||||
new Material[] {Material.IRON_AXE, Material.GOLD_AXE, Material.DIAMOND_AXE},
|
||||
new Action[] {Action.RIGHT_CLICK_AIR, Action.RIGHT_CLICK_BLOCK}));
|
||||
|
||||
|
||||
//Passive A
|
||||
@ -366,6 +373,8 @@ public class SkillFactory extends MiniPlugin implements ISkillFactory
|
||||
new Material[] {Material.IRON_SWORD, Material.GOLD_SWORD, Material.DIAMOND_SWORD},
|
||||
new Action[] {Action.RIGHT_CLICK_AIR, Action.RIGHT_CLICK_BLOCK}));
|
||||
|
||||
AddSkill(new StaticLazer(this, "Static Lazer", ClassType.Mage, SkillType.Sword, 1, 5));
|
||||
|
||||
//Axe
|
||||
AddSkill(new FireBlast(this, "Fire Blast", ClassType.Mage, SkillType.Axe,
|
||||
1, 5,
|
||||
@ -491,6 +500,13 @@ public class SkillFactory extends MiniPlugin implements ISkillFactory
|
||||
10000, -1500, false,
|
||||
new Material[] {Material.BOW},
|
||||
new Action[] {Action.LEFT_CLICK_AIR, Action.LEFT_CLICK_BLOCK}));
|
||||
|
||||
AddSkill(new ExplosiveShot(this, "Explosive Arrow", ClassType.Ranger, SkillType.Bow,
|
||||
1, 4,
|
||||
0, 0,
|
||||
20000, -2000, false,
|
||||
new Material[] {Material.BOW},
|
||||
new Action[] {Action.LEFT_CLICK_AIR, Action.LEFT_CLICK_BLOCK}));
|
||||
|
||||
//Passive A
|
||||
AddSkill(new Barrage(this, "Barrage", ClassType.Ranger, SkillType.PassiveA, 1, 3));
|
||||
|
@ -1,8 +1,13 @@
|
||||
package mineplex.minecraft.game.classcombat.shop;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import mineplex.core.MiniPlugin;
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.achievement.Achievement;
|
||||
import mineplex.core.achievement.AchievementManager;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.minecraft.game.classcombat.Class.ClassManager;
|
||||
import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
|
||||
import mineplex.minecraft.game.classcombat.item.ItemFactory;
|
||||
@ -12,14 +17,18 @@ public class ClassShopManager extends MiniPlugin
|
||||
private ClassManager _classManager;
|
||||
private SkillFactory _skillFactory;
|
||||
private ItemFactory _itemFactory;
|
||||
private AchievementManager _achievementManager;
|
||||
private CoreClientManager _clientManager;
|
||||
|
||||
public ClassShopManager(JavaPlugin plugin, ClassManager classManager, SkillFactory skillFactory, ItemFactory itemFactory)
|
||||
public ClassShopManager(JavaPlugin plugin, ClassManager classManager, SkillFactory skillFactory, ItemFactory itemFactory, AchievementManager achievementManager, CoreClientManager clientManager)
|
||||
{
|
||||
super("Class Shop Manager", plugin);
|
||||
|
||||
_classManager = classManager;
|
||||
_skillFactory = skillFactory;
|
||||
_itemFactory = itemFactory;
|
||||
_achievementManager = achievementManager;
|
||||
_clientManager = clientManager;
|
||||
}
|
||||
|
||||
public ClassManager GetClassManager()
|
||||
@ -36,4 +45,21 @@ public class ClassShopManager extends MiniPlugin
|
||||
{
|
||||
return _itemFactory;
|
||||
}
|
||||
|
||||
public boolean hasAchievements(Player player)
|
||||
{
|
||||
if (_clientManager.Get(player).GetRank().Has(Rank.MODERATOR))
|
||||
return true;
|
||||
|
||||
return _achievementManager.hasCategory(player, new Achievement[]
|
||||
{
|
||||
Achievement.CHAMPIONS_ACE,
|
||||
Achievement.CHAMPIONS_ASSASSINATION,
|
||||
Achievement.CHAMPIONS_EARTHQUAKE,
|
||||
Achievement.CHAMPIONS_FLAWLESS_VICTORY,
|
||||
Achievement.CHAMPIONS_MASS_ELECTROCUTION,
|
||||
Achievement.CHAMPIONS_THE_LONGEST_SHOT,
|
||||
Achievement.CHAMPIONS_WINS,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -216,7 +216,8 @@ public class SkillPage extends ShopPageBase<ClassShopManager, ClassCombatShop>
|
||||
{
|
||||
List<String> skillLore = new ArrayList<String>();
|
||||
|
||||
boolean locked = isSkillLocked(skill);
|
||||
boolean achievementLocked = skill.isAchievementSkill() && !Plugin.hasAchievements(Player);
|
||||
boolean locked = isSkillLocked(skill) || achievementLocked;
|
||||
Material material = locked ? Material.EMERALD : (clientClass.GetSavingCustomBuild().hasSkill(skill) ? Material.WRITTEN_BOOK : Material.BOOK);
|
||||
boolean hasSkill = clientClass.GetSavingCustomBuild().hasSkill(skill);
|
||||
int level = hasSkill ? clientClass.GetSavingCustomBuild().getLevel(skill) : 1;
|
||||
@ -224,7 +225,7 @@ public class SkillPage extends ShopPageBase<ClassShopManager, ClassCombatShop>
|
||||
ChatColor.RESET + C.Bold + " - " + ChatColor.GREEN + C.Bold + "Level " + (hasSkill ? level : 0) + "/" + skill.getMaxLevel());
|
||||
|
||||
|
||||
if (locked)
|
||||
if (locked && !skill.isAchievementSkill())
|
||||
{
|
||||
skillLore.add(C.cYellow + skill.GetGemCost() + " Gems");
|
||||
skillLore.add(C.cBlack);
|
||||
@ -247,7 +248,7 @@ public class SkillPage extends ShopPageBase<ClassShopManager, ClassCombatShop>
|
||||
if (hasSkill)
|
||||
skillLore.add(C.cGreen + "Left-Click to Upgrade to Level " + (level + 1));
|
||||
else
|
||||
skillLore.add(C.cGreen + "Left-Click to Select");
|
||||
skillLore.add(C.cGreen + "Left-Click to " + (locked && !achievementLocked ? "Purchase" : "Select"));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -266,9 +267,21 @@ public class SkillPage extends ShopPageBase<ClassShopManager, ClassCombatShop>
|
||||
}
|
||||
|
||||
|
||||
ShopItem skillItem = new ShopItem(material, name, skillLore.toArray(new String[skillLore.size()]), level, locked, true);
|
||||
ShopItem skillItem = null;
|
||||
|
||||
if (achievementLocked)
|
||||
{
|
||||
skillLore.add(C.cGray + " ");
|
||||
skillLore.add(C.cPurple + "To use this skill, you must have all");
|
||||
skillLore.add(C.cPurple + "Champions Achievements unlocked!");
|
||||
skillItem = new ShopItem(Material.DIAMOND, (byte)0, name, skillLore.toArray(new String[skillLore.size()]), level, achievementLocked, true);
|
||||
}
|
||||
else
|
||||
skillItem = new ShopItem(material, name, skillLore.toArray(new String[skillLore.size()]), level, locked, true);
|
||||
|
||||
if (locked)
|
||||
if (achievementLocked)
|
||||
AddItem(slotNumber, skillItem);
|
||||
else if (locked)
|
||||
AddButton(slotNumber, skillItem, new PurchaseSkillButton(this, skill));
|
||||
else
|
||||
AddButton(slotNumber, skillItem, new SelectSkillButton(this, skill, Math.min((hasSkill ? level + 1 : level), skill.getMaxLevel()), clientClass.GetSavingCustomBuild().SkillTokens >= skill.GetTokenCost()));
|
||||
|
@ -186,6 +186,9 @@ public class ServerMonitor
|
||||
|
||||
for (ServerGroup serverGroup : serverGroups)
|
||||
{
|
||||
if (serverGroup.getName().equals("Testing"))
|
||||
continue;
|
||||
|
||||
handleGroupChanges(dedicatedServers, serverTracker, serverGroup, false);
|
||||
}
|
||||
|
||||
|
@ -6,6 +6,7 @@ import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.command.CommandBase;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.util.Callback;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UUIDFetcher;
|
||||
import mineplex.staffServer.salespackage.SalesPackageManager;
|
||||
@ -18,18 +19,26 @@ public class BoosterCommand extends CommandBase<SalesPackageManager>
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Execute(Player caller, String[] args)
|
||||
public void Execute(final Player caller, String[] args)
|
||||
{
|
||||
if (args == null || args.length != 2)
|
||||
return;
|
||||
|
||||
String playerName = args[0];
|
||||
int amount = Integer.parseInt(args[1]);
|
||||
final String playerName = args[0];
|
||||
final int amount = Integer.parseInt(args[1]);
|
||||
|
||||
UUID uuid = UUIDFetcher.getUUIDOf(playerName);
|
||||
|
||||
Plugin.getDonationManager().PurchaseUnknownSalesPackage(null, playerName, uuid, "Gem Booster " + amount, false, 0, false);
|
||||
Plugin.getInventoryManager().addItemToInventoryForOffline(uuid.toString(), "Utility", "Gem Booster", amount);
|
||||
caller.sendMessage(F.main(Plugin.getName(), "Added " + amount + " boosters to " + playerName + "'s account!"));
|
||||
Plugin.getInventoryManager().addItemToInventoryForOffline(new Callback<Boolean>()
|
||||
{
|
||||
public void run(Boolean success)
|
||||
{
|
||||
if (success)
|
||||
caller.sendMessage(F.main(Plugin.getName(), "Added " + amount + " boosters to " + playerName + "'s account!"));
|
||||
else
|
||||
caller.sendMessage(F.main(Plugin.getName(), "There was an error adding " + amount + " boosters to " + playerName + "'s account!"));
|
||||
}
|
||||
}, uuid.toString(), "Utility", "Gem Booster", amount);
|
||||
}
|
||||
}
|
||||
|
@ -6,6 +6,7 @@ import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.command.CommandBase;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.util.Callback;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UUIDFetcher;
|
||||
import mineplex.staffServer.salespackage.SalesPackageManager;
|
||||
@ -18,18 +19,27 @@ public class TreasureChestCommand extends CommandBase<SalesPackageManager>
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Execute(Player caller, String[] args)
|
||||
public void Execute(final Player caller, String[] args)
|
||||
{
|
||||
if (args == null || args.length != 2)
|
||||
return;
|
||||
|
||||
String playerName = args[0];
|
||||
int amount = Integer.parseInt(args[1]);
|
||||
final String playerName = args[0];
|
||||
final int amount = Integer.parseInt(args[1]);
|
||||
|
||||
UUID uuid = UUIDFetcher.getUUIDOf(playerName);
|
||||
|
||||
Plugin.getDonationManager().PurchaseUnknownSalesPackage(null, playerName, uuid, "Treasure Chest " + amount, false, 0, false);
|
||||
Plugin.getInventoryManager().addItemToInventoryForOffline(uuid.toString(), "Utility", "Treasure Chest", amount);
|
||||
caller.sendMessage(F.main(Plugin.getName(), "Added " + amount + " treasure chests to " + playerName + "'s account!"));
|
||||
Plugin.getInventoryManager().addItemToInventoryForOffline(new Callback<Boolean>()
|
||||
{
|
||||
public void run(Boolean success)
|
||||
{
|
||||
if (success)
|
||||
caller.sendMessage(F.main(Plugin.getName(), "Added " + amount + " treasure chests to " + playerName + "'s account!"));
|
||||
else
|
||||
caller.sendMessage(F.main(Plugin.getName(), "There was an error adding " + amount + " treasure chests to " + playerName + "'s account!"));
|
||||
}
|
||||
}, uuid.toString(), "Utility", "Treasure Chest", amount);
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -6,6 +6,7 @@ import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.command.CommandBase;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.util.Callback;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UUIDFetcher;
|
||||
import mineplex.staffServer.salespackage.SalesPackageManager;
|
||||
@ -18,18 +19,26 @@ public class TreasureKeyCommand extends CommandBase<SalesPackageManager>
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Execute(Player caller, String[] args)
|
||||
public void Execute(final Player caller, String[] args)
|
||||
{
|
||||
if (args == null || args.length != 2)
|
||||
return;
|
||||
|
||||
String playerName = args[0];
|
||||
int amount = Integer.parseInt(args[1]);
|
||||
final String playerName = args[0];
|
||||
final int amount = Integer.parseInt(args[1]);
|
||||
|
||||
UUID uuid = UUIDFetcher.getUUIDOf(playerName);
|
||||
|
||||
Plugin.getDonationManager().PurchaseUnknownSalesPackage(null, playerName, uuid, "Treasure Key " + amount, false, 0, false);
|
||||
Plugin.getInventoryManager().addItemToInventoryForOffline(uuid.toString(), "Treasure", "Treasure Key", amount);
|
||||
caller.sendMessage(F.main(Plugin.getName(), "Added " + amount + " treasure Keys to " + playerName + "'s account!"));
|
||||
Plugin.getInventoryManager().addItemToInventoryForOffline(new Callback<Boolean>()
|
||||
{
|
||||
public void run(Boolean success)
|
||||
{
|
||||
if (success)
|
||||
caller.sendMessage(F.main(Plugin.getName(), "Added " + amount + " treasure Keys to " + playerName + "'s account!"));
|
||||
else
|
||||
caller.sendMessage(F.main(Plugin.getName(), "There was an error adding " + amount + " treasure Keys to " + playerName + "'s account!"));
|
||||
}
|
||||
}, uuid.toString(), "Treasure", "Treasure Key", amount);
|
||||
}
|
||||
}
|
||||
|
@ -63,7 +63,7 @@ public class Arcade extends JavaPlugin
|
||||
{
|
||||
//Delete Old Games Folders
|
||||
DeleteFolders();
|
||||
|
||||
|
||||
//Configs
|
||||
getConfig().addDefault(WEB_CONFIG, "http://accounts.mineplex.com/");
|
||||
getConfig().set(WEB_CONFIG, getConfig().getString(WEB_CONFIG));
|
||||
|
@ -103,6 +103,7 @@ import nautilus.game.arcade.managers.GameLobbyManager;
|
||||
import nautilus.game.arcade.managers.GameLootManager;
|
||||
import nautilus.game.arcade.managers.GameManager;
|
||||
import nautilus.game.arcade.managers.GamePlayerManager;
|
||||
import nautilus.game.arcade.managers.GameSpectatorManager;
|
||||
import nautilus.game.arcade.managers.GameStatManager;
|
||||
import nautilus.game.arcade.managers.GameTournamentManager;
|
||||
import nautilus.game.arcade.managers.GameWorldManager;
|
||||
@ -214,25 +215,6 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
||||
|
||||
_projectileManager = projectileManager;
|
||||
|
||||
if (serverConfig.GameList.contains(GameType.ChampionsDominate)
|
||||
|| serverConfig.GameList.contains(GameType.ChampionsTDM)
|
||||
|| serverConfig.GameList.contains(GameType.ChampionsMOBA))
|
||||
{
|
||||
Energy energy = new Energy(plugin);
|
||||
ItemFactory itemFactory = new ItemFactory(_plugin, _blockRestore, _conditionManager, damageManager, energy,
|
||||
_fire, _projectileManager, webAddress);
|
||||
_skillFactory = new SkillFactory(plugin, damageManager, this, _damageManager.GetCombatManager(),
|
||||
_conditionManager, _projectileManager, _disguiseManager, _blockRestore, _fire, new Movement(plugin), teleport,
|
||||
energy, webAddress);
|
||||
_classManager = new ClassManager(plugin, clientManager, donationManager, _skillFactory, itemFactory,
|
||||
webAddress);
|
||||
|
||||
_classShopManager = new ClassShopManager(_plugin, _classManager, _skillFactory, itemFactory);
|
||||
_classShop = new ClassCombatShop(_classShopManager, clientManager, donationManager, webAddress);
|
||||
|
||||
_eloManager = new EloManager(_plugin);
|
||||
}
|
||||
|
||||
_statsManager = new StatsManager(plugin);
|
||||
_taskManager = new TaskManager(plugin, webAddress);
|
||||
_achievementManager = new AchievementManager(_statsManager, clientManager, donationManager);
|
||||
@ -259,6 +241,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
||||
_gameTournamentManager = new GameTournamentManager(this);
|
||||
new GameStatManager(this);
|
||||
new GameLootManager(this, petManager);
|
||||
new GameSpectatorManager(this);
|
||||
_gameWorldManager = new GameWorldManager(this);
|
||||
new MiscManager(this);
|
||||
_idleManager = new IdleManager(this);
|
||||
@ -269,6 +252,25 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
||||
new CompassAddon(plugin, this);
|
||||
new SoupAddon(plugin, this);
|
||||
new TeamArmorAddon(plugin, this);
|
||||
|
||||
if (serverConfig.GameList.contains(GameType.ChampionsDominate)
|
||||
|| serverConfig.GameList.contains(GameType.ChampionsTDM)
|
||||
|| serverConfig.GameList.contains(GameType.ChampionsMOBA))
|
||||
{
|
||||
Energy energy = new Energy(plugin);
|
||||
ItemFactory itemFactory = new ItemFactory(_plugin, _blockRestore, _conditionManager, damageManager, energy,
|
||||
_fire, _projectileManager, webAddress);
|
||||
_skillFactory = new SkillFactory(plugin, damageManager, this, _damageManager.GetCombatManager(),
|
||||
_conditionManager, _projectileManager, _disguiseManager, _blockRestore, _fire, new Movement(plugin), teleport,
|
||||
energy, webAddress);
|
||||
_classManager = new ClassManager(plugin, clientManager, donationManager, _skillFactory, itemFactory,
|
||||
webAddress);
|
||||
|
||||
_classShopManager = new ClassShopManager(_plugin, _classManager, _skillFactory, itemFactory, _achievementManager, clientManager);
|
||||
_classShop = new ClassCombatShop(_classShopManager, clientManager, donationManager, webAddress);
|
||||
|
||||
_eloManager = new EloManager(_plugin);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -11,19 +11,28 @@ import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.CraftWorld;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Hanging;
|
||||
import org.bukkit.entity.Minecart;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.minecart.CommandMinecart;
|
||||
import org.bukkit.entity.minecart.ExplosiveMinecart;
|
||||
import org.bukkit.entity.minecart.HopperMinecart;
|
||||
import org.bukkit.entity.minecart.PoweredMinecart;
|
||||
import org.bukkit.entity.minecart.StorageMinecart;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
import org.bukkit.event.hanging.HangingBreakEvent;
|
||||
import org.bukkit.event.hanging.HangingPlaceEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.player.PlayerLoginEvent;
|
||||
import org.bukkit.event.world.WorldLoadEvent;
|
||||
import org.bukkit.scoreboard.Objective;
|
||||
@ -33,11 +42,14 @@ import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.NautHashMap;
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.common.util.UtilEvent;
|
||||
import mineplex.core.common.util.UtilGear;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilTabTitle;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.common.util.UtilTextMiddle;
|
||||
import mineplex.core.common.util.UtilEvent.ActionType;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.minecraft.game.classcombat.event.ClassCombatCreatureAllowSpawnEvent;
|
||||
@ -195,7 +207,6 @@ public abstract class Game implements Listener
|
||||
|
||||
private double _itemMergeRadius = 0;
|
||||
|
||||
|
||||
public boolean AnnounceStay = true;
|
||||
public boolean AnnounceJoinQuit = true;
|
||||
public boolean AnnounceSilence = true;
|
||||
|
@ -1010,22 +1010,14 @@ public class Bridge extends TeamGame implements OreObsfucation
|
||||
"Cannot place blocks this high up."));
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
//Under Water
|
||||
if (event.getBlock().getRelative(BlockFace.UP).isLiquid())
|
||||
{
|
||||
UtilPlayer.message(event.getPlayer(), F.main("Game",
|
||||
"Cannot place blocks under liquids."));
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (_bridgesDown)
|
||||
return;
|
||||
|
||||
|
||||
//In Liquid
|
||||
if (event.getBlockReplacedState().getTypeId() == 8 ||
|
||||
if (event.getBlock().getRelative(BlockFace.UP).isLiquid() ||
|
||||
event.getBlockReplacedState().getTypeId() == 8 ||
|
||||
event.getBlockReplacedState().getTypeId() == 9 ||
|
||||
event.getBlockReplacedState().getTypeId() == 10 ||
|
||||
event.getBlockReplacedState().getTypeId() == 11)
|
||||
@ -1615,7 +1607,7 @@ public class Bridge extends TeamGame implements OreObsfucation
|
||||
// }
|
||||
|
||||
@EventHandler
|
||||
public void boatDeny(PlayerInteractEvent event)
|
||||
public void vehicleDeny(PlayerInteractEvent event)
|
||||
{
|
||||
if (!UtilEvent.isAction(event, ActionType.R))
|
||||
return;
|
||||
|
@ -562,7 +562,7 @@ public class DragonEscape extends SoloGame
|
||||
|
||||
if (!UtilTime.elapsed(GetStateTime(), 10000))
|
||||
{
|
||||
UtilPlayer.message(player, F.main("Game", "You cannot dig for " + F.elem(UtilTime.MakeStr(6000 - (System.currentTimeMillis() - GetStateTime())) + ".")));
|
||||
UtilPlayer.message(player, F.main("Game", "You cannot dig for " + F.elem(UtilTime.MakeStr(10000 - (System.currentTimeMillis() - GetStateTime())) + ".")));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -100,6 +100,9 @@ public class Dragons extends SoloGame
|
||||
|
||||
for (Item item : _sparkler.GetItems())
|
||||
{
|
||||
if (item.getLocation().getY() < 4 || item.getLocation().getBlock().isLiquid())
|
||||
continue;
|
||||
|
||||
for (DragonData data : _dragons.values())
|
||||
{
|
||||
if (UtilMath.offset(data.Location, item.getLocation()) < 48)
|
||||
|
@ -60,7 +60,7 @@ public class Micro extends TeamGame
|
||||
this.BlockBreak = true;
|
||||
this.BlockPlace = true;
|
||||
|
||||
registerStatTrackers(new KillsWithinGameStatTracker(this, 12, "Annihilation"));
|
||||
registerStatTrackers(new KillsWithinGameStatTracker(this, 8, "Annihilation"));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -380,30 +380,30 @@ public class MineStrike extends TeamGame
|
||||
((CraftPlayer) event.getEntity()).getHandle().spectating = true;
|
||||
}
|
||||
|
||||
public void disguiseSneak(Player player, GameTeam team)
|
||||
{
|
||||
//Create Disguise
|
||||
if (!_disguise.containsKey(player))
|
||||
{
|
||||
_disguise.put(player, new DisguisePlayer(player, ((CraftPlayer)player).getProfile()));
|
||||
}
|
||||
|
||||
DisguisePlayer disguise = _disguise.get(player);
|
||||
disguise.setSneaking(true);
|
||||
Manager.GetDisguise().disguise(_disguise.get(player));
|
||||
|
||||
for (Player other : UtilServer.getPlayers())
|
||||
{
|
||||
if (team.HasPlayer(other))
|
||||
{
|
||||
Manager.GetDisguise().removeViewerToDisguise(disguise, other);
|
||||
}
|
||||
else
|
||||
{
|
||||
Manager.GetDisguise().addViewerToDisguise(disguise, other);
|
||||
}
|
||||
}
|
||||
}
|
||||
// public void disguiseSneak(Player player, GameTeam team)
|
||||
// {
|
||||
// //Create Disguise
|
||||
// if (!_disguise.containsKey(player))
|
||||
// {
|
||||
// _disguise.put(player, new DisguisePlayer(player, ((CraftPlayer)player).getProfile()));
|
||||
// }
|
||||
//
|
||||
// DisguisePlayer disguise = _disguise.get(player);
|
||||
// disguise.setSneaking(true);
|
||||
// Manager.GetDisguise().disguise(_disguise.get(player));
|
||||
//
|
||||
// for (Player other : UtilServer.getPlayers())
|
||||
// {
|
||||
// if (team.HasPlayer(other))
|
||||
// {
|
||||
// Manager.GetDisguise().removeViewerToDisguise(disguise, other);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// Manager.GetDisguise().addViewerToDisguise(disguise, other, true);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
public void giveTeamArmor(Player player, Color color)
|
||||
{
|
||||
|
@ -99,7 +99,6 @@ public class Paintball extends TeamGame
|
||||
}
|
||||
|
||||
private HashMap<Player, PlayerCopy> _doubles = new HashMap<Player, PlayerCopy>();
|
||||
private HashSet<Projectile> _water = new HashSet<Projectile>();
|
||||
|
||||
public Paintball(ArcadeManager manager)
|
||||
{
|
||||
@ -127,7 +126,7 @@ public class Paintball extends TeamGame
|
||||
new KillFastStatTracker(this, 4, 5, "KillingSpree"),
|
||||
new WinWithoutLosingTeammateStatTracker(this, "FlawlessVictory"),
|
||||
new MedicStatTracker(this),
|
||||
new WinFastStatTracker(this, 20, "Speedrunner"),
|
||||
new WinFastStatTracker(this, 30, "Speedrunner"),
|
||||
new LastStandStatTracker(this)
|
||||
);
|
||||
}
|
||||
@ -334,7 +333,7 @@ public class Paintball extends TeamGame
|
||||
|
||||
player.setVelocity(new Vector(0,1.2,0));
|
||||
|
||||
_doubles.put(player, new PlayerCopy(this, player));
|
||||
_doubles.put(player, new PlayerCopy(this, player, GetTeam(player).GetColor()));
|
||||
}
|
||||
|
||||
// @EventHandler
|
||||
|
@ -3,21 +3,23 @@ package nautilus.game.arcade.game.games.paintball;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.disguise.disguises.DisguisePlayer;
|
||||
import nautilus.game.arcade.game.Game;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.EntityEffect;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Skeleton;
|
||||
|
||||
public class PlayerCopy
|
||||
{
|
||||
private Paintball Host;
|
||||
private Game Host;
|
||||
|
||||
private Skeleton _ent;
|
||||
private Player _owner;
|
||||
|
||||
public PlayerCopy(Paintball host, Player owner)
|
||||
public PlayerCopy(Game host, Player owner, ChatColor nameColor)
|
||||
{
|
||||
Host = host;
|
||||
|
||||
@ -34,12 +36,12 @@ public class PlayerCopy
|
||||
//Armor
|
||||
_ent.getEquipment().setArmorContents(owner.getInventory().getArmorContents());
|
||||
|
||||
_ent.setCustomName(C.cWhite + C.Bold + C.Scramble + "XX" + ChatColor.RESET + " " + host.GetTeam(owner).GetColor() + owner.getName() + " " + C.cWhite + C.Bold + C.Scramble + "XX");
|
||||
_ent.setCustomName(C.cWhite + C.Bold + C.Scramble + "XX" + ChatColor.RESET + " " + nameColor + owner.getName() + " " + C.cWhite + C.Bold + C.Scramble + "XX");
|
||||
_ent.setCustomNameVisible(true);
|
||||
|
||||
//Disguise
|
||||
////DisguisePlayer disguise = new DisguisePlayer(_ent, owner.getName());
|
||||
//Host.Manager.GetDisguise().disguise(disguise);
|
||||
// DisguisePlayer disguise = new DisguisePlayer(_ent, ((CraftPlayer)owner).getProfile());
|
||||
// Host.Manager.GetDisguise().disguise(disguise);
|
||||
}
|
||||
|
||||
public LivingEntity GetEntity()
|
||||
|
@ -127,6 +127,8 @@ public class Runner extends SoloGame implements IThrown
|
||||
return;
|
||||
|
||||
_blocks.put(block, System.currentTimeMillis());
|
||||
|
||||
block.setTypeIdAndData(159, (byte) 14, false);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@ -178,61 +180,9 @@ public class Runner extends SoloGame implements IThrown
|
||||
while (blockIterator.hasNext())
|
||||
{
|
||||
Block block = blockIterator.next();
|
||||
|
||||
// if (!UtilTime.elapsed(_blocks.get(block), 120))
|
||||
// continue;
|
||||
|
||||
blockIterator.remove();
|
||||
|
||||
//Degrade
|
||||
if (block.getTypeId() == 98)
|
||||
{
|
||||
if (block.getData() == 0)
|
||||
{
|
||||
readd.add(block);
|
||||
block.setData((byte)2);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
//Degrade
|
||||
if (block.getTypeId() == 35 || block.getTypeId() == 159)
|
||||
{
|
||||
if (block.getData() == 3)
|
||||
{
|
||||
readd.add(block);
|
||||
block.setData((byte)5);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (block.getData() == 5)
|
||||
{
|
||||
readd.add(block);
|
||||
block.setData((byte)4);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (block.getData() == 4)
|
||||
{
|
||||
readd.add(block);
|
||||
block.setData((byte)1);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (block.getData() == 1)
|
||||
{
|
||||
readd.add(block);
|
||||
block.setData((byte)14);
|
||||
continue;
|
||||
}
|
||||
|
||||
else if (block.getData() != 14)
|
||||
{
|
||||
readd.add(block);
|
||||
block.setData((byte)3);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (!UtilTime.elapsed(_blocks.get(block), 600))
|
||||
continue;
|
||||
|
||||
//Fall
|
||||
int id = block.getTypeId();
|
||||
@ -240,13 +190,78 @@ public class Runner extends SoloGame implements IThrown
|
||||
MapUtil.QuickChangeBlockAt(block.getLocation(), Material.AIR);
|
||||
FallingBlock ent = block.getWorld().spawnFallingBlock(block.getLocation(), id, data);
|
||||
Manager.GetProjectile().AddThrow(ent, null, this, -1, true, false, false, false, 1d);
|
||||
|
||||
blockIterator.remove();
|
||||
}
|
||||
|
||||
//Re-add
|
||||
for (Block block : readd)
|
||||
{
|
||||
_blocks.put(block, System.currentTimeMillis());
|
||||
}
|
||||
//
|
||||
//// if (!UtilTime.elapsed(_blocks.get(block), 120))
|
||||
//// continue;
|
||||
//
|
||||
// blockIterator.remove();
|
||||
//
|
||||
// //Degrade
|
||||
// if (block.getTypeId() == 98)
|
||||
// {
|
||||
// if (block.getData() == 0)
|
||||
// {
|
||||
// readd.add(block);
|
||||
// block.setData((byte)2);
|
||||
// continue;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// //Degrade
|
||||
// if (block.getTypeId() == 35 || block.getTypeId() == 159)
|
||||
// {
|
||||
// if (block.getData() == 3)
|
||||
// {
|
||||
// readd.add(block);
|
||||
// block.setData((byte)5);
|
||||
// continue;
|
||||
// }
|
||||
//
|
||||
// if (block.getData() == 5)
|
||||
// {
|
||||
// readd.add(block);
|
||||
// block.setData((byte)4);
|
||||
// continue;
|
||||
// }
|
||||
//
|
||||
// if (block.getData() == 4)
|
||||
// {
|
||||
// readd.add(block);
|
||||
// block.setData((byte)1);
|
||||
// continue;
|
||||
// }
|
||||
//
|
||||
// if (block.getData() == 1)
|
||||
// {
|
||||
// readd.add(block);
|
||||
// block.setData((byte)14);
|
||||
// continue;
|
||||
// }
|
||||
//
|
||||
// else if (block.getData() != 14)
|
||||
// {
|
||||
// readd.add(block);
|
||||
// block.setData((byte)3);
|
||||
// continue;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// //Fall
|
||||
// int id = block.getTypeId();
|
||||
// byte data = block.getData();
|
||||
// MapUtil.QuickChangeBlockAt(block.getLocation(), Material.AIR);
|
||||
// FallingBlock ent = block.getWorld().spawnFallingBlock(block.getLocation(), id, data);
|
||||
// Manager.GetProjectile().AddThrow(ent, null, this, -1, true, false, false, false, 1d);
|
||||
// }
|
||||
//
|
||||
// //Re-add
|
||||
// for (Block block : readd)
|
||||
// {
|
||||
// _blocks.put(block, System.currentTimeMillis());
|
||||
// }
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
@ -151,7 +151,7 @@ public class Snake extends SoloGame
|
||||
this.GemMultiplier = 0.5;
|
||||
|
||||
registerStatTrackers(
|
||||
new KillsWithinGameStatTracker(this, 8, "Cannibal"),
|
||||
new KillsWithinGameStatTracker(this, 6, "Cannibal"),
|
||||
new ChooChooStatTracker(this),
|
||||
new SlimySheepStatTracker(this)
|
||||
);
|
||||
|
@ -6,13 +6,23 @@ import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.Set;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.EntityEffect;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.ThrownPotion;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.entity.EntityCombustEvent;
|
||||
import org.bukkit.event.entity.ProjectileHitEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
@ -22,12 +32,15 @@ import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
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.data.BlockData;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.GameType;
|
||||
import nautilus.game.arcade.events.GameStateChangeEvent;
|
||||
@ -35,6 +48,9 @@ import nautilus.game.arcade.events.PlayerDeathOutEvent;
|
||||
import nautilus.game.arcade.events.PlayerKitGiveEvent;
|
||||
import nautilus.game.arcade.game.GameTeam;
|
||||
import nautilus.game.arcade.game.TeamGame;
|
||||
import nautilus.game.arcade.game.GameTeam.PlayerState;
|
||||
import nautilus.game.arcade.game.games.paintball.PlayerCopy;
|
||||
import nautilus.game.arcade.game.games.paintball.Paintball.ReviveEvent;
|
||||
import nautilus.game.arcade.game.games.wither.kit.*;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
import nautilus.game.arcade.kit.NullKit;
|
||||
@ -44,15 +60,17 @@ public class WitherGame extends TeamGame implements IBlockRestorer
|
||||
{
|
||||
private GameTeam _runners;
|
||||
private GameTeam _withers;
|
||||
|
||||
|
||||
private double _witherFactor = 2.5;
|
||||
|
||||
private int _yLimit = 0;
|
||||
|
||||
private long _gameTime = 300000;
|
||||
|
||||
private int _livesPerPlayer = 3;
|
||||
private HashMap<Player, Integer> _lives = new HashMap<Player, Integer>();
|
||||
private HashMap<Player, PlayerCopy> _doubles = new HashMap<Player, PlayerCopy>();
|
||||
|
||||
// private int _livesPerPlayer = 3;
|
||||
// private HashMap<Player, Integer> _lives = new HashMap<Player, Integer>();
|
||||
|
||||
private HashSet<BlockData> _blocks = new HashSet<BlockData>();
|
||||
|
||||
@ -62,9 +80,10 @@ public class WitherGame extends TeamGame implements IBlockRestorer
|
||||
|
||||
new Kit[]
|
||||
{
|
||||
//new KitHumanRunner(manager),
|
||||
new KitHumanArcher(manager),
|
||||
new KitHumanBuilder(manager),
|
||||
//new KitHumanBuilder(manager),
|
||||
//new KitHumanRunner(manager),
|
||||
new NullKit(manager),
|
||||
new NullKit(manager),
|
||||
new NullKit(manager),
|
||||
new KitWitherMinion(manager),
|
||||
@ -75,8 +94,8 @@ public class WitherGame extends TeamGame implements IBlockRestorer
|
||||
new String[]
|
||||
{
|
||||
|
||||
C.cGreen + "Humans" + C.cWhite + " Find Armor Upgrades to help surive!",
|
||||
C.cGreen + "Humans" + C.cWhite + " 5 Lives per Player",
|
||||
C.cGreen + "Humans" + C.cWhite + " Run and hide from the Withers",
|
||||
C.cGreen + "Humans" + C.cWhite + " Revive your dead allies!",
|
||||
C.cGreen + "Humans" + C.cWhite + " Win by surviving for 5 minutes",
|
||||
" ",
|
||||
C.cRed + "Withers" + C.cWhite + " Moves very slowly when near ground",
|
||||
@ -95,6 +114,9 @@ public class WitherGame extends TeamGame implements IBlockRestorer
|
||||
|
||||
this.KitRegisterState = GameState.Prepare;
|
||||
|
||||
this.TeamArmor = true;
|
||||
this.TeamArmorHotbar = false;
|
||||
|
||||
_help = new String[]
|
||||
{
|
||||
C.cRed + C.Bold + "This game is in early stages of development!",
|
||||
@ -164,15 +186,17 @@ public class WitherGame extends TeamGame implements IBlockRestorer
|
||||
|
||||
public void setWither(Player player, boolean forced)
|
||||
{
|
||||
_lives.remove(player);
|
||||
// _lives.remove(player);
|
||||
|
||||
SetPlayerTeam(player, _withers, true);
|
||||
|
||||
|
||||
//Kit
|
||||
Kit newKit = GetKits()[4];
|
||||
|
||||
SetKit(player, newKit, false);
|
||||
newKit.ApplyKit(player);
|
||||
|
||||
player.teleport(_withers.GetSpawn());
|
||||
|
||||
if (forced)
|
||||
{
|
||||
@ -185,25 +209,25 @@ public class WitherGame extends TeamGame implements IBlockRestorer
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void playerDead(final PlayerDeathOutEvent event)
|
||||
{
|
||||
Player player = event.GetPlayer();
|
||||
|
||||
if (_lives.containsKey(player))
|
||||
{
|
||||
int lives = _lives.get(player);
|
||||
|
||||
if (lives <= 1)
|
||||
return;
|
||||
|
||||
_lives.put(player, lives - 1);
|
||||
|
||||
UtilPlayer.message(player, F.main("Game", "You have " + F.elem(C.cGreen + C.Bold + lives + " Lives Remaining") + "."));
|
||||
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
// @EventHandler
|
||||
// public void playerLoseLife(final PlayerDeathOutEvent event)
|
||||
// {
|
||||
// Player player = event.GetPlayer();
|
||||
//
|
||||
// if (_lives.containsKey(player))
|
||||
// {
|
||||
// int lives = _lives.get(player);
|
||||
//
|
||||
// if (lives <= 1)
|
||||
// return;
|
||||
//
|
||||
// _lives.put(player, lives - 1);
|
||||
//
|
||||
// UtilPlayer.message(player, F.main("Game", "You have " + F.elem(C.cGreen + C.Bold + lives + " Lives Remaining") + "."));
|
||||
//
|
||||
// event.setCancelled(true);
|
||||
// }
|
||||
// }
|
||||
|
||||
@EventHandler
|
||||
public void gameStart(GameStateChangeEvent event)
|
||||
@ -211,31 +235,31 @@ public class WitherGame extends TeamGame implements IBlockRestorer
|
||||
if (event.GetState() != GameState.Live)
|
||||
return;
|
||||
|
||||
UtilTextMiddle.display(C.cGreen + "Humans Hiding", "12 Seconds until Assault", 10, 80, 10);
|
||||
UtilTextMiddle.display(C.cGreen + "Humans Hiding", "15 Seconds until Assault", 10, 80, 10);
|
||||
|
||||
for (Player player : _withers.GetPlayers(true))
|
||||
{
|
||||
Manager.GetCondition().Factory().Blind("Game Start", player, null, 12, 0, false, false, false);
|
||||
Manager.GetCondition().Factory().Blind("Game Start", player, null, 15, 0, false, false, false);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void playerLivesDisplay(PlayerKitGiveEvent event)
|
||||
{
|
||||
if (!_runners.HasPlayer(event.GetPlayer()))
|
||||
return;
|
||||
|
||||
//Player Lives
|
||||
if (!_lives.containsKey(event.GetPlayer()))
|
||||
_lives.put(event.GetPlayer(), _livesPerPlayer);
|
||||
|
||||
int lives = _lives.get(event.GetPlayer());
|
||||
|
||||
if (lives <= 0)
|
||||
return;
|
||||
|
||||
event.GetPlayer().getInventory().setItem(8, ItemStackFactory.Instance.CreateStack(Material.BONE, (byte)0, lives, C.cGreen + C.Bold + lives + " Lives Remaining"));
|
||||
}
|
||||
// @EventHandler
|
||||
// public void playerLivesDisplay(PlayerKitGiveEvent event)
|
||||
// {
|
||||
// if (!_runners.HasPlayer(event.GetPlayer()))
|
||||
// return;
|
||||
//
|
||||
// //Player Lives
|
||||
// if (!_lives.containsKey(event.GetPlayer()))
|
||||
// _lives.put(event.GetPlayer(), _livesPerPlayer);
|
||||
//
|
||||
// int lives = _lives.get(event.GetPlayer());
|
||||
//
|
||||
// if (lives <= 0)
|
||||
// return;
|
||||
//
|
||||
// event.GetPlayer().getInventory().setItem(8, ItemStackFactory.Instance.CreateStack(Material.BONE, (byte)0, lives, C.cGreen + C.Bold + lives + " Lives Remaining"));
|
||||
// }
|
||||
|
||||
@Override
|
||||
public void EndCheck()
|
||||
@ -292,9 +316,9 @@ public class WitherGame extends TeamGame implements IBlockRestorer
|
||||
if (event.getType() != UpdateType.FAST)
|
||||
return;
|
||||
|
||||
int lives = 0;
|
||||
for (int i : _lives.values())
|
||||
lives += i;
|
||||
// int lives = 0;
|
||||
// for (int i : _lives.values())
|
||||
// lives += i;
|
||||
|
||||
//Wipe Last
|
||||
Scoreboard.Reset();
|
||||
@ -307,9 +331,9 @@ public class WitherGame extends TeamGame implements IBlockRestorer
|
||||
Scoreboard.Write(_withers.GetColor() + C.Bold + _withers.GetName());
|
||||
Scoreboard.Write(_withers.GetColor() + "" + _withers.GetPlayers(true).size() + " Players");
|
||||
|
||||
Scoreboard.WriteBlank();
|
||||
Scoreboard.Write(C.cYellow + C.Bold + "Human Lives");
|
||||
Scoreboard.Write(lives + " / " + (_lives.size() * _livesPerPlayer));
|
||||
// Scoreboard.WriteBlank();
|
||||
// Scoreboard.Write(C.cYellow + C.Bold + "Humans Alive");
|
||||
// Scoreboard.Write(lives + " / " + (_lives.size() * _livesPerPlayer));
|
||||
|
||||
Scoreboard.WriteBlank();
|
||||
Scoreboard.Write(C.cYellow + C.Bold + "Time Left");
|
||||
@ -357,13 +381,13 @@ public class WitherGame extends TeamGame implements IBlockRestorer
|
||||
ArrayList<Location> collisions = new ArrayList<Location>();
|
||||
|
||||
//Fly Speed
|
||||
double speed = 0.06 - (_yLimit - player.getLocation().getY()) * 0.075;
|
||||
double speed = 0.09 - (_yLimit - player.getLocation().getY()) * 0.006;
|
||||
|
||||
if (speed > 0.16)
|
||||
speed = 0.16;
|
||||
|
||||
if (speed < 0.015)
|
||||
speed = 0.015;
|
||||
if (speed < 0.016)
|
||||
speed = 0.016;
|
||||
|
||||
player.setFlySpeed((float)speed);
|
||||
|
||||
@ -431,29 +455,227 @@ public class WitherGame extends TeamGame implements IBlockRestorer
|
||||
}
|
||||
}
|
||||
|
||||
// @EventHandler
|
||||
// public void cleanLives(PlayerQuitEvent event)
|
||||
// {
|
||||
// _lives.remove(event.getPlayer());
|
||||
// }
|
||||
|
||||
// @EventHandler
|
||||
// public void livesUpdate(UpdateEvent event)
|
||||
// {
|
||||
// if (!IsLive())
|
||||
// return;
|
||||
//
|
||||
// if (event.getType() != UpdateType.FASTER)
|
||||
// return;
|
||||
//
|
||||
// Iterator<Player> playerIter = _lives.keySet().iterator();
|
||||
//
|
||||
// while (playerIter.hasNext())
|
||||
// {
|
||||
// Player player = playerIter.next();
|
||||
//
|
||||
// if (!player.isOnline() || !_runners.HasPlayer(player))
|
||||
// playerIter.remove();
|
||||
// }
|
||||
// }
|
||||
|
||||
@EventHandler
|
||||
public void playerQuit(PlayerQuitEvent event)
|
||||
public void arrowDamage(CustomDamageEvent event)
|
||||
{
|
||||
_lives.remove(event.getPlayer());
|
||||
if (event.GetProjectile() == null)
|
||||
return;
|
||||
|
||||
event.AddMult(GetName(), "Arrow Mod", 0.75, false);
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void damageOut(CustomDamageEvent event)
|
||||
{
|
||||
if (event.IsCancelled())
|
||||
return;
|
||||
|
||||
if (event.GetDamageePlayer() == null)
|
||||
return;
|
||||
|
||||
if (event.GetDamage() < event.GetDamageePlayer().getHealth())
|
||||
return;
|
||||
|
||||
event.SetCancelled("Fake Death");
|
||||
|
||||
event.GetDamageePlayer().playEffect(EntityEffect.HURT);
|
||||
|
||||
playerOut(event.GetDamageePlayer());
|
||||
|
||||
if (event.GetDamagerPlayer(true) != null)
|
||||
{
|
||||
AddGems(event.GetDamagerPlayer(true), 2, "Humans Stunned", true);
|
||||
|
||||
Bukkit.broadcastMessage(C.cBlue + "Death> " + C.cGreen + event.GetDamageePlayer().getName() + C.cGray + " was killed by " + C.cRed + event.GetDamagerPlayer(true).getName() + C.cGray + ".");
|
||||
}
|
||||
else
|
||||
{
|
||||
Bukkit.broadcastMessage(C.cBlue + "Death> " + C.cGreen + event.GetDamageePlayer().getName() + C.cGray + " was killed.");
|
||||
}
|
||||
}
|
||||
|
||||
public void playerOut(Player player)
|
||||
{
|
||||
//State
|
||||
SetPlayerState(player, PlayerState.OUT);
|
||||
player.setHealth(20);
|
||||
|
||||
player.setFlySpeed(0.1f);
|
||||
|
||||
//Conditions
|
||||
Manager.GetCondition().Factory().Blind("Hit", player, player, 1.5, 0, false, false, false);
|
||||
Manager.GetCondition().Factory().Cloak("Hit", player, player, 9999, false, false);
|
||||
|
||||
//Settings
|
||||
player.setGameMode(GameMode.CREATIVE);
|
||||
player.setFlying(true);
|
||||
((CraftPlayer)player).getHandle().spectating = true;
|
||||
((CraftPlayer)player).getHandle().k = false;
|
||||
|
||||
player.setVelocity(new Vector(0,1.2,0));
|
||||
|
||||
_doubles.put(player, new PlayerCopy(this, player, ChatColor.YELLOW));
|
||||
}
|
||||
|
||||
public void playerIn(final Player player, final LivingEntity copy)
|
||||
{
|
||||
//State
|
||||
SetPlayerState(player, PlayerState.IN);
|
||||
player.setHealth(20);
|
||||
|
||||
//Teleport
|
||||
if (copy != null)
|
||||
{
|
||||
Location loc = player.getLocation();
|
||||
loc.setX(copy.getLocation().getX());
|
||||
loc.setY(copy.getLocation().getY());
|
||||
loc.setZ(copy.getLocation().getZ());
|
||||
player.teleport(loc);
|
||||
}
|
||||
|
||||
//Settings
|
||||
player.setGameMode(GameMode.SURVIVAL);
|
||||
player.setFlying(false);
|
||||
((CraftPlayer)player).getHandle().spectating = false;
|
||||
((CraftPlayer)player).getHandle().k = true;
|
||||
|
||||
//Items
|
||||
player.getInventory().remove(Material.WATCH);
|
||||
player.getInventory().remove(Material.COMPASS);
|
||||
|
||||
//Inform
|
||||
UtilPlayer.message(player, F.main("Game", "You have been revived!"));
|
||||
|
||||
//Delayed Visibility
|
||||
if (copy != null)
|
||||
{
|
||||
UtilServer.getServer().getScheduler().scheduleSyncDelayedTask(Manager.GetPlugin(), new Runnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
//Remove Invis
|
||||
if (IsAlive(player))
|
||||
Manager.GetCondition().EndCondition(player, ConditionType.CLOAK, null);
|
||||
|
||||
//Remove Copy
|
||||
copy.remove();
|
||||
}
|
||||
}, 4);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void livesUpdate(UpdateEvent event)
|
||||
public void revive(ProjectileHitEvent event)
|
||||
{
|
||||
if (!IsLive())
|
||||
return;
|
||||
|
||||
if (event.getType() != UpdateType.FASTER)
|
||||
if (!(event.getEntity() instanceof ThrownPotion))
|
||||
return;
|
||||
|
||||
if (event.getEntity().getShooter() == null)
|
||||
return;
|
||||
|
||||
if (!(event.getEntity().getShooter() instanceof Player))
|
||||
return;
|
||||
|
||||
Player thrower = (Player)event.getEntity().getShooter();
|
||||
|
||||
GameTeam throwerTeam = GetTeam(thrower);
|
||||
if (throwerTeam == null) return;
|
||||
|
||||
//Revive
|
||||
Iterator<PlayerCopy> copyIterator = _doubles.values().iterator();
|
||||
while (copyIterator.hasNext())
|
||||
{
|
||||
PlayerCopy copy = copyIterator.next();
|
||||
|
||||
GameTeam otherTeam = GetTeam(copy.GetPlayer());
|
||||
if (otherTeam == null || !otherTeam.equals(throwerTeam))
|
||||
continue;
|
||||
|
||||
if (UtilMath.offset(copy.GetEntity().getLocation().add(0,1,0), event.getEntity().getLocation()) > 3)
|
||||
continue;
|
||||
|
||||
playerIn(copy.GetPlayer(), copy.GetEntity());
|
||||
copyIterator.remove();
|
||||
|
||||
AddGems(thrower, 3, "Revived Ally", true);
|
||||
}
|
||||
|
||||
//Revive
|
||||
for (Player player : GetPlayers(true))
|
||||
{
|
||||
GameTeam otherTeam = GetTeam(player);
|
||||
if (otherTeam == null || !otherTeam.equals(throwerTeam))
|
||||
continue;
|
||||
|
||||
if (UtilMath.offset(player.getLocation().add(0,1,0), event.getEntity().getLocation()) > 3)
|
||||
continue;
|
||||
|
||||
playerIn(player, null);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void removePotionEffect(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.TICK)
|
||||
return;
|
||||
|
||||
Iterator<Player> playerIter = _lives.keySet().iterator();
|
||||
|
||||
while (playerIter.hasNext())
|
||||
for (Player player : GetPlayers(true))
|
||||
player.removePotionEffect(PotionEffectType.WATER_BREATHING);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void skeletonDamage(CustomDamageEvent event)
|
||||
{
|
||||
for (PlayerCopy copy : _doubles.values())
|
||||
{
|
||||
Player player = playerIter.next();
|
||||
|
||||
if (!player.isOnline() || !_runners.HasPlayer(player))
|
||||
playerIter.remove();
|
||||
if (copy.GetEntity().equals(event.GetDamageeEntity()))
|
||||
{
|
||||
event.SetCancelled("Runner Copy Cancel");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void skeletonCombust(EntityCombustEvent event)
|
||||
{
|
||||
for (PlayerCopy copy : _doubles.values())
|
||||
{
|
||||
if (copy.GetEntity().equals(event.getEntity()))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,15 +1,21 @@
|
||||
package nautilus.game.arcade.game.games.wither.kit;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.PotionMeta;
|
||||
|
||||
import mineplex.core.disguise.disguises.DisguisePlayer;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
import nautilus.game.arcade.kit.KitAvailability;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
import nautilus.game.arcade.kit.perks.PerkDoubleJump;
|
||||
import nautilus.game.arcade.kit.perks.PerkFletcher;
|
||||
import nautilus.game.arcade.kit.perks.PerkRopedArrow;
|
||||
import nautilus.game.arcade.kit.perks.PerkWitherArrowBlind;
|
||||
@ -27,8 +33,8 @@ public class KitHumanArcher extends Kit
|
||||
|
||||
new Perk[]
|
||||
{
|
||||
new PerkRopedArrow("Roped Arrow", 1, 4000),
|
||||
new PerkWitherArrowBlind(3),
|
||||
new PerkDoubleJump("Double Jump", 1, 0.8, true, 4000, true),
|
||||
new PerkWitherArrowBlind(6),
|
||||
new PerkFletcher(4, 4, true),
|
||||
|
||||
},
|
||||
@ -42,10 +48,15 @@ public class KitHumanArcher extends Kit
|
||||
{
|
||||
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD));
|
||||
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW));
|
||||
|
||||
ItemStack potion = new ItemStack(Material.POTION, 2, (short)16429); // 16422
|
||||
PotionMeta potionMeta = (PotionMeta)potion.getItemMeta();
|
||||
potionMeta.setDisplayName(ChatColor.RESET + "Revival Potion");
|
||||
potion.setItemMeta(potionMeta);
|
||||
player.getInventory().addItem(potion);
|
||||
|
||||
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP));
|
||||
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP));
|
||||
|
||||
Manager.GetCondition().Factory().Invulnerable("Spawn Invul", player, player, 6, false, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1,16 +1,22 @@
|
||||
package nautilus.game.arcade.game.games.wither.kit;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.PotionMeta;
|
||||
|
||||
import mineplex.core.disguise.disguises.DisguisePlayer;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
import nautilus.game.arcade.kit.KitAvailability;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
import nautilus.game.arcade.kit.perks.PerkBlockRestorer;
|
||||
import nautilus.game.arcade.kit.perks.PerkDoubleJump;
|
||||
import nautilus.game.arcade.kit.perks.PerkIronShell;
|
||||
|
||||
public class KitHumanBuilder extends Kit
|
||||
@ -26,6 +32,7 @@ public class KitHumanBuilder extends Kit
|
||||
|
||||
new Perk[]
|
||||
{
|
||||
new PerkDoubleJump("Double Jump", 1, 0.8, true, 6000, true),
|
||||
new PerkIronShell(),
|
||||
new PerkBlockRestorer()
|
||||
},
|
||||
@ -39,10 +46,15 @@ public class KitHumanBuilder extends Kit
|
||||
{
|
||||
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE));
|
||||
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SPADE));
|
||||
|
||||
ItemStack potion = new ItemStack(Material.POTION, 2, (short)16429); // 16422
|
||||
PotionMeta potionMeta = (PotionMeta)potion.getItemMeta();
|
||||
potionMeta.setDisplayName(ChatColor.RESET + "Revival Potion");
|
||||
potion.setItemMeta(potionMeta);
|
||||
player.getInventory().addItem(potion);
|
||||
|
||||
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP));
|
||||
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP));
|
||||
|
||||
Manager.GetCondition().Factory().Invulnerable("Spawn Invul", player, player, 6, false, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1,24 +1,29 @@
|
||||
package nautilus.game.arcade.game.games.wither.kit;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.PotionMeta;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.disguise.disguises.DisguisePlayer;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
import nautilus.game.arcade.kit.KitAvailability;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
import nautilus.game.arcade.kit.perks.PerkDoubleJump;
|
||||
import nautilus.game.arcade.kit.perks.PerkLeap;
|
||||
|
||||
public class KitHumanRunner extends Kit
|
||||
{
|
||||
public KitHumanRunner(ArcadeManager manager)
|
||||
{
|
||||
super(manager, "Human Leaper", KitAvailability.Free,
|
||||
super(manager, "Human Jumper", KitAvailability.Free,
|
||||
|
||||
new String[]
|
||||
{
|
||||
@ -27,7 +32,7 @@ public class KitHumanRunner extends Kit
|
||||
|
||||
new Perk[]
|
||||
{
|
||||
new PerkLeap("Leap", 1, 1, 4000)
|
||||
new PerkDoubleJump("Double Jump", 1, 0.8, true, 6000, true),
|
||||
},
|
||||
EntityType.ZOMBIE,
|
||||
null);
|
||||
@ -38,10 +43,15 @@ public class KitHumanRunner extends Kit
|
||||
public void GiveItems(Player player)
|
||||
{
|
||||
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE));
|
||||
|
||||
ItemStack potion = new ItemStack(Material.POTION, 2, (short)16429); // 16422
|
||||
PotionMeta potionMeta = (PotionMeta)potion.getItemMeta();
|
||||
potionMeta.setDisplayName(ChatColor.RESET + "Revival Potion");
|
||||
potion.setItemMeta(potionMeta);
|
||||
player.getInventory().addItem(potion);
|
||||
|
||||
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP));
|
||||
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP));
|
||||
|
||||
Manager.GetCondition().Factory().Invulnerable("Spawn Invul", player, player, 6, false, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -38,26 +38,28 @@ public class KitWitherMinion extends Kit
|
||||
new PerkWitherAttack(),
|
||||
new PerkWitherMinion()
|
||||
},
|
||||
EntityType.SKELETON,
|
||||
EntityType.WITHER,
|
||||
null);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void SpawnCustom(LivingEntity ent)
|
||||
{
|
||||
ent.setMaxHealth(300);
|
||||
ent.setHealth(300);
|
||||
|
||||
DisguiseWither disguise = new DisguiseWither(ent);
|
||||
disguise.SetName(C.cYellow + "Wither");
|
||||
disguise.SetCustomNameVisible(true);
|
||||
Manager.GetDisguise().disguise(disguise);
|
||||
}
|
||||
// @Override
|
||||
// public void SpawnCustom(LivingEntity ent)
|
||||
// {
|
||||
// ent.setMaxHealth(300);
|
||||
// ent.setHealth(300);
|
||||
//
|
||||
// DisguiseWither disguise = new DisguiseWither(ent);
|
||||
// disguise.SetName(C.cYellow + "Wither");
|
||||
// disguise.SetCustomNameVisible(true);
|
||||
// Manager.GetDisguise().disguise(disguise);
|
||||
// }
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void GiveItems(Player player)
|
||||
{
|
||||
{
|
||||
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.GOLD_SWORD, (byte)0, 1,
|
||||
C.cYellow + C.Bold + "Left-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Wither Skull"));
|
||||
|
||||
|
@ -181,7 +181,7 @@ public class PerkSparkler extends Perk
|
||||
@EventHandler
|
||||
public void Sparkle(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.FASTER)
|
||||
if (event.getType() != UpdateType.FAST)
|
||||
return;
|
||||
|
||||
Iterator<Item> itemIterator = _items.iterator();
|
||||
@ -197,7 +197,7 @@ public class PerkSparkler extends Perk
|
||||
continue;
|
||||
}
|
||||
|
||||
UtilFirework.playFirework(item.getLocation(), Type.BURST, Color.GREEN, false, false);
|
||||
UtilFirework.playFirework(item.getLocation(), Type.BURST, Color.YELLOW, false, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -96,21 +96,21 @@ public class PerkWitherArrowBlind extends Perk
|
||||
boolean hit = false;
|
||||
for (Player player : getWitherTeam().GetPlayers(true))
|
||||
{
|
||||
if (UtilMath.offset(player.getLocation().add(0, 1, 0), arrow.getLocation()) < _proximityHit)
|
||||
if (UtilMath.offset(player.getLocation().add(0, 3, 0), arrow.getLocation()) < _proximityHit)
|
||||
{
|
||||
Manager.GetCondition().Factory().Blind(GetName(), player, null, 4, 0, false, false, false);
|
||||
|
||||
UtilParticle.PlayParticle(ParticleType.HUGE_EXPLOSION, arrow.getLocation(), 0, 0, 0, 0, 1);
|
||||
|
||||
arrowIterator.remove();
|
||||
arrow.remove();
|
||||
hit = true;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (hit)
|
||||
{
|
||||
UtilParticle.PlayParticle(ParticleType.HUGE_EXPLOSION, arrow.getLocation(), 0, 0, 0, 0, 1);
|
||||
arrowIterator.remove();
|
||||
arrow.remove();
|
||||
continue;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//Dead
|
||||
|
@ -41,13 +41,13 @@ public class PerkWitherArrows extends Perk
|
||||
|
||||
if (!player.isBlocking())
|
||||
{
|
||||
player.setExp((float) Math.min(0.999, player.getExp()+(1f/30f)));
|
||||
player.setExp((float) Math.min(0.999, player.getExp()+(1f/20f)));
|
||||
}
|
||||
else if (player.getExp() > 0)
|
||||
{
|
||||
player.setExp((float) Math.max(0, player.getExp()-(1f/30f)));
|
||||
player.setExp((float) Math.max(0, player.getExp()-(1f/20f)));
|
||||
|
||||
for (int i=0 ; i<1 ; i++)
|
||||
for (int i=0 ; i<2 ; i++)
|
||||
{
|
||||
Arrow arrow = player.getWorld().spawnArrow(
|
||||
player.getEyeLocation().add(player.getLocation().getDirection()),
|
||||
|
@ -137,7 +137,7 @@ public class PerkWitherAttack extends Perk
|
||||
double scale = 0.4 + 0.6 * Math.min(1, skull.getTicksLived()/20d);
|
||||
|
||||
//Players
|
||||
HashMap<Player, Double> players = UtilPlayer.getInRadius(skull.getLocation(), 6);
|
||||
HashMap<Player, Double> players = UtilPlayer.getInRadius(skull.getLocation(), 7);
|
||||
for (Player player : players.keySet())
|
||||
{
|
||||
if (!Manager.GetGame().IsAlive(player))
|
||||
@ -145,7 +145,7 @@ public class PerkWitherAttack extends Perk
|
||||
|
||||
//Damage Event
|
||||
Manager.GetDamage().NewDamageEvent(player, (LivingEntity)skull.getShooter(), null,
|
||||
DamageCause.CUSTOM, 8 * players.get(player) * scale, true, true, false,
|
||||
DamageCause.CUSTOM, 2 + 10 * players.get(player) * scale, true, true, false,
|
||||
UtilEnt.getName((LivingEntity)skull.getShooter()), GetName());
|
||||
}
|
||||
|
||||
|
@ -108,7 +108,7 @@ public class GameGemManager implements Listener
|
||||
if (event.GetState() != PlayerState.OUT)
|
||||
return;
|
||||
|
||||
if (event.GetGame().GetType() == GameType.Paintball || event.GetGame().GetType() == GameType.MineStrike)
|
||||
if (event.GetGame().GetType() == GameType.WitherAssault || event.GetGame().GetType() == GameType.Paintball || event.GetGame().GetType() == GameType.MineStrike)
|
||||
return;
|
||||
|
||||
RewardGems(event.GetGame(), event.GetPlayer(), false);
|
||||
|
@ -60,6 +60,9 @@ public class GameLootManager implements Listener
|
||||
//Chest
|
||||
_rewardManager.addReward(new InventoryReward(_rewardManager, Manager.getInventoryManager(), "Treasure Chest", "Treasure Chest", 1, 1,
|
||||
new ItemStack(Material.CHEST), RewardRarity.COMMON, 4));
|
||||
|
||||
_rewardManager.addReward(new InventoryReward(_rewardManager, Manager.getInventoryManager(), "Treasure Chest", "Treasure Chest", 1, 2,
|
||||
new ItemStack(Material.CHEST), RewardRarity.COMMON, 1));
|
||||
|
||||
//Key
|
||||
_rewardManager.addReward(new InventoryReward(_rewardManager, Manager.getInventoryManager(), "Treasure Key", "Treasure Key", 1, 1,
|
||||
|
@ -0,0 +1,72 @@
|
||||
package nautilus.game.arcade.managers;
|
||||
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.GameType;
|
||||
import nautilus.game.arcade.game.Game.GameState;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Minecart;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.minecart.CommandMinecart;
|
||||
import org.bukkit.entity.minecart.ExplosiveMinecart;
|
||||
import org.bukkit.entity.minecart.HopperMinecart;
|
||||
import org.bukkit.entity.minecart.PoweredMinecart;
|
||||
import org.bukkit.entity.minecart.StorageMinecart;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.block.Action;
|
||||
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.vehicle.VehicleDamageEvent;
|
||||
|
||||
public class GameSpectatorManager implements Listener
|
||||
{
|
||||
ArcadeManager Manager;
|
||||
|
||||
public GameSpectatorManager(ArcadeManager manager)
|
||||
{
|
||||
Manager = manager;
|
||||
|
||||
Manager.GetPluginManager().registerEvents(this, Manager.GetPlugin());
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOW)
|
||||
public void interactCancel(PlayerInteractEvent event)
|
||||
{
|
||||
if (Manager.GetGame() == null)
|
||||
return;
|
||||
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (!Manager.GetGame().IsAlive(player))
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOW)
|
||||
public void interactEntityCancel(PlayerInteractEntityEvent event)
|
||||
{
|
||||
if (Manager.GetGame() == null)
|
||||
return;
|
||||
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (!Manager.GetGame().IsAlive(player))
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOW)
|
||||
public void vehicleDamage(VehicleDamageEvent event)
|
||||
{
|
||||
if (Manager.GetGame() == null)
|
||||
return;
|
||||
|
||||
if (!(event.getAttacker() instanceof Player))
|
||||
return;
|
||||
|
||||
Player player = (Player)event.getAttacker();
|
||||
|
||||
if (!Manager.GetGame().IsAlive(player))
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
@ -52,12 +52,8 @@ public class MiscManager implements Listener
|
||||
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (!Manager.GetGame().IsAlive(player))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
}
|
||||
//BoneMeal
|
||||
else if (event.getPlayer().getItemInHand().getType() == Material.INK_SACK && event.getPlayer().getItemInHand().getData().getData() == (byte)15)
|
||||
if (event.getPlayer().getItemInHand().getType() == Material.INK_SACK && event.getPlayer().getItemInHand().getData().getData() == (byte)15)
|
||||
{
|
||||
if (event.getAction() == Action.RIGHT_CLICK_BLOCK && Manager.GetGame().GetType() != GameType.UHC)
|
||||
event.setCancelled(true);
|
||||
|
Loading…
Reference in New Issue
Block a user