Merge branch 'master' of ssh://184.154.0.242:7999/min/Mineplex

This commit is contained in:
Jonathan Williams 2015-01-29 17:50:24 -08:00
commit 81a52184c9
184 changed files with 7121 additions and 1967 deletions

View File

@ -15,6 +15,7 @@ public enum Rank
MODERATOR("Mod", ChatColor.GOLD), MODERATOR("Mod", ChatColor.GOLD),
HELPER("Helper", ChatColor.DARK_AQUA), HELPER("Helper", ChatColor.DARK_AQUA),
MAPDEV("Mapper", ChatColor.BLUE), MAPDEV("Mapper", ChatColor.BLUE),
MAPLEAD("MapKing", ChatColor.DARK_PURPLE),
//Staff ^^ //Staff ^^

View File

@ -48,6 +48,11 @@ public class UtilInv
itemStack.removeEnchantment(_enchantment); itemStack.removeEnchantment(_enchantment);
} }
public static DullEnchantment getDullEnchantment()
{
return _enchantment;
}
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public static boolean insert(Player player, ItemStack stack) public static boolean insert(Player player, ItemStack stack)
{ {

View File

@ -37,8 +37,16 @@ public class UtilTextBottom
public static void displayProgress(String prefix, double amount, String suffix, Player... players) public static void displayProgress(String prefix, double amount, String suffix, Player... players)
{ {
displayProgress(prefix, amount, suffix, false, players);
}
public static void displayProgress(String prefix, double amount, String suffix, boolean progressDirectionSwap, Player... players)
{
if (progressDirectionSwap)
amount = 1 - amount;
//Generate Bar //Generate Bar
int bars = 12; int bars = 24;
String progressBar = C.cGreen + ""; String progressBar = C.cGreen + "";
boolean colorChange = false; boolean colorChange = false;
for (int i=0 ; i<bars ; i++) for (int i=0 ; i<bars ; i++)
@ -49,7 +57,7 @@ public class UtilTextBottom
colorChange = true; colorChange = true;
} }
progressBar += ""; progressBar += "";
} }
//Send to Player //Send to Player

View File

@ -464,4 +464,13 @@ public class CoreClientManager extends MiniPlugin
{ {
_loginProcessors.put(processor.getName(), processor); _loginProcessors.put(processor.getName(), processor);
} }
public boolean hasRank(Player player, Rank rank)
{
CoreClient client = Get(player);
if (client == null)
return false;
return client.GetRank().Has(rank);
}
} }

View File

@ -62,6 +62,8 @@ public class AntiHack extends MiniPlugin
//Player Info //Player Info
private HashSet<Player> _velocityEvent = new HashSet<Player>(); private HashSet<Player> _velocityEvent = new HashSet<Player>();
private HashMap<Player, Long> _lastMoveEvent = new HashMap<Player, Long>(); private HashMap<Player, Long> _lastMoveEvent = new HashMap<Player, Long>();
private HashSet<Player> _hubAttempted = new HashSet<Player>();
//Hack Requirements //Hack Requirements
public int FloatHackTicks = 10; public int FloatHackTicks = 10;
@ -347,7 +349,7 @@ public class AntiHack extends MiniPlugin
{ {
player.playSound(player.getLocation(), Sound.ENDERDRAGON_GROWL, 2f, 0.5f); player.playSound(player.getLocation(), Sound.ENDERDRAGON_GROWL, 2f, 0.5f);
if (_kick) if (_kick || _hubAttempted.remove(player))
{ {
player.kickPlayer( player.kickPlayer(
C.cGold + "Mineplex Anti-Cheat" + "\n" + C.cGold + "Mineplex Anti-Cheat" + "\n" +
@ -358,6 +360,8 @@ public class AntiHack extends MiniPlugin
} }
else else
{ {
_hubAttempted.add(player);
UtilPlayer.message(player, C.cGold + C.Strike + "---------------------------------------------"); UtilPlayer.message(player, C.cGold + C.Strike + "---------------------------------------------");
UtilPlayer.message(player, ""); UtilPlayer.message(player, "");
UtilPlayer.message(player, C.cGold + "Mineplex Anti-Cheat"); UtilPlayer.message(player, C.cGold + "Mineplex Anti-Cheat");
@ -452,6 +456,17 @@ public class AntiHack extends MiniPlugin
detector.Reset(player); detector.Reset(player);
} }
} }
for (Iterator<Player> playerIterator = _hubAttempted.iterator(); playerIterator.hasNext();)
{
Player player = playerIterator.next();
if (!player.isOnline() || !player.isValid())
{
playerIterator.remove();
}
}
} }
public void setEnabled(boolean b) public void setEnabled(boolean b)

View File

@ -221,7 +221,7 @@ public class Menu extends ShopPageBase<CosmeticManager, CosmeticShop>
} }
else else
{ {
treasureManager.attemptOpenTreasure(player); // treasureManager.attemptOpenTreasure(player);
} }
} }

View File

@ -20,6 +20,14 @@ public class BlockData
public void restore() public void restore()
{ {
restore(false);
}
public void restore(boolean requireNotAir)
{
if (requireNotAir && Block.getType() == org.bukkit.Material.AIR)
return;
Block.setTypeIdAndData(Material.getId(), Data, true); Block.setTypeIdAndData(Material.getId(), Data, true);
} }
} }

View File

@ -28,327 +28,360 @@ import mineplex.core.friend.command.DeleteFriend;
import mineplex.core.friend.data.FriendData; import mineplex.core.friend.data.FriendData;
import mineplex.core.friend.data.FriendRepository; import mineplex.core.friend.data.FriendRepository;
import mineplex.core.friend.data.FriendStatus; import mineplex.core.friend.data.FriendStatus;
import mineplex.core.portal.Portal;
import mineplex.core.preferences.PreferencesManager; import mineplex.core.preferences.PreferencesManager;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
public class FriendManager extends MiniDbClientPlugin<FriendData> public class FriendManager extends MiniDbClientPlugin<FriendData>
{ {
private static FriendSorter _friendSorter = new FriendSorter(); private static FriendSorter _friendSorter = new FriendSorter();
private PreferencesManager _preferenceManager;
private FriendRepository _repository;
public FriendManager(JavaPlugin plugin, CoreClientManager clientManager, PreferencesManager preferences)
{
super("Friends", plugin, clientManager);
_preferenceManager = preferences;
_repository = new FriendRepository(plugin);
}
@Override
public void AddCommands()
{
addCommand(new AddFriend(this));
addCommand(new DeleteFriend(this));
}
@Override
protected FriendData AddPlayer(String player)
{
return new FriendData();
}
@EventHandler private PreferencesManager _preferenceManager;
public void updateFriends(UpdateEvent event) private FriendRepository _repository;
{ private Portal _portal;
if (event.getType() != UpdateType.SLOW || Bukkit.getOnlinePlayers().size() == 0)
return;
final Player[] onlinePlayers = UtilServer.getPlayers();
Bukkit.getServer().getScheduler().runTaskAsynchronously(_plugin, new Runnable()
{
public void run()
{
final NautHashMap<String, FriendData> newData = _repository.getFriendsForAll(onlinePlayers);
Bukkit.getServer().getScheduler().runTask(_plugin, new Runnable()
{
public void run()
{
for (Player player : Bukkit.getOnlinePlayers())
{
if (newData.containsKey(player.getUniqueId().toString()))
{
Get(player).Friends = newData.get(player.getUniqueId().toString()).Friends;
}
else
{
Get(player).Friends.clear();
}
}
}
});
}
});
}
public void addFriend(final Player caller, final String name) public FriendManager(JavaPlugin plugin, CoreClientManager clientManager, PreferencesManager preferences, Portal portal)
{ {
boolean update = false; super("Friends", plugin, clientManager);
for (FriendStatus status : Get(caller).Friends)
{
if (status.Name.equalsIgnoreCase(name))
{
if (status.Status == FriendStatusType.Pending || status.Status == FriendStatusType.Blocked)
{
update = true;
break;
}
else if (status.Status == FriendStatusType.Denied)
{
caller.sendMessage(F.main(getName(), ChatColor.GREEN + name + ChatColor.GRAY + " has denied your friend request."));
return;
}
else if (status.Status == FriendStatusType.Accepted)
{
caller.sendMessage(F.main(getName(), "You are already friends with " + ChatColor.GREEN + name));
return;
}
else if (status.Status == FriendStatusType.Sent)
{
caller.sendMessage(F.main(getName(), ChatColor.GREEN + name + ChatColor.GRAY + " has yet to respond to your friend request."));
return;
}
}
}
final boolean updateFinal = update;
Bukkit.getServer().getScheduler().runTaskAsynchronously(GetPlugin(), new Runnable()
{
public void run()
{
if (updateFinal)
{
_repository.updateFriend(caller.getName(), name, "Accepted");
_repository.updateFriend(name, caller.getName(), "Accepted");
Bukkit.getServer().getScheduler().runTask(_plugin, new Runnable()
{
public void run()
{
for (Iterator<FriendStatus> statusIterator = Get(caller).Friends.iterator(); statusIterator.hasNext();)
{
FriendStatus status = statusIterator.next();
if (status.Name.equalsIgnoreCase(name))
{
status.Status = FriendStatusType.Accepted;
break;
}
}
}
});
}
else
{
_repository.addFriend(caller, name);
Bukkit.getServer().getScheduler().runTask(_plugin, new Runnable()
{
public void run()
{
for (Iterator<FriendStatus> statusIterator = Get(caller).Friends.iterator(); statusIterator.hasNext();)
{
FriendStatus status = statusIterator.next();
if (status.Name.equalsIgnoreCase(name))
{
status.Status = FriendStatusType.Sent;
break;
}
}
}
});
}
Bukkit.getServer().getScheduler().runTask(_plugin, new Runnable()
{
public void run()
{
if (updateFinal)
caller.sendMessage(F.main(getName(), "You and " + ChatColor.GREEN + name + ChatColor.GRAY + " are now friends!"));
else
caller.sendMessage(F.main(getName(), "Added " + ChatColor.GREEN + name + ChatColor.GRAY + " to your friends list!"));
}
});
}
});
}
public void removeFriend(final Player caller, final String name) _preferenceManager = preferences;
{ _repository = new FriendRepository(plugin);
Bukkit.getServer().getScheduler().runTaskAsynchronously(GetPlugin(), new Runnable() _portal = portal;
{ }
public void run()
{ public Portal getPortal()
_repository.removeFriend(caller.getName(), name); {
_repository.removeFriend(name, caller.getName()); return _portal;
}
Bukkit.getServer().getScheduler().runTask(_plugin, new Runnable()
{
public void run()
{
for (Iterator<FriendStatus> statusIterator = Get(caller).Friends.iterator(); statusIterator.hasNext();)
{
FriendStatus status = statusIterator.next();
if (status.Name.equalsIgnoreCase(name))
{
status.Status = FriendStatusType.Blocked;
break;
}
}
caller.sendMessage(F.main(getName(), "Deleted " + ChatColor.GREEN + name + ChatColor.GRAY + " from your friends list!"));
}
});
}
});
}
public void showFriends(Player caller) @Override
{ public void AddCommands()
boolean isStaff = ClientManager.Get(caller).GetRank().Has(Rank.HELPER); {
boolean gotAFriend = false; addCommand(new AddFriend(this));
List<FriendStatus> friendStatuses = Get(caller).Friends; addCommand(new DeleteFriend(this));
Collections.sort(friendStatuses, _friendSorter); }
caller.sendMessage(C.cAqua + C.Strike + "======================[" + ChatColor.RESET + C.cWhite + C.Bold + "Friends" + ChatColor.RESET + C.cAqua + C.Strike + "]======================");
ArrayList<ChildJsonMessage> sentLines = new ArrayList<ChildJsonMessage>();
ArrayList<ChildJsonMessage> pendingLines = new ArrayList<ChildJsonMessage>();
ArrayList<ChildJsonMessage> onlineLines = new ArrayList<ChildJsonMessage>();
ArrayList<ChildJsonMessage> offlineLines = new ArrayList<ChildJsonMessage>();
for (FriendStatus friend : friendStatuses)
{
if (friend.Status == FriendStatusType.Blocked || friend.Status == FriendStatusType.Denied)
continue;
if (!_preferenceManager.Get(caller).PendingFriendRequests && friend.Status == FriendStatusType.Pending)
continue;
gotAFriend = true;
ChildJsonMessage message = new JsonMessage("").color("white").extra("").color("white");
if (friend.Status == FriendStatusType.Accepted) @Override
{ protected FriendData AddPlayer(String player)
//Online Friend {
if (friend.Online) return new FriendData();
{ }
if (friend.ServerName.contains("STAFF") || friend.ServerName.contains("CUST"))
{
if (isStaff && friend.ServerName.contains("STAFF"))
message.add("Teleport").color("green").bold().click("run_command", "/server " + friend.ServerName).hover("show_text", "Teleport to " + friend.Name + "'s server.");
else
message.add("No Teleport").color("yellow").bold();
}
else
message.add("Teleport").color("green").bold().click("run_command", "/server " + friend.ServerName).hover("show_text", "Teleport to " + friend.Name + "'s server.");
message.add(" - ").color("white");
message.add("Delete").color("red").bold().click("run_command", "/unfriend " + friend.Name).hover("show_text", "Remove " + friend.Name + " from your friends list.");
message.add(" - ").color("white");
message.add(friend.Name).color(friend.Online ? "green" : "gray");
message.add(" - ").color("white");
if (friend.ServerName.contains("STAFF") || friend.ServerName.contains("CUST"))
{
if (isStaff && friend.ServerName.contains("STAFF"))
message.add(friend.ServerName).color("dark_green");
else
message.add("Private Staff Server").color("dark_green");
}
else
message.add(friend.ServerName).color("dark_green");
onlineLines.add(message);
}
//Offline Friend
else
{
message.add("Delete").color("red").bold().click("run_command", "/unfriend " + friend.Name).hover("show_text", "Remove " + friend.Name + " from your friends list.");
message.add(" - ").color("white");
message.add(friend.Name).color(friend.Online ? "green" : "gray");
message.add(" - ").color("white");
message.add("Offline for ").color("gray").add(UtilTime.MakeStr(friend.LastSeenOnline)).color("gray");
offlineLines.add(message);
}
}
//Pending
else if (friend.Status == FriendStatusType.Pending)
{
message.add("Accept").color("green").bold().click("run_command", "/friend " + friend.Name).hover("show_text", "Accept " + friend.Name + "'s friend request.");
message.add(" - ").color("white");
message.add("Deny").color("red").bold().click("run_command", "/unfriend " + friend.Name).hover("show_text", "Deny " + friend.Name + "'s friend request.");
message.add(" - ").color("white");
message.add(friend.Name + " Requested Friendship").color("gray");
pendingLines.add(message);
}
//Sent
else if (friend.Status == FriendStatusType.Sent)
{
message.add("Cancel").color("red").bold().click("run_command", "/unfriend " + friend.Name).hover("show_text", "Cancel friend request to " + friend.Name);
message.add(" - ").color("white");
message.add(friend.Name + " Friendship Request").color("gray");
sentLines.add(message);
}
}
//Send In Order
for (JsonMessage msg : sentLines)
msg.sendToPlayer(caller);
for (JsonMessage msg : offlineLines)
msg.sendToPlayer(caller);
for (JsonMessage msg : pendingLines)
msg.sendToPlayer(caller);
for (JsonMessage msg : onlineLines)
msg.sendToPlayer(caller);
if (!gotAFriend)
{
caller.sendMessage(" ");
caller.sendMessage("Welcome to your Friends List!");
caller.sendMessage(" ");
caller.sendMessage("To add friends, type " + C.cGreen + "/friend <Player Name>");
caller.sendMessage(" ");
caller.sendMessage("Type " + C.cGreen + "/friend" + ChatColor.RESET + " at any time to interact with your friends!");
caller.sendMessage(" ");
}
caller.sendMessage(C.cAqua + C.Strike + "=====================================================");
}
@Override @EventHandler
public void processLoginResultSet(String playerName, ResultSet resultSet) throws SQLException public void updateFriends(UpdateEvent event)
{ {
Set(playerName, _repository.loadClientInformation(resultSet)); if (event.getType() != UpdateType.SLOW || Bukkit.getOnlinePlayers().size() == 0)
} return;
@Override final Player[] onlinePlayers = UtilServer.getPlayers();
public String getQuery(String uuid, String name)
{ Bukkit.getServer().getScheduler().runTaskAsynchronously(_plugin, new Runnable()
return "SELECT tA.Name, status, serverName, tA.lastLogin, now() FROM accountFriend INNER Join accounts AS fA ON fA.uuid = uuidSource INNER JOIN accounts AS tA ON tA.uuid = uuidTarget LEFT JOIN playerMap ON tA.name = playerName WHERE uuidSource = '" + uuid + "';"; {
} public void run()
{
final NautHashMap<String, FriendData> newData = _repository.getFriendsForAll(onlinePlayers);
Bukkit.getServer().getScheduler().runTask(_plugin, new Runnable()
{
public void run()
{
for (Player player : Bukkit.getOnlinePlayers())
{
if (newData.containsKey(player.getUniqueId().toString()))
{
Get(player).setFriends(newData.get(player.getUniqueId().toString()).getFriends());
}
else
{
Get(player).getFriends().clear();
}
}
}
});
}
});
}
public void addFriend(final Player caller, final String name)
{
if (caller.getName().equalsIgnoreCase(name))
{
caller.sendMessage(F.main(getName(), ChatColor.GRAY
+ "You cannot add yourself as a friend"));
return;
}
boolean update = false;
for (FriendStatus status : Get(caller).getFriends())
{
if (status.Name.equalsIgnoreCase(name))
{
if (status.Status == FriendStatusType.Pending || status.Status == FriendStatusType.Blocked)
{
update = true;
break;
}
else if (status.Status == FriendStatusType.Denied)
{
caller.sendMessage(F.main(getName(), ChatColor.GREEN + name + ChatColor.GRAY
+ " has denied your friend request."));
return;
}
else if (status.Status == FriendStatusType.Accepted)
{
caller.sendMessage(F.main(getName(), "You are already friends with " + ChatColor.GREEN + name));
return;
}
else if (status.Status == FriendStatusType.Sent)
{
caller.sendMessage(F.main(getName(), ChatColor.GREEN + name + ChatColor.GRAY
+ " has yet to respond to your friend request."));
return;
}
}
}
final boolean updateFinal = update;
Bukkit.getServer().getScheduler().runTaskAsynchronously(GetPlugin(), new Runnable()
{
public void run()
{
if (updateFinal)
{
_repository.updateFriend(caller.getName(), name, "Accepted");
_repository.updateFriend(name, caller.getName(), "Accepted");
Bukkit.getServer().getScheduler().runTask(_plugin, new Runnable()
{
public void run()
{
for (Iterator<FriendStatus> statusIterator = Get(caller).getFriends().iterator(); statusIterator
.hasNext();)
{
FriendStatus status = statusIterator.next();
if (status.Name.equalsIgnoreCase(name))
{
status.Status = FriendStatusType.Accepted;
break;
}
}
}
});
}
else
{
_repository.addFriend(caller, name);
Bukkit.getServer().getScheduler().runTask(_plugin, new Runnable()
{
public void run()
{
for (Iterator<FriendStatus> statusIterator = Get(caller).getFriends().iterator(); statusIterator
.hasNext();)
{
FriendStatus status = statusIterator.next();
if (status.Name.equalsIgnoreCase(name))
{
status.Status = FriendStatusType.Sent;
break;
}
}
}
});
}
Bukkit.getServer().getScheduler().runTask(_plugin, new Runnable()
{
public void run()
{
if (updateFinal)
caller.sendMessage(F.main(getName(), "You and " + ChatColor.GREEN + name + ChatColor.GRAY
+ " are now friends!"));
else
caller.sendMessage(F.main(getName(), "Added " + ChatColor.GREEN + name + ChatColor.GRAY
+ " to your friends list!"));
}
});
}
});
}
public void removeFriend(final Player caller, final String name)
{
Bukkit.getServer().getScheduler().runTaskAsynchronously(GetPlugin(), new Runnable()
{
public void run()
{
_repository.removeFriend(caller.getName(), name);
_repository.removeFriend(name, caller.getName());
Bukkit.getServer().getScheduler().runTask(_plugin, new Runnable()
{
public void run()
{
for (Iterator<FriendStatus> statusIterator = Get(caller).getFriends().iterator(); statusIterator
.hasNext();)
{
FriendStatus status = statusIterator.next();
if (status.Name.equalsIgnoreCase(name))
{
status.Status = FriendStatusType.Blocked;
break;
}
}
caller.sendMessage(F.main(getName(), "Deleted " + ChatColor.GREEN + name + ChatColor.GRAY
+ " from your friends list!"));
}
});
}
});
}
@Deprecated
public void showFriends(Player caller)
{
boolean isStaff = ClientManager.Get(caller).GetRank().Has(Rank.HELPER);
boolean gotAFriend = false;
List<FriendStatus> friendStatuses = Get(caller).getFriends();
Collections.sort(friendStatuses, _friendSorter);
caller.sendMessage(C.cAqua + C.Strike + "======================[" + ChatColor.RESET + C.cWhite + C.Bold + "Friends"
+ ChatColor.RESET + C.cAqua + C.Strike + "]======================");
ArrayList<ChildJsonMessage> sentLines = new ArrayList<ChildJsonMessage>();
ArrayList<ChildJsonMessage> pendingLines = new ArrayList<ChildJsonMessage>();
ArrayList<ChildJsonMessage> onlineLines = new ArrayList<ChildJsonMessage>();
ArrayList<ChildJsonMessage> offlineLines = new ArrayList<ChildJsonMessage>();
for (FriendStatus friend : friendStatuses)
{
if (friend.Status == FriendStatusType.Blocked || friend.Status == FriendStatusType.Denied)
continue;
if (!_preferenceManager.Get(caller).PendingFriendRequests && friend.Status == FriendStatusType.Pending)
continue;
gotAFriend = true;
ChildJsonMessage message = new JsonMessage("").color("white").extra("").color("white");
if (friend.Status == FriendStatusType.Accepted)
{
// Online Friend
if (friend.Online)
{
if (friend.ServerName.contains("STAFF") || friend.ServerName.contains("CUST"))
{
if (isStaff && friend.ServerName.contains("STAFF"))
message.add("Teleport").color("green").bold().click("run_command", "/server " + friend.ServerName)
.hover("show_text", "Teleport to " + friend.Name + "'s server.");
else
message.add("No Teleport").color("yellow").bold();
}
else
message.add("Teleport").color("green").bold().click("run_command", "/server " + friend.ServerName)
.hover("show_text", "Teleport to " + friend.Name + "'s server.");
message.add(" - ").color("white");
message.add("Delete").color("red").bold().click("run_command", "/unfriend " + friend.Name)
.hover("show_text", "Remove " + friend.Name + " from your friends list.");
message.add(" - ").color("white");
message.add(friend.Name).color(friend.Online ? "green" : "gray");
message.add(" - ").color("white");
if (friend.ServerName.contains("STAFF") || friend.ServerName.contains("CUST"))
{
if (isStaff && friend.ServerName.contains("STAFF"))
message.add(friend.ServerName).color("dark_green");
else
message.add("Private Staff Server").color("dark_green");
}
else
message.add(friend.ServerName).color("dark_green");
onlineLines.add(message);
}
// Offline Friend
else
{
message.add("Delete").color("red").bold().click("run_command", "/unfriend " + friend.Name)
.hover("show_text", "Remove " + friend.Name + " from your friends list.");
message.add(" - ").color("white");
message.add(friend.Name).color(friend.Online ? "green" : "gray");
message.add(" - ").color("white");
message.add("Offline for ").color("gray").add(UtilTime.MakeStr(friend.LastSeenOnline)).color("gray");
offlineLines.add(message);
}
}
// Pending
else if (friend.Status == FriendStatusType.Pending)
{
message.add("Accept").color("green").bold().click("run_command", "/friend " + friend.Name)
.hover("show_text", "Accept " + friend.Name + "'s friend request.");
message.add(" - ").color("white");
message.add("Deny").color("red").bold().click("run_command", "/unfriend " + friend.Name)
.hover("show_text", "Deny " + friend.Name + "'s friend request.");
message.add(" - ").color("white");
message.add(friend.Name + " Requested Friendship").color("gray");
pendingLines.add(message);
}
// Sent
else if (friend.Status == FriendStatusType.Sent)
{
message.add("Cancel").color("red").bold().click("run_command", "/unfriend " + friend.Name)
.hover("show_text", "Cancel friend request to " + friend.Name);
message.add(" - ").color("white");
message.add(friend.Name + " Friendship Request").color("gray");
sentLines.add(message);
}
}
// Send In Order
for (JsonMessage msg : sentLines)
msg.sendToPlayer(caller);
for (JsonMessage msg : offlineLines)
msg.sendToPlayer(caller);
for (JsonMessage msg : pendingLines)
msg.sendToPlayer(caller);
for (JsonMessage msg : onlineLines)
msg.sendToPlayer(caller);
if (!gotAFriend)
{
caller.sendMessage(" ");
caller.sendMessage("Welcome to your Friends List!");
caller.sendMessage(" ");
caller.sendMessage("To add friends, type " + C.cGreen + "/friend <Player Name>");
caller.sendMessage(" ");
caller.sendMessage("Type " + C.cGreen + "/friend" + ChatColor.RESET + " at any time to interact with your friends!");
caller.sendMessage(" ");
}
caller.sendMessage(C.cAqua + C.Strike + "=====================================================");
}
@Override
public void processLoginResultSet(String playerName, ResultSet resultSet) throws SQLException
{
Set(playerName, _repository.loadClientInformation(resultSet));
}
@Override
public String getQuery(String uuid, String name)
{
return "SELECT tA.Name, status, serverName, tA.lastLogin, now() FROM accountFriend INNER Join accounts AS fA ON fA.uuid = uuidSource INNER JOIN accounts AS tA ON tA.uuid = uuidTarget LEFT JOIN playerMap ON tA.name = playerName WHERE uuidSource = '"
+ uuid + "';";
}
} }

View File

@ -5,35 +5,35 @@ import org.bukkit.entity.Player;
import mineplex.core.command.CommandBase; import mineplex.core.command.CommandBase;
import mineplex.core.common.Rank; import mineplex.core.common.Rank;
import mineplex.core.common.util.Callback; import mineplex.core.common.util.Callback;
import mineplex.core.common.util.F;
import mineplex.core.friend.FriendManager; import mineplex.core.friend.FriendManager;
import mineplex.core.friend.ui.FriendsGUI;
public class AddFriend extends CommandBase<FriendManager> public class AddFriend extends CommandBase<FriendManager>
{ {
public AddFriend(FriendManager plugin) public AddFriend(FriendManager plugin)
{ {
super(plugin, Rank.ALL, "friend", "f"); super(plugin, Rank.ALL, "friends", "friend", "f");
} }
@Override @Override
public void Execute(final Player caller, final String[] args) public void Execute(final Player caller, final String[] args)
{ {
if (args == null) if (args == null)
{ {
Plugin.showFriends(caller); new FriendsGUI(Plugin, caller);
} }
else else
{ {
CommandCenter.GetClientManager().checkPlayerName(caller, args[0], new Callback<String>() CommandCenter.GetClientManager().checkPlayerName(caller, args[0], new Callback<String>()
{ {
public void run(String result) public void run(String result)
{ {
if (result != null) if (result != null)
{ {
Plugin.addFriend(caller, result); Plugin.addFriend(caller, result);
} }
} }
}); });
} }
} }
} }

View File

@ -1,9 +1,39 @@
package mineplex.core.friend.data; package mineplex.core.friend.data;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import mineplex.core.friend.ui.FriendsGUI;
public class FriendData public class FriendData
{ {
public List<FriendStatus> Friends = new ArrayList<FriendStatus>(); private ArrayList<FriendStatus> _friends = new ArrayList<FriendStatus>();
private FriendsGUI _friendsPage;
public ArrayList<FriendStatus> getFriends()
{
return _friends;
}
public void setFriends(ArrayList<FriendStatus> newFriends)
{
_friends = newFriends;
updateGui();
}
private void updateGui()
{
if (_friendsPage != null)
{
_friendsPage.updateGui();
}
}
public void setGui(FriendsGUI friendsPage)
{
_friendsPage = friendsPage;
}
public FriendsGUI getGui()
{
return _friendsPage;
}
} }

View File

@ -95,7 +95,7 @@ public class FriendRepository extends RepositoryBase
if (!friends.containsKey(uuidSource)) if (!friends.containsKey(uuidSource))
friends.put(uuidSource, new FriendData()); friends.put(uuidSource, new FriendData());
friends.get(uuidSource).Friends.add(friend); friends.get(uuidSource).getFriends().add(friend);
} }
} }
}); });
@ -116,7 +116,7 @@ public class FriendRepository extends RepositoryBase
friend.ServerName = resultSet.getString(3); friend.ServerName = resultSet.getString(3);
friend.LastSeenOnline = resultSet.getTimestamp(5).getTime() - resultSet.getTimestamp(4).getTime(); friend.LastSeenOnline = resultSet.getTimestamp(5).getTime() - resultSet.getTimestamp(4).getTime();
friendData.Friends.add(friend); friendData.getFriends().add(friend);
} }
return friendData; return friendData;

View File

@ -4,9 +4,12 @@ import mineplex.core.friend.FriendStatusType;
public class FriendStatus public class FriendStatus
{ {
public String Name; public String Name;
public String ServerName; public String ServerName;
public boolean Online; public boolean Online;
public long LastSeenOnline; /**
public FriendStatusType Status; * This seems like it should be unmodified without current time subtracted when set
*/
public long LastSeenOnline;
public FriendStatusType Status;
} }

View File

@ -0,0 +1,186 @@
package mineplex.core.friend.ui;
import mineplex.core.command.CommandCenter;
import mineplex.core.common.util.Callback;
import mineplex.core.friend.FriendManager;
import mineplex.core.itemstack.ItemBuilder;
import net.minecraft.server.v1_7_R4.ContainerAnvil;
import net.minecraft.server.v1_7_R4.EntityHuman;
import net.minecraft.server.v1_7_R4.EntityPlayer;
import net.minecraft.server.v1_7_R4.PacketPlayOutOpenWindow;
import org.apache.commons.lang.StringUtils;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.HandlerList;
import org.bukkit.event.Listener;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.inventory.InventoryCloseEvent;
import org.bukkit.inventory.Inventory;
public class AddFriendPage implements Listener
{
private class AnvilContainer extends ContainerAnvil
{
private String n;
public AnvilContainer(EntityHuman entity)
{
super(entity.inventory, entity.world, 0, 0, 0, entity);
}
@Override
public boolean a(EntityHuman entityhuman)
{
return true;
}
@Override
public void a(String origString)
{
n = origString;
_itemName = origString;
/* if (!Objects.equal(origString, itemName))
{
ItemBuilder builder = new ItemBuilder(Material.PAPER);
ItemStack item = currentInventory.getItem(2);
if (item != null && item.getType() != Material.AIR)
{
builder = new ItemBuilder(item);
}
builder.setRawTitle(origString);
itemName = origString;
currentInventory.setItem(2, builder.build());
}*/
if (getSlot(2).hasItem())
{
net.minecraft.server.v1_7_R4.ItemStack itemstack = getSlot(2).getItem();
if (StringUtils.isBlank(origString))
itemstack.t();
else
{
itemstack.c(this.n);
}
}
e();
}
}
private FriendManager _friends;
private Player _player;
private Inventory _currentInventory;
private String _itemName = "";
private boolean _searching;
public AddFriendPage(FriendManager friends, Player player)
{
_player = player;
_friends = friends;
openInventory();
friends.RegisterEvents(this);
}
@EventHandler
public void onInventoryClose(InventoryCloseEvent event)
{
if (event.getPlayer() == _player)
{
unregisterListener();
}
}
public void unregisterListener()
{
_currentInventory.clear();
HandlerList.unregisterAll(this);
}
@EventHandler
public void onInventoryClick(InventoryClickEvent event)
{
if (event.getRawSlot() < 3)
{
event.setCancelled(true);
if (event.getRawSlot() == 2)
{
if (_itemName.length() > 1 && !_searching)
{
_searching = true;
CommandCenter.Instance.GetClientManager().checkPlayerName(_player, _itemName, new Callback<String>()
{
public void run(String result)
{
_searching = false;
if (result != null)
{
_friends.addFriend(_player, result);
_player.playSound(_player.getLocation(), Sound.NOTE_PLING, 1, 1.6f);
unregisterListener();
new FriendsGUI(_friends, _player);
}
else
{
// _player.sendMessage(C.Bold + "Player not found");
_player.playSound(_player.getLocation(), Sound.ITEM_BREAK, 1, .6f);
}
}
});
}
else
{
_player.playSound(_player.getLocation(), Sound.ITEM_BREAK, 1, .6f);
}
}
}
else if (event.isShiftClick())
{
event.setCancelled(true);
}
}
public void openInventory()
{
_player.closeInventory();
EntityPlayer p = ((CraftPlayer) _player).getHandle();
AnvilContainer container = new AnvilContainer(p);
int c = p.nextContainerCounter();
PacketPlayOutOpenWindow packet = new PacketPlayOutOpenWindow(c, 8, "Repairing", 0, true);
p.playerConnection.sendPacket(packet);
// Set their active container to the container
p.activeContainer = container;
// Set their active container window id to that counter stuff
p.activeContainer.windowId = c;
// Add the slot listener
p.activeContainer.addSlotListener(p); // Set the items to the items from the inventory given
_currentInventory = container.getBukkitView().getTopInventory();
_currentInventory.setItem(0, new ItemBuilder(Material.PAPER).setRawTitle("Friend's Name").build());
_currentInventory.setItem(2, new ItemBuilder(Material.PAPER).setRawTitle("Search").build());
}
}

View File

@ -0,0 +1,36 @@
package mineplex.core.friend.ui;
import mineplex.core.itemstack.ItemBuilder;
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
public enum FriendPage
{
FRIENDS(new ItemBuilder(Material.SKULL_ITEM, 1, (short) 3).setTitle("Friends").build(), "Friends"),
FRIEND_REQUESTS(new ItemBuilder(Material.RED_ROSE).setTitle("Friend Requests").build(), "Friend Requests"),
DELETE_FRIENDS(new ItemBuilder(Material.TNT).setTitle("Delete Friends").build(), "Delete Friends"),
SEND_REQUEST(new ItemBuilder(Material.BOOK_AND_QUILL).setTitle("Send Friend Request").build(), "Send Friend Request");
private ItemStack _icon;
private String _name;
private FriendPage(ItemStack item, String name)
{
_icon = item;
_name = name;
}
public String getName()
{
return _name;
}
public ItemStack getIcon()
{
return _icon;
}
}

View File

@ -0,0 +1,551 @@
package mineplex.core.friend.ui;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Iterator;
import mineplex.core.command.CommandCenter;
import mineplex.core.common.util.C;
import mineplex.core.common.util.NautHashMap;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilTime;
import mineplex.core.friend.FriendManager;
import mineplex.core.friend.FriendStatusType;
import mineplex.core.friend.data.FriendData;
import mineplex.core.friend.data.FriendStatus;
import mineplex.core.itemstack.ItemBuilder;
import mineplex.core.itemstack.ItemLayout;
import mineplex.core.shop.item.IButton;
import net.minecraft.server.v1_7_R4.EntityPlayer;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
import org.bukkit.craftbukkit.v1_7_R4.event.CraftEventFactory;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.HandlerList;
import org.bukkit.event.Listener;
import org.bukkit.event.inventory.ClickType;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.inventory.InventoryCloseEvent;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
public class FriendsGUI implements Listener
{
private NautHashMap<Integer, IButton> _buttonMap = new NautHashMap<Integer, IButton>();
private FriendPage _currentPage = FriendPage.FRIENDS;
private FriendPage _previousPage;
private Player _player;
private FriendManager _plugin;
private Inventory _inventory;
private int _page;
private Comparator<FriendStatus> _friendCompare = new Comparator<FriendStatus>()
{
@Override
public int compare(FriendStatus o1, FriendStatus o2)
{
if (o1.Online == o2.Online)
{
return o1.Name.compareToIgnoreCase(o2.Name);
}
if (o1.Online)
{
return -1;
}
return 1;
}
};
public FriendsGUI(FriendManager plugin, Player player)
{
_plugin = plugin;
_player = player;
buildPage();
_plugin.RegisterEvents(this);
getFriendData().setGui(this);
}
private void AddButton(int slot, ItemStack item, IButton button)
{
_inventory.setItem(slot, item);
_buttonMap.put(slot, button);
}
public void buildDeleteFriends()
{
ArrayList<FriendStatus> friends = new ArrayList<FriendStatus>();
for (FriendStatus friend : getFriendData().getFriends())
{
if (friend.Status == FriendStatusType.Accepted)
{
friends.add(friend);
}
}
Collections.sort(friends, _friendCompare);
boolean pages = this.addPages(friends.size(), new Runnable()
{
public void run()
{
buildDeleteFriends();
}
});
for (int i = 0; i < (pages ? 27 : 36); i++)
{
int friendSlot = (_page * 27) + i;
int slot = i + 18;
if (friendSlot >= friends.size())
{
break;
}
FriendStatus friend = friends.get(friendSlot);
ItemBuilder builder = new ItemBuilder(Material.SKULL_ITEM, 1, (short) (friend.Online ? 3 : 0));
builder.setTitle(C.cWhite + C.Bold + friend.Name);
builder.addLore(C.cGray + C.Bold + "Status: " + (friend.Online ? C.cDGreen + "Online" : C.cRed + "Offline"));
if (friend.Online)
{
builder.addLore(C.cDGray + C.Bold + "Server: " + C.cGray + friend.ServerName);
}
else
{
builder.addLore(C.cGray + "Last seen " + UtilTime.MakeStr(friend.LastSeenOnline) + " ago");
}
builder.addLore("");
builder.addLore(C.cGray + "Left click to delete from friends");
final String name = friend.Name;
AddButton(slot, builder.build(), new IButton()
{
@Override
public void onClick(Player player, ClickType clickType)
{
if (clickType.isLeftClick())
{
CommandCenter.Instance.OnPlayerCommandPreprocess(new PlayerCommandPreprocessEvent(player, "/unfriend "
+ name));
}
}
});
}
}
private boolean addPages(int amount, final Runnable runnable)
{
if (amount > 36)
{
if (_page > 0)
{
AddButton(45, new ItemBuilder(Material.SIGN).setTitle("Previous Page").build(), new IButton()
{
@Override
public void onClick(Player player, ClickType clickType)
{
Iterator<Integer> itel = _buttonMap.keySet().iterator();
while (itel.hasNext())
{
int slot = itel.next();
if (slot > 8)
{
itel.remove();
_inventory.setItem(slot, new ItemStack(Material.AIR));
}
}
_page -= 1;
runnable.run();
}
});
}
if (amount > (_page + 1) * 27)
{
AddButton(53, new ItemBuilder(Material.SIGN).setTitle("Next Page").build(), new IButton()
{
@Override
public void onClick(Player player, ClickType clickType)
{
Iterator<Integer> itel = _buttonMap.keySet().iterator();
while (itel.hasNext())
{
int slot = itel.next();
if (slot > 8)
{
itel.remove();
_inventory.setItem(slot, new ItemStack(Material.AIR));
}
}
_page += 1;
runnable.run();
}
});
}
return true;
}
return false;
}
private void buildFriends()
{
ArrayList<FriendStatus> friends = new ArrayList<FriendStatus>();
for (FriendStatus friend : getFriendData().getFriends())
{
if (friend.Status == FriendStatusType.Accepted)
{
friends.add(friend);
}
}
Collections.sort(friends, _friendCompare);
boolean pages = addPages(friends.size(), new Runnable()
{
@Override
public void run()
{
buildFriends();
}
});
for (int i = 0; i < (pages ? 27 : 36); i++)
{
int friendSlot = (_page * 27) + i;
int slot = i + 18;
if (friendSlot >= friends.size())
{
break;
}
FriendStatus friend = friends.get(friendSlot);
ItemBuilder builder = new ItemBuilder(Material.SKULL_ITEM, 1, (short) (friend.Online ? 3 : 0));
builder.setTitle(C.cWhite + C.Bold + friend.Name);
builder.addLore(C.cGray + C.Bold + "Status: " + (friend.Online ? C.cDGreen + "Online" : C.cRed + "Offline"));
if (friend.Online)
{
builder.addLore(C.cDGray + C.Bold + "Server: " + C.cGray + friend.ServerName);
}
else
{
builder.addLore(C.cGray + "Last seen " + UtilTime.MakeStr(friend.LastSeenOnline) + " ago");
}
if (friend.Online)
{
builder.addLore("");
builder.addLore(C.cGray + "Left click to teleport to their server");
final String serverName = friend.ServerName;
AddButton(slot, builder.build(), new IButton()
{
@Override
public void onClick(Player player, ClickType clickType)
{
_plugin.getPortal().sendPlayerToServer(player, serverName);
}
});
}
else
{
_inventory.setItem(slot, builder.build());
}
}
}
public void updateGui()
{
if (_currentPage == FriendPage.FRIENDS)
{
buildFriends();
}
else if (_currentPage == FriendPage.FRIEND_REQUESTS)
{
buildRequests();
}
else if (_currentPage == FriendPage.DELETE_FRIENDS)
{
buildDeleteFriends();
}
}
private void buildPage()
{
if (_currentPage != _previousPage)
{
_inventory = Bukkit.createInventory(null, 54, _currentPage.getName());
}
else
{
_inventory.setItem(53, new ItemStack(Material.AIR));
_inventory.setItem(45, new ItemStack(Material.AIR));
}
_page = 0;
_buttonMap.clear();
ArrayList<Integer> itemSlots = new ItemLayout("XOXOXOXOX").getItemSlots();
for (int i = 0; i < FriendPage.values().length; i++)
{
final FriendPage page = FriendPage.values()[i];
ItemStack icon = page == _currentPage ?
new ItemBuilder(page.getIcon()).addEnchantment(UtilInv.getDullEnchantment(), 1).build()
:
page.getIcon();
this.AddButton(itemSlots.get(i), icon, new IButton()
{
@Override
public void onClick(Player player, ClickType clickType)
{
if (_currentPage != page || _page != 0)
{
_currentPage = page;
buildPage();
}
}
});
}
if (_currentPage == FriendPage.FRIENDS)
{
buildFriends();
}
else if (_currentPage == FriendPage.FRIEND_REQUESTS)
{
buildRequests();
}
else if (_currentPage == FriendPage.DELETE_FRIENDS)
{
buildDeleteFriends();
}
else if (_currentPage == FriendPage.SEND_REQUEST)
{
unregisterListener();
new AddFriendPage(_plugin, _player);
return;
}
if (_previousPage != _currentPage)
{
_previousPage = _currentPage;
EntityPlayer nmsPlayer = ((CraftPlayer) _player).getHandle();
if (nmsPlayer.activeContainer != nmsPlayer.defaultContainer)
{
// Do this so that other inventories know their time is over.
CraftEventFactory.handleInventoryCloseEvent(nmsPlayer);
nmsPlayer.m();
}
_player.openInventory(_inventory);
}
}
private void buildRequests()
{
ArrayList<FriendStatus> friends = new ArrayList<FriendStatus>();
for (FriendStatus friend : getFriendData().getFriends())
{
if (friend.Status == FriendStatusType.Sent || friend.Status == FriendStatusType.Pending)
{
friends.add(friend);
}
}
Collections.sort(friends, new Comparator<FriendStatus>()
{
@Override
public int compare(FriendStatus o1, FriendStatus o2)
{
if (o1.Status == o2.Status)
{
return o1.Name.compareToIgnoreCase(o2.Name);
}
if (o1.Status == FriendStatusType.Sent)
{
return -1;
}
return 1;
}
});
boolean pages = addPages(friends.size(), new Runnable()
{
@Override
public void run()
{
buildRequests();
}
});
for (int i = 0; i < (pages ? 27 : 36); i++)
{
int friendSlot = (_page * 27) + i;
final int slot = i + 18;
if (friendSlot >= friends.size())
{
break;
}
FriendStatus friend = friends.get(friendSlot);
ItemBuilder builder;
final boolean isSender = friend.Status == FriendStatusType.Sent;
if (isSender)
{
builder = new ItemBuilder(Material.ENDER_PEARL);
builder.setTitle(C.cGray + "Friend request to " + C.cWhite + C.Bold + friend.Name);
}
else
{
builder = new ItemBuilder(Material.PAPER);
builder.setTitle(C.cGray + "Friend request from " + C.cWhite + C.Bold + friend.Name);
}
builder.addLore("");
builder.addLore(C.cGray + (isSender ? "C" : "Left c") + "lick to " + (isSender ? "cancel" : "accept")
+ " friend request");
if (!isSender)
{
builder.addLore(C.cGray + "Right click to refuse friend request");
}
final String name = friend.Name;
AddButton(slot, builder.build(), new IButton()
{
@Override
public void onClick(Player player, ClickType clickType)
{
if (isSender || clickType.isRightClick())
{
CommandCenter.Instance.OnPlayerCommandPreprocess(new PlayerCommandPreprocessEvent(player, "/unfriend "
+ name));
_inventory.setItem(slot, new ItemStack(Material.AIR));
_buttonMap.remove(slot);
}
else if (!isSender && clickType.isLeftClick())
{
CommandCenter.Instance.OnPlayerCommandPreprocess(new PlayerCommandPreprocessEvent(player, "/friend "
+ name));
_inventory.setItem(slot, new ItemStack(Material.AIR));
_buttonMap.remove(slot);
}
}
});
}
}
private FriendData getFriendData()
{
return _plugin.Get(_player);
}
@EventHandler
public void OnInventoryClick(InventoryClickEvent event)
{
if (_inventory.getTitle().equals(event.getInventory().getTitle()) && event.getWhoClicked() == _player)
{
if (_buttonMap.containsKey(event.getRawSlot()))
{
if (event.getWhoClicked() instanceof Player)
{
IButton button = _buttonMap.get(event.getRawSlot());
button.onClick(((Player) event.getWhoClicked()), event.getClick());
_player.playSound(_player.getLocation(), Sound.NOTE_PLING, 1, 1.6f);
}
}
else
{
_player.playSound(_player.getLocation(), Sound.ITEM_BREAK, 1, .6f);
}
event.setCancelled(true);
}
}
@EventHandler
public void OnInventoryClose(InventoryCloseEvent event)
{
if (_inventory.getTitle().equals(event.getInventory().getTitle()) && event.getPlayer() == _player)
{
unregisterListener();
}
}
private void unregisterListener()
{
FriendData data = getFriendData();
if (data != null && data.getGui() == this)
{
data.setGui(null);
}
HandlerList.unregisterAll(this);
}
}

View File

@ -37,6 +37,11 @@ public class ItemLayout
} }
} }
public ArrayList<Integer> getItemSlots()
{
return _size;
}
public ItemStack[] generate(ArrayList<ItemStack> items) public ItemStack[] generate(ArrayList<ItemStack> items)
{ {
return generate(items.toArray(new ItemStack[0])); return generate(items.toArray(new ItemStack[0]));
@ -50,8 +55,10 @@ public class ItemLayout
public ItemStack[] generate(boolean doRepeats, ItemStack... items) public ItemStack[] generate(boolean doRepeats, ItemStack... items)
{ {
ItemStack[] itemArray = new ItemStack[_invSize]; ItemStack[] itemArray = new ItemStack[_invSize];
if (items.length == 0) if (items.length == 0)
return itemArray; return itemArray;
int i = 0; int i = 0;
for (int slot : _size) for (int slot : _size)
{ {
@ -62,6 +69,7 @@ public class ItemLayout
else else
break; break;
} }
itemArray[slot] = items[i]; itemArray[slot] = items[i];
} }

View File

@ -6,7 +6,6 @@ import java.util.LinkedList;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.PlayerDeathEvent; import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import mineplex.core.MiniPlugin; import mineplex.core.MiniPlugin;
@ -204,6 +203,17 @@ public class Recharge extends MiniPlugin
_recharge.get(player.getName()).get(ability).DisplayForce = displayForce; _recharge.get(player.getName()).get(ability).DisplayForce = displayForce;
} }
public void setCountdown(Player player, String ability, boolean countdown)
{
if (!_recharge.containsKey(player.getName()))
return;
if (!_recharge.get(player.getName()).containsKey(ability))
return;
_recharge.get(player.getName()).get(ability).Countdown = countdown;
}
public void Reset(Player player) public void Reset(Player player)
{ {
_recharge.put(player.getName(), new NautHashMap<String, RechargeData>()); _recharge.put(player.getName(), new NautHashMap<String, RechargeData>());

View File

@ -30,6 +30,7 @@ public class RechargeData
public ItemStack Item; public ItemStack Item;
public boolean DisplayForce = false; public boolean DisplayForce = false;
public boolean Countdown = false; //This will make the output a countdown, instead of a recharge.
public boolean AttachItem; public boolean AttachItem;
public boolean AttachDurability; public boolean AttachDurability;
@ -62,11 +63,15 @@ public class RechargeData
{ {
if (!UtilTime.elapsed(Time, Recharge)) if (!UtilTime.elapsed(Time, Recharge))
{ {
UtilTextBottom.displayProgress(C.Bold + Name, percent, UtilTime.MakeStr(Recharge - (System.currentTimeMillis() - Time)), Player); UtilTextBottom.displayProgress(C.Bold + Name, percent, UtilTime.MakeStr(Recharge - (System.currentTimeMillis() - Time)), Countdown, Player);
} }
else else
{ {
UtilTextBottom.display(C.cGreen + C.Bold + Name + " Recharged", Player);
if (!Countdown)
UtilTextBottom.display(C.cGreen + C.Bold + Name + " Recharged", Player);
else
UtilTextBottom.display(C.cRed + C.Bold + Name + " Ended", Player);
//PLING! //PLING!
if (Recharge > 4000) if (Recharge > 4000)

View File

@ -279,7 +279,7 @@ public class RewardManager
treasureList.add(reward); treasureList.add(reward);
} }
public Reward[] getRewards(Player player, boolean isChestOpening) public Reward[] getRewards(Player player, RewardType type)
{ {
int currentReward = 0; int currentReward = 0;
Reward[] rewards = new Reward[4]; Reward[] rewards = new Reward[4];
@ -287,7 +287,7 @@ public class RewardManager
while (currentReward < 4) while (currentReward < 4)
{ {
Reward reward = nextReward(player, rewards, currentReward == 3 && !hasUncommon, isChestOpening); Reward reward = nextReward(player, rewards, currentReward == 3 && !hasUncommon, type);
if (reward == null) if (reward == null)
{ {
@ -321,32 +321,10 @@ public class RewardManager
// return nextReward(player, excludedRewards, false, isChestOpening); // return nextReward(player, excludedRewards, false, isChestOpening);
// } // }
public Reward nextReward(Player player, Reward[] excludedRewards, boolean requiresUncommon, boolean isChestOpening) public Reward nextReward(Player player, Reward[] excludedRewards, boolean requiresUncommon, RewardType type)
{ {
double rand = _random.nextDouble(); RewardRarity rarity = type.generateRarity(requiresUncommon);
RewardRarity rarity;
if (isChestOpening ? rand <= 0.01 : rand <= 0.0001)
{
// 1% or 0.01%
rarity = RewardRarity.LEGENDARY;
}
else if (isChestOpening ? rand <= 0.05 : rand <= 0.001)
{
// 4% or 0.09%
rarity = RewardRarity.RARE;
}
else if ((isChestOpening ? rand <= 0.3 : rand <= 0.03) || requiresUncommon)
{
// 25% or 2.9%
rarity = RewardRarity.UNCOMMON;
}
else
{
// 70% or 97%
rarity = RewardRarity.COMMON;
}
List<Reward> treasureList = _treasureMap.get(rarity); List<Reward> treasureList = _treasureMap.get(rarity);
int totalWeight = 0; int totalWeight = 0;

View File

@ -14,7 +14,12 @@ public enum RewardRarity
* (Fireworks, sounds, etc) * (Fireworks, sounds, etc)
*/ */
OTHER("Other", cWhite), COMMON("Common", cAqua), UNCOMMON("Uncommon", cGreen), RARE("Rare", cGold), LEGENDARY("Legendary", cRed); OTHER("Other", cWhite),
COMMON("Common", cAqua),
UNCOMMON("Uncommon", cGreen),
RARE("Rare", cGold),
LEGENDARY("Legendary", cRed),
MYTHICAL("Mythical", C.cBlack);
private String _name; private String _name;
private String _color; private String _color;

View File

@ -0,0 +1,37 @@
package mineplex.core.reward;
public enum RewardType
{
//% Chances Mythic Legend Rare Uncommon
GameLoot( 0.000001, 0.001, 0.004, 3),
BasicChest( 0, 0.01, 0.04, 5),
HeroicChest( 0, 1, 4, 25),
LegendaryChest( 1, 2, 8, 40);
private double _mythicalChance;
private double _legendaryChance;
private double _rareChance;
private double _uncommonChance;
RewardType(double mythical, double legend, double rare, double uncommon)
{
_mythicalChance = (mythical / 100d);
_legendaryChance = _mythicalChance + (legend / 100d); //Add previous chance to prep for generateRarity random values.
_rareChance = _legendaryChance + (rare / 100d);
_uncommonChance = _rareChance + (uncommon / 100d);
}
public RewardRarity generateRarity(boolean requiresUncommon)
{
double rand = Math.random();
RewardRarity rarity = RewardRarity.COMMON;
if (rand <= _mythicalChance) rarity = RewardRarity.MYTHICAL;
else if (rand <= _legendaryChance) rarity = RewardRarity.LEGENDARY;
else if (rand <= _rareChance) rarity = RewardRarity.RARE;
else if (rand <= _uncommonChance || requiresUncommon) rarity = RewardRarity.UNCOMMON;
return rarity;
}
}

View File

@ -1,13 +0,0 @@
package mineplex.core.scoreboard;
import org.bukkit.plugin.java.JavaPlugin;
import mineplex.core.MiniPlugin;
public class EasyScoreboard extends MiniPlugin
{
public EasyScoreboard(JavaPlugin plugin)
{
super("EasyScoreboard", plugin);
}
}

View File

@ -0,0 +1,195 @@
package mineplex.core.scoreboard;
import java.util.ArrayList;
import mineplex.core.common.Rank;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilMath;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.bukkit.scoreboard.DisplaySlot;
import org.bukkit.scoreboard.Objective;
import org.bukkit.scoreboard.Scoreboard;
import org.bukkit.scoreboard.Team;
public class PlayerScoreboard
{
private ScoreboardManager _manager;
private String _scoreboardData = "default";
private Scoreboard _scoreboard;
private Objective _sideObjective;
private ArrayList<String> _currentLines = new ArrayList<String>();
private String[] _teamNames;
public PlayerScoreboard(ScoreboardManager manager, Player player)
{
_manager = manager;
}
private void addTeams(Player player)
{
for (Rank rank : Rank.values())
{
if (rank != Rank.ALL)
_scoreboard.registerNewTeam(rank.Name).setPrefix(rank.GetTag(true, true) + ChatColor.RESET + " ");
else
_scoreboard.registerNewTeam(rank.Name).setPrefix("");
}
_scoreboard.registerNewTeam("Party").setPrefix(ChatColor.LIGHT_PURPLE + C.Bold + "Party" + ChatColor.RESET + " ");
for (Player otherPlayer : Bukkit.getOnlinePlayers())
{
if (_manager.getClients().Get(otherPlayer) == null)
continue;
String rankName = _manager.getClients().Get(player).GetRank().Name;
String otherRankName = _manager.getClients().Get(otherPlayer).GetRank().Name;
if (!_manager.getClients().Get(player).GetRank().Has(Rank.ULTRA) && _manager.getDonation().Get(player.getName()).OwnsUltraPackage())
{
rankName = Rank.ULTRA.Name;
}
if (!_manager.getClients().Get(otherPlayer).GetRank().Has(Rank.ULTRA) && _manager.getDonation().Get(otherPlayer.getName()).OwnsUltraPackage())
{
otherRankName = Rank.ULTRA.Name;
}
//Add Other to Self
_scoreboard.getTeam(otherRankName).addPlayer(otherPlayer);
//Add Self to Other
otherPlayer.getScoreboard().getTeam(rankName).addPlayer(player);
}
}
private ScoreboardData getData()
{
ScoreboardData data = _manager.getData(_scoreboardData, false);
if (data != null)
return data;
//Revert to default
_scoreboardData = "default";
return _manager.getData(_scoreboardData, false);
}
public void draw(ScoreboardManager manager, Player player)
{
ScoreboardData data = getData();
if (data == null)
return;
for (int i=0 ; i<data.getLines(manager, player).size() ; i++)
{
//Get New Line
String newLine = data.getLines(manager, player).get(i);
//Check if Unchanged
if (_currentLines.size() > i)
{
String oldLine = _currentLines.get(i);
if (oldLine.equals(newLine))
continue;
}
//Update
Team team = _scoreboard.getTeam(_teamNames[i]);
if (team == null)
{
System.out.println("Scoreboard Error: Line Team Not Found!");
return;
}
//Set Line Prefix/Suffix
team.setPrefix(newLine.substring(0, Math.min(newLine.length(), 16)));
team.setSuffix(ChatColor.getLastColors(newLine) + newLine.substring(team.getPrefix().length(), Math.min(newLine.length(), 32)));
//Line
_sideObjective.getScore(_teamNames[i]).setScore(15-i);
}
//Hide Old Unused
if (_currentLines.size() > data.getLines(manager, player).size())
{
for (int i=data.getLines(manager, player).size() ; i<_currentLines.size() ; i++)
{
_scoreboard.resetScores(_teamNames[i]);
}
}
//Save New State
_currentLines = data.getLines(manager, player);
}
public void setTitle(String out)
{
_sideObjective.setDisplayName(out);
}
public void assignScoreboard(Player player, ScoreboardData data)
{
//Scoreboard
_scoreboard = Bukkit.getScoreboardManager().getNewScoreboard();
//Side Obj
_sideObjective = _scoreboard.registerNewObjective(player.getName() + UtilMath.r(999999999), "dummy");
_sideObjective.setDisplaySlot(DisplaySlot.SIDEBAR);
_sideObjective.setDisplayName(C.Bold + " MINEPLEX ");
//Teams
addTeams(player);
//Create Line Teams - There will always be 16 teams, with static line allocations.
_teamNames = new String[16];
for (int i=0 ; i<16 ; i++)
{
String teamName = ChatColor.COLOR_CHAR + "" + ("1234567890abcdefghijklmnopqrstuvwxyz".toCharArray())[i] + ChatColor.RESET;
_teamNames[i] = teamName;
Team team = _scoreboard.registerNewTeam(teamName);
team.addEntry(teamName);
}
//
// if (data.getDisplayRanks())
// for (Player otherPlayer : Bukkit.getOnlinePlayers())
// {
// if (_clientManager.Get(otherPlayer) == null)
// continue;
//
// String rankName = _clientManager.Get(player).GetRank().Name;
// String otherRankName = _clientManager.Get(otherPlayer).GetRank().Name;
//
// if (!_clientManager.Get(player).GetRank().Has(Rank.ULTRA) && _donationManager.Get(player.getName()).OwnsUltraPackage())
// {
// rankName = Rank.ULTRA.Name;
// }
//
// if (!_clientManager.Get(otherPlayer).GetRank().Has(Rank.ULTRA) && _donationManager.Get(otherPlayer.getName()).OwnsUltraPackage())
// {
// otherRankName = Rank.ULTRA.Name;
// }
//
// //Add Other to Self
// board.getTeam(otherRankName).addPlayer(otherPlayer);
// }
//Set Scoreboard
player.setScoreboard(_scoreboard);
}
}

View File

@ -0,0 +1,108 @@
package mineplex.core.scoreboard;
import java.util.ArrayList;
import mineplex.core.scoreboard.elements.*;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
public class ScoreboardData
{
private ArrayList<ScoreboardElement> _elements = new ArrayList<ScoreboardElement>();
public ScoreboardData()
{
}
public ArrayList<String> getLines(ScoreboardManager manager, Player player)
{
ArrayList<String> output = new ArrayList<String>();
for (ScoreboardElement elem : _elements)
output.addAll(elem.GetLines(manager, player));
return output;
}
public void reset()
{
_elements.clear();
}
public String prepareLine(String line)
{
if (line.length() > 28)
{
// Due to the scoreboard using teams, You can use prefix and suffix for a total length of 32.
// this means that the total length of the string can't extend 32.
// Reason for the fancy logic is that the beginning of the suffix needs to use colors from line1 else the line is pure
// white. And line2 can't have its length extend 16..
String line1 = line.substring(0, 16);
String color = ChatColor.getLastColors(line1);
String line2 = line.substring(16);
int length = 16 - (color + line2).length();
if (length > 0)
{
return line1 + line2.substring(0, line2.length() - length);
}
}
return line;
}
public void write(String line)
{
line = prepareLine(line);
_elements.add(new ScoreboardElementText(line));
}
public void writeOrdered(String key, String line, int value, boolean prependScore)
{
if (prependScore)
line = value + " " + line;
line = prepareLine(line);
for (ScoreboardElement elem : _elements)
{
if (elem instanceof ScoreboardElementScores)
{
ScoreboardElementScores scores = (ScoreboardElementScores) elem;
if (scores.IsKey(key))
{
scores.AddScore(line, value);
return;
}
}
}
_elements.add(new ScoreboardElementScores(key, line, value, true));
}
public void writeEmpty()
{
_elements.add(new ScoreboardElementText(" "));
}
public void writePlayerGems()
{
_elements.add(new ScoreboardElementGemCount());
}
public void writePlayerCoins()
{
_elements.add(new ScoreboardElementCoinCount());
}
public void writePlayerRank()
{
_elements.add(new ScoreboardElementRank());
}
}

View File

@ -0,0 +1,151 @@
package mineplex.core.scoreboard;
import java.util.HashMap;
import java.util.Iterator;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.plugin.java.JavaPlugin;
import mineplex.core.MiniPlugin;
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.util.C;
import mineplex.core.donation.DonationManager;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
public class ScoreboardManager extends MiniPlugin
{
private CoreClientManager _clientManager;
private DonationManager _donationManager;
//This stores current scoreboard for the player
private HashMap<Player, PlayerScoreboard> _playerScoreboards = new HashMap<Player, PlayerScoreboard>();
//Scoreboards (can be shared between players)
private HashMap<String, ScoreboardData> _scoreboards = new HashMap<String, ScoreboardData>();
//Title
private String _title = " MINEPLEX ";
private int _shineIndex;
private boolean _shineDirection = true;
public ScoreboardManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager)
{
super("Scoreboard Manager", plugin);
_clientManager = clientManager;
_donationManager = donationManager;
}
public CoreClientManager getClients()
{
return _clientManager;
}
public DonationManager getDonation()
{
return _donationManager;
}
@EventHandler
public void playerJoin(PlayerJoinEvent event)
{
_playerScoreboards.put(event.getPlayer(), new PlayerScoreboard(this, event.getPlayer()));
}
@EventHandler
public void playerQuit(PlayerQuitEvent event)
{
_playerScoreboards.remove(event.getPlayer());
}
public void draw()
{
Iterator<Player> playerIterator = _playerScoreboards.keySet().iterator();
while (playerIterator.hasNext())
{
Player player = playerIterator.next();
//Offline
if (!player.isOnline())
{
playerIterator.remove();
continue;
}
_playerScoreboards.get(player).draw(this, player);
}
}
public ScoreboardData getData(String scoreboardName, boolean create)
{
if (!create)
return _scoreboards.get(scoreboardName);
if (!_scoreboards.containsKey(scoreboardName))
_scoreboards.put(scoreboardName, new ScoreboardData());
return _scoreboards.get(scoreboardName);
}
@EventHandler
public void updateTitle(UpdateEvent event)
{
if (event.getType() != UpdateType.FASTER)
return;
String out;
if (_shineDirection)
{
out = C.cGold + C.Bold;
}
else
{
out = C.cWhite + C.Bold;
}
for (int i = 0; i < _title.length(); i++)
{
char c = _title.charAt(i);
if (_shineDirection)
{
if (i == _shineIndex)
out += C.cYellow + C.Bold;
if (i == _shineIndex + 1)
out += C.cWhite + C.Bold;
}
else
{
if (i == _shineIndex)
out += C.cYellow + C.Bold;
if (i == _shineIndex + 1)
out += C.cGold + C.Bold;
}
out += c;
}
for (PlayerScoreboard ps : _playerScoreboards.values())
{
ps.setTitle(out);
}
_shineIndex++;
if (_shineIndex == _title.length() * 2)
{
_shineIndex = 0;
_shineDirection = !_shineDirection;
}
}
}

View File

@ -0,0 +1,12 @@
package mineplex.core.scoreboard.elements;
import java.util.ArrayList;
import org.bukkit.entity.Player;
import mineplex.core.scoreboard.ScoreboardManager;
public abstract class ScoreboardElement
{
public abstract ArrayList<String> GetLines(ScoreboardManager manager, Player player);
}

View File

@ -0,0 +1,19 @@
package mineplex.core.scoreboard.elements;
import java.util.ArrayList;
import mineplex.core.common.CurrencyType;
import mineplex.core.scoreboard.ScoreboardManager;
import org.bukkit.entity.Player;
public class ScoreboardElementCoinCount extends ScoreboardElement
{
@Override
public ArrayList<String> GetLines(ScoreboardManager manager, Player player)
{
ArrayList<String> output = new ArrayList<String>();
output.add(manager.getDonation().Get(player).GetBalance(CurrencyType.Coins) + "");
return output;
}
}

View File

@ -0,0 +1,19 @@
package mineplex.core.scoreboard.elements;
import java.util.ArrayList;
import mineplex.core.common.CurrencyType;
import mineplex.core.scoreboard.ScoreboardManager;
import org.bukkit.entity.Player;
public class ScoreboardElementGemCount extends ScoreboardElement
{
@Override
public ArrayList<String> GetLines(ScoreboardManager manager, Player player)
{
ArrayList<String> output = new ArrayList<String>();
output.add(manager.getDonation().Get(player).GetBalance(CurrencyType.Gems) + "");
return output;
}
}

View File

@ -0,0 +1,37 @@
package mineplex.core.scoreboard.elements;
import java.util.ArrayList;
import org.bukkit.entity.Player;
import mineplex.core.common.Rank;
import mineplex.core.scoreboard.ScoreboardManager;
public class ScoreboardElementRank extends ScoreboardElement
{
@Override
public ArrayList<String> GetLines(ScoreboardManager manager, Player player)
{
ArrayList<String> output = new ArrayList<String>();
if (manager.getClients().Get(player).GetRank().Has(Rank.ULTRA))
{
output.add(manager.getClients().Get(player).GetRank().Name);
}
else if (manager.getDonation().Get(player.getName()).OwnsUnknownPackage("SuperSmashMobs ULTRA") ||
manager.getDonation().Get(player.getName()).OwnsUnknownPackage("Survival Games ULTRA") ||
manager.getDonation().Get(player.getName()).OwnsUnknownPackage("Minigames ULTRA") ||
manager.getDonation().Get(player.getName()).OwnsUnknownPackage("CastleSiege ULTRA") ||
manager.getDonation().Get(player.getName()).OwnsUnknownPackage("Champions ULTRA"))
{
output.add("Single Ultra");
}
else
{
output.add("No Rank");
}
return output;
}
}

View File

@ -0,0 +1,69 @@
package mineplex.core.scoreboard.elements;
import java.util.ArrayList;
import java.util.HashMap;
import mineplex.core.scoreboard.ScoreboardManager;
import org.bukkit.entity.Player;
public class ScoreboardElementScores extends ScoreboardElement
{
private String _key;
private HashMap<String, Integer> _scores;
private boolean _higherIsBetter;
public ScoreboardElementScores(String key, String line, int value, boolean higherIsBetter)
{
_scores = new HashMap<String, Integer>();
_key = key;
AddScore(line, value);
_higherIsBetter = higherIsBetter;
}
@Override
public ArrayList<String> GetLines(ScoreboardManager manager, Player player)
{
ArrayList<String> orderedScores = new ArrayList<String>();
//Order Scores
while (orderedScores.size() < _scores.size())
{
String bestKey = null;
int bestScore = 0;
for (String key : _scores.keySet())
{
if (orderedScores.contains(key))
continue;
if (bestKey == null ||
(_higherIsBetter && _scores.get(key) >= bestScore) ||
(!_higherIsBetter && _scores.get(key) <= bestScore))
{
bestKey = key;
bestScore = _scores.get(key);
}
}
orderedScores.add(bestKey);
}
return orderedScores;
}
public boolean IsKey(String key)
{
return _key.equals(key);
}
public void AddScore(String line, int value)
{
_scores.put(line, value);
}
}

View File

@ -0,0 +1,28 @@
package mineplex.core.scoreboard.elements;
import java.util.ArrayList;
import mineplex.core.scoreboard.ScoreboardManager;
import org.bukkit.entity.Player;
public class ScoreboardElementText extends ScoreboardElement
{
private String _line;
public ScoreboardElementText(String line)
{
_line = line;
}
@Override
public ArrayList<String> GetLines(ScoreboardManager manager, Player player)
{
ArrayList<String> orderedScores = new ArrayList<String>();
orderedScores.add(_line);
return orderedScores;
}
}

View File

@ -33,16 +33,4 @@ public class BlockInfo
{ {
return _data; return _data;
} }
@Override
public int hashCode()
{
return _block.hashCode();
}
@Override
public boolean equals(Object obj)
{
return _block.equals(obj);
}
} }

View File

@ -2,22 +2,15 @@ package mineplex.core.treasure;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import mineplex.core.reward.Reward;
/**
* Created by Shaun on 8/29/2014.
*/
public class ChestData public class ChestData
{ {
private Block _block; private Block _block;
private Reward _reward;
private boolean _opened; private boolean _opened;
public ChestData(Block block, Reward reward) public ChestData(Block block)
{ {
_block = block; _block = block;
_opened = false; _opened = false;
_reward = reward;
} }
public boolean isOpened() public boolean isOpened()
@ -35,9 +28,4 @@ public class ChestData
return _block; return _block;
} }
public Reward getReward()
{
return _reward;
}
} }

View File

@ -1,21 +1,20 @@
package mineplex.core.treasure; package mineplex.core.treasure;
import java.util.HashSet; import java.util.ArrayList;
import java.util.Iterator; import java.util.Iterator;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List;
import java.util.Random; import java.util.Random;
import java.util.Set;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Effect; import org.bukkit.Effect;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer; import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
import org.bukkit.craftbukkit.v1_7_R4.util.CraftMagicNumbers; import org.bukkit.craftbukkit.v1_7_R4.util.CraftMagicNumbers;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import net.minecraft.server.v1_7_R4.PacketPlayOutBlockAction; import net.minecraft.server.v1_7_R4.PacketPlayOutBlockAction;
import mineplex.core.blockrestore.BlockRestore; import mineplex.core.blockrestore.BlockRestore;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
@ -39,134 +38,54 @@ public class Treasure
{ {
private BlockRestore _blockRestore; private BlockRestore _blockRestore;
// Decay Sets private List<BlockInfo> _chestBlockInfo = new ArrayList<>();
private HashSet<BlockInfo> _wallsBlockInfo = new HashSet<>(); private List<BlockInfo> _openedChestBlockInfo = new ArrayList<>();
private HashSet<BlockInfo> _outerRingBlockInfo = new HashSet<>();
private HashSet<BlockInfo> _centerBlockInfo = new HashSet<>();
private HashSet<BlockInfo> _chestBlockInfo = new HashSet<>();
private Player _player; private Player _player;
private Random _random; private Random _random;
private Block _centerBlock; private Block _centerBlock;
private int _tickCount; private int _tickCount;
private TreasureType _treasureType;
private ChestData[] _chestData; private ChestData[] _chestData;
private int _currentChest;
private Reward[] _rewards;
private int _currentReward;
private boolean _finished; private boolean _finished;
private int _finishedTickCount; private int _finishedTickCount;
private LinkedList<Animation> _animations; private LinkedList<Animation> _animations;
private TreasureStyle _style;
private HologramManager _hologramManager; private HologramManager _hologramManager;
public Treasure(Player player, Reward[] rewards, BlockRestore blockRestore, HologramManager hologramManager) public Treasure(Player player, Reward[] rewards, Block centerBlock, Block[] chestBlocks, TreasureType treasureType, BlockRestore blockRestore, HologramManager hologramManager)
{ {
this(player, new Random(), rewards, hologramManager); this(player, new Random(), rewards, centerBlock, chestBlocks, treasureType, hologramManager);
_blockRestore = blockRestore; _blockRestore = blockRestore;
} }
public Treasure(Player player, Random seed, Reward[] rewards, HologramManager hologramManager) public Treasure(Player player, Random seed, Reward[] rewards, Block centerBlock, Block[] chestBlocks, TreasureType treasureType, HologramManager hologramManager)
{ {
_player = player; _player = player;
_random = seed; _random = seed;
_style = TreasureStyle.values()[_random.nextInt(TreasureStyle.values().length)]; _treasureType = treasureType;
_centerBlock = player.getLocation().getBlock().getRelative(BlockFace.DOWN); _centerBlock = centerBlock;
_animations = new LinkedList<Animation>(); _animations = new LinkedList<Animation>();
_hologramManager = hologramManager; _hologramManager = hologramManager;
// _animations.add(new ParticleAnimation(this)); _currentChest = 0;
_currentReward = 0;
_rewards = rewards;
_chestData = new ChestData[4]; _chestData = new ChestData[chestBlocks.length];
_chestData[0] = new ChestData(_centerBlock.getRelative(2, 1, 0), rewards[0]); for (int i = 0; i < _chestData.length; i++)
_chestData[1] = new ChestData(_centerBlock.getRelative(-2, 1, 0), rewards[1]);
_chestData[2] = new ChestData(_centerBlock.getRelative(0, 1, 2), rewards[2]);
_chestData[3] = new ChestData(_centerBlock.getRelative(0, 1, -2), rewards[3]);
}
private void createCenterClay()
{
for (int x = -1; x <= 1; x++)
{ {
for (int z = -1; z <= 1; z++) _chestData[i] = new ChestData(chestBlocks[i]);
{
if (Math.abs(x) == 1 || Math.abs(z) == 1)
{
Block block = _centerBlock.getRelative(x, 0, z);
_blockRestore.Restore(block);
_centerBlockInfo.add(new BlockInfo(block));
setBlock(block, _style.getPrimaryMaterial(), _style.getPrimaryData());
}
}
}
}
private void createOuterClay()
{
for (int x = -2; x <= 2; x++)
{
{
Block block = _centerBlock.getRelative(x, 0, -2);
_blockRestore.Restore(block);
_outerRingBlockInfo.add(new BlockInfo(block));
setBlock(block, _style.getSecondaryMaterial(), _style.getSecondaryData());
}
{
Block block = _centerBlock.getRelative(x, 0, 2);
_blockRestore.Restore(block);
_outerRingBlockInfo.add(new BlockInfo(block));
setBlock(block, _style.getSecondaryMaterial(), _style.getSecondaryData());
}
}
for (int z = -1; z <= 1; z++)
{
{
Block block = _centerBlock.getRelative(-2, 0, z);
_blockRestore.Restore(block);
_outerRingBlockInfo.add(new BlockInfo(block));
setBlock(block, _style.getSecondaryMaterial(), _style.getSecondaryData());
}
{
Block block = _centerBlock.getRelative(2, 0, z);
_blockRestore.Restore(block);
_outerRingBlockInfo.add(new BlockInfo(block));
setBlock(block, _style.getSecondaryMaterial(), _style.getSecondaryData());
}
}
}
private void createWalls()
{
for (int z = -2; z <= 2; z++)
{
for (int x = -2; x <= 2; x++)
{
if ((Math.abs(x) == 2 || Math.abs(z) == 2) && (x != 0 && z != 0))
{
Block playerBlock = getPlayerBlock();
Block block = playerBlock.getRelative(x, 0, z);
_blockRestore.Restore(block);
_wallsBlockInfo.add(new BlockInfo(block));
setBlock(block, _style.getWallMaterial(), _style.getWallData());
}
}
} }
} }
@ -182,54 +101,16 @@ public class Treasure
_finishedTickCount++; _finishedTickCount++;
} }
if (_tickCount == 5) if (_tickCount % 10 == 0 && _currentChest < _chestData.length)
{ {
Block block = _centerBlock; Block block = _chestData[_currentChest].getBlock();
ChestSpawnAnimation chestSpawn = new ChestSpawnAnimation(this, block, _chestBlockInfo);
_blockRestore.Restore(block); _animations.add(chestSpawn);
_centerBlockInfo.add(new BlockInfo(block)); _currentChest++;
_centerBlockInfo.add(new BlockInfo(block.getRelative(BlockFace.DOWN)));
setBlock(block, Material.REDSTONE_LAMP_ON, (byte) 0);
setBlock(block.getRelative(BlockFace.DOWN), Material.REDSTONE_TORCH_ON, (byte) 0);
} }
else if (_tickCount == 10)
{ if (_tickCount == 60 * 20)
createCenterClay();
}
else if (_tickCount == 20)
{
createOuterClay();
}
else if (_tickCount == 30)
{
createWalls();
}
else if (_tickCount == 50)
{
Block block = getPlayerBlock().getRelative(2, 0, 0);
ChestSpawnAnimation task = new ChestSpawnAnimation(this, block, (byte)4, _chestBlockInfo);
_animations.add(task);
}
else if (_tickCount == 80)
{
Block block = getPlayerBlock().getRelative(-2, 0, 0);
ChestSpawnAnimation task = new ChestSpawnAnimation(this, block, (byte)5, _chestBlockInfo);
_animations.add(task);
}
else if (_tickCount == 110)
{
Block block = getPlayerBlock().getRelative(0, 0, 2);
ChestSpawnAnimation task = new ChestSpawnAnimation(this, block, (byte)2, _chestBlockInfo);
_animations.add(task);
}
else if (_tickCount == 140)
{
Block block = getPlayerBlock().getRelative(0, 0, -2);
ChestSpawnAnimation task = new ChestSpawnAnimation(this, block, (byte)3, _chestBlockInfo);
_animations.add(task);
}
else if (_tickCount == 60 * 20)
{ {
for (BlockInfo blockInfo : _chestBlockInfo) for (BlockInfo blockInfo : _chestBlockInfo)
{ {
@ -271,11 +152,6 @@ public class Treasure
return _centerBlock; return _centerBlock;
} }
public Block getPlayerBlock()
{
return _centerBlock.getRelative(BlockFace.UP);
}
public void setBlock(Block block, Material material, byte data) public void setBlock(Block block, Material material, byte data)
{ {
block.setType(material); block.setType(material);
@ -286,25 +162,31 @@ public class Treasure
public void openChest(Block block) public void openChest(Block block)
{ {
ChestData data = getChestData(block); ChestData data = getChestData(block);
if (data != null && !data.isOpened()) if (data != null && !data.isOpened() && _currentReward < _rewards.length)
{ {
RewardData rewardData = data.getReward().giveReward("Treasure", _player); Reward reward = _rewards[_currentReward];
RewardData rewardData = reward.giveReward("Treasure", _player);
_currentReward++;
BlockInfo info = getBlockInfo(block);
_chestBlockInfo.remove(info);
_openedChestBlockInfo.add(info);
data.setOpened(true); data.setOpened(true);
ChestOpenAnimation chestOpenTask = new ChestOpenAnimation(this, data, rewardData, _hologramManager); ChestOpenAnimation chestOpenTask = new ChestOpenAnimation(this, data, rewardData, _hologramManager);
_animations.add(chestOpenTask); _animations.add(chestOpenTask);
// Extra effects based off the rarity of the treasure // Extra effects based off the rarity of the treasure
if (data.getReward().getRarity() == RewardRarity.UNCOMMON) if (reward.getRarity() == RewardRarity.UNCOMMON)
{ {
_animations.add(new UncommonAnimation(this, data.getBlock())); _animations.add(new UncommonAnimation(this, data.getBlock()));
} }
else if (data.getReward().getRarity() == RewardRarity.RARE) else if (reward.getRarity() == RewardRarity.RARE)
{ {
_animations.add(new RareAnimation(this, data.getBlock().getLocation().add(0.5, 1.5, 0.5))); _animations.add(new RareAnimation(this, data.getBlock().getLocation().add(0.5, 1.5, 0.5)));
Bukkit.broadcastMessage(F.main("Treasure", F.name(_player.getName()) + " found " + C.cGold + "Rare " + rewardData.getFriendlyName())); Bukkit.broadcastMessage(F.main("Treasure", F.name(_player.getName()) + " found " + C.cGold + "Rare " + rewardData.getFriendlyName()));
} }
else if (data.getReward().getRarity() == RewardRarity.LEGENDARY) else if (reward.getRarity() == RewardRarity.LEGENDARY)
{ {
_animations.add(new LegendaryAnimation(this, data.getBlock())); _animations.add(new LegendaryAnimation(this, data.getBlock()));
Bukkit.broadcastMessage(F.main("Treasure", F.name(_player.getName()) + " found " + C.cRed + "Legendary " + rewardData.getFriendlyName())); Bukkit.broadcastMessage(F.main("Treasure", F.name(_player.getName()) + " found " + C.cRed + "Legendary " + rewardData.getFriendlyName()));
@ -312,13 +194,23 @@ public class Treasure
if (isFinished()) if (isFinished())
{ {
TreasureRemoveAnimation animation = new TreasureRemoveAnimation(this, _centerBlockInfo, _outerRingBlockInfo, _wallsBlockInfo); TreasureRemoveAnimation animation = new TreasureRemoveAnimation(this, _openedChestBlockInfo, _chestBlockInfo);
_animations.add(animation); _animations.add(animation);
_finished = true; _finished = true;
} }
} }
} }
public BlockInfo getBlockInfo(Block block)
{
for (BlockInfo blockInfo : _chestBlockInfo)
{
if (blockInfo.getBlock().equals(block))
return blockInfo;
}
return null;
}
public void sendChestOpenPackets(Player... players) public void sendChestOpenPackets(Player... players)
{ {
for (ChestData data : _chestData) for (ChestData data : _chestData)
@ -357,35 +249,20 @@ public class Treasure
public boolean isFinished() public boolean isFinished()
{ {
boolean allOpened = true; return _currentReward == _rewards.length;
for (int i = 0; i < _chestData.length; i++)
{
if (!_chestData[i].isOpened())
allOpened = false;
}
return allOpened;
} }
public void cleanup() public void cleanup()
{ {
for (ChestData chestData : _chestData)
for (int i = _currentReward; i < _rewards.length; i++)
{ {
// Give any unopened rewards to the player _rewards[_currentReward].giveReward("Treasure", _player);
// This only applies if they leave the server
// while opening a treasure
if (!chestData.isOpened())
{
chestData.setOpened(true);
chestData.getReward().giveReward("Treasure", _player);
}
} }
// Remove any extra blocks // Remove any extra blocks
resetBlockInfo(_wallsBlockInfo);
resetBlockInfo(_centerBlockInfo);
resetBlockInfo(_outerRingBlockInfo);
resetBlockInfo(_chestBlockInfo); resetBlockInfo(_chestBlockInfo);
resetBlockInfo(_openedChestBlockInfo);
for (Animation animation : _animations) for (Animation animation : _animations)
{ {
@ -394,40 +271,33 @@ public class Treasure
_animations.clear(); _animations.clear();
} }
public void resetBlockInfo(Set<BlockInfo> blockInfoSet) public void resetBlockInfo(List<BlockInfo> blockInfoSet)
{ {
for (BlockInfo blockInfo : blockInfoSet) for (BlockInfo blockInfo : blockInfoSet)
{ {
Block block = blockInfo.getBlock(); resetBlockInfo(blockInfo);
if (block.getType().equals(Material.CHEST))
{
UtilParticle.PlayParticle(UtilParticle.ParticleType.LARGE_SMOKE, block.getLocation().add(0.5, 0.5, 0.5), 0.5F, 0.5F, 0.5F, 0.1F, 10);
// block.getLocation().getWorld().createExplosion(block.getLocation().add(0.5, 0.5, 0.5), 0F);
}
block.getLocation().getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, block.getTypeId());
block.setTypeId(blockInfo.getId());
block.setData(blockInfo.getData());
} }
blockInfoSet.clear(); blockInfoSet.clear();
} }
public void resetBlockInfo(BlockInfo blockInfo)
{
Block block = blockInfo.getBlock();
if (block.getType().equals(Material.CHEST))
{
UtilParticle.PlayParticle(UtilParticle.ParticleType.LARGE_SMOKE, block.getLocation().add(0.5, 0.5, 0.5), 0.5F, 0.5F, 0.5F, 0.1F, 10);
// block.getLocation().getWorld().createExplosion(block.getLocation().add(0.5, 0.5, 0.5), 0F);
}
block.getLocation().getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, block.getTypeId());
block.setTypeId(blockInfo.getId());
block.setData(blockInfo.getData());
}
public boolean containsBlock(Block block) public boolean containsBlock(Block block)
{ {
for (BlockInfo info : _wallsBlockInfo)
if (info.getBlock().equals(block))
return true;
for (BlockInfo info : _outerRingBlockInfo)
if (info.getBlock().equals(block))
return true;
for (BlockInfo info : _centerBlockInfo)
if (info.getBlock().equals(block))
return true;
for (BlockInfo info : _chestBlockInfo) for (BlockInfo info : _chestBlockInfo)
if (info.getBlock().equals(block)) if (info.getBlock().equals(block))
return true; return true;
@ -435,9 +305,8 @@ public class Treasure
return false; return false;
} }
public TreasureStyle getStyle() public TreasureType getTreasureType()
{ {
return _style; return _treasureType;
} }
} }

View File

@ -0,0 +1,289 @@
package mineplex.core.treasure;
import java.util.List;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
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.inventory.InventoryOpenEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.event.player.PlayerVelocityEvent;
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilTextMiddle;
import mineplex.core.donation.DonationManager;
import mineplex.core.gadget.event.GadgetBlockEvent;
import mineplex.core.hologram.Hologram;
import mineplex.core.hologram.HologramManager;
import mineplex.core.reward.Reward;
import mineplex.core.treasure.event.TreasureFinishEvent;
import mineplex.core.treasure.event.TreasureStartEvent;
import mineplex.core.treasure.gui.TreasureShop;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
public class TreasureLocation implements Listener
{
private TreasureManager _treasureManager;
private Hologram _hologram;
private HologramManager _hologramManager;
private Treasure _currentTreasure;
private Block _chestBlock;
private byte _chestBlockData;
private Block[] _chestSpawns;
private TreasureShop _shop;
public TreasureLocation(TreasureManager treasureManager, CoreClientManager clientManager, DonationManager donationManager, Block chestBlock, Block[] chestSpawns, HologramManager hologramManager)
{
_treasureManager = treasureManager;
_chestBlock = chestBlock;
_chestBlockData = _chestBlock.getData();
_chestSpawns = chestSpawns;
_hologramManager = hologramManager;
_currentTreasure = null;
_hologram = new Hologram(_hologramManager, chestBlock.getLocation().add(0.5, 1.5, 0.5), C.cGreen + "Treasure Chest");
setHoloChestVisible(true);
_shop = new TreasureShop(treasureManager, clientManager, donationManager, this);
}
@EventHandler
public void onInteract(PlayerInteractEvent event)
{
if (event.getAction() == Action.RIGHT_CLICK_BLOCK && event.getClickedBlock().equals(_chestBlock))
{
openShop(event.getPlayer());
event.setCancelled(true);
}
}
public void attemptOpenTreasure(Player player, TreasureType treasureType)
{
TreasureStartEvent event = new TreasureStartEvent(player);
Bukkit.getPluginManager().callEvent(event);
if (event.isCancelled())
{
return;
}
setHoloChestVisible(false);
Bukkit.broadcastMessage(F.main("Treasure", F.name(player.getName()) + " is opening a " + C.cGreen + "Treasure Chest"));
Reward[] rewards = _treasureManager.getRewards(player, treasureType.getRewardType());
Treasure treasure = new Treasure(player, rewards, _chestBlock, _chestSpawns, treasureType, _treasureManager.getBlockRestore(), _hologramManager);
_currentTreasure = treasure;
UtilTextMiddle.display(treasureType.getName(), "Choose 4 Chests To Open");
Location teleportLocation = treasure.getCenterBlock().getLocation().add(0.5, 0, 0.5);
teleportLocation.setPitch(player.getLocation().getPitch());
teleportLocation.setYaw(player.getLocation().getYaw());
for (Entity entity : player.getNearbyEntities(3, 3, 3))
{
UtilAction.velocity(entity, UtilAlg.getTrajectory(entity.getLocation(), treasure.getCenterBlock().getLocation()).multiply(-1), 1.5, true, 0.8, 0, 1.0, true);
}
player.teleport(teleportLocation);
}
private void setHoloChestVisible(boolean visible)
{
if (visible)
{
_hologram.start();
_chestBlock.setType(Material.CHEST);
_chestBlock.setData(_chestBlockData);
}
else
{
_hologram.stop();
_chestBlock.setType(Material.AIR);
}
}
public void cleanup()
{
if (_currentTreasure != null)
{
_currentTreasure.cleanup();
_currentTreasure = null;
}
}
@EventHandler
public void update(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
if (isTreasureInProgress())
{
Treasure treasure = _currentTreasure;
treasure.update();
if (treasure.isFinished() && treasure.getFinishedTickCount() >= 80)
{
treasure.cleanup();
TreasureFinishEvent finishEvent = new TreasureFinishEvent(treasure.getPlayer(), treasure);
Bukkit.getPluginManager().callEvent(finishEvent);
}
}
}
@EventHandler
public void onTreasureFinish(TreasureFinishEvent event)
{
if (event.getTreasure().equals(_currentTreasure))
{
_currentTreasure = null;
setHoloChestVisible(true);
}
}
@EventHandler
public void preventGadgetBlockEvent(GadgetBlockEvent event)
{
if (isTreasureInProgress())
{
List<Block> blocks = event.getBlocks();
for (Block block : blocks)
{
if (_currentTreasure.containsBlock(block))
{
event.setCancelled(true);
return;
}
}
}
}
@EventHandler(priority = EventPriority.HIGH)
public void interact(PlayerInteractEvent event)
{
Player player = event.getPlayer();
if (isTreasureInProgress())
{
if (_currentTreasure.getPlayer().equals(player))
{
if (event.getAction() == Action.RIGHT_CLICK_BLOCK)
{
_currentTreasure.openChest(event.getClickedBlock());
}
event.setCancelled(true);
}
else if (event.getAction() == Action.RIGHT_CLICK_BLOCK)
{
ChestData chestData = _currentTreasure.getChestData(event.getClickedBlock());
if (chestData != null)
{
event.setCancelled(true);
}
}
}
}
@EventHandler
public void inventoryOpen(InventoryOpenEvent event)
{
if (isTreasureInProgress() && event.getPlayer().equals(_currentTreasure.getPlayer()))
{
event.setCancelled(true);
}
}
@EventHandler
public void cancelMove(PlayerMoveEvent event)
{
Player player = event.getPlayer();
if (isTreasureInProgress())
{
if (_currentTreasure.getPlayer().equals(player))
{
Treasure treasure = _currentTreasure;
Location centerLocation = treasure.getCenterBlock().getLocation().add(0.5, 0.5, 0.5);
if (event.getTo().distanceSquared(centerLocation) > 9)
{
Location newTo = event.getFrom();
newTo.setPitch(event.getTo().getPitch());
newTo.setYaw(event.getTo().getYaw());
event.setTo(newTo);
}
}
else
{
Location fromLocation = event.getFrom();
Location toLocation = event.getTo();
Location centerLocation = _currentTreasure.getCenterBlock().getLocation().add(0.5, 1.5, 0.5);
double toDistanceFromCenter = centerLocation.distanceSquared(toLocation);
if (toDistanceFromCenter <= 9)
{
// Only cancel movement if they are moving towards the center
double fromDistanceFromCenter = centerLocation.distanceSquared(fromLocation);
if (toDistanceFromCenter < fromDistanceFromCenter)
{
Location spawnLocation = new Location(player.getWorld(), 0, 64, 0);
UtilAction.velocity(player, UtilAlg.getTrajectory(player.getLocation(), spawnLocation).multiply(-1), 1.5, true, 0.8, 0, 1.0, true);
event.setTo(event.getFrom());
}
}
}
}
}
@EventHandler
public void cancelVelocity(PlayerVelocityEvent event)
{
Player player = event.getPlayer();
if (isTreasureInProgress() && _currentTreasure.getPlayer().equals(player))
{
event.setCancelled(true);
}
}
@EventHandler
public void quit(PlayerQuitEvent event)
{
if (isTreasureInProgress() && _currentTreasure.getPlayer().equals(event.getPlayer()))
{
reset();
}
}
public boolean isTreasureInProgress()
{
return _currentTreasure != null;
}
public void reset()
{
cleanup();
_chestBlock.setType(Material.CHEST);
_chestBlock.setData(_chestBlockData);
_hologram.start();
}
public void openShop(Player player)
{
_shop.attemptShopOpen(player);
}
}

View File

@ -1,440 +1,127 @@
package mineplex.core.treasure; package mineplex.core.treasure;
import java.util.Iterator; import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Location; import org.bukkit.World;
import org.bukkit.Material;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.block.Action;
import org.bukkit.event.inventory.InventoryOpenEvent;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.event.player.PlayerVelocityEvent;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import mineplex.core.MiniPlugin; import mineplex.core.MiniPlugin;
import mineplex.core.account.CoreClientManager;
import mineplex.core.blockrestore.BlockRestore; import mineplex.core.blockrestore.BlockRestore;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.NautHashMap;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.donation.DonationManager; import mineplex.core.donation.DonationManager;
import mineplex.core.event.StackerEvent;
import mineplex.core.gadget.event.GadgetBlockEvent;
import mineplex.core.hologram.HologramManager; import mineplex.core.hologram.HologramManager;
import mineplex.core.inventory.InventoryManager; import mineplex.core.inventory.InventoryManager;
import mineplex.core.pet.PetManager; import mineplex.core.pet.PetManager;
import mineplex.core.reward.Reward; import mineplex.core.reward.Reward;
import mineplex.core.reward.RewardManager; import mineplex.core.reward.RewardManager;
import mineplex.core.reward.RewardRarity; import mineplex.core.reward.RewardType;
import mineplex.core.treasure.event.TreasureFinishEvent;
import mineplex.core.treasure.event.TreasureStartEvent;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
/** /**
* Created by Shaun on 8/27/2014. * Created by Shaun on 8/27/2014.
*/ */
public class TreasureManager extends MiniPlugin public class TreasureManager extends MiniPlugin
{ {
private NautHashMap<Player, Treasure> _playerTreasureMap;
private RewardManager _rewardManager; private RewardManager _rewardManager;
private InventoryManager _inventoryManager; private InventoryManager _inventoryManager;
private BlockRestore _blockRestore; private BlockRestore _blockRestore;
private HologramManager _hologramManager; private HologramManager _hologramManager;
private List<TreasureLocation> _treasureLocations;
public TreasureManager(JavaPlugin plugin, DonationManager donationManager, InventoryManager inventoryManager, PetManager petManager, BlockRestore blockRestore, HologramManager hologramManager) public TreasureManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager, InventoryManager inventoryManager, PetManager petManager, BlockRestore blockRestore, HologramManager hologramManager)
{ {
super("Treasure", plugin); super("Treasure", plugin);
_playerTreasureMap = new NautHashMap<Player, Treasure>();
_inventoryManager = inventoryManager; _inventoryManager = inventoryManager;
_blockRestore = blockRestore; _blockRestore = blockRestore;
_hologramManager = hologramManager; _hologramManager = hologramManager;
_rewardManager = new RewardManager(donationManager, inventoryManager, petManager, _rewardManager = new RewardManager(donationManager, inventoryManager, petManager,
100, 250, 100, 250,
500, 1000, 500, 1000,
1500, 2500, 1500, 2500,
6000, 12000, 6000, 12000,
true); true);
World world = Bukkit.getWorlds().get(0);
_treasureLocations = new ArrayList<TreasureLocation>();
{
Block chestBlock = world.getBlockAt(-19, 72, -19);
Block chestLoc1 = world.getBlockAt(-16, 72, -20);
Block chestLoc2 = world.getBlockAt(-18, 72, -22);
Block chestLoc3 = world.getBlockAt(-20, 72, -22);
Block chestLoc4 = world.getBlockAt(-22, 72, -20);
Block chestLoc5 = world.getBlockAt(-22, 72, -18);
Block chestLoc6 = world.getBlockAt(-20, 72, -16);
Block chestLoc7 = world.getBlockAt(-18, 72, -16);
Block chestLoc8 = world.getBlockAt(-16, 72, -18);
_treasureLocations.add(new TreasureLocation(this, clientManager, donationManager, chestBlock, new Block[]{chestLoc1, chestLoc2, chestLoc3, chestLoc4, chestLoc5, chestLoc6, chestLoc7, chestLoc8}, _hologramManager));
}
{
Block chestBlock = world.getBlockAt(19, 72, 19);
Block chestLoc1 = world.getBlockAt(16, 72, 20);
Block chestLoc2 = world.getBlockAt(18, 72, 22);
Block chestLoc3 = world.getBlockAt(20, 72, 22);
Block chestLoc4 = world.getBlockAt(22, 72, 20);
Block chestLoc5 = world.getBlockAt(22, 72, 18);
Block chestLoc6 = world.getBlockAt(20, 72, 16);
Block chestLoc7 = world.getBlockAt(18, 72, 16);
Block chestLoc8 = world.getBlockAt(16, 72, 18);
_treasureLocations.add(new TreasureLocation(this, clientManager, donationManager, chestBlock, new Block[]{chestLoc1, chestLoc2, chestLoc3, chestLoc4, chestLoc5, chestLoc6, chestLoc7, chestLoc8}, _hologramManager));
}
{
Block chestBlock = world.getBlockAt(19, 72, -19);
Block chestLoc1 = world.getBlockAt(16, 72, -20);
Block chestLoc2 = world.getBlockAt(18, 72, -22);
Block chestLoc3 = world.getBlockAt(20, 72, -22);
Block chestLoc4 = world.getBlockAt(22, 72, -20);
Block chestLoc5 = world.getBlockAt(22, 72, -18);
Block chestLoc6 = world.getBlockAt(20, 72, -16);
Block chestLoc7 = world.getBlockAt(18, 72, -16);
Block chestLoc8 = world.getBlockAt(16, 72, -18);
_treasureLocations.add(new TreasureLocation(this, clientManager, donationManager, chestBlock, new Block[]{chestLoc1, chestLoc2, chestLoc3, chestLoc4, chestLoc5, chestLoc6, chestLoc7, chestLoc8}, _hologramManager));
}
{
Block chestBlock = world.getBlockAt(-19, 72, 19);
Block chestLoc1 = world.getBlockAt(-16, 72, 20);
Block chestLoc2 = world.getBlockAt(-18, 72, 22);
Block chestLoc3 = world.getBlockAt(-20, 72, 22);
Block chestLoc4 = world.getBlockAt(-22, 72, 20);
Block chestLoc5 = world.getBlockAt(-22, 72, 18);
Block chestLoc6 = world.getBlockAt(-20, 72, 16);
Block chestLoc7 = world.getBlockAt(-18, 72, 16);
Block chestLoc8 = world.getBlockAt(-16, 72, 18);
_treasureLocations.add(new TreasureLocation(this, clientManager, donationManager, chestBlock, new Block[]{chestLoc1, chestLoc2, chestLoc3, chestLoc4, chestLoc5, chestLoc6, chestLoc7, chestLoc8}, _hologramManager));
}
for (TreasureLocation treasureLocation : _treasureLocations)
{
_plugin.getServer().getPluginManager().registerEvents(treasureLocation, _plugin);
}
} }
@Override @Override
public void Disable() public void Disable()
{ {
for (Treasure treasure : _playerTreasureMap.values()) for (TreasureLocation treasureLocation : _treasureLocations)
{ {
treasure.cleanup(); treasureLocation.cleanup();
} }
} }
public void attemptOpenTreasure(Player player) public Reward[] getRewards(Player player, RewardType rewardType)
{ {
attemptOpenTreasure(player, false); return _rewardManager.getRewards(player, rewardType);
} }
private void attemptOpenTreasure(Player player, boolean ignoreKey) public BlockRestore getBlockRestore()
{ {
if (checkNearbyBlocks(player) || checkNearSpawn(player) || checkInAir(player) || checkNearbyTreasure(player) || (!ignoreKey && checkNoTreasureAndKey(player))) return _blockRestore;
return;
TreasureStartEvent event = new TreasureStartEvent(player);
Bukkit.getPluginManager().callEvent(event);
if (event.isCancelled())
{
return;
}
if (!ignoreKey)
{
// Remove a treasure and a key
_inventoryManager.addItemToInventory(player, "Treasure", "Treasure Key", -1);
_inventoryManager.addItemToInventory(player, "Utility", "Treasure Chest", -1);
}
Bukkit.broadcastMessage(F.main("Treasure", F.name(player.getName()) + " is opening a " + C.cGreen + "Treasure Chest"));
Reward[] rewards = _rewardManager.getRewards(player, true);
Treasure treasure = new Treasure(player, rewards, _blockRestore, _hologramManager);
_playerTreasureMap.put(player, treasure);
Location teleportLocation = treasure.getPlayerBlock().getLocation().add(0.5, 0, 0.5);
teleportLocation.setPitch(player.getLocation().getPitch());
teleportLocation.setYaw(player.getLocation().getYaw());
for (Entity entity : player.getNearbyEntities(3, 3, 3))
{
UtilAction.velocity(entity, UtilAlg.getTrajectory(entity.getLocation(), treasure.getCenterBlock().getLocation()).multiply(-1), 1.5, true, 0.8, 0, 1.0, true);
}
player.teleport(teleportLocation);
} }
private boolean checkNoTreasureAndKey(Player player)
{
int treasureCount = _inventoryManager.Get(player).getItemCount("Treasure Chest");
int treasureKeyCount = _inventoryManager.Get(player).getItemCount("Treasure Key");
if (treasureCount < 1)
{
UtilPlayer.message(player, F.main("Treasure", "You don't have any treasure chests."));
}
else if (treasureKeyCount < 1)
{
UtilPlayer.message(player, F.main("Treasure", "You don't have any treasure keys."));
}
return (treasureCount < 1 || treasureKeyCount < 1);
}
private boolean checkNearbyTreasure(Player player)
{
boolean nearTreasure = false;
for (Treasure treasure : _playerTreasureMap.values())
{
if (UtilMath.offset2d(treasure.getCenterBlock().getLocation(), player.getLocation()) <= 10)
nearTreasure = true;
}
if (nearTreasure)
UtilPlayer.message(player, F.main("Treasure", "You are too close to another players treasure."));
return nearTreasure;
}
private boolean checkNearbyBlocks(Player player)
{
//todo improve this
Block centerBlock = player.getLocation().getBlock();
for (int y = 0; y <= 3; y++)
{
for (int x = -3; x <= 3; x++)
{
for (int z = -3; z <= 3; z++)
{
Block block = centerBlock.getRelative(x, y, z);
if (UtilBlock.solid(block))
{
UtilPlayer.message(player, F.main("Treasure", "You need a clear area to open Treasure Chests."));
return true;
}
}
}
}
return false;
}
private boolean checkInAir(Player player)
{
boolean grounded = UtilEnt.isGrounded(player);
if (!grounded)
UtilPlayer.message(player, F.main("Treasure", "You can't open chests while in the air."));
return !grounded;
}
private boolean checkNearSpawn(Player player)
{
boolean nearSpawn = UtilMath.offset2d(new Location(player.getWorld(), 0, 0, 0), player.getLocation()) < 10;
if (nearSpawn)
UtilPlayer.message(player, F.main("Treasure", "You can't open chests near spawn."));
return nearSpawn;
}
@EventHandler
public void update(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
Iterator<Treasure> iterator = _playerTreasureMap.values().iterator();
while(iterator.hasNext())
{
Treasure treasure = iterator.next();
treasure.update();
if (treasure.isFinished() && treasure.getFinishedTickCount() >= 80)
{
treasure.cleanup();
iterator.remove();
TreasureFinishEvent finishEvent = new TreasureFinishEvent(treasure.getPlayer(), treasure);
Bukkit.getPluginManager().callEvent(finishEvent);
}
}
}
@EventHandler
public void join(PlayerJoinEvent event)
{
final Player player = event.getPlayer();
_plugin.getServer().getScheduler().runTaskLater(_plugin, new Runnable()
{
@Override
public void run()
{
if (!player.isOnline())
return;
for (Treasure treasure : _playerTreasureMap.values())
{
treasure.sendChestOpenPackets(player);
}
}
}, 10L);
}
@EventHandler
public void quit(PlayerQuitEvent event)
{
if (_playerTreasureMap.containsKey(event.getPlayer()))
{
Treasure treasure = _playerTreasureMap.remove(event.getPlayer());
treasure.cleanup();
}
}
@EventHandler
public void cancelMove(PlayerMoveEvent event)
{
Player player = event.getPlayer();
if (_playerTreasureMap.containsKey(player))
{
Treasure treasure = _playerTreasureMap.get(player);
if (!event.getTo().getBlock().getRelative(BlockFace.DOWN).equals(treasure.getCenterBlock()))
{
Location newTo = treasure.getCenterBlock().getLocation().add(0.5, 1.1, 0.5);
newTo.setPitch(event.getTo().getPitch());
newTo.setYaw(event.getTo().getYaw());
event.setTo(newTo);
}
}
else
{
for (Treasure treasure : _playerTreasureMap.values())
{
Location fromLocation = event.getFrom();
Location toLocation = event.getTo();
Location centerLocation = treasure.getCenterBlock().getLocation().add(0.5, 1.5, 0.5);
double toDistanceFromCenter = centerLocation.distanceSquared(toLocation);
if (toDistanceFromCenter <= 9)
{
// Only cancel movement if they are moving towards the center
double fromDistanceFromCenter = centerLocation.distanceSquared(fromLocation);
if (toDistanceFromCenter < fromDistanceFromCenter)
{
UtilAction.velocity(player, UtilAlg.getTrajectory(player.getLocation(), centerLocation).multiply(-1), 1.5, true, 0.8, 0, 1.0, true);
event.setTo(event.getFrom());
}
}
}
}
}
@EventHandler
public void cancelVelocity(PlayerVelocityEvent event)
{
// Need to prevent players
Player player = event.getPlayer();
if (_playerTreasureMap.containsKey(player))
{
event.setCancelled(true);
}
}
@EventHandler
public void cancelStacker(StackerEvent event)
{
if (event.getEntity() instanceof Player)
{
Player player = ((Player) event.getEntity());
if (_playerTreasureMap.containsKey(player))
{
event.setCancelled(true);
}
}
}
@EventHandler
public void inventoryOpen(InventoryOpenEvent event)
{
// Prevent players in treasures from opening inventories
if (event.getPlayer() instanceof Player)
{
if (_playerTreasureMap.containsKey(((Player) event.getPlayer())))
{
event.setCancelled(true);
}
}
}
@EventHandler(priority = EventPriority.HIGH)
public void interact(PlayerInteractEvent event)
{
Player player = event.getPlayer();
if (_playerTreasureMap.containsKey(player))
{
if (event.getAction() == Action.RIGHT_CLICK_BLOCK && event.getClickedBlock().getType() == Material.CHEST)
{
Treasure treasure = _playerTreasureMap.get(player);
treasure.openChest(event.getClickedBlock());
}
// Always cancel interact for treasure players, prevents players from being able to open up cosmetic menu and other menus
event.setCancelled(true);
}
else if (event.getAction() == Action.RIGHT_CLICK_BLOCK && event.getClickedBlock().getType() == Material.CHEST)
{
for (Treasure treasure : _playerTreasureMap.values())
{
ChestData data = treasure.getChestData(event.getClickedBlock());
if (data != null)
{
event.setCancelled(true);
}
}
}
}
@EventHandler
public void preventGadgetBlockEvent(GadgetBlockEvent event)
{
List<Block> blocks = event.getBlocks();
for (Block block : blocks)
{
for (Treasure treasure : _playerTreasureMap.values())
{
if (treasure.containsBlock(block))
{
event.setCancelled(true);
return;
}
}
}
}
@EventHandler
public void treasureFinish(TreasureFinishEvent event)
{
_playerTreasureMap.remove(event.getPlayer());
}
@EventHandler
public void command(PlayerCommandPreprocessEvent event)
{
if (!event.getPlayer().isOp())
return;
if (event.getMessage().startsWith("/treasurechest"))
{
event.getPlayer().sendMessage(C.cGreen + C.Bold + "Received 10 Treasure Chest...");
_inventoryManager.addItemToInventory(event.getPlayer(), "Utility", "Treasure Chest", 10);
event.setCancelled(true);
}
if (event.getMessage().startsWith("/treasuredebug"))
{
event.getPlayer().sendMessage(C.cGreen + C.Bold + "Treasure Debug...");
attemptOpenTreasure(event.getPlayer(), true);
event.setCancelled(true);
}
if (event.getMessage().startsWith("/rewardchest") || event.getMessage().startsWith("/rewardgame"))
{
int common = 0;
int uncommon = 0;
int rare = 0;
int legend = 0;
int toTest = 10000000;
for (int i=0 ; i<toTest ; i++)
{
Reward reward = _rewardManager.nextReward(null, null, false, event.getMessage().startsWith("/rewardchest"));
if (reward.getRarity() == RewardRarity.COMMON) common++;
if (reward.getRarity() == RewardRarity.UNCOMMON) uncommon++;
if (reward.getRarity() == RewardRarity.RARE) rare++;
if (reward.getRarity() == RewardRarity.LEGENDARY) legend++;
}
event.getPlayer().sendMessage(C.cGreen + C.Bold + (event.getMessage().startsWith("/rewardchest") ? "Chest Rewards" : "Post-Game Rewards"));
event.getPlayer().sendMessage("Common: " + common + " " + UtilMath.trim(3, (double)common/(double)toTest*100d) + "%");
event.getPlayer().sendMessage("Uncommon: " + uncommon + " " + UtilMath.trim(3, (double)uncommon/(double)toTest*100d) + "%");
event.getPlayer().sendMessage("Rare: " + rare + " " + UtilMath.trim(3, (double)rare/(double)toTest*100d) + "%");
event.getPlayer().sendMessage("Legendary: " + legend + " " + UtilMath.trim(3, (double)legend/(double)toTest*100d) + "%");
event.setCancelled(true);
}
}
} }

View File

@ -0,0 +1,46 @@
package mineplex.core.treasure;
import org.bukkit.Material;
import mineplex.core.common.util.C;
import mineplex.core.reward.RewardType;
public enum TreasureType
{
BASIC(C.cYellow + "Basic Chest", RewardType.BasicChest, Material.CHEST, TreasureStyle.NATURE),
HEROIC(C.cGold + "Heroic Chest", RewardType.HeroicChest, Material.TRAPPED_CHEST, TreasureStyle.WATER),
LEGENDARY(C.cRed + "Legendary Chest", RewardType.LegendaryChest, Material.ENDER_CHEST, TreasureStyle.NETHER);
private String _name;
private RewardType _rewardType;
private Material _material;
private TreasureStyle _treasureStyle;
TreasureType(String name, RewardType rewardType, Material material, TreasureStyle treasureStyle)
{
_name = name;
_rewardType = rewardType;
_material = material;
_treasureStyle = treasureStyle;
}
public RewardType getRewardType()
{
return _rewardType;
}
public String getName()
{
return _name;
}
public Material getMaterial()
{
return _material;
}
public TreasureStyle getStyle()
{
return _treasureStyle;
}
}

View File

@ -1,9 +1,8 @@
package mineplex.core.treasure.animation; package mineplex.core.treasure.animation;
import java.util.HashSet; import java.util.List;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound; import org.bukkit.Sound;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.craftbukkit.v1_7_R4.CraftWorld; import org.bukkit.craftbukkit.v1_7_R4.CraftWorld;
@ -18,22 +17,39 @@ import mineplex.core.treasure.Treasure;
*/ */
public class ChestSpawnAnimation extends Animation public class ChestSpawnAnimation extends Animation
{ {
private static final int ANIMATION_DURATION = 30; private static final int ANIMATION_DURATION = 10;
private Block _block; private Block _block;
private byte _direction; private byte _direction;
private Location _centerLocation; private Location _centerLocation;
private HashSet<BlockInfo> _chestBlockInfo; private List<BlockInfo> _chestBlockInfo;
public ChestSpawnAnimation(Treasure tresure, Block block, byte direction, HashSet<BlockInfo> chestBlockInfo) public ChestSpawnAnimation(Treasure tresure, Block block, List<BlockInfo> chestBlockInfo)
{ {
super(tresure); super(tresure);
_block = block; _block = block;
_direction = direction; int relX = getTreasure().getCenterBlock().getX() - block.getX();
int relZ = getTreasure().getCenterBlock().getZ() - block.getZ();
if (Math.abs(relX) > Math.abs(relZ))
{
if (relX > 0)
_direction = (byte) 5;
else
_direction = (byte) 4;
}
else
{
if (relZ > 0)
_direction = (byte) 3;
else
_direction = (byte) 2;
}
_centerLocation = block.getLocation().clone().add(0.5, 0.5, 0.5); _centerLocation = block.getLocation().clone().add(0.5, 0.5, 0.5);
_centerLocation.getWorld().playSound(_centerLocation, Sound.LAVA, 1, 1); _centerLocation.getWorld().playSound(_centerLocation, Sound.LAVA, 1, 1);
_chestBlockInfo = chestBlockInfo; _chestBlockInfo = chestBlockInfo;
} }
@Override @Override
@ -49,16 +65,16 @@ public class ChestSpawnAnimation extends Animation
double lead = i * ((2d * Math.PI)/2); double lead = i * ((2d * Math.PI)/2);
float x = (float) (Math.sin(getTicks()/4D + lead)); float x = (float) (Math.sin(getTicks()/4D + lead));
float z = (float) (Math.cos(getTicks()/4D + lead)); float z = (float) (Math.cos(getTicks()/4D + lead));
UtilParticle.PlayParticle(getTreasure().getStyle().getSecondaryParticle(), _centerLocation.clone().add(x * width, y, z * width), 0f, 0f, 0f, 0, 1); UtilParticle.PlayParticle(getTreasure().getTreasureType().getStyle().getSecondaryParticle(), _centerLocation.clone().add(x * width, y, z * width), 0f, 0f, 0f, 0, 1);
} }
if (getTicks() >= ANIMATION_DURATION) if (getTicks() >= ANIMATION_DURATION)
{ {
_chestBlockInfo.add(new BlockInfo(_block)); _chestBlockInfo.add(new BlockInfo(_block));
getTreasure().setBlock(_block, Material.CHEST, _direction); getTreasure().setBlock(_block, getTreasure().getTreasureType().getMaterial(), _direction);
_block.getLocation().getWorld().playSound(_centerLocation, Sound.ANVIL_LAND, 0.5f, 1f); _block.getLocation().getWorld().playSound(_centerLocation, Sound.ANVIL_LAND, 0.5f, 1f);
UtilParticle.ParticleType particleType = getTreasure().getStyle().getChestSpawnParticle(); UtilParticle.ParticleType particleType = getTreasure().getTreasureType().getStyle().getChestSpawnParticle();
if (particleType != null) if (particleType != null)
{ {

View File

@ -54,7 +54,7 @@ public class ParticleAnimation extends Animation
{ {
Vector position = PATH.get(pathPosition); Vector position = PATH.get(pathPosition);
UtilParticle.PlayParticle(getTreasure().getStyle().getPrimaryParticle(), getTreasure().getCenterBlock().getLocation().add(0.5, 0, 0.5).add(position), 0, 0, 0, 0, 1); UtilParticle.PlayParticle(getTreasure().getTreasureType().getStyle().getPrimaryParticle(), getTreasure().getCenterBlock().getLocation().add(0.5, 0, 0.5).add(position), 0, 0, 0, 0, 1);
pathPosition = (pathPosition + 1) % PATH.size(); pathPosition = (pathPosition + 1) % PATH.size();
} }

View File

@ -1,6 +1,6 @@
package mineplex.core.treasure.animation; package mineplex.core.treasure.animation;
import java.util.HashSet; import java.util.List;
import java.util.Random; import java.util.Random;
import mineplex.core.treasure.BlockInfo; import mineplex.core.treasure.BlockInfo;
@ -12,66 +12,38 @@ import mineplex.core.treasure.Treasure;
public class TreasureRemoveAnimation extends Animation public class TreasureRemoveAnimation extends Animation
{ {
private Random _random = new Random(); private Random _random = new Random();
private List<BlockInfo> _openedChests;
private List<BlockInfo> _otherChests;
private HashSet<BlockInfo> _wallsBlockInfo; public TreasureRemoveAnimation(Treasure treasure, List<BlockInfo> openedChests, List<BlockInfo> otherChests)
private HashSet<BlockInfo> _outerRingBlockInfo;
private HashSet<BlockInfo> _centerBlockInfo;
public TreasureRemoveAnimation(Treasure treasure, HashSet<BlockInfo> centerBlockInfo, HashSet<BlockInfo> outerRingBlockInfo, HashSet<BlockInfo> wallsBlockInfo)
{ {
super(treasure); super(treasure);
_wallsBlockInfo = wallsBlockInfo; _openedChests = openedChests;
_centerBlockInfo = centerBlockInfo; _otherChests = otherChests;
_outerRingBlockInfo = outerRingBlockInfo;
} }
@Override @Override
protected void tick() protected void tick()
{ {
// Chests go away at 100 ticks if (getTicks() >= 20 && getTicks() % 10 == 0)
HashSet<BlockInfo> blockInfoSet = null;
if (getTicks() == 40)
{ {
blockInfoSet = _wallsBlockInfo; if (!_otherChests.isEmpty())
}
else if (getTicks() == 50)
{
blockInfoSet = _outerRingBlockInfo;
}
else if (getTicks() == 60)
{
blockInfoSet = _centerBlockInfo;
}
if (blockInfoSet != null)
{
getTreasure().resetBlockInfo(blockInfoSet);
}
/*
if (getTicks() % 2 == 0)
{
if (_blockRestoreMap.size() > 4)
{ {
Block block; BlockInfo info = _otherChests.remove(_random.nextInt(_otherChests.size()));
do getTreasure().resetBlockInfo(info);
{ // System.out.println("otherchests");
Block[] keyArray = _blockRestoreMap.keySet().toArray(new Block[0]);
block = keyArray[_random.nextInt(keyArray.length)];
}
while (block.getType() == Material.CHEST);
BlockInfo blockInfo = _blockRestoreMap.remove(block);
getTreasure().setBlock(block, Material.getMaterial(blockInfo.getId()), blockInfo.getData(), false);
} }
// else if (!_openedChests.isEmpty())
// {
// System.out.println("openchests");
// BlockInfo info = _openedChests.remove(_random.nextInt(_openedChests.size()));
// getTreasure().resetBlockInfo(info);
// }
else else
{ {
finish(); finish();
} }
} }
*/
} }
@Override @Override

View File

@ -0,0 +1,30 @@
package mineplex.core.treasure.gui;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import mineplex.core.shop.item.IButton;
import mineplex.core.treasure.TreasureLocation;
import mineplex.core.treasure.TreasureType;
public class OpenTreasureButton implements IButton
{
private Player _player;
private TreasureLocation _treasureLocation;
private TreasureType _treasureType;
public OpenTreasureButton(Player player, TreasureLocation treasureLocation, TreasureType treasureType)
{
_player = player;
_treasureLocation = treasureLocation;
_treasureType = treasureType;
}
@Override
public void onClick(Player player, ClickType clickType)
{
// TODO
_treasureLocation.attemptOpenTreasure(player, _treasureType);
}
}

View File

@ -0,0 +1,40 @@
package mineplex.core.treasure.gui;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.util.C;
import mineplex.core.shop.item.ShopItem;
import mineplex.core.shop.page.ShopPageBase;
import mineplex.core.treasure.TreasureLocation;
import mineplex.core.treasure.TreasureManager;
import mineplex.core.treasure.TreasureType;
public class TreasurePage extends ShopPageBase<TreasureManager, TreasureShop>
{
private TreasureLocation _treasureLocation;
public TreasurePage(TreasureManager plugin, TreasureShop shop, TreasureLocation treasureLocation, CoreClientManager clientManager, mineplex.core.donation.DonationManager donationManager, Player player)
{
super(plugin, shop, clientManager, donationManager, "Open Treasure", player, 9);
_treasureLocation = treasureLocation;
BuildPage();
}
@Override
protected void BuildPage()
{
//1 2 3 4 5 6 7 8 9
ShopItem basic = new ShopItem(Material.CHEST, C.cGreen + C.Bold + "Basic Chest", new String[] {}, 0, false, false);
ShopItem heroic = new ShopItem(Material.TRAPPED_CHEST, C.cGold + C.Bold + "Heroic Chest", new String[] {}, 0, false, false);
ShopItem legendary = new ShopItem(Material.ENDER_CHEST, C.cRed + C.Bold + "Legendary Chest", new String[] {}, 0, false, false);
AddButton(2, basic, new OpenTreasureButton(Player, _treasureLocation, TreasureType.BASIC));
AddButton(4, heroic, new OpenTreasureButton(Player, _treasureLocation, TreasureType.HEROIC));
AddButton(6, legendary, new OpenTreasureButton(Player, _treasureLocation, TreasureType.LEGENDARY));
}
}

View File

@ -0,0 +1,27 @@
package mineplex.core.treasure.gui;
import org.bukkit.entity.Player;
import mineplex.core.account.CoreClientManager;
import mineplex.core.donation.DonationManager;
import mineplex.core.shop.ShopBase;
import mineplex.core.shop.page.ShopPageBase;
import mineplex.core.treasure.TreasureLocation;
import mineplex.core.treasure.TreasureManager;
public class TreasureShop extends ShopBase<TreasureManager>
{
private TreasureLocation _treasureLocation;
public TreasureShop(TreasureManager plugin, CoreClientManager clientManager, DonationManager donationManager, TreasureLocation treasureLocation)
{
super(plugin, clientManager, donationManager, "Treasure Shop");
_treasureLocation = treasureLocation;
}
@Override
protected ShopPageBase<TreasureManager, ? extends ShopBase<TreasureManager>> BuildPagesFor(Player player)
{
return new TreasurePage(Plugin, this, _treasureLocation, ClientManager, DonationManager, player);
}
}

View File

@ -137,7 +137,7 @@ public class Hub extends JavaPlugin implements IRelation
new ClassCombatShop(shopManager, clientManager, donationManager, false, "Knight", classManager.GetClass("Knight")); new ClassCombatShop(shopManager, clientManager, donationManager, false, "Knight", classManager.GetClass("Knight"));
new ClassCombatShop(shopManager, clientManager, donationManager, false, "Assassin", classManager.GetClass("Assassin")); new ClassCombatShop(shopManager, clientManager, donationManager, false, "Assassin", classManager.GetClass("Assassin"));
new FriendManager(this, clientManager, preferenceManager); new FriendManager(this, clientManager, preferenceManager, portal);
//Updates //Updates
getServer().getScheduler().scheduleSyncRepeatingTask(this, new Updater(this), 1, 1); getServer().getScheduler().scheduleSyncRepeatingTask(this, new Updater(this), 1, 1);

View File

@ -45,7 +45,6 @@ import mineplex.core.MiniClientPlugin;
import mineplex.core.account.CoreClient; import mineplex.core.account.CoreClient;
import mineplex.core.account.CoreClientManager; import mineplex.core.account.CoreClientManager;
import mineplex.core.achievement.AchievementManager; import mineplex.core.achievement.AchievementManager;
import mineplex.core.benefit.BenefitManager;
import mineplex.core.blockrestore.BlockRestore; import mineplex.core.blockrestore.BlockRestore;
import mineplex.core.common.Rank; import mineplex.core.common.Rank;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
@ -85,7 +84,6 @@ import mineplex.hub.commands.ForcefieldRadius;
import mineplex.hub.commands.GadgetToggle; import mineplex.hub.commands.GadgetToggle;
import mineplex.hub.commands.GameModeCommand; import mineplex.hub.commands.GameModeCommand;
import mineplex.hub.commands.NewsCommand; import mineplex.hub.commands.NewsCommand;
import mineplex.hub.mail.MailManager;
import mineplex.hub.modules.ForcefieldManager; import mineplex.hub.modules.ForcefieldManager;
import mineplex.hub.modules.JumpManager; import mineplex.hub.modules.JumpManager;
import mineplex.hub.modules.MapManager; import mineplex.hub.modules.MapManager;
@ -95,7 +93,6 @@ import mineplex.hub.modules.TextManager;
import mineplex.hub.modules.UHCManager; import mineplex.hub.modules.UHCManager;
import mineplex.hub.modules.VisibilityManager; import mineplex.hub.modules.VisibilityManager;
import mineplex.hub.modules.WorldManager; import mineplex.hub.modules.WorldManager;
import mineplex.hub.notification.NotificationManager;
import mineplex.hub.party.Party; import mineplex.hub.party.Party;
import mineplex.hub.party.PartyManager; import mineplex.hub.party.PartyManager;
import mineplex.hub.poll.PollManager; import mineplex.hub.poll.PollManager;
@ -182,7 +179,7 @@ public class HubManager extends MiniClientPlugin<HubClient>
_inventoryManager = new InventoryManager(plugin, clientManager); _inventoryManager = new InventoryManager(plugin, clientManager);
//new BenefitManager(plugin, clientManager, _inventoryManager); //new BenefitManager(plugin, clientManager, _inventoryManager);
_gadgetManager = new GadgetManager(_plugin, clientManager, donationManager, _inventoryManager, _mountManager, petManager, preferences, disguiseManager, blockRestore, new ProjectileManager(plugin)); _gadgetManager = new GadgetManager(_plugin, clientManager, donationManager, _inventoryManager, _mountManager, petManager, preferences, disguiseManager, blockRestore, new ProjectileManager(plugin));
_treasureManager = new TreasureManager(_plugin, donationManager, _inventoryManager, petManager, _blockRestore, hologramManager); _treasureManager = new TreasureManager(_plugin, clientManager, donationManager, _inventoryManager, petManager, _blockRestore, hologramManager);
new CosmeticManager(_plugin, clientManager, donationManager, _inventoryManager, _gadgetManager, _mountManager, petManager, _treasureManager); new CosmeticManager(_plugin, clientManager, donationManager, _inventoryManager, _gadgetManager, _mountManager, petManager, _treasureManager);
_petManager = petManager; _petManager = petManager;

View File

@ -0,0 +1,74 @@
package mineplex.hub.modules;
import org.bukkit.event.EventHandler;
import mineplex.core.MiniPlugin;
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.util.C;
import mineplex.core.donation.DonationManager;
import mineplex.core.scoreboard.ScoreboardData;
import mineplex.core.scoreboard.ScoreboardManager;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.hub.HubManager;
public class HubScoreboardManager extends MiniPlugin
{
private ScoreboardManager _scoreboardManager;
private String _serverName;
public HubScoreboardManager(HubManager manager, CoreClientManager clientManager, DonationManager donationManager)
{
super("Hub Scoreboard Manager", manager.GetPlugin());
_scoreboardManager = new ScoreboardManager(manager.GetPlugin(), clientManager, donationManager);
init();
}
private String getServerName()
{
if (_serverName == null)
_serverName = GetPlugin().getConfig().getString("serverstatus.name");
return _serverName;
}
private void init()
{
ScoreboardData data = _scoreboardManager.getData("default", true);
data.writeEmpty();
//Server
data.write(C.cAqua + C.Bold + "Server");
data.write(getServerName());
data.writeEmpty();
//Gems
data.write(C.cGreen + C.Bold + "Gems");
data.writePlayerGems();
data.writeEmpty();
//Coins
data.write(C.cYellow + C.Bold + "Coins");
data.writePlayerCoins();
data.writeEmpty();
//Rank
data.write(C.cGold + C.Bold + "Rank");
data.writePlayerRank();
data.writeEmpty();
//Website
data.write(C.cRed + C.Bold + "Website");
data.write("www.mineplex.com");
}
@EventHandler
public void drawUpdate(UpdateEvent event)
{
if (event.getType() == UpdateType.FAST)
_scoreboardManager.draw();
}
}

View File

@ -5,6 +5,8 @@ public enum GameType
//Mini //Mini
Other("Other"), Other("Other"),
Unknown("Unknown"), Unknown("Unknown"),
Lobby("Lobby"),
BaconBrawl("Bacon Brawl"), BaconBrawl("Bacon Brawl"),
Barbarians("A Barbarians Life"), Barbarians("A Barbarians Life"),
Bridge("The Bridges"), Bridge("The Bridges"),
@ -52,8 +54,13 @@ public enum GameType
TurfWars("Turf Wars"), TurfWars("Turf Wars"),
UHC("Ultra Hardcore"), UHC("Ultra Hardcore"),
WitherAssault("Wither Assault"), WitherAssault("Wither Assault"),
WizardBattles("Wizard Battles"), Wizards("Wizards"),
ZombieSurvival("Zombie Survival"), ZombieSurvival("Zombie Survival"),
Upload("Upload"),
InProgress("In Progress"),
None("None"); None("None");
String _name; String _name;

View File

@ -66,7 +66,9 @@ import mineplex.mapparser.command.HubCommand;
import mineplex.mapparser.command.ListCommand; import mineplex.mapparser.command.ListCommand;
import mineplex.mapparser.command.MapCommand; import mineplex.mapparser.command.MapCommand;
import mineplex.mapparser.command.NameCommand; import mineplex.mapparser.command.NameCommand;
import mineplex.mapparser.command.ParseCommand; import mineplex.mapparser.command.ParseCommand200;
import mineplex.mapparser.command.ParseCommand400;
import mineplex.mapparser.command.ParseCommand600;
import mineplex.mapparser.command.RenameCommand; import mineplex.mapparser.command.RenameCommand;
import mineplex.mapparser.command.SaveCommand; import mineplex.mapparser.command.SaveCommand;
import mineplex.mapparser.command.WorldsCommand; import mineplex.mapparser.command.WorldsCommand;
@ -81,6 +83,8 @@ public class MapParser extends JavaPlugin implements Listener
private List<BaseCommand> _commands = new ArrayList<BaseCommand>(); private List<BaseCommand> _commands = new ArrayList<BaseCommand>();
private Location _spawnLocation; private Location _spawnLocation;
private HashMap<Player, Boolean> _permissionMap = new HashMap<Player, Boolean>();
@Override @Override
public void onEnable() public void onEnable()
{ {
@ -104,7 +108,9 @@ public class MapParser extends JavaPlugin implements Listener
_commands.add(new ListCommand(this)); _commands.add(new ListCommand(this));
_commands.add(new MapCommand(this)); _commands.add(new MapCommand(this));
_commands.add(new NameCommand(this)); _commands.add(new NameCommand(this));
_commands.add(new ParseCommand(this)); _commands.add(new ParseCommand200(this));
_commands.add(new ParseCommand400(this));
_commands.add(new ParseCommand600(this));
_commands.add(new RenameCommand(this)); _commands.add(new RenameCommand(this));
_commands.add(new SaveCommand(this)); _commands.add(new SaveCommand(this));
_commands.add(new WorldsCommand(this)); _commands.add(new WorldsCommand(this));
@ -127,11 +133,37 @@ public class MapParser extends JavaPlugin implements Listener
ResetInventory(event.getPlayer()); ResetInventory(event.getPlayer());
DisplayHelp(player); DisplayHelp(player);
for (Plugin plugin : Bukkit.getPluginManager().getPlugins())
player.addAttachment(plugin, "worldedit.*", true);
} }
@EventHandler
public void permissionUpdate(TickEvent event)
{
for (Player player : UtilServer.getPlayers())
{
permissionSet(player);
}
}
public void permissionSet(Player player)
{
boolean hasPermission = GetData(player.getWorld().getName()).HasAccess(player);
if (!_permissionMap.containsKey(player) || _permissionMap.get(player) != hasPermission)
{
for (Plugin plugin : Bukkit.getPluginManager().getPlugins())
{
player.addAttachment(plugin, "worldedit.*", hasPermission);
player.addAttachment(plugin, "voxelsniper.sniper", hasPermission);
player.addAttachment(plugin, "voxelsniper.brush.*", hasPermission);
}
_permissionMap.put(player, hasPermission);
UtilPlayer.message(player, "Plugin Permissions: " + F.tf(hasPermission));
}
}
public void DisplayHelp(Player player) public void DisplayHelp(Player player)
{ {
UtilPlayer.message(player, F.main("Parser", "Listing Commands;")); UtilPlayer.message(player, F.main("Parser", "Listing Commands;"));
@ -440,13 +472,13 @@ public class MapParser extends JavaPlugin implements Listener
public void ResetInventory(Player player) public void ResetInventory(Player player)
{ {
UtilInv.Clear(player); // UtilInv.Clear(player);
//
player.getInventory().addItem(new ItemStack(Material.STONE_SWORD)); // player.getInventory().addItem(new ItemStack(Material.STONE_SWORD));
player.getInventory().addItem(new ItemStack(Material.STONE_SPADE)); // player.getInventory().addItem(new ItemStack(Material.STONE_SPADE));
player.getInventory().addItem(new ItemStack(Material.STONE_PICKAXE)); // player.getInventory().addItem(new ItemStack(Material.STONE_PICKAXE));
player.getInventory().addItem(new ItemStack(Material.STONE_AXE)); // player.getInventory().addItem(new ItemStack(Material.STONE_AXE));
player.getInventory().addItem(new ItemStack(Material.WOOD_AXE)); // player.getInventory().addItem(new ItemStack(Material.WOOD_AXE));
} }
public WorldManager getWorldManager() public WorldManager getWorldManager()
@ -491,7 +523,7 @@ public class MapParser extends JavaPlugin implements Listener
System.out.println(world + ChatColor.RESET + " " + name + ChatColor.RESET + " " + event.getMessage()); System.out.println(world + ChatColor.RESET + " " + name + ChatColor.RESET + " " + event.getMessage());
} }
@EventHandler @EventHandler(priority = EventPriority.LOWEST)
public void InteractCancel(PlayerInteractEvent event) public void InteractCancel(PlayerInteractEvent event)
{ {
//Permission //Permission
@ -501,17 +533,23 @@ public class MapParser extends JavaPlugin implements Listener
} }
} }
@EventHandler @EventHandler(priority = EventPriority.LOWEST)
public void WorldeditCancel(PlayerCommandPreprocessEvent event) public void commandCancel(PlayerCommandPreprocessEvent event)
{ {
if (event.getMessage().startsWith("//")) if (event.getMessage().startsWith("/tp") ||
event.getMessage().startsWith("/hub") ||
event.getMessage().startsWith("/list") ||
event.getMessage().startsWith("/map") ||
event.getMessage().startsWith("/create") ||
event.getMessage().startsWith("/copy") ||
event.getMessage().startsWith("/delete"))
return;
//Permission
if (!GetData(event.getPlayer().getWorld().getName()).HasAccess(event.getPlayer()))
{ {
//Permission UtilPlayer.message(event.getPlayer(), F.main("Parser", "You do not have Build-Access for this Map."));
if (!GetData(event.getPlayer().getWorld().getName()).HasAccess(event.getPlayer())) event.setCancelled(true);
{
UtilPlayer.message(event.getPlayer(), F.main("Parser", "You do not have Build-Access for this Map."));
event.setCancelled(true);
}
} }
} }

View File

@ -46,7 +46,7 @@ public class Parse
private int _processed = 0; private int _processed = 0;
public Parse(MapParser host, World world, String[] args, Location loc, MapData data) public Parse(MapParser host, World world, String[] args, Location loc, MapData data, int size)
{ {
Host = host; Host = host;
@ -56,6 +56,8 @@ public class Parse
_mapData = data; _mapData = data;
_size = size;
for (String arg : args) for (String arg : args)
Host.Announce("Parse Arg: " + F.elem(arg)); Host.Announce("Parse Arg: " + F.elem(arg));

View File

@ -26,22 +26,13 @@ public class CreateCommand extends BaseCommand
@Override @Override
public boolean execute(Player player, String alias, String[] args) public boolean execute(Player player, String alias, String[] args)
{ {
if (args.length < 2) if (args.length < 1)
{ {
message(player, "Invalid Input. " + F.elem("/create <MapName> <GameType>")); message(player, "Invalid Input. " + F.elem("/create <MapName>"));
return true; return true;
} }
GameType gameType = null; GameType gameType = GameType.InProgress;
try
{
gameType = GameType.valueOf(args[1]);
}
catch (Exception e)
{
getPlugin().sendValidGameTypes(player);
}
String worldName = "map/" + gameType.GetName() + "/" + args[0]; String worldName = "map/" + gameType.GetName() + "/" + args[0];

View File

@ -5,6 +5,7 @@ import java.io.File;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.mapparser.GameType; import mineplex.mapparser.GameType;
@ -15,6 +16,8 @@ import mineplex.mapparser.MapParser;
*/ */
public class ListCommand extends BaseCommand public class ListCommand extends BaseCommand
{ {
private boolean _colorSwitch = false;
public ListCommand(MapParser plugin) public ListCommand(MapParser plugin)
{ {
super(plugin, "list"); super(plugin, "list");
@ -27,9 +30,12 @@ public class ListCommand extends BaseCommand
{ {
UtilPlayer.message(player, F.main("Parser", "Listing Maps;")); UtilPlayer.message(player, F.main("Parser", "Listing Maps;"));
boolean colorSwitch = false;
for (GameType gameType : GameType.values()) for (GameType gameType : GameType.values())
{ {
listMaps(player, gameType); if (listMaps(player, gameType, colorSwitch))
colorSwitch = !colorSwitch;
} }
} }
else if (args.length == 1) else if (args.length == 1)
@ -46,20 +52,22 @@ public class ListCommand extends BaseCommand
UtilPlayer.message(player, F.main("Parser", "Listing Maps for gametype " + F.elem(gameType.GetName()))); UtilPlayer.message(player, F.main("Parser", "Listing Maps for gametype " + F.elem(gameType.GetName())));
listMaps(player, gameType); listMaps(player, gameType, false);
} }
return true; return true;
} }
private void listMaps(Player player, GameType gameType) private boolean listMaps(Player player, GameType gameType, boolean colorSwitch)
{ {
String maps = ""; String maps = "";
ChatColor color = ChatColor.YELLOW; ChatColor color = ChatColor.AQUA;
if (colorSwitch)
color = ChatColor.GREEN;
File mapsFolder = new File("map" + File.separator + gameType.GetName()); File mapsFolder = new File("map" + File.separator + gameType.GetName());
if (!mapsFolder.exists()) if (!mapsFolder.exists())
return; return false;
for (File file : mapsFolder.listFiles()) for (File file : mapsFolder.listFiles())
{ {
@ -68,17 +76,26 @@ public class ListCommand extends BaseCommand
maps += color + file.getName() + " "; maps += color + file.getName() + " ";
if (color == ChatColor.YELLOW) if (color == ChatColor.AQUA)
color = ChatColor.GOLD; color = ChatColor.DARK_AQUA;
else else if (color == ChatColor.DARK_AQUA)
color = ChatColor.YELLOW; color = ChatColor.AQUA;
else if (color == ChatColor.GREEN)
color = ChatColor.DARK_GREEN;
else if (color == ChatColor.DARK_GREEN)
color = ChatColor.GREEN;
} }
// Print line of maps for specific gametype // Print line of maps for specific gametype
if (maps.length() > 0) if (maps.length() > 0)
{ {
maps = F.elem(gameType.name()) + "> " + maps; maps = F.elem(ChatColor.RESET + C.Scramble + "!" + ChatColor.RESET + C.Bold + gameType.name()) + "> " + maps;
player.sendMessage(maps); player.sendMessage(maps);
return true;
} }
return false;
} }
} }

View File

@ -12,11 +12,11 @@ import mineplex.mapparser.Parse;
/** /**
* Created by Shaun on 8/15/2014. * Created by Shaun on 8/15/2014.
*/ */
public class ParseCommand extends BaseCommand public class ParseCommand200 extends BaseCommand
{ {
public ParseCommand(MapParser plugin) public ParseCommand200(MapParser plugin)
{ {
super(plugin, "parse"); super(plugin, "parse200");
} }
@Override @Override
@ -57,7 +57,7 @@ public class ParseCommand extends BaseCommand
} }
//Parse the World //Parse the World
getPlugin().setCurrentParse(new Parse(getPlugin(), parseableWorld, args, parseLoc, getPlugin().GetData(parseLoc.getWorld().getName()))); getPlugin().setCurrentParse(new Parse(getPlugin(), parseableWorld, args, parseLoc, getPlugin().GetData(parseLoc.getWorld().getName()), 200));
return true; return true;
} }

View File

@ -0,0 +1,64 @@
package mineplex.mapparser.command;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.entity.Player;
import mineplex.core.common.util.F;
import mineplex.mapparser.MapData;
import mineplex.mapparser.MapParser;
import mineplex.mapparser.Parse;
/**
* Created by Shaun on 8/15/2014.
*/
public class ParseCommand400 extends BaseCommand
{
public ParseCommand400(MapParser plugin)
{
super(plugin, "parse400");
}
@Override
public boolean execute(Player player, String alias, String[] args)
{
if (!player.isOp())
{
message(player, "Only OPs can parse maps!");
return true;
}
Location parseLoc = player.getLocation();
World world = parseLoc.getWorld();
MapData data = getPlugin().GetData(world.getName());
if (data.MapName.equals("null") || data.MapCreator.equals("null") || data.MapGameType.equals("null"))
{
message(player, "Map Name/Author/GameType are not set!");
return true;
}
//Teleport Players Out
for (Player worldPlayer : world.getPlayers())
{
worldPlayer.teleport(getPlugin().getSpawnLocation());
message(player, "World " + F.elem(world.getName()) + " is preparing to be parsed.");
}
//Unload World > Copy
World parseableWorld = getPlugin().getWorldManager().prepMapParse(world);
if (parseableWorld == null)
{
message(player, "Could not prepare world for parsing!");
return true;
}
//Parse the World
getPlugin().setCurrentParse(new Parse(getPlugin(), parseableWorld, args, parseLoc, getPlugin().GetData(parseLoc.getWorld().getName()), 400));
return true;
}
}

View File

@ -0,0 +1,64 @@
package mineplex.mapparser.command;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.entity.Player;
import mineplex.core.common.util.F;
import mineplex.mapparser.MapData;
import mineplex.mapparser.MapParser;
import mineplex.mapparser.Parse;
/**
* Created by Shaun on 8/15/2014.
*/
public class ParseCommand600 extends BaseCommand
{
public ParseCommand600(MapParser plugin)
{
super(plugin, "parse","parse600");
}
@Override
public boolean execute(Player player, String alias, String[] args)
{
if (!player.isOp())
{
message(player, "Only OPs can parse maps!");
return true;
}
Location parseLoc = player.getLocation();
World world = parseLoc.getWorld();
MapData data = getPlugin().GetData(world.getName());
if (data.MapName.equals("null") || data.MapCreator.equals("null") || data.MapGameType.equals("null"))
{
message(player, "Map Name/Author/GameType are not set!");
return true;
}
//Teleport Players Out
for (Player worldPlayer : world.getPlayers())
{
worldPlayer.teleport(getPlugin().getSpawnLocation());
message(player, "World " + F.elem(world.getName()) + " is preparing to be parsed.");
}
//Unload World > Copy
World parseableWorld = getPlugin().getWorldManager().prepMapParse(world);
if (parseableWorld == null)
{
message(player, "Could not prepare world for parsing!");
return true;
}
//Parse the World
getPlugin().setCurrentParse(new Parse(getPlugin(), parseableWorld, args, parseLoc, getPlugin().GetData(parseLoc.getWorld().getName()), 600));
return true;
}
}

View File

@ -41,6 +41,8 @@ public class CustomExplosion extends Explosion
private DamageManager _manager; private DamageManager _manager;
private String _damageReason; private String _damageReason;
private boolean _dropItems = true; private boolean _dropItems = true;
private boolean _damageBlocksEqually;
private boolean _createFire;
public CustomExplosion(DamageManager manager, Location loc, float explosionSize, String deathCause) public CustomExplosion(DamageManager manager, Location loc, float explosionSize, String deathCause)
{ {
@ -50,12 +52,18 @@ public class CustomExplosion extends Explosion
_damageReason = deathCause; _damageReason = deathCause;
} }
public CustomExplosion setBlocksDamagedEqually(boolean damageEqually)
{
_damageBlocksEqually = damageEqually;
return this;
}
public CustomExplosion explode() public CustomExplosion explode()
{ {
// Explode the explosion // Explode the explosion
a(); a();
a(true); a(true);
return this; return this;
} }
@ -116,8 +124,8 @@ public class CustomExplosion extends Explosion
if (block.getMaterial() != Material.AIR) if (block.getMaterial() != Material.AIR)
{ {
float f3 = this.source != null ? this.source.a(this, this._world, l, i1, j1, block) : block float f3 = this.source != null ? this.source.a(this, this._world, l, i1, j1, block)
.a(this.source); : (_damageBlocksEqually ? Blocks.DIRT : block).a(this.source);
f1 -= (f3 + 0.3F) * f2; f1 -= (f3 + 0.3F) * f2;
} }
@ -295,7 +303,7 @@ public class CustomExplosion extends Explosion
} }
} }
if (this.a) if (this._createFire)
{ {
Iterator iterator = this.blocks.iterator(); Iterator iterator = this.blocks.iterator();

View File

@ -123,7 +123,7 @@ public class Arcade extends JavaPlugin
new MemoryFix(this); new MemoryFix(this);
new CustomTagFix(this, packetHandler); new CustomTagFix(this, packetHandler);
new FriendManager(this, _clientManager, preferenceManager); new FriendManager(this, _clientManager, preferenceManager, portal);
//Updates //Updates
getServer().getScheduler().scheduleSyncRepeatingTask(this, new Updater(this), 1, 1); getServer().getScheduler().scheduleSyncRepeatingTask(this, new Updater(this), 1, 1);

View File

@ -110,9 +110,9 @@ import nautilus.game.arcade.managers.GameWorldManager;
import nautilus.game.arcade.managers.IdleManager; import nautilus.game.arcade.managers.IdleManager;
import nautilus.game.arcade.managers.MiscManager; import nautilus.game.arcade.managers.MiscManager;
import nautilus.game.arcade.shop.ArcadeShop; import nautilus.game.arcade.shop.ArcadeShop;
public class ArcadeManager extends MiniPlugin implements IRelation public class ArcadeManager extends MiniPlugin implements IRelation
{ {
// Modules // Modules
private BlockRestore _blockRestore; private BlockRestore _blockRestore;
private Blood _blood; private Blood _blood;
@ -129,7 +129,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation
private Fire _fire; private Fire _fire;
private ProjectileManager _projectileManager; private ProjectileManager _projectileManager;
private Portal _portal; private Portal _portal;
private ArcadeShop _arcadeShop; private ArcadeShop _arcadeShop;
@ -594,19 +594,9 @@ public class ArcadeManager extends MiniPlugin implements IRelation
@EventHandler @EventHandler
public void MessageJoin(PlayerJoinEvent event) public void MessageJoin(PlayerJoinEvent event)
{ {
if (_game == null || _game.AnnounceJoinQuit) if (_game != null && _game.AnnounceJoinQuit)
{ event.setJoinMessage(F.sys("Join", GetColor(event.getPlayer()) + event.getPlayer().getName()));
Player player = event.getPlayer();
if (_clientManager.Get(player).GetRank() != Rank.LEGEND)
event.setJoinMessage(null);
else
{
event.setJoinMessage(C.cGreen + C.Bold + "Legend " + player.getName() + " has joined!");
UtilFirework.playFirework(player.getEyeLocation(), org.bukkit.FireworkEffect.Type.BALL_LARGE, Color.LIME, true, true);
player.getWorld().playSound(player.getEyeLocation(), Sound.WITHER_SPAWN, 2f, 1f);
}
}
else else
event.setJoinMessage(null); event.setJoinMessage(null);
} }

View File

@ -50,7 +50,7 @@ import nautilus.game.arcade.game.games.tug.Tug;
import nautilus.game.arcade.game.games.turfforts.TurfForts; import nautilus.game.arcade.game.games.turfforts.TurfForts;
import nautilus.game.arcade.game.games.uhc.UHC; import nautilus.game.arcade.game.games.uhc.UHC;
import nautilus.game.arcade.game.games.wither.WitherGame; import nautilus.game.arcade.game.games.wither.WitherGame;
import nautilus.game.arcade.game.games.wizards.WizardBattles; import nautilus.game.arcade.game.games.wizards.Wizards;
import nautilus.game.arcade.game.games.zombiesurvival.ZombieSurvival; import nautilus.game.arcade.game.games.zombiesurvival.ZombieSurvival;
public class GameFactory public class GameFactory
@ -108,7 +108,7 @@ public class GameFactory
else if (gameType == GameType.TurfWars) return new TurfForts(_manager); else if (gameType == GameType.TurfWars) return new TurfForts(_manager);
else if (gameType == GameType.UHC) return new UHC(_manager); else if (gameType == GameType.UHC) return new UHC(_manager);
else if (gameType == GameType.WitherAssault) return new WitherGame(_manager); else if (gameType == GameType.WitherAssault) return new WitherGame(_manager);
else if (gameType == GameType.WizardBattles) return new WizardBattles(_manager); else if (gameType == GameType.Wizards) return new Wizards(_manager);
else if (gameType == GameType.ZombieSurvival) return new ZombieSurvival(_manager); else if (gameType == GameType.ZombieSurvival) return new ZombieSurvival(_manager);
else return null; else return null;
} }

View File

@ -52,7 +52,7 @@ public enum GameType
TurfWars("Turf Wars", Material.STAINED_CLAY, (byte)14, GameCategory.ARCADE), TurfWars("Turf Wars", Material.STAINED_CLAY, (byte)14, GameCategory.ARCADE),
UHC("Ultra Hardcore", Material.GOLDEN_APPLE, (byte)0, GameCategory.SURVIVAL), UHC("Ultra Hardcore", Material.GOLDEN_APPLE, (byte)0, GameCategory.SURVIVAL),
WitherAssault("Wither Assault", Material.SKULL_ITEM, (byte)1, GameCategory.ARCADE), WitherAssault("Wither Assault", Material.SKULL_ITEM, (byte)1, GameCategory.ARCADE),
WizardBattles("Wizard Battles", Material.BLAZE_ROD, (byte)0, GameCategory.SURVIVAL), Wizards("Wizards", Material.BLAZE_ROD, (byte)0, GameCategory.SURVIVAL),
ZombieSurvival("Zombie Survival", Material.SKULL_ITEM, (byte)2, GameCategory.SURVIVAL); ZombieSurvival("Zombie Survival", Material.SKULL_ITEM, (byte)2, GameCategory.SURVIVAL);
String _name; String _name;

View File

@ -149,6 +149,8 @@ public class Bridge extends TeamGame implements OreObsfucation
"The last team alive wins!" "The last team alive wins!"
}); });
this.CompassSpectatorMenu = false;
_ore = new OreHider(); _ore = new OreHider();
// Flags // Flags

View File

@ -4,11 +4,11 @@ import org.bukkit.entity.EntityType;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.SmashKit;
public abstract class AbstractKitChaser extends SmashKit public abstract class AbstractKitChaser extends Kit
{ {
public AbstractKitChaser(ArcadeManager manager, String name, KitAvailability kitAvailability, String[] kitDesc, Perk[] kitPerks, EntityType entityType, ItemStack itemInHand) public AbstractKitChaser(ArcadeManager manager, String name, KitAvailability kitAvailability, String[] kitDesc, Perk[] kitPerks, EntityType entityType, ItemStack itemInHand)
{ {

View File

@ -199,7 +199,7 @@ public class DragonEscape extends SoloGame
@EventHandler @EventHandler
public void Invisibility(PlayerKitGiveEvent event) public void Invisibility(PlayerKitGiveEvent event)
{ {
Manager.GetCondition().Factory().Invisible(GetName(), event.GetPlayer(), event.GetPlayer(), 25, 0, false, false, false); Manager.GetCondition().Factory().Invisible(GetName(), event.GetPlayer(), event.GetPlayer(), 40, 0, false, false, false);
} }
@EventHandler @EventHandler

View File

@ -68,8 +68,8 @@ public class DragonEscapeTeams extends TeamGame
new Kit[] new Kit[]
{ {
new KitLeaper(manager), new KitLeaper(manager),
//new KitDisruptor(manager),
new KitWarper(manager), new KitWarper(manager),
new KitDigger(manager),
}, },
new String[] new String[]

View File

@ -13,12 +13,12 @@ import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.kit.AbbreviatedKit;
import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.SmashKit;
import nautilus.game.arcade.kit.perks.*; import nautilus.game.arcade.kit.perks.*;
public class KitFinn extends SmashKit public class KitFinn extends AbbreviatedKit
{ {
public KitFinn(ArcadeManager manager) public KitFinn(ArcadeManager manager)
{ {

View File

@ -14,12 +14,12 @@ import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.kit.AbbreviatedKit;
import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.SmashKit;
import nautilus.game.arcade.kit.perks.*; import nautilus.game.arcade.kit.perks.*;
public class KitRobinHood extends SmashKit public class KitRobinHood extends AbbreviatedKit
{ {
public KitRobinHood(ArcadeManager manager) public KitRobinHood(ArcadeManager manager)
{ {

View File

@ -14,12 +14,13 @@ import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.kit.AbbreviatedKit;
import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.SmashKit; import nautilus.game.arcade.kit.SmashKit;
import nautilus.game.arcade.kit.perks.*; import nautilus.game.arcade.kit.perks.*;
public class KitThor extends SmashKit public class KitThor extends AbbreviatedKit
{ {
public KitThor(ArcadeManager manager) public KitThor(ArcadeManager manager)
{ {

View File

@ -11,12 +11,13 @@ import mineplex.core.disguise.disguises.DisguiseCow;
import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.itemstack.ItemStackFactory;
import mineplex.minecraft.game.core.damage.CustomDamageEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.kit.AbbreviatedKit;
import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.SmashKit; import nautilus.game.arcade.kit.SmashKit;
import nautilus.game.arcade.kit.perks.*; import nautilus.game.arcade.kit.perks.*;
public class KitCow extends SmashKit public class KitCow extends AbbreviatedKit
{ {
public KitCow(ArcadeManager manager) public KitCow(ArcadeManager manager)
{ {

View File

@ -34,7 +34,7 @@ public class QuiverTeams extends TeamGame
private HashMap<GameTeam, Integer> _teamKills = new HashMap<GameTeam, Integer>(); private HashMap<GameTeam, Integer> _teamKills = new HashMap<GameTeam, Integer>();
private HashMap<Player, Long> _deathTime = new HashMap<Player, Long>(); private HashMap<Player, Long> _deathTime = new HashMap<Player, Long>();
private int _reqKills = 60; private int _reqKills = 100;
public QuiverTeams(ArcadeManager manager) public QuiverTeams(ArcadeManager manager)
{ {

View File

@ -34,6 +34,7 @@ public class KitEvolvePage extends ShopPageBase<KitEvolve, KitEvolveShop>
{ {
Kit hisKit = _search.GetKit(Player); Kit hisKit = _search.GetKit(Player);
UpgradeKit kit = null; UpgradeKit kit = null;
for (UpgradeKit k : _kits) for (UpgradeKit k : _kits)
{ {
if (k.kit == hisKit) if (k.kit == hisKit)
@ -42,44 +43,55 @@ public class KitEvolvePage extends ShopPageBase<KitEvolve, KitEvolveShop>
break; break;
} }
} }
boolean canEvolve = _search.canEvolve(Player); boolean canEvolve = _search.canEvolve(Player);
AddItem(kit.kitSlot, makeItem(kit.kit)); AddItem(kit.kitSlot, makeItem(kit.kit));
for (int slot : kit.path) for (int slot : kit.path)
{ {
AddItem(slot, makeItem(new ItemBuilder(Material.STAINED_GLASS_PANE, 1, (short) 15).setTitle(" ").build())); AddItem(slot, makeItem(new ItemBuilder(Material.STAINED_GLASS_PANE, 1, (short) 15).setTitle(" ").build()));
} }
if (kit.daddy != null) if (kit.daddy != null)
{ {
AddItem(kit.daddy.kitSlot, makeItem(kit.daddy.kit)); AddItem(kit.daddy.kitSlot, makeItem(kit.daddy.kit));
for (int slot : kit.daddy.path) for (int slot : kit.daddy.path)
{ {
AddItem(slot, makeItem(new ItemBuilder(Material.STAINED_GLASS_PANE, 1, (short) 15).setTitle(" ").build())); AddItem(slot, makeItem(new ItemBuilder(Material.STAINED_GLASS_PANE, 1, (short) 15).setTitle(" ").build()));
} }
if (kit.daddy.daddy != null) if (kit.daddy.daddy != null)
{ {
AddItem(kit.daddy.daddy.kitSlot, makeItem(kit.daddy.daddy.kit)); AddItem(kit.daddy.daddy.kitSlot, makeItem(kit.daddy.daddy.kit));
} }
} }
if (canEvolve) if (canEvolve)
{ {
for (UpgradeKit child : kit.children) for (UpgradeKit child : kit.children)
{ {
for (int slot : child.path) for (int slot : child.path)
AddItem(slot, makeItem(new ItemBuilder(Material.STAINED_GLASS_PANE).setTitle(" ").build())); AddItem(slot, makeItem(new ItemBuilder(Material.STAINED_GLASS_PANE).setTitle(" ").build()));
AddButton(child.kitSlot, makeItem(child.kit), new EvolveButton(_search, child.kit)); AddButton(child.kitSlot, makeItem(child.kit), new EvolveButton(_search, child.kit));
} }
} }
for (UpgradeKit k : _kits) for (UpgradeKit k : _kits)
{ {
ItemStack item = getItem(k.kitSlot); ItemStack item = getItem(k.kitSlot);
if (item == null || item.getType() == Material.AIR) if (item == null || item.getType() == Material.AIR)
{ {
AddItem(k.kitSlot, makeItem(new ItemBuilder(Material.COAL).setTitle(C.cRed + "Locked").build())); AddItem(k.kitSlot, makeItem(new ItemBuilder(Material.COAL).setTitle(C.cRed + "Locked").build()));
} }
} }
for (int slot = 0; slot < this.getSize(); slot++) for (int slot = 0; slot < this.getSize(); slot++)
{ {
ItemStack item = getItem(slot); ItemStack item = getItem(slot);
if (item == null || item.getType() == Material.AIR) if (item == null || item.getType() == Material.AIR)
{ {
AddItem(slot, makeItem(new ItemBuilder(Material.STAINED_GLASS_PANE, 1, (short) 12).setTitle(" ").build())); AddItem(slot, makeItem(new ItemBuilder(Material.STAINED_GLASS_PANE, 1, (short) 12).setTitle(" ").build()));

View File

@ -33,6 +33,7 @@ public class KitTitan extends Kit
@Override @Override
public void GiveItems(Player player) public void GiveItems(Player player)
{ {
PlayerInventory inv = player.getInventory(); PlayerInventory inv = player.getInventory();
inv.setItem(2, new ItemBuilder(Material.BLAZE_POWDER).setTitle(ChatColor.GOLD + "Fuse").build()); inv.setItem(2, new ItemBuilder(Material.BLAZE_POWDER).setTitle(ChatColor.GOLD + "Fuse").build());
inv.addItem(new ItemBuilder(Material.IRON_SWORD) inv.addItem(new ItemBuilder(Material.IRON_SWORD)

View File

@ -1,8 +1,17 @@
package nautilus.game.arcade.game.games.smash; package nautilus.game.arcade.game.games.smash;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet;
import org.bukkit.ChatColor;
import org.bukkit.FireworkEffect.Type;
import org.bukkit.Color;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound; import org.bukkit.Sound;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.EnderCrystal;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
@ -17,8 +26,17 @@ import org.bukkit.event.player.PlayerInteractEvent;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilFirework;
import mineplex.core.common.util.UtilInv; import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer; 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.recharge.Recharge; import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
@ -32,6 +50,7 @@ import nautilus.game.arcade.game.SoloGame;
import nautilus.game.arcade.game.GameTeam.PlayerState; import nautilus.game.arcade.game.GameTeam.PlayerState;
import nautilus.game.arcade.game.games.smash.kits.*; import nautilus.game.arcade.game.games.smash.kits.*;
import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.SmashKit;
import nautilus.game.arcade.stats.KillFastStatTracker; import nautilus.game.arcade.stats.KillFastStatTracker;
import nautilus.game.arcade.stats.FreeKitWinStatTracker; import nautilus.game.arcade.stats.FreeKitWinStatTracker;
import nautilus.game.arcade.stats.OneVThreeStatTracker; import nautilus.game.arcade.stats.OneVThreeStatTracker;
@ -41,25 +60,32 @@ import nautilus.game.arcade.stats.WinWithoutDyingStatTracker;
public class SuperSmash extends SoloGame public class SuperSmash extends SoloGame
{ {
private HashMap<Player, Integer> _lives = new HashMap<Player, Integer>(); private HashMap<Player, Integer> _lives = new HashMap<Player, Integer>();
private Location _powerupCurrent = null;
private Location _powerupTarget = null;
private EnderCrystal _powerup = null;
private long _lastPowerup = 0;
private HashSet<BlockData> _restoreBlock = new HashSet<BlockData>();
public SuperSmash(ArcadeManager manager) public SuperSmash(ArcadeManager manager)
{ {
super(manager, GameType.Smash, super(manager, GameType.Smash,
new Kit[] new Kit[]
{ {
new KitSkeleton(manager), new KitSkeleton(manager),
new KitGolem(manager), new KitGolem(manager),
new KitSpider(manager), new KitSpider(manager),
new KitSlime(manager), new KitSlime(manager),
new KitCreeper(manager), new KitCreeper(manager),
new KitEnderman(manager), new KitEnderman(manager),
new KitSnowman(manager), new KitSnowman(manager),
new KitWolf(manager), new KitWolf(manager),
new KitBlaze(manager), new KitBlaze(manager),
new KitWitch(manager), new KitWitch(manager),
new KitChicken(manager), new KitChicken(manager),
@ -68,7 +94,8 @@ public class SuperSmash extends SoloGame
new KitSkySquid(manager), new KitSkySquid(manager),
new KitWitherSkeleton(manager), new KitWitherSkeleton(manager),
new KitMagmaCube(manager), new KitMagmaCube(manager),
new KitZombie(manager),
new KitSheep(manager) new KitSheep(manager)
}, },
@ -84,13 +111,15 @@ public class SuperSmash extends SoloGame
this.DeathOut = false; this.DeathOut = false;
this.DamageTeamSelf = true; this.DamageTeamSelf = true;
this.CompassEnabled = true; this.CompassEnabled = true;
this.DeathSpectateSecs = 4; this.DeathSpectateSecs = 4;
this.SpawnDistanceRequirement = 16; this.SpawnDistanceRequirement = 32;
this.WorldWaterDamage = 1000;
// Add stat table here // Add stat table here
// Example // Example
//Manager.GetStatsManager().addTable("SuperSmashMobStats", "Kills", "Deaths", "Wins", "Losses"); //Manager.GetStatsManager().addTable("SuperSmashMobStats", "Kills", "Deaths", "Wins", "Losses");
@ -101,7 +130,7 @@ public class SuperSmash extends SoloGame
new OneVThreeStatTracker(this), new OneVThreeStatTracker(this),
new KillFastStatTracker(this, 3, 10, "TripleKill"), new KillFastStatTracker(this, 3, 10, "TripleKill"),
new RecoveryMasterStatTracker(this) new RecoveryMasterStatTracker(this)
); );
} }
@EventHandler(priority = EventPriority.HIGH) @EventHandler(priority = EventPriority.HIGH)
@ -127,32 +156,32 @@ public class SuperSmash extends SoloGame
{ {
if (!_lives.containsKey(player)) if (!_lives.containsKey(player))
return 0; return 0;
if (!IsAlive(player)) if (!IsAlive(player))
return 0; return 0;
return _lives.get(player); return _lives.get(player);
} }
private boolean LoseLife(Player player) private boolean LoseLife(Player player)
{ {
int lives = GetLives(player) - 1; int lives = GetLives(player) - 1;
if (lives > 0) if (lives > 0)
{ {
UtilPlayer.message(player, C.cRed + C.Bold + "You have died!"); UtilPlayer.message(player, C.cRed + C.Bold + "You have died!");
UtilPlayer.message(player, C.cRed + C.Bold + "You have " + lives + " lives left!"); UtilPlayer.message(player, C.cRed + C.Bold + "You have " + lives + " lives left!");
player.playSound(player.getLocation(), Sound.NOTE_BASS_GUITAR, 2f, 0.5f); player.playSound(player.getLocation(), Sound.NOTE_BASS_GUITAR, 2f, 0.5f);
_lives.put(player, lives); _lives.put(player, lives);
return true; return true;
} }
else else
{ {
UtilPlayer.message(player, C.cRed + C.Bold + "You are out of the game!"); UtilPlayer.message(player, C.cRed + C.Bold + "You are out of the game!");
player.playSound(player.getLocation(), Sound.EXPLODE, 2f, 1f); player.playSound(player.getLocation(), Sound.EXPLODE, 2f, 1f);
return false; return false;
} }
} }
@ -172,7 +201,7 @@ public class SuperSmash extends SoloGame
Scoreboard.WriteBlank(); Scoreboard.WriteBlank();
Scoreboard.Write(C.cGreen + "Players Alive"); Scoreboard.Write(C.cGreen + "Players Alive");
Scoreboard.Write(GetPlayers(true).size() + " "); Scoreboard.Write(GetPlayers(true).size() + " ");
Scoreboard.WriteBlank(); Scoreboard.WriteBlank();
Scoreboard.Write(C.cRed + "Players Dead"); Scoreboard.Write(C.cRed + "Players Dead");
Scoreboard.Write((GetPlayers(false).size() - GetPlayers(true).size()) + " "); Scoreboard.Write((GetPlayers(false).size() - GetPlayers(true).size()) + " ");
@ -180,12 +209,12 @@ public class SuperSmash extends SoloGame
else else
{ {
Scoreboard.WriteBlank(); Scoreboard.WriteBlank();
//Write New //Write New
for (Player player : GetPlayers(true)) for (Player player : GetPlayers(true))
{ {
int lives = GetLives(player); int lives = GetLives(player);
String out; String out;
if (lives >= 4) out = C.cGreen + player.getName(); if (lives >= 4) out = C.cGreen + player.getName();
else if (lives == 3) out = C.cYellow + player.getName(); else if (lives == 3) out = C.cYellow + player.getName();
@ -194,34 +223,150 @@ public class SuperSmash extends SoloGame
else if (lives == 0) out = C.cRed + player.getName(); else if (lives == 0) out = C.cRed + player.getName();
else else
continue; continue;
Scoreboard.WriteOrdered("Lives", out, lives, true); Scoreboard.WriteOrdered("Lives", out, lives, true);
} }
} }
Scoreboard.Draw(); Scoreboard.Draw();
} }
@EventHandler
public void powerupSpawn(UpdateEvent event)
{
if (event.getType() != UpdateType.FASTER)
return;
if (!IsLive())
return;
if (_powerup == null)
{
if (!UtilTime.elapsed(_lastPowerup, 12000))
return;
if (WorldData.GetDataLocs("RED").isEmpty())
return;
if (_powerupTarget == null)
{
Location newTarget = UtilAlg.Random(WorldData.GetDataLocs("RED"));
_powerupTarget = newTarget;
_powerupCurrent = _powerupTarget.clone().add(0, 160, 0);
//Blocks
for (int x=-1 ; x<=1 ; x++)
for (int z=-1 ; z<=1 ; z++)
{
_restoreBlock.add(new BlockData(_powerupTarget.getBlock().getRelative(x, -2, z)));
_restoreBlock.add(new BlockData(_powerupTarget.getBlock().getRelative(x, -1, z)));
_powerupTarget.getBlock().getRelative(x, -2, z).setType(Material.IRON_BLOCK);
_powerupTarget.getBlock().getRelative(x, -1, z).setType(Material.QUARTZ_BLOCK);
}
_powerupTarget.getBlock().getRelative(BlockFace.DOWN).setType(Material.BEACON);
}
if (_powerupTarget.getY() < _powerupCurrent.getY())
{
_powerupCurrent.add(0, -2, 0);
UtilFirework.playFirework(_powerupCurrent, Type.BURST, Color.RED, false, true);
}
else
{
CreatureAllowOverride = true;
_powerup = _powerupTarget.getWorld().spawn(_powerupTarget, EnderCrystal.class);
CreatureAllowOverride = false;
_powerupTarget.getBlock().getRelative(BlockFace.DOWN).setType(Material.GLASS);
_powerupTarget = null;
_powerupCurrent = null;
_lastPowerup = System.currentTimeMillis();
//Restore Blocks
for (BlockData block : _restoreBlock)
block.restore(true);
_restoreBlock.clear();
}
}
}
@EventHandler
public void powerupPickup(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
if (!IsLive())
return;
if (_powerup == null)
return;
Player best = null;
double bestDist = 0;
for (Player player : GetPlayers(true))
{
double dist = UtilMath.offset(player, _powerup);
if (dist > 2)
continue;
if (best == null || dist < bestDist)
{
best = player;
bestDist = dist;
}
}
if (best != null)
{
_powerup.remove();
_powerup = null;
best.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.NETHER_STAR, (byte)0, ((SmashKit)GetKit(best)).getSuperCharges(),
C.cYellow + C.Bold + "Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + ((SmashKit)GetKit(best)).getSuperName()));
_lastPowerup = System.currentTimeMillis();
Manager.GetGame().Announce(C.Bold + best.getName() + " collected " + C.cGreen + C.Bold + "Smash Crystal" + ChatColor.RESET + C.Bold + "!");
best.setHealth(20);
}
}
@EventHandler(priority = EventPriority.LOWEST)
public void powerupDamage(EntityDamageEvent event)
{
if (_powerup != null && _powerup.equals(event.getEntity()))
event.setCancelled(true);
}
@EventHandler(priority = EventPriority.LOWEST) @EventHandler(priority = EventPriority.LOWEST)
public void FallDamage(CustomDamageEvent event) public void FallDamage(CustomDamageEvent event)
{ {
if (event.IsCancelled()) if (event.IsCancelled())
return; return;
if (event.GetCause() == DamageCause.FALL) if (event.GetCause() == DamageCause.FALL)
event.SetCancelled("No Fall Damage"); event.SetCancelled("No Fall Damage");
} }
@EventHandler(priority = EventPriority.HIGH) @EventHandler(priority = EventPriority.HIGH)
public void Knockback(CustomDamageEvent event) public void Knockback(CustomDamageEvent event)
{ {
if (event.IsCancelled()) if (event.IsCancelled())
return; return;
if (event.GetDamageePlayer() != null) if (event.GetDamageePlayer() != null)
event.AddKnockback("Smash Knockback", 1 + 0.1 * (20 - event.GetDamageePlayer().getHealth())); event.AddKnockback("Smash Knockback", 1 + 0.1 * (20 - event.GetDamageePlayer().getHealth()));
} }
@EventHandler(priority = EventPriority.HIGH) @EventHandler(priority = EventPriority.HIGH)
public void ArenaWalls(CustomDamageEvent event) public void ArenaWalls(CustomDamageEvent event)
{ {
@ -232,27 +377,27 @@ public class SuperSmash extends SoloGame
{ {
event.GetDamageeEntity().eject(); event.GetDamageeEntity().eject();
event.GetDamageeEntity().leaveVehicle(); event.GetDamageeEntity().leaveVehicle();
if (event.GetDamageePlayer() != null) if (event.GetDamageePlayer() != null)
event.GetDamageeEntity().getWorld().strikeLightningEffect(event.GetDamageeEntity().getLocation()); event.GetDamageeEntity().getWorld().strikeLightningEffect(event.GetDamageeEntity().getLocation());
event.AddMod("Smash", "Super Smash Mobs", 5000, false); event.AddMod("Smash", "Super Smash Mobs", 5000, false);
} }
} }
@EventHandler @EventHandler
public void HealthChange(EntityRegainHealthEvent event) public void HealthChange(EntityRegainHealthEvent event)
{ {
if (event.getRegainReason() == RegainReason.SATIATED) if (event.getRegainReason() == RegainReason.SATIATED)
event.setCancelled(true); event.setCancelled(true);
} }
@EventHandler(priority = EventPriority.MONITOR) @EventHandler(priority = EventPriority.MONITOR)
public void EntityDeath(EntityDeathEvent event) public void EntityDeath(EntityDeathEvent event)
{ {
event.getDrops().clear(); event.getDrops().clear();
} }
@Override @Override
public void SetKit(Player player, Kit kit, boolean announce) public void SetKit(Player player, Kit kit, boolean announce)
{ {
@ -277,112 +422,103 @@ public class SuperSmash extends SoloGame
UtilInv.Update(player); UtilInv.Update(player);
} }
} }
@EventHandler(priority = EventPriority.LOWEST) @EventHandler(priority = EventPriority.LOWEST)
public void AbilityDescription(PlayerInteractEvent event) public void AbilityDescription(PlayerInteractEvent event)
{ {
if (event.isCancelled()) if (event.isCancelled())
return; return;
Player player = event.getPlayer(); Player player = event.getPlayer();
if (player.getItemInHand() == null) if (player.getItemInHand() == null)
return; return;
if (player.getItemInHand().getItemMeta() == null) if (player.getItemInHand().getItemMeta() == null)
return; return;
if (player.getItemInHand().getItemMeta().getDisplayName() == null) if (player.getItemInHand().getItemMeta().getDisplayName() == null)
return; return;
if (player.getItemInHand().getItemMeta().getLore() == null) if (player.getItemInHand().getItemMeta().getLore() == null)
return; return;
if (Manager.GetGame() == null || Manager.GetGame().GetState() != GameState.Recruit) if (Manager.GetGame() == null || Manager.GetGame().GetState() != GameState.Recruit)
return; return;
for (int i=player.getItemInHand().getItemMeta().getLore().size() ; i<=7 ; i++) for (int i=player.getItemInHand().getItemMeta().getLore().size() ; i<=7 ; i++)
UtilPlayer.message(player, " "); UtilPlayer.message(player, " ");
UtilPlayer.message(player, ArcadeFormat.Line); UtilPlayer.message(player, ArcadeFormat.Line);
UtilPlayer.message(player, "§aAbility - §f§l" + player.getItemInHand().getItemMeta().getDisplayName()); UtilPlayer.message(player, "§aAbility - §f§l" + player.getItemInHand().getItemMeta().getDisplayName());
//Perk Descs //Perk Descs
for (String line : player.getItemInHand().getItemMeta().getLore()) for (String line : player.getItemInHand().getItemMeta().getLore())
{ {
UtilPlayer.message(player, line); UtilPlayer.message(player, line);
} }
UtilPlayer.message(player, ArcadeFormat.Line); UtilPlayer.message(player, ArcadeFormat.Line);
player.playSound(player.getLocation(), Sound.NOTE_PLING, 1f, 2f); player.playSound(player.getLocation(), Sound.NOTE_PLING, 1f, 2f);
event.setCancelled(true); event.setCancelled(true);
} }
@EventHandler
public void ExplosionDamageCancel(EntityDamageEvent event)
{
if (event.getCause() == DamageCause.ENTITY_EXPLOSION || event.getCause() == DamageCause.BLOCK_EXPLOSION)
{
event.setCancelled(true);
}
}
@Override @Override
public double GetKillsGems(Player killer, Player killed, boolean assist) public double GetKillsGems(Player killer, Player killed, boolean assist)
{ {
return 4; return 4;
} }
@EventHandler @EventHandler
public void BlockFade(BlockFadeEvent event) public void BlockFade(BlockFadeEvent event)
{ {
event.setCancelled(true); event.setCancelled(true);
} }
private int hungerTick = 0; private int hungerTick = 0;
@EventHandler @EventHandler
public void Hunger(UpdateEvent event) public void Hunger(UpdateEvent event)
{ {
if (event.getType() != UpdateType.SEC) if (event.getType() != UpdateType.SEC)
return; return;
if (!IsLive()) if (!IsLive())
return; return;
hungerTick = (hungerTick + 1)%10; hungerTick = (hungerTick + 1)%10;
for (Player player : GetPlayers(true)) for (Player player : GetPlayers(true))
{ {
player.setSaturation(3f); player.setSaturation(3f);
player.setExhaustion(0f); player.setExhaustion(0f);
if (player.getFoodLevel() <= 0) if (player.getFoodLevel() <= 0)
{ {
Manager.GetDamage().NewDamageEvent(player, null, null, Manager.GetDamage().NewDamageEvent(player, null, null,
DamageCause.STARVATION, 1, false, true, false, DamageCause.STARVATION, 1, false, true, false,
"Starvation", GetName()); "Starvation", GetName());
UtilPlayer.message(player, F.main("Game", "Attack other players to restore hunger!")); UtilPlayer.message(player, F.main("Game", "Attack other players to restore hunger!"));
} }
if (hungerTick == 0) if (hungerTick == 0)
UtilPlayer.hunger(player, -1); UtilPlayer.hunger(player, -1);
} }
} }
@EventHandler(priority = EventPriority.MONITOR) @EventHandler(priority = EventPriority.MONITOR)
public void HungerRestore(CustomDamageEvent event) public void HungerRestore(CustomDamageEvent event)
{ {
if (event.IsCancelled()) if (event.IsCancelled())
return; return;
Player damager = event.GetDamagerPlayer(true); Player damager = event.GetDamagerPlayer(true);
if (damager == null) if (damager == null)
return; return;
if (damager.equals(event.GetDamageeEntity())) if (damager.equals(event.GetDamageeEntity()))
return; return;
@ -392,7 +528,7 @@ public class SuperSmash extends SoloGame
int amount = Math.max(1, (int)(event.GetDamage()/2)); int amount = Math.max(1, (int)(event.GetDamage()/2));
UtilPlayer.hunger(damager, amount); UtilPlayer.hunger(damager, amount);
} }
public String GetMode() public String GetMode()
{ {
return "Deathmatch"; return "Deathmatch";

View File

@ -1,9 +1,7 @@
package nautilus.game.arcade.game.games.smash; package nautilus.game.arcade.game.games.smash;
import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import org.bukkit.Bukkit;
import org.bukkit.Sound; import org.bukkit.Sound;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
@ -38,8 +36,6 @@ import nautilus.game.arcade.kit.Kit;
public class SuperSmashTeam extends TeamGame public class SuperSmashTeam extends TeamGame
{ {
private HashMap<Player, Integer> _lives = new HashMap<Player, Integer>(); private HashMap<Player, Integer> _lives = new HashMap<Player, Integer>();
private ArrayList<String> _lastScoreboard = new ArrayList<String>();
public SuperSmashTeam(ArcadeManager manager) public SuperSmashTeam(ArcadeManager manager)
{ {
@ -49,25 +45,26 @@ public class SuperSmashTeam extends TeamGame
{ {
new KitSkeleton(manager), new KitSkeleton(manager),
//new KitGolem(manager), new KitGolem(manager),
//new KitSpider(manager), new KitSpider(manager),
//new KitSlime(manager), new KitSlime(manager),
new KitCreeper(manager), new KitCreeper(manager),
//new KitEnderman(manager), new KitEnderman(manager),
//new KitSnowman(manager), new KitSnowman(manager),
new KitWolf(manager), new KitWolf(manager),
new KitBlaze(manager), new KitBlaze(manager),
new KitWitch(manager), new KitWitch(manager),
//new KitChicken(manager), new KitChicken(manager),
new KitSkeletalHorse(manager), new KitSkeletalHorse(manager),
//new KitPig(manager), new KitPig(manager),
new KitSkySquid(manager), new KitSkySquid(manager),
new KitWitherSkeleton(manager), new KitWitherSkeleton(manager),
//new KitMagmaCube(manager), new KitMagmaCube(manager),
new KitSheep(manager)
}, },
@ -302,15 +299,6 @@ public class SuperSmashTeam extends TeamGame
event.setCancelled(true); event.setCancelled(true);
} }
@EventHandler
public void ExplosionDamageCancel(EntityDamageEvent event)
{
if (event.getCause() == DamageCause.ENTITY_EXPLOSION || event.getCause() == DamageCause.BLOCK_EXPLOSION)
{
event.setCancelled(true);
}
}
@Override @Override
public double GetKillsGems(Player killer, Player killed, boolean assist) public double GetKillsGems(Player killer, Player killed, boolean assist)
{ {

View File

@ -2,17 +2,20 @@ package nautilus.game.arcade.game.games.smash.kits;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilInv;
import mineplex.core.disguise.disguises.DisguiseBlaze; import mineplex.core.disguise.disguises.DisguiseBlaze;
import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.SmashKit; import nautilus.game.arcade.kit.SmashKit;
@ -43,13 +46,16 @@ public class KitBlaze extends SmashKit
new PerkFirefly() new PerkFirefly()
}, },
EntityType.BLAZE, EntityType.BLAZE,
new ItemStack(Material.BLAZE_ROD)); new ItemStack(Material.BLAZE_ROD),
"Phoenix", 16000, Sound.BLAZE_DEATH);
} }
@Override @Override
public void GiveItems(Player player) public void giveCoreItems(Player player)
{ {
UtilInv.Clear(player);
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD, (byte)0, 1, player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD, (byte)0, 1,
C.cYellow + C.Bold + "Hold Block" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Inferno", C.cYellow + C.Bold + "Hold Block" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Inferno",
new String[] new String[]
@ -67,14 +73,40 @@ public class KitBlaze extends SmashKit
ChatColor.RESET + "forward with great power, destroying", ChatColor.RESET + "forward with great power, destroying",
ChatColor.RESET + "anyone you touch.", ChatColor.RESET + "anyone you touch.",
ChatColor.RESET + "", ChatColor.RESET + "",
ChatColor.RESET + "If hit are hit by a projectile during", ChatColor.RESET + "If you are hit by a projectile during",
ChatColor.RESET + "startup time, the skill is cancelled.", ChatColor.RESET + "startup time, the skill is cancelled.",
})); }));
if (Manager.GetGame().GetState() == GameState.Recruit)
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.NETHER_STAR, (byte)0, 1,
C.cYellow + C.Bold + "Smash Crystal" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Phoenix",
new String[]
{
ChatColor.RESET + "Unleash all your fiery power and",
ChatColor.RESET + "propel yourself forwards, destroying",
ChatColor.RESET + "everything that comes into your path."
}));
player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE)); player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE));
player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS)); player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS));
player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS)); player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS));
}
@Override
public void giveSuperItems(Player player)
{
player.getInventory().remove(Material.IRON_SWORD);
player.getInventory().remove(Material.IRON_AXE);
UtilInv.Update(player);
}
@Override
public void GiveItems(Player player)
{
giveCoreItems(player);
//Disguise //Disguise
DisguiseBlaze disguise = new DisguiseBlaze(player); DisguiseBlaze disguise = new DisguiseBlaze(player);

View File

@ -2,11 +2,13 @@ package nautilus.game.arcade.game.games.smash.kits;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilInv;
import mineplex.core.disguise.disguises.DisguiseChicken; import mineplex.core.disguise.disguises.DisguiseChicken;
import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.itemstack.ItemStackFactory;
import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.ArcadeManager;
@ -35,16 +37,18 @@ public class KitChicken extends SmashKit
new PerkFlap(0.8, 0.8, false), new PerkFlap(0.8, 0.8, false),
new PerkEggGun(), new PerkEggGun(),
new PerkChickenRocket() new PerkChickenRocket()
}, },
EntityType.CHICKEN, EntityType.CHICKEN,
new ItemStack(Material.EGG)); new ItemStack(Material.EGG),
"Airial Gunner", 20000, Sound.CHICKEN_HURT);
} }
@Override @Override
public void GiveItems(Player player) public void giveCoreItems(Player player)
{ {
UtilInv.Clear(player);
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD, (byte)0, 1, player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD, (byte)0, 1,
C.cYellow + C.Bold + "Hold Block" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Egg Blaster", C.cYellow + C.Bold + "Hold Block" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Egg Blaster",
new String[] new String[]
@ -75,9 +79,33 @@ public class KitChicken extends SmashKit
ChatColor.RESET + "", ChatColor.RESET + "",
ChatColor.RESET + C.cAqua + "Flap uses Energy (Experience Bar)", ChatColor.RESET + C.cAqua + "Flap uses Energy (Experience Bar)",
})); }));
if (Manager.GetGame().GetState() == GameState.Recruit)
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.NETHER_STAR, (byte)0, 1,
C.cYellow + C.Bold + "Smash Crystal" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Airial Gunner",
new String[]
{
ChatColor.RESET + "Unleash an unlimited barrage of eggs",
ChatColor.RESET + "while also gaining permanant flight.",
}));
player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.LEATHER_CHESTPLATE)); player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.LEATHER_CHESTPLATE));
}
@Override
public void giveSuperItems(Player player)
{
player.getInventory().remove(Material.IRON_SWORD);
player.getInventory().remove(Material.IRON_AXE);
UtilInv.Update(player);
}
@Override
public void GiveItems(Player player)
{
giveCoreItems(player);
//Disguise //Disguise
DisguiseChicken disguise = new DisguiseChicken(player); DisguiseChicken disguise = new DisguiseChicken(player);
@ -85,8 +113,14 @@ public class KitChicken extends SmashKit
disguise.setName(Manager.GetGame().GetTeam(player).GetColor() + player.getName()); disguise.setName(Manager.GetGame().GetTeam(player).GetColor() + player.getName());
else else
disguise.setName(player.getName()); disguise.setName(player.getName());
disguise.setCustomNameVisible(true); disguise.setCustomNameVisible(true);
Manager.GetDisguise().disguise(disguise); Manager.GetDisguise().disguise(disguise);
} }
@Override
public void activateSuperCustom(Player player)
{
player.setExp(0.99f);
}
} }

View File

@ -1,36 +0,0 @@
package nautilus.game.arcade.game.games.smash.kits;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.C;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.SmashKit;
public class KitComingSoon extends SmashKit
{
public KitComingSoon(ArcadeManager manager)
{
super(manager, C.cRed + "Coming Soon", KitAvailability.Gem, 5000,
new String[]
{
},
new Perk[]
{
},
EntityType.VILLAGER,
new ItemStack(Material.IRON_SWORD));
}
@Override
public void GiveItems(Player player)
{
}
}

View File

@ -7,6 +7,7 @@ import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilInv;
import mineplex.core.disguise.disguises.DisguiseCow; import mineplex.core.disguise.disguises.DisguiseCow;
import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.itemstack.ItemStackFactory;
import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.ArcadeManager;
@ -33,12 +34,15 @@ public class KitCow extends SmashKit
}, },
EntityType.COW, EntityType.COW,
new ItemStack(Material.MILK_BUCKET)); new ItemStack(Material.MILK_BUCKET),
"", 0, null);
} }
@Override @Override
public void GiveItems(Player player) public void giveCoreItems(Player player)
{ {
UtilInv.Clear(player);
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE, (byte)0, 1, player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE, (byte)0, 1,
C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Stampede", C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Stampede",
new String[] new String[]
@ -58,6 +62,18 @@ public class KitCow extends SmashKit
player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.IRON_CHESTPLATE)); player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.IRON_CHESTPLATE));
player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.IRON_LEGGINGS)); player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.IRON_LEGGINGS));
player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.DIAMOND_BOOTS)); player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.DIAMOND_BOOTS));
}
@Override
public void giveSuperItems(Player player)
{
}
@Override
public void GiveItems(Player player)
{
giveCoreItems(player);
//Disguise //Disguise
DisguiseCow disguise = new DisguiseCow(player); DisguiseCow disguise = new DisguiseCow(player);

View File

@ -2,11 +2,13 @@ package nautilus.game.arcade.game.games.smash.kits;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilInv;
import mineplex.core.disguise.disguises.DisguiseCreeper; import mineplex.core.disguise.disguises.DisguiseCreeper;
import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.itemstack.ItemStackFactory;
import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.ArcadeManager;
@ -39,12 +41,15 @@ public class KitCreeper extends SmashKit
new PerkCreeperExplode(), new PerkCreeperExplode(),
}, },
EntityType.CREEPER, EntityType.CREEPER,
new ItemStack(Material.TNT)); new ItemStack(Material.TNT),
"Atomic Blast", 0, Sound.CREEPER_DEATH);
} }
@Override @Override
public void GiveItems(Player player) public void giveCoreItems(Player player)
{ {
UtilInv.Clear(player);
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE, (byte)0, 1, player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE, (byte)0, 1,
C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Sulphur Bomb", C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Sulphur Bomb",
new String[] new String[]
@ -68,7 +73,7 @@ public class KitCreeper extends SmashKit
})); }));
if (Manager.GetGame().GetState() == GameState.Recruit) if (Manager.GetGame().GetState() == GameState.Recruit)
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.NETHER_STAR, (byte)0, 1, player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.COAL, (byte)0, 1,
C.cYellow + C.Bold + "Passive" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Lightning Shield", C.cYellow + C.Bold + "Passive" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Lightning Shield",
new String[] new String[]
{ {
@ -78,12 +83,38 @@ public class KitCreeper extends SmashKit
ChatColor.RESET + "Lightning Shield blocks 1 melee attack,", ChatColor.RESET + "Lightning Shield blocks 1 melee attack,",
ChatColor.RESET + "striking lightning on the attacker.", ChatColor.RESET + "striking lightning on the attacker.",
})); }));
if (Manager.GetGame().GetState() == GameState.Recruit)
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.NETHER_STAR, (byte)0, 1,
C.cYellow + C.Bold + "Smash Crystal" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Atomic Blast",
new String[]
{
ChatColor.RESET + "After a short duration, you will explode",
ChatColor.RESET + "a gigantic explosion which destroys the",
ChatColor.RESET + "map and everyone nearby. You are sent flying",
ChatColor.RESET + "in the direction you are looking."
}));
player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(Material.LEATHER_HELMET)); player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(Material.LEATHER_HELMET));
player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.LEATHER_CHESTPLATE)); player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.LEATHER_CHESTPLATE));
player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.LEATHER_LEGGINGS)); player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.LEATHER_LEGGINGS));
player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.LEATHER_BOOTS)); player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.LEATHER_BOOTS));
}
@Override
public void giveSuperItems(Player player)
{
player.getInventory().remove(Material.IRON_SPADE);
player.getInventory().remove(Material.IRON_AXE);
UtilInv.Update(player);
}
@Override
public void GiveItems(Player player)
{
giveCoreItems(player);
//Disguise //Disguise
DisguiseCreeper disguise = new DisguiseCreeper(player); DisguiseCreeper disguise = new DisguiseCreeper(player);

View File

@ -6,6 +6,7 @@ import java.util.Map.Entry;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
@ -13,17 +14,20 @@ import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilInv;
import mineplex.core.disguise.disguises.DisguiseEnderman; import mineplex.core.disguise.disguises.DisguiseEnderman;
import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.SmashKit; import nautilus.game.arcade.kit.SmashKit;
import nautilus.game.arcade.kit.perks.PerkBlink; import nautilus.game.arcade.kit.perks.PerkBlink;
import nautilus.game.arcade.kit.perks.PerkBlockToss; import nautilus.game.arcade.kit.perks.PerkBlockToss;
import nautilus.game.arcade.kit.perks.PerkDoubleJump; import nautilus.game.arcade.kit.perks.PerkDoubleJump;
import nautilus.game.arcade.kit.perks.PerkEndermanDragon;
import nautilus.game.arcade.kit.perks.PerkSmashStats; import nautilus.game.arcade.kit.perks.PerkSmashStats;
import nautilus.game.arcade.kit.perks.event.PerkBlockGrabEvent; import nautilus.game.arcade.kit.perks.event.PerkBlockGrabEvent;
import nautilus.game.arcade.kit.perks.event.PerkBlockThrowEvent; import nautilus.game.arcade.kit.perks.event.PerkBlockThrowEvent;
@ -45,16 +49,20 @@ public class KitEnderman extends SmashKit
new PerkSmashStats(7, 1.3, 0.25, 6), new PerkSmashStats(7, 1.3, 0.25, 6),
new PerkDoubleJump("Double Jump", 0.9, 0.9, false), new PerkDoubleJump("Double Jump", 0.9, 0.9, false),
new PerkBlink("Blink", 16, 6000), new PerkBlink("Blink", 16, 6000),
new PerkBlockToss() new PerkBlockToss(),
new PerkEndermanDragon()
}, },
EntityType.ENDERMAN, EntityType.ENDERMAN,
new ItemStack(Material.ENDER_PEARL)); new ItemStack(Material.ENDER_PEARL),
"Dragon Rider", 30000, Sound.ENDERDRAGON_GROWL);
} }
@Override @Override
public void GiveItems(Player player) public void giveCoreItems(Player player)
{ {
UtilInv.Clear(player);
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD, (byte)0, 1, player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD, (byte)0, 1,
C.cYellow + C.Bold + "Hold/Release Block" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Block Toss", C.cYellow + C.Bold + "Hold/Release Block" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Block Toss",
new String[] new String[]
@ -77,12 +85,36 @@ public class KitEnderman extends SmashKit
ChatColor.RESET + "", ChatColor.RESET + "",
ChatColor.RESET + "You cannot pass through blocks.", ChatColor.RESET + "You cannot pass through blocks.",
})); }));
if (Manager.GetGame().GetState() == GameState.Recruit)
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.NETHER_STAR, (byte)0, 1,
C.cYellow + C.Bold + "Smash Crystal" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Dragon Rider",
new String[]
{
ChatColor.RESET + "Summon a dragon from The End to fly into",
ChatColor.RESET + "your opponents, dealing devestating damage.",
}));
player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_HELMET)); player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_HELMET));
player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE)); player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE));
player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS)); player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS));
player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS)); player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS));
}
@Override
public void giveSuperItems(Player player)
{
player.getInventory().remove(Material.IRON_SWORD);
player.getInventory().remove(Material.IRON_AXE);
UtilInv.Update(player);
}
@Override
public void GiveItems(Player player)
{
giveCoreItems(player);
//Disguise //Disguise
DisguiseEnderman disguise = new DisguiseEnderman(player); DisguiseEnderman disguise = new DisguiseEnderman(player);

View File

@ -2,14 +2,17 @@ package nautilus.game.arcade.game.games.smash.kits;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilInv;
import mineplex.core.disguise.disguises.DisguiseIronGolem; import mineplex.core.disguise.disguises.DisguiseIronGolem;
import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.itemstack.ItemStackFactory;
import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.SmashKit; import nautilus.game.arcade.kit.SmashKit;
@ -33,15 +36,19 @@ public class KitGolem extends SmashKit
new PerkFissure(), new PerkFissure(),
new PerkIronHook(), new PerkIronHook(),
new PerkSeismicSlam(), new PerkSeismicSlam(),
new PerkEarthquake()
}, },
EntityType.IRON_GOLEM, EntityType.IRON_GOLEM,
new ItemStack(Material.IRON_BLOCK)); new ItemStack(Material.IRON_BLOCK),
"Earthquake", 0, Sound.IRONGOLEM_DEATH);
} }
@Override @Override
public void GiveItems(Player player) public void giveCoreItems(Player player)
{ {
UtilInv.Clear(player);
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE, (byte)0, 1, player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE, (byte)0, 1,
C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Fissure", C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Fissure",
new String[] new String[]
@ -69,11 +76,33 @@ public class KitGolem extends SmashKit
ChatColor.RESET + "slam back into the ground with huge force.", ChatColor.RESET + "slam back into the ground with huge force.",
ChatColor.RESET + "Nearby opponents take damage and knockback.", ChatColor.RESET + "Nearby opponents take damage and knockback.",
})); }));
if (Manager.GetGame().GetState() == GameState.Recruit)
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.NETHER_STAR, (byte)0, 1,
C.cYellow + C.Bold + "Smash Crystal" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Earthquake",
new String[]
{
ChatColor.RESET + "Begin an earthquake that will give damage",
ChatColor.RESET + "and knockback to any player who is touching",
ChatColor.RESET + "the ground, anywhere on the map!",
}));
player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(Material.IRON_HELMET)); player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(Material.IRON_HELMET));
player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.IRON_CHESTPLATE)); player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.IRON_CHESTPLATE));
player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.IRON_LEGGINGS)); player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.IRON_LEGGINGS));
player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.DIAMOND_BOOTS)); player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.DIAMOND_BOOTS));
}
@Override
public void giveSuperItems(Player player)
{
}
@Override
public void GiveItems(Player player)
{
giveCoreItems(player);
//Disguise //Disguise
DisguiseIronGolem disguise = new DisguiseIronGolem(player); DisguiseIronGolem disguise = new DisguiseIronGolem(player);
@ -83,7 +112,7 @@ public class KitGolem extends SmashKit
else else
disguise.setName(player.getName()); disguise.setName(player.getName());
disguise.setCustomNameVisible(true); //disguise.setCustomNameVisible(true);
Manager.GetDisguise().disguise(disguise); Manager.GetDisguise().disguise(disguise);
} }
} }

View File

@ -4,7 +4,6 @@ import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.Iterator; import java.util.Iterator;
import org.bukkit.ChatColor;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
@ -24,6 +23,7 @@ import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.disguise.disguises.DisguiseSkeleton; import mineplex.core.disguise.disguises.DisguiseSkeleton;
import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.itemstack.ItemStackFactory;
@ -66,12 +66,15 @@ public class KitKnight extends SmashKit
new PerkNotFinished() new PerkNotFinished()
}, },
EntityType.HORSE, EntityType.HORSE,
new ItemStack(Material.IRON_BARDING)); new ItemStack(Material.IRON_BARDING),
"", 0, null);
} }
@Override @Override
public void GiveItems(Player player) public void giveCoreItems(Player player)
{ {
UtilInv.Clear(player);
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE, (byte)0, 1, player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE, (byte)0, 1,
C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Horse Kick", C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Horse Kick",
new String[] new String[]
@ -90,7 +93,17 @@ public class KitKnight extends SmashKit
player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.IRON_CHESTPLATE)); player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.IRON_CHESTPLATE));
player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.IRON_LEGGINGS)); player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.IRON_LEGGINGS));
player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.IRON_BOOTS)); player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.IRON_BOOTS));
}
@Override
public void giveSuperItems(Player player)
{
}
@Override
public void GiveItems(Player player)
{
//Disguise //Disguise
DisguiseSkeleton disguise = new DisguiseSkeleton(player); DisguiseSkeleton disguise = new DisguiseSkeleton(player);

View File

@ -2,14 +2,17 @@ package nautilus.game.arcade.game.games.smash.kits;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilInv;
import mineplex.core.disguise.disguises.DisguiseMagmaCube; import mineplex.core.disguise.disguises.DisguiseMagmaCube;
import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.itemstack.ItemStackFactory;
import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.SmashKit; import nautilus.game.arcade.kit.SmashKit;
@ -32,16 +35,20 @@ public class KitMagmaCube extends SmashKit
new PerkMagmaBoost(), new PerkMagmaBoost(),
new PerkMagmaBlast(), new PerkMagmaBlast(),
new PerkFlameDash(), new PerkFlameDash(),
new PerkMeteorShower()
}, },
EntityType.MAGMA_CUBE, EntityType.MAGMA_CUBE,
new ItemStack(Material.MAGMA_CREAM)); new ItemStack(Material.MAGMA_CREAM),
"Meteor Shower", 0, Sound.AMBIENCE_THUNDER);
} }
@Override @Override
public void GiveItems(Player player) public void giveCoreItems(Player player)
{ {
UtilInv.Clear(player);
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE, (byte)0, 1, player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE, (byte)0, 1,
C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Magma Blast", C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Magma Blast",
new String[] new String[]
@ -65,10 +72,32 @@ public class KitMagmaCube extends SmashKit
ChatColor.RESET + "", ChatColor.RESET + "",
ChatColor.RESET + "Right-Click again to end Flame Dash early.", ChatColor.RESET + "Right-Click again to end Flame Dash early.",
})); }));
if (Manager.GetGame().GetState() == GameState.Recruit)
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.NETHER_STAR, (byte)0, 1,
C.cYellow + C.Bold + "Smash Crystal" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Meteor Shower",
new String[]
{
ChatColor.RESET + "Summon a deadly meteor shower that will rain",
ChatColor.RESET + "down on your target location, causing extreme",
ChatColor.RESET + "damage and knockback to enemies!",
}));
player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_HELMET)); player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_HELMET));
player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE)); player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE));
player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS)); player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS));
}
@Override
public void giveSuperItems(Player player)
{
}
@Override
public void GiveItems(Player player)
{
giveCoreItems(player);
//Disguise //Disguise
DisguiseMagmaCube disguise = new DisguiseMagmaCube(player); DisguiseMagmaCube disguise = new DisguiseMagmaCube(player);

View File

@ -1,6 +1,7 @@
package nautilus.game.arcade.game.games.smash.kits; package nautilus.game.arcade.game.games.smash.kits;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilInv;
import mineplex.core.disguise.disguises.DisguisePig; import mineplex.core.disguise.disguises.DisguisePig;
import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
@ -18,6 +19,7 @@ import nautilus.game.arcade.kit.perks.PerkSmashStats;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
@ -43,12 +45,15 @@ public class KitPig extends SmashKit
}, },
EntityType.PIG, EntityType.PIG,
new ItemStack(Material.PORK)); new ItemStack(Material.PORK),
"Pig Stink", 40000, Sound.PIG_DEATH);
} }
@Override @Override
public void GiveItems(Player player) public void giveCoreItems(Player player)
{ {
UtilInv.Clear(player);
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE, (byte)0, 1, player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE, (byte)0, 1,
C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Bouncy Bacon", C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Bouncy Bacon",
new String[] new String[]
@ -84,10 +89,32 @@ public class KitPig extends SmashKit
ChatColor.RESET + "When your health returns to 6, you return", ChatColor.RESET + "When your health returns to 6, you return",
ChatColor.RESET + "back to Pig Form.", ChatColor.RESET + "back to Pig Form.",
})); }));
if (Manager.GetGame().GetState() == GameState.Recruit)
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.NETHER_STAR, (byte)0, 1,
C.cYellow + C.Bold + "Smash Crystal" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Pig Stink",
new String[]
{
ChatColor.RESET + "Unleash your inner pig, causing all enemies",
ChatColor.RESET + "to get nausea for a duration, while you become",
ChatColor.RESET + "a powerful Nether Pig!",
}));
player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE)); player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE));
player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS)); player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS));
player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS)); player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS));
}
@Override
public void giveSuperItems(Player player)
{
}
@Override
public void GiveItems(Player player)
{
giveCoreItems(player);
//Disguise //Disguise
DisguisePig disguise = new DisguisePig(player); DisguisePig disguise = new DisguisePig(player);
@ -112,7 +139,21 @@ public class KitPig extends SmashKit
if (!HasKit(player)) if (!HasKit(player))
continue; continue;
player.setExp((float) Math.min(0.999, player.getExp()+0.005)); player.setExp((float) Math.min(0.999, player.getExp() + (isSuperActive(player) ? 0.02 : 0.005)));
} }
} }
@Override
public void activateSuperCustom(Player player)
{
for (Player other : Manager.GetGame().GetPlayers(true))
if (!player.equals(other))
Manager.GetCondition().Factory().Confuse("Pig Stink " + player.getName(), other, player, 40, 0, false, false, false);
}
@Override
public void deactivateSuperCustom(Player player)
{
}
} }

View File

@ -3,15 +3,18 @@ package nautilus.game.arcade.game.games.smash.kits;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.DyeColor; import org.bukkit.DyeColor;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import mineplex.core.achievement.Achievement; import mineplex.core.achievement.Achievement;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilInv;
import mineplex.core.disguise.disguises.DisguiseSheep; import mineplex.core.disguise.disguises.DisguiseSheep;
import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.itemstack.ItemStackFactory;
import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.SmashKit; import nautilus.game.arcade.kit.SmashKit;
@ -33,11 +36,13 @@ public class KitSheep extends SmashKit
new PerkDoubleJump("Double Jump", 1, 1, false), new PerkDoubleJump("Double Jump", 1, 1, false),
new PerkLazer(40, 6000), new PerkLazer(40, 6000),
new PerkWoolBomb(), new PerkWoolBomb(),
new PerkWoolCloud() new PerkWoolCloud(),
new PerkSheepHoming()
}, },
EntityType.SHEEP, EntityType.SHEEP,
new ItemStack(Material.WOOL)); new ItemStack(Material.WOOL),
"Homing Sheeples", 0, Sound.SHEEP_IDLE);
this.setAchievementRequirements(new Achievement[] this.setAchievementRequirements(new Achievement[]
{ {
@ -51,10 +56,12 @@ public class KitSheep extends SmashKit
} }
@Override @Override
public void GiveItems(Player player) public void giveCoreItems(Player player)
{ {
UtilInv.Clear(player);
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD, (byte)0, 1, player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD, (byte)0, 1,
C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Static Laser", C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Static Lazer",
new String[] new String[]
{ {
ChatColor.RESET + "Charge up static electricity in your", ChatColor.RESET + "Charge up static electricity in your",
@ -83,10 +90,32 @@ public class KitSheep extends SmashKit
ChatColor.RESET + "", ChatColor.RESET + "",
ChatColor.RESET + "Using this recharges your Double Jump.", ChatColor.RESET + "Using this recharges your Double Jump.",
})); }));
if (Manager.GetGame().GetState() == GameState.Recruit)
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.NETHER_STAR, (byte)0, 1,
C.cYellow + C.Bold + "Smash Crystal" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Homing Sheeples",
new String[]
{
ChatColor.RESET + "Release one Homing Sheeple towards every player.",
ChatColor.RESET + "They will slowly home in on their target and",
ChatColor.RESET + "explode to deal devestating damage.",
}));
player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE)); player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE));
player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS)); player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS));
player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS)); player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS));
}
@Override
public void giveSuperItems(Player player)
{
}
@Override
public void GiveItems(Player player)
{
giveCoreItems(player);
//Disguise //Disguise
DisguiseSheep disguise = new DisguiseSheep(player); DisguiseSheep disguise = new DisguiseSheep(player);

View File

@ -3,6 +3,7 @@ package nautilus.game.arcade.game.games.smash.kits;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;
import org.bukkit.entity.Horse; import org.bukkit.entity.Horse;
@ -13,7 +14,7 @@ import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilEnt;
import mineplex.core.disguise.disguises.DisguiseCow; import mineplex.core.common.util.UtilInv;
import mineplex.core.disguise.disguises.DisguiseHorse; import mineplex.core.disguise.disguises.DisguiseHorse;
import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.itemstack.ItemStackFactory;
import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.ArcadeManager;
@ -39,23 +40,26 @@ public class KitSkeletalHorse extends SmashKit
new PerkDoubleJump("Double Jump", 1, 1, false), new PerkDoubleJump("Double Jump", 1, 1, false),
new PerkHorseKick(), new PerkHorseKick(),
new PerkBoneRush(), new PerkBoneRush(),
new PerkInfernalHorror() new PerkDeadlyBones()
}, },
EntityType.HORSE, EntityType.HORSE,
new ItemStack(Material.BONE)); new ItemStack(Material.BONE),
"Bone Storm", 24000, Sound.HORSE_SKELETON_DEATH);
} }
@Override @Override
public void GiveItems(Player player) public void giveCoreItems(Player player)
{ {
UtilInv.Clear(player);
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE, (byte)0, 1, player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE, (byte)0, 1,
C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Bone Kick", C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Bone Kick",
new String[] new String[]
{ {
ChatColor.RESET + "Stand on your hind legs and maul enemies", ChatColor.RESET + "Stand on your hind legs and maul enemies",
ChatColor.RESET + "infront of you with your front legs, dealing", ChatColor.RESET + "in front of you with your front legs, ",
ChatColor.RESET + "damage and large knockback.", ChatColor.RESET + "dealing damage and large knockback.",
})); }));
@ -71,22 +75,46 @@ public class KitSkeletalHorse extends SmashKit
})); }));
if (Manager.GetGame().GetState() == GameState.Recruit) if (Manager.GetGame().GetState() == GameState.Recruit)
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BLAZE_POWDER, (byte)0, 1, player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BONE, (byte)0, 1,
C.cYellow + C.Bold + "Passive" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Infernal Horror", C.cYellow + C.Bold + "Passive" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Deadly Bones",
new String[] new String[]
{ {
ChatColor.RESET + "Charge your Rage by taking/dealing damage.", ChatColor.RESET + "Whenever you take damage, you drop a bone",
ChatColor.RESET + "When your Rage hits 100%, you transform", ChatColor.RESET + "which will explode after a few seconds",
ChatColor.RESET + "into Infernal Horror.", ChatColor.RESET + "dealing damage and knockback to enemies."
}));
if (Manager.GetGame().GetState() == GameState.Recruit)
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.NETHER_STAR, (byte)0, 1,
C.cYellow + C.Bold + "Smash Crystal" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Bone Storm",
new String[]
{
ChatColor.RESET + "Charge forth in a mighty bone storm.",
ChatColor.RESET + "Bones deal damage and knockback.",
ChatColor.RESET + "", ChatColor.RESET + "",
ChatColor.RESET + "Infernal Horror has Speed 2, 1 Bonus Damage", ChatColor.RESET + "Holding Crouch will prevent you from",
ChatColor.RESET + "and improved Bone Rush and Bone Kick.", ChatColor.RESET + "moving forward with the bones.",
})); }));
player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_HELMET)); player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_HELMET));
player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE)); player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE));
player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS)); player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS));
player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS)); player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS));
}
@Override
public void giveSuperItems(Player player)
{
player.getInventory().remove(Material.IRON_SPADE);
player.getInventory().remove(Material.IRON_AXE);
UtilInv.Update(player);
}
@Override
public void GiveItems(Player player)
{
giveCoreItems(player);
//Disguise //Disguise
DisguiseHorse disguise = new DisguiseHorse(player); DisguiseHorse disguise = new DisguiseHorse(player);

View File

@ -2,12 +2,13 @@ package nautilus.game.arcade.game.games.smash.kits;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.enchantments.Enchantment; import org.bukkit.Sound;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilInv;
import mineplex.core.disguise.disguises.DisguiseSkeleton; import mineplex.core.disguise.disguises.DisguiseSkeleton;
import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.itemstack.ItemStackFactory;
import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.ArcadeManager;
@ -21,6 +22,7 @@ import nautilus.game.arcade.kit.perks.PerkDoubleJump;
import nautilus.game.arcade.kit.perks.PerkFletcher; import nautilus.game.arcade.kit.perks.PerkFletcher;
import nautilus.game.arcade.kit.perks.PerkKnockbackArrow; import nautilus.game.arcade.kit.perks.PerkKnockbackArrow;
import nautilus.game.arcade.kit.perks.PerkRopedArrow; import nautilus.game.arcade.kit.perks.PerkRopedArrow;
import nautilus.game.arcade.kit.perks.PerkSkeletonArrowStorm;
import nautilus.game.arcade.kit.perks.PerkSmashStats; import nautilus.game.arcade.kit.perks.PerkSmashStats;
public class KitSkeleton extends SmashKit public class KitSkeleton extends SmashKit
@ -41,15 +43,19 @@ public class KitSkeleton extends SmashKit
new PerkKnockbackArrow(1.75), new PerkKnockbackArrow(1.75),
new PerkBoneExplosion(), new PerkBoneExplosion(),
new PerkRopedArrow("Roped Arrow", 1, 5000), new PerkRopedArrow("Roped Arrow", 1, 5000),
new PerkBarrage(5, 250, true, false), new PerkBarrage(5, 300, true, false),
new PerkSkeletonArrowStorm()
}, },
EntityType.SKELETON, EntityType.SKELETON,
new ItemStack(Material.BOW)); new ItemStack(Material.BOW),
"Arrow Storm", 8000, Sound.SKELETON_HURT);
} }
@Override @Override
public void GiveItems(Player player) public void giveCoreItems(Player player)
{ {
UtilInv.Clear(player);
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE, (byte)0, 1, player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE, (byte)0, 1,
C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Bone Explosion", C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Bone Explosion",
new String[] new String[]
@ -76,12 +82,33 @@ public class KitSkeleton extends SmashKit
ChatColor.RESET + "When you release, you will quickly fire", ChatColor.RESET + "When you release, you will quickly fire",
ChatColor.RESET + "all the arrows in succession.", ChatColor.RESET + "all the arrows in succession.",
})); }));
if (Manager.GetGame().GetState() == GameState.Recruit)
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.NETHER_STAR, (byte)0, 1,
C.cYellow + C.Bold + "Smash Crystal" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Arrow Storm",
new String[]
{
ChatColor.RESET + "Fire hundreds of arrows in quick succession",
ChatColor.RESET + "which deal damage and knockback to enemies.",
}));
player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_HELMET)); player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_HELMET));
player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE)); player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE));
player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS)); player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS));
player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS)); player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS));
}
@Override
public void giveSuperItems(Player player)
{
}
@Override
public void GiveItems(Player player)
{
giveCoreItems(player);
//Disguise //Disguise
DisguiseSkeleton disguise = new DisguiseSkeleton(player); DisguiseSkeleton disguise = new DisguiseSkeleton(player);

View File

@ -2,20 +2,24 @@ package nautilus.game.arcade.game.games.smash.kits;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilInv;
import mineplex.core.disguise.disguises.DisguiseSquid; import mineplex.core.disguise.disguises.DisguiseSquid;
import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.itemstack.ItemStackFactory;
import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.SmashKit; import nautilus.game.arcade.kit.SmashKit;
import nautilus.game.arcade.kit.perks.PerkDoubleJump; import nautilus.game.arcade.kit.perks.PerkDoubleJump;
import nautilus.game.arcade.kit.perks.PerkInkBlast; import nautilus.game.arcade.kit.perks.PerkInkBlast;
import nautilus.game.arcade.kit.perks.PerkSmashStats; import nautilus.game.arcade.kit.perks.PerkSmashStats;
import nautilus.game.arcade.kit.perks.PerkStormSquid;
import nautilus.game.arcade.kit.perks.PerkSuperSquid; import nautilus.game.arcade.kit.perks.PerkSuperSquid;
public class KitSkySquid extends SmashKit public class KitSkySquid extends SmashKit
@ -34,21 +38,17 @@ public class KitSkySquid extends SmashKit
new PerkDoubleJump("Double Jump", 0.9, 0.9, false), new PerkDoubleJump("Double Jump", 0.9, 0.9, false),
new PerkSuperSquid(), new PerkSuperSquid(),
new PerkInkBlast(), new PerkInkBlast(),
new PerkStormSquid()
}, },
EntityType.SQUID, EntityType.SQUID,
new ItemStack(Material.INK_SACK)); new ItemStack(Material.INK_SACK),
"Storm Squid", 24000, Sound.SPLASH2);
} }
@Override @Override
public void GiveItems(Player player) public void giveCoreItems(Player player)
{ {
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD, (byte)0, 1, UtilInv.Clear(player);
C.cYellow + C.Bold + "Hold/Release Block" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Super Squid",
new String[]
{
ChatColor.RESET + "You become invulnerable and fly through",
ChatColor.RESET + "the sky in the direction you are looking.",
}));
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE, (byte)0, 1, player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE, (byte)0, 1,
C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Ink Shotgun", C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Ink Shotgun",
@ -58,10 +58,52 @@ public class KitSkySquid extends SmashKit
ChatColor.RESET + "They explode upon hitting something, dealing", ChatColor.RESET + "They explode upon hitting something, dealing",
ChatColor.RESET + "damage and knockback.", ChatColor.RESET + "damage and knockback.",
})); }));
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD, (byte)0, 1,
C.cYellow + C.Bold + "Hold/Release Block" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Super Squid",
new String[]
{
ChatColor.RESET + "You become invulnerable and fly through",
ChatColor.RESET + "the sky in the direction you are looking.",
}));
if (Manager.GetGame().GetState() == GameState.Recruit)
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.NETHER_STAR, (byte)0, 1,
C.cYellow + C.Bold + "Smash Crystal" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Storm Squid",
new String[]
{
ChatColor.RESET + "Gain permanent flight, as well as the ability",
ChatColor.RESET + "to strike lightning at your target location",
ChatColor.RESET + "after a short delay.",
}));
player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE)); player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE));
player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS)); player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS));
player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS)); player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS));
}
@Override
public void giveSuperItems(Player player)
{
player.getInventory().remove(Material.IRON_SWORD);
player.getInventory().remove(Material.IRON_AXE);
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.DIAMOND_AXE, (byte)0, 1,
C.cYellow + C.Bold + "Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Lightning Strike",
new String[]
{
ChatColor.RESET + "Strikes lightning at target location after",
ChatColor.RESET + "a short delay. Deals large damage and knockback.",
}));
UtilInv.Update(player);
}
@Override
public void GiveItems(Player player)
{
giveCoreItems(player);
//Disguise //Disguise
DisguiseSquid disguise = new DisguiseSquid(player); DisguiseSquid disguise = new DisguiseSquid(player);
@ -74,4 +116,19 @@ public class KitSkySquid extends SmashKit
disguise.setCustomNameVisible(true); disguise.setCustomNameVisible(true);
Manager.GetDisguise().disguise(disguise); Manager.GetDisguise().disguise(disguise);
} }
@Override
public void activateSuperCustom(Player player)
{
Manager.GetGame().WorldWeatherEnabled = true;
Manager.GetGame().WorldData.World.setStorm(true);
Manager.GetGame().WorldData.World.setThundering(true);
Manager.GetGame().WorldData.World.setThunderDuration(9999);
}
@Override
public void deactivateSuperCustom(Player player)
{
Manager.GetGame().WorldWeatherEnabled = false;
}
} }

View File

@ -1,15 +1,29 @@
package nautilus.game.arcade.game.games.smash.kits; package nautilus.game.arcade.game.games.smash.kits;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.GameMode;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.disguise.disguises.DisguiseBase;
import mineplex.core.disguise.disguises.DisguiseSlime; import mineplex.core.disguise.disguises.DisguiseSlime;
import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.itemstack.ItemStackFactory;
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.ArcadeManager;
import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.SmashKit; import nautilus.game.arcade.kit.SmashKit;
@ -36,12 +50,15 @@ public class KitSlime extends SmashKit
new PerkSlimeRocket(), new PerkSlimeRocket(),
}, },
EntityType.SLIME, EntityType.SLIME,
new ItemStack(Material.SLIME_BALL)); new ItemStack(Material.SLIME_BALL),
"Giga Slime", 24000, Sound.SLIME_ATTACK);
} }
@Override @Override
public void GiveItems(Player player) public void giveCoreItems(Player player)
{ {
UtilInv.Clear(player);
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD, (byte)0, 1, player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD, (byte)0, 1,
C.cYellow + C.Bold + "Hold/Release Block" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Slime Rocket", C.cYellow + C.Bold + "Hold/Release Block" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Slime Rocket",
new String[] new String[]
@ -67,9 +84,33 @@ public class KitSlime extends SmashKit
ChatColor.RESET + "However, you take 50% of the damage and", ChatColor.RESET + "However, you take 50% of the damage and",
ChatColor.RESET + "knockback in the opposite direction.", ChatColor.RESET + "knockback in the opposite direction.",
})); }));
if (Manager.GetGame().GetState() == GameState.Recruit)
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.NETHER_STAR, (byte)0, 1,
C.cYellow + C.Bold + "Smash Crystal" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Giga Slime",
new String[]
{
ChatColor.RESET + "Grow into a gigantic slime that deals damage",
ChatColor.RESET + "and knockback to anyone that comes nearby.",
}));
player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_HELMET)); player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_HELMET));
player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE)); player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE));
}
@Override
public void giveSuperItems(Player player)
{
player.getInventory().remove(Material.IRON_SWORD);
player.getInventory().remove(Material.IRON_AXE);
UtilInv.Update(player);
}
@Override
public void GiveItems(Player player)
{
giveCoreItems(player);
//Disguise //Disguise
DisguiseSlime disguise = new DisguiseSlime(player); DisguiseSlime disguise = new DisguiseSlime(player);
@ -84,4 +125,75 @@ public class KitSlime extends SmashKit
disguise.SetSize(3); disguise.SetSize(3);
} }
@Override
public void activateSuperCustom(Player player)
{
DisguiseBase disguise = Manager.GetDisguise().getDisguise(player);
if (disguise != null && disguise instanceof DisguiseSlime)
{
DisguiseSlime slime = (DisguiseSlime)disguise;
slime.SetSize(14);
Manager.GetDisguise().updateDisguise(slime);
}
player.setExp(0.99f);
Manager.GetCondition().Factory().Speed("Giga Slime", player, player, 20, 1, false, false, false);
}
@Override
public void deactivateSuperCustom(Player player)
{
Manager.GetCondition().EndCondition(player, ConditionType.SPEED, "Giga Slime");
}
@EventHandler(priority = EventPriority.LOW)
public void immunityDamagee(CustomDamageEvent event)
{
if (event.GetDamageePlayer() == null || event.GetDamagerEntity(true) == null)
return;
if (this.isSuperActive(event.GetDamageePlayer()))
event.SetCancelled(getSuperName());
}
@EventHandler(priority = EventPriority.LOW)
public void immunityDamager(CustomDamageEvent event)
{
if (event.GetCause() != DamageCause.ENTITY_ATTACK)
return;
if (event.GetDamagerPlayer(true) == null)
return;
if (isSuperActive(event.GetDamagerPlayer(true)))
event.SetCancelled(getSuperName());
}
@EventHandler
public void collide(UpdateEvent event)
{
for (Player player : getSuperActive())
for (Player other : Manager.GetGame().GetPlayers(true))
{
if (player.equals(other))
continue;
if (other.getGameMode() != GameMode.SURVIVAL)
continue;
if (UtilMath.offset(player.getLocation().add(0, 3, 0), other.getLocation()) < 5)
{
Manager.GetDamage().NewDamageEvent(other, player, null,
DamageCause.CUSTOM, 8, true, false, false,
player.getName(), GetName());
UtilParticle.PlayParticle(ParticleType.SLIME, other.getLocation().add(0, 0.6, 0), 1f, 1f, 1f, 0, 20);
player.getWorld().playSound(other.getLocation(), Sound.SLIME_ATTACK, 3f, 1f);
}
}
}
} }

View File

@ -2,11 +2,13 @@ package nautilus.game.arcade.game.games.smash.kits;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilInv;
import mineplex.core.disguise.disguises.DisguiseSnowman; import mineplex.core.disguise.disguises.DisguiseSnowman;
import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.itemstack.ItemStackFactory;
import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.ArcadeManager;
@ -20,6 +22,7 @@ import nautilus.game.arcade.kit.perks.PerkDamageSnow;
import nautilus.game.arcade.kit.perks.PerkDoubleJump; import nautilus.game.arcade.kit.perks.PerkDoubleJump;
import nautilus.game.arcade.kit.perks.PerkIcePath; import nautilus.game.arcade.kit.perks.PerkIcePath;
import nautilus.game.arcade.kit.perks.PerkSmashStats; import nautilus.game.arcade.kit.perks.PerkSmashStats;
import nautilus.game.arcade.kit.perks.PerkSnowTurret;
public class KitSnowman extends SmashKit public class KitSnowman extends SmashKit
{ {
@ -33,21 +36,38 @@ public class KitSnowman extends SmashKit
new Perk[] new Perk[]
{ {
new PerkSmashStats(5, 1.4, 0.3, 6), new PerkSmashStats(5.5, 1.4, 0.3, 6),
new PerkDoubleJump("Double Jump", 0.9, 0.9, false), new PerkDoubleJump("Double Jump", 0.9, 0.9, false),
new PerkDamageSnow(1, 1.25), new PerkDamageSnow(1, 0.4),
new PerkArcticAura(), new PerkArcticAura(),
new PerkBlizzard(), new PerkBlizzard(),
new PerkIcePath(), new PerkIcePath(),
new PerkSnowTurret(),
}, },
EntityType.SNOWMAN, EntityType.SNOWMAN,
new ItemStack(Material.SNOW_BALL)); new ItemStack(Material.SNOW_BALL),
"Snow Turret", 0, Sound.STEP_SNOW);
setSuperCharges(3);
} }
@Override
public void giveCoreItems(Player player)
{
}
@Override
public void giveSuperItems(Player player)
{
}
@Override @Override
public void GiveItems(Player player) public void GiveItems(Player player)
{ {
UtilInv.Clear(player);
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD, (byte)0, 1, player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD, (byte)0, 1,
C.cYellow + C.Bold + "Hold Block" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Blizzard", C.cYellow + C.Bold + "Hold Block" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Blizzard",
new String[] new String[]
@ -77,12 +97,22 @@ public class KitSnowman extends SmashKit
ChatColor.RESET + "", ChatColor.RESET + "",
ChatColor.RESET + "Your aura shrinks on low energy.", ChatColor.RESET + "Your aura shrinks on low energy.",
})); }));
if (Manager.GetGame().GetState() == GameState.Recruit)
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.NETHER_STAR, (byte)0, 1,
C.cYellow + C.Bold + "Smash Crystal" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Snow Turret",
new String[]
{
ChatColor.RESET + "Spawn three snow turrets that continously",
ChatColor.RESET + "throw snowballs at the nearest enemy,",
ChatColor.RESET + "dealing damage and knockback.",
}));
player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_HELMET)); player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_HELMET));
player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE)); player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE));
player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS)); player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS));
player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS)); player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS));
//Disguise //Disguise
DisguiseSnowman disguise = new DisguiseSnowman(player); DisguiseSnowman disguise = new DisguiseSnowman(player);

View File

@ -7,6 +7,7 @@ import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilInv;
import mineplex.core.disguise.disguises.DisguiseSpider; import mineplex.core.disguise.disguises.DisguiseSpider;
import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.itemstack.ItemStackFactory;
import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.ArcadeManager;
@ -31,18 +32,21 @@ public class KitSpider extends SmashKit
new Perk[] new Perk[]
{ {
new PerkSmashStats(6, 1.75, 0.25, 5.5), new PerkSmashStats(7, 1.6, 0.3, 5.5),
new PerkSpiderLeap(), new PerkSpiderLeap(),
new PerkNeedler(), new PerkNeedler(),
new PerkWebShot(), new PerkWebShot(),
}, },
EntityType.SPIDER, EntityType.SPIDER,
new ItemStack(Material.WEB)); new ItemStack(Material.WEB),
"", 0, null);
} }
@Override @Override
public void GiveItems(Player player) public void giveCoreItems(Player player)
{ {
UtilInv.Clear(player);
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD, (byte)0, 1, player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD, (byte)0, 1,
C.cYellow + C.Bold + "Hold/Release Block" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Needler", C.cYellow + C.Bold + "Hold/Release Block" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Needler",
new String[] new String[]
@ -89,7 +93,19 @@ public class KitSpider extends SmashKit
player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE)); player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE));
player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS)); player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS));
player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS)); player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS));
}
@Override
public void giveSuperItems(Player player)
{
}
@Override
public void GiveItems(Player player)
{
giveCoreItems(player);
//Disguise //Disguise
DisguiseSpider disguise = new DisguiseSpider(player); DisguiseSpider disguise = new DisguiseSpider(player);

View File

@ -2,19 +2,15 @@ package nautilus.game.arcade.game.games.smash.kits;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.disguise.disguises.DisguiseWitch; import mineplex.core.disguise.disguises.DisguiseWitch;
import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.Game.GameState; import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.KitAvailability;
@ -38,16 +34,20 @@ public class KitWitch extends SmashKit
new PerkDoubleJump("Double Jump", 0.9, 0.9, false), new PerkDoubleJump("Double Jump", 0.9, 0.9, false),
new PerkWitchPotion(), new PerkWitchPotion(),
new PerkBatWave(), new PerkBatWave(),
new PerkBatForm()
}, },
EntityType.WITCH, EntityType.WITCH,
new ItemStack(Material.POTION)); new ItemStack(Material.POTION),
"Bat Form", 20000, Sound.BAT_HURT);
} }
@Override @Override
public void GiveItems(Player player) public void giveCoreItems(Player player)
{ {
UtilInv.Clear(player);
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE, (byte)0, 1, player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE, (byte)0, 1,
C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Daze Potion", C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Daze Potion",
new String[] new String[]
@ -74,11 +74,43 @@ public class KitWitch extends SmashKit
ChatColor.RESET + "causing you to be pulled behind them!", ChatColor.RESET + "causing you to be pulled behind them!",
})); }));
if (Manager.GetGame().GetState() == GameState.Recruit)
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.NETHER_STAR, (byte)0, 1,
C.cYellow + C.Bold + "Smash Crystal" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Bat Form",
new String[]
{
ChatColor.RESET + "Transform into a bat that can fly and",
ChatColor.RESET + "launch powerful sonic blasts at opponents,",
ChatColor.RESET + "dealing damage and knockback.",
}));
player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE)); player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE));
player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS)); player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS));
player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS)); player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS));
}
@Override
public void giveSuperItems(Player player)
{
player.getInventory().remove(Material.IRON_SPADE);
player.getInventory().remove(Material.IRON_AXE);
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.DIAMOND_AXE, (byte)0, 1,
C.cYellow + C.Bold + "Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Sonic Boom",
new String[]
{
ChatColor.RESET + "Screech loudly to create a sonic boom",
ChatColor.RESET + "that deals damage and knockback to enemies!",
}));
UtilInv.Update(player);
}
@Override
public void GiveItems(Player player)
{
giveCoreItems(player);
//Disguise //Disguise
DisguiseWitch disguise = new DisguiseWitch(player); DisguiseWitch disguise = new DisguiseWitch(player);
@ -91,21 +123,19 @@ public class KitWitch extends SmashKit
Manager.GetDisguise().disguise(disguise); Manager.GetDisguise().disguise(disguise);
} }
@EventHandler @Override
public void Visuals(UpdateEvent event) public void activateSuperCustom(Player player)
{ {
if (event.getType() != UpdateType.FASTER) for (Perk perk : GetPerks())
return; if (perk instanceof PerkDoubleJump)
((PerkDoubleJump)perk).disableForPlayer(player);
for (Player player : UtilServer.getPlayers()) }
{
if (!HasKit(player)) @Override
continue; public void deactivateSuperCustom(Player player)
{
for (Player other : UtilServer.getPlayers()) for (Perk perk : GetPerks())
{ if (perk instanceof PerkDoubleJump)
UtilParticle.PlayParticle(other, ParticleType.WITCH_MAGIC, player.getLocation().add(0, 1, 0), 0.25f, 0.5f, 0.25f, 0, 2); ((PerkDoubleJump)perk).enableForPlayer(player);
}
}
} }
} }

View File

@ -1,6 +1,5 @@
package nautilus.game.arcade.game.games.smash.kits; package nautilus.game.arcade.game.games.smash.kits;
import org.bukkit.ChatColor;
import org.bukkit.Color; import org.bukkit.Color;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
@ -13,6 +12,7 @@ import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.LeatherArmorMeta; import org.bukkit.inventory.meta.LeatherArmorMeta;
import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilServer;
import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
@ -42,12 +42,14 @@ public class KitWither extends SmashKit
new PerkSkullShot(), new PerkSkullShot(),
}, },
EntityType.ZOMBIE, EntityType.ZOMBIE,
new ItemStack(Material.BOW)); new ItemStack(Material.BOW),
"", 0, null);
} }
@Override @Override
public void GiveItems(Player player) public void giveCoreItems(Player player)
{ {
UtilInv.Clear(player);
player.getInventory().addItem(new ItemStack(Material.ARROW)); player.getInventory().addItem(new ItemStack(Material.ARROW));
@ -73,6 +75,18 @@ public class KitWither extends SmashKit
player.getInventory().setBoots(boots); player.getInventory().setBoots(boots);
} }
@Override
public void giveSuperItems(Player player)
{
}
@Override
public void GiveItems(Player player)
{
giveCoreItems(player);
}
@EventHandler @EventHandler
public void InvisibilityUpdate(UpdateEvent event) public void InvisibilityUpdate(UpdateEvent event)
{ {

View File

@ -2,21 +2,24 @@ package nautilus.game.arcade.game.games.smash.kits;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.entity.Skeleton.SkeletonType; import org.bukkit.entity.Skeleton.SkeletonType;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.LeatherArmorMeta;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilInv;
import mineplex.core.disguise.disguises.DisguiseSkeleton; import mineplex.core.disguise.disguises.DisguiseSkeleton;
import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.itemstack.ItemStackFactory;
import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.SmashKit; import nautilus.game.arcade.kit.SmashKit;
import nautilus.game.arcade.kit.perks.PerkDoubleJump; import nautilus.game.arcade.kit.perks.PerkDoubleJump;
import nautilus.game.arcade.kit.perks.PerkSmashStats; import nautilus.game.arcade.kit.perks.PerkSmashStats;
import nautilus.game.arcade.kit.perks.PerkWitherForm;
import nautilus.game.arcade.kit.perks.PerkWitherImage; import nautilus.game.arcade.kit.perks.PerkWitherImage;
import nautilus.game.arcade.kit.perks.PerkWitherSkull; import nautilus.game.arcade.kit.perks.PerkWitherSkull;
@ -36,21 +39,25 @@ public class KitWitherSkeleton extends SmashKit
new PerkDoubleJump("Double Jump", 0.9, 0.9, false), new PerkDoubleJump("Double Jump", 0.9, 0.9, false),
new PerkWitherSkull(), new PerkWitherSkull(),
new PerkWitherImage(), new PerkWitherImage(),
new PerkWitherForm()
}, },
EntityType.SKELETON, EntityType.SKELETON,
new ItemStack(Material.IRON_SWORD)); new ItemStack(Material.IRON_SWORD),
"Wither Form", 18000, Sound.WITHER_SPAWN);
} }
@Override @Override
public void GiveItems(Player player) public void giveCoreItems(Player player)
{ {
UtilInv.Clear(player);
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD, (byte)0, 1, player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD, (byte)0, 1,
C.cYellow + C.Bold + "Hold Block" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Guided Wither Skull", C.cYellow + C.Bold + "Hold Block" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Guided Wither Skull",
new String[] new String[]
{ {
ChatColor.RESET + "Launch a Wither Skull forwards, hold", ChatColor.RESET + "Launch a Wither Skull forwards, hold",
ChatColor.RESET + "block to guide the missile!", ChatColor.RESET + "block to guide the missile! Release",
ChatColor.RESET + "Detonates on collision.", ChatColor.RESET + "block to detonate it midair.",
})); }));
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE, (byte)0, 1, player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE, (byte)0, 1,
@ -64,12 +71,44 @@ public class KitWitherSkeleton extends SmashKit
ChatColor.RESET + "Use the skill again to swap positions", ChatColor.RESET + "Use the skill again to swap positions",
ChatColor.RESET + "with your image.", ChatColor.RESET + "with your image.",
})); }));
if (Manager.GetGame().GetState() == GameState.Recruit)
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.NETHER_STAR, (byte)0, 1,
C.cYellow + C.Bold + "Smash Crystal" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Wither Form",
new String[]
{
ChatColor.RESET + "Transform into a legendary Wither that is",
ChatColor.RESET + "able to launch wither skulls at opponents,",
ChatColor.RESET + "dealing damage and knockback.",
}));
player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_HELMET)); player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_HELMET));
player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE)); player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE));
player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS)); player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS));
player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS)); player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS));
}
@Override
public void giveSuperItems(Player player)
{
player.getInventory().remove(Material.IRON_SWORD);
player.getInventory().remove(Material.IRON_AXE);
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.DIAMOND_AXE, (byte)0, 1,
C.cYellow + C.Bold + "Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Wither Skull",
new String[]
{
ChatColor.RESET + "Launch a deadly Wither Skull forwards.",
}));
UtilInv.Update(player);
}
@Override
public void GiveItems(Player player)
{
giveCoreItems(player);
//Disguise //Disguise
DisguiseSkeleton disguise = new DisguiseSkeleton(player); DisguiseSkeleton disguise = new DisguiseSkeleton(player);

View File

@ -7,6 +7,7 @@ import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilInv;
import mineplex.core.disguise.disguises.DisguiseWolf; import mineplex.core.disguise.disguises.DisguiseWolf;
import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.itemstack.ItemStackFactory;
import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.ArcadeManager;
@ -35,12 +36,15 @@ public class KitWolf extends SmashKit
new PerkWolf(), new PerkWolf(),
}, },
EntityType.WOLF, EntityType.WOLF,
new ItemStack(Material.BONE)); new ItemStack(Material.BONE),
"", 0, null);
} }
@Override @Override
public void GiveItems(Player player) public void giveCoreItems(Player player)
{ {
UtilInv.Clear(player);
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE, (byte)0, 1, player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE, (byte)0, 1,
C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Cub Tackle", C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Cub Tackle",
new String[] new String[]
@ -68,11 +72,23 @@ public class KitWolf extends SmashKit
{ {
ChatColor.RESET + "When you attack someone, you receive", ChatColor.RESET + "When you attack someone, you receive",
ChatColor.RESET + "+1 Damage for 3 seconds. Bonus damage", ChatColor.RESET + "+1 Damage for 3 seconds. Bonus damage",
ChatColor.RESET + "stacks from multiple hits..", ChatColor.RESET + "stacks from multiple hits.",
})); }));
player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE)); player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE));
player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS)); player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS));
}
@Override
public void giveSuperItems(Player player)
{
}
@Override
public void GiveItems(Player player)
{
giveCoreItems(player);
//Disguise //Disguise
DisguiseWolf disguise = new DisguiseWolf(player); DisguiseWolf disguise = new DisguiseWolf(player);

View File

@ -0,0 +1,122 @@
package nautilus.game.arcade.game.games.smash.kits;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilInv;
import mineplex.core.disguise.disguises.DisguiseZombie;
import mineplex.core.itemstack.ItemStackFactory;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.SmashKit;
import nautilus.game.arcade.kit.perks.PerkDoubleJump;
import nautilus.game.arcade.kit.perks.PerkFleshArrow;
import nautilus.game.arcade.kit.perks.PerkFletcher;
import nautilus.game.arcade.kit.perks.PerkKnockbackArrow;
import nautilus.game.arcade.kit.perks.PerkNightLivingDead;
import nautilus.game.arcade.kit.perks.PerkSmashStats;
import nautilus.game.arcade.kit.perks.PerkDeathsGrasp;
public class KitZombie extends SmashKit
{
public KitZombie(ArcadeManager manager)
{
super(manager, "Zombie", KitAvailability.Gem, 6000,
new String[]
{
},
new Perk[]
{
new PerkSmashStats(6, 1.25, 0.3, 4.5),
new PerkDoubleJump("Double Jump", 0.9, 0.9, false),
new PerkFletcher(2, 2, false),
new PerkKnockbackArrow(2),
new PerkFleshArrow(),
new PerkDeathsGrasp(),
new PerkNightLivingDead()
},
EntityType.ZOMBIE,
new ItemStack(Material.BOW),
"Night of the Living Dead", 0, Sound.AMBIENCE_CAVE);
}
@Override
public void giveCoreItems(Player player)
{
UtilInv.Clear(player);
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE, (byte)0, 1,
C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Deaths Grasp",
new String[]
{
ChatColor.RESET + "Leap forwards. If you collide with an opponent,",
ChatColor.RESET + "you deal damage, throw them behind you and",
ChatColor.RESET + "instantly recharges the ability.",
}));
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW, (byte)0, 1,
C.cYellow + C.Bold + "Left-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Flesh Arrow",
new String[]
{
ChatColor.RESET + "Instantly fires an arrow with a baby ",
ChatColor.RESET + "zombie impaled on it. The zombie will",
ChatColor.RESET + "attack enemies after the arrow hits.",
}));
if (Manager.GetGame().GetState() == GameState.Recruit)
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BONE, (byte)0, 1,
C.cYellow + C.Bold + "Passive" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Combo Shot",
new String[]
{
ChatColor.RESET + "Your arrows deal 2x damage to oppoents",
ChatColor.RESET + "who are airborne from Deaths Grasp.",
ChatColor.RESET + "",
}));
if (Manager.GetGame().GetState() == GameState.Recruit)
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.NETHER_STAR, (byte)0, 1,
C.cYellow + C.Bold + "Smash Crystal" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Night of the Living Dead",
new String[]
{
ChatColor.RESET + "Cast the world into darkness as hundreds",
ChatColor.RESET + "of undead minions sprout up from the ground",
ChatColor.RESET + "to attack your enemies.",
}));
player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE));
player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS));
}
@Override
public void giveSuperItems(Player player)
{
}
@Override
public void GiveItems(Player player)
{
giveCoreItems(player);
//Disguise
DisguiseZombie disguise = new DisguiseZombie(player);
if (Manager.GetGame().GetTeam(player) != null)
disguise.setName(Manager.GetGame().GetTeam(player).GetColor() + player.getName());
else
disguise.setName(player.getName());
disguise.setCustomNameVisible(true);
Manager.GetDisguise().disguise(disguise);
}
}

View File

@ -121,12 +121,14 @@ public class SurvivalGamesTeams extends TeamGame
new KitKnight(manager), new KitKnight(manager),
new KitArcher(manager), new KitArcher(manager),
//new KitBrawler(manager), new KitBrawler(manager),
//new KitAssassin(manager), new KitAssassin(manager),
new KitBeastmaster(manager), new KitBeastmaster(manager),
//new KitBomber(manager), new KitBomber(manager),
//new KitNecromancer(manager) //new KitNecromancer(manager),
new KitHorseman(manager)
}, },
new String[] new String[]
@ -170,6 +172,8 @@ public class SurvivalGamesTeams extends TeamGame
this.CompassEnabled = false; //XXX this.CompassEnabled = false; //XXX
this.InventoryClick = true; this.InventoryClick = true;
this.InventoryOpenBlock = true;
this.InventoryOpenChest = true;
//Blocks //Blocks
this.BlockBreakAllow.add(46); //TNT this.BlockBreakAllow.add(46); //TNT
@ -1377,6 +1381,9 @@ public class SurvivalGamesTeams extends TeamGame
if (other.isSneaking()) if (other.isSneaking())
continue; continue;
if (GetTeam(player).equals(GetTeam(other)))
continue;
double dist = UtilMath.offset(player, other); double dist = UtilMath.offset(player, other);
@ -1395,11 +1402,10 @@ public class SurvivalGamesTeams extends TeamGame
{ {
ItemStack stack = player.getInventory().getItem(i); ItemStack stack = player.getInventory().getItem(i);
ItemMeta itemMeta = stack.getItemMeta(); ItemMeta itemMeta = stack.getItemMeta();
itemMeta.setDisplayName( itemMeta.setDisplayName(
" " + C.cWhite + C.Bold + "Nearest Player: " + C.cYellow + target.getName() + " " + C.cWhite + C.Bold + "Nearest Player: " + GetTeam(target).GetColor() + target.getName() +
" " + C.cWhite + C.Bold + "Distance: " + C.cYellow + UtilMath.trim(1, bestDist)); " " + C.cWhite + C.Bold + "Distance: " + GetTeam(target).GetColor() + UtilMath.trim(1, bestDist));
stack.setItemMeta(itemMeta); stack.setItemMeta(itemMeta);
player.getInventory().setItem(i, stack); player.getInventory().setItem(i, stack);

View File

@ -1012,30 +1012,29 @@ public class UHC extends TeamGame
if (event.getMessage().startsWith("/kill")) if (event.getMessage().startsWith("/kill"))
event.setCancelled(true); event.setCancelled(true);
if (event.getMessage().startsWith("/uhc time day")) // if (event.getMessage().startsWith("/uhc time day"))
{ // {
this.WorldTimeSet = 4000; // this.WorldTimeSet = 4000;
event.setCancelled(true); // event.setCancelled(true);
//
Announce(event.getPlayer().getName() + " set time to Always Day!"); // Announce(event.getPlayer().getName() + " set time to Always Day!");
} // }
//
if (event.getMessage().startsWith("/uhc time night")) // if (event.getMessage().startsWith("/uhc time night"))
{ // {
this.WorldTimeSet = 16000; // this.WorldTimeSet = 16000;
event.setCancelled(true); // event.setCancelled(true);
//
Announce(event.getPlayer().getName() + " set time to Always Night!"); // Announce(event.getPlayer().getName() + " set time to Always Night!");
} // }
//
if (event.getMessage().startsWith("/uhc time cycle")) // if (event.getMessage().startsWith("/uhc time cycle"))
{ // {
this.WorldTimeSet = -1; // this.WorldTimeSet = -1;
event.setCancelled(true); // event.setCancelled(true);
//
Announce(event.getPlayer().getName() + " set time to Day and Night!"); // Announce(event.getPlayer().getName() + " set time to Day and Night!");
} // }
} }
@EventHandler(priority = EventPriority.LOWEST) @EventHandler(priority = EventPriority.LOWEST)

View File

@ -13,6 +13,7 @@ import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilServer;
import mineplex.core.disguise.disguises.DisguiseWither; import mineplex.core.disguise.disguises.DisguiseWither;
import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.ArcadeManager;
@ -117,6 +118,9 @@ public class KitWitherMinion extends Kit
@EventHandler @EventHandler
public void witherFlight(UpdateEvent event) public void witherFlight(UpdateEvent event)
{ {
if (event.getType() != UpdateType.TICK)
return;
for (Player player : UtilServer.getPlayers()) for (Player player : UtilServer.getPlayers())
{ {
if (!HasKit(player)) if (!HasKit(player))

View File

@ -7,7 +7,7 @@ public abstract class Spell implements Listener
{ {
private SpellType Spell; private SpellType Spell;
protected WizardBattles Wizards; protected Wizards Wizards;
/** /**
* Charges him for the cost of the spell * Charges him for the cost of the spell

View File

@ -15,10 +15,10 @@ import org.bukkit.entity.Player;
public class SpellMenuPage extends ShopPageBase<WizardSpellMenu, WizardSpellMenuShop> public class SpellMenuPage extends ShopPageBase<WizardSpellMenu, WizardSpellMenuShop>
{ {
private WizardBattles _wizard; private Wizards _wizard;
public SpellMenuPage(WizardSpellMenu plugin, WizardSpellMenuShop shop, CoreClientManager clientManager, public SpellMenuPage(WizardSpellMenu plugin, WizardSpellMenuShop shop, CoreClientManager clientManager,
DonationManager donationManager, Player player, WizardBattles wizard) DonationManager donationManager, Player player, Wizards wizard)
{ {
super(plugin, shop, clientManager, donationManager, "Spell Menu", player); super(plugin, shop, clientManager, donationManager, "Spell Menu", player);
_wizard = wizard; _wizard = wizard;
@ -57,7 +57,7 @@ public class SpellMenuPage extends ShopPageBase<WizardSpellMenu, WizardSpellMenu
if (usedNumbers.contains(i % 9) && spell != null) if (usedNumbers.contains(i % 9) && spell != null)
{ {
int spellLevel = wizard.getSpellLevel(spell); int spellLevel = wizard == null ? 1 : wizard.getSpellLevel(spell);
if (spellLevel > 0) if (spellLevel > 0)
{ {
@ -65,8 +65,10 @@ public class SpellMenuPage extends ShopPageBase<WizardSpellMenu, WizardSpellMenu
builder.setTitle(spell.getElement().getColor() + spell.getSpellName()); builder.setTitle(spell.getElement().getColor() + spell.getSpellName());
builder.addLore(""); builder.addLore("");
builder.addLore(C.cBlue + C.Bold + "Spell Level: " + C.cWhite + spellLevel); builder.addLore(C.cBlue + C.Bold + "Spell Level: " + C.cWhite + spellLevel);
builder.addLore(C.cBlue + C.Bold + "Mana Cost: " + C.cWhite + spell.getManaCost(wizard)); builder.addLore(C.cBlue + C.Bold + "Mana Cost: " + C.cWhite
builder.addLore(C.cBlue + C.Bold + "Cooldown: " + C.cWhite + spell.getSpellCooldown(wizard) + " seconds"); + (wizard == null ? spell.getBaseManaCost() : spell.getManaCost(wizard)));
builder.addLore(C.cBlue + C.Bold + "Cooldown: " + C.cWhite
+ (wizard == null ? spell.getBaseCooldown() : spell.getSpellCooldown(wizard)) + " seconds");
builder.addLore(""); builder.addLore("");
for (String lore : spell.getDesc()) for (String lore : spell.getDesc())
@ -74,8 +76,15 @@ public class SpellMenuPage extends ShopPageBase<WizardSpellMenu, WizardSpellMenu
builder.addLore(C.cGray + lore, 35); builder.addLore(C.cGray + lore, 35);
} }
AddButton(i, new ShopItem(builder.build(), spell.name(), spell.name(), 1, true, true), new SpellButton(this, if (wizard == null)
spell)); {
AddItem(i, new ShopItem(builder.build(), spell.name(), spell.name(), 1, true, true));
}
else
{
AddButton(i, new ShopItem(builder.build(), spell.name(), spell.name(), 1, true, true), new SpellButton(
this, spell));
}
} }
else else
{ {
@ -91,7 +100,7 @@ public class SpellMenuPage extends ShopPageBase<WizardSpellMenu, WizardSpellMenu
} }
} }
public WizardBattles getWizards() public Wizards getWizards()
{ {
return _wizard; return _wizard;
} }

View File

@ -100,7 +100,7 @@ public enum SpellType // ❤
C.cGold + C.Bold + "Explosion Size: " + C.Bold + C.cWhite + "Spell Level", C.cGold + C.Bold + "Explosion Size: " + C.Bold + C.cWhite + "Spell Level",
C.cGold + C.Bold + "Rune Size: " + C.Bold + C.cWhite + "Spell Level x 0.8", C.cGold + C.Bold + "Rune Size: " + C.Bold + C.cWhite + "Spell Level + 1",
"", "",
@ -117,7 +117,7 @@ public enum SpellType // ❤
-2, // Cooldown change per level -2, // Cooldown change per level
10, // Item amount in loot 10, // Item amount in loot
C.cGold + C.Bold + "Explosion Size: " + C.Bold + C.cWhite + "(Spell Level x 0.2) + 0.8", C.cGold + C.Bold + "Explosion Size: " + C.Bold + C.cWhite + "(Spell Level x 0.25) + 0.8",
"", "",
@ -148,9 +148,9 @@ public enum SpellType // ❤
SpellHeal.class, // Spell class SpellHeal.class, // Spell class
5, // Spell max level 5, // Spell max level
50, // Mana cost 50, // Mana cost
5, // Spell cooldown 30, // Spell cooldown
0, // Mana cost change per level 0, // Mana cost change per level
10, // Cooldown change per level -1, // Cooldown change per level
5, // Item amount in loot 5, // Item amount in loot
C.cGold + C.Bold + "Heals: " + C.Bold + C.cWhite + "(Spell Level / 2) + 1.5", C.cGold + C.Bold + "Heals: " + C.Bold + C.cWhite + "(Spell Level / 2) + 1.5",
@ -643,6 +643,14 @@ public enum SpellType // ❤
{ {
return _itemAmount; return _itemAmount;
} }
public int getBaseManaCost() {
return _spellCost;
}
public int getBaseCooldown() {
return _spellCooldown;
}
public int getManaCost(Wizard wizard) public int getManaCost(Wizard wizard)
{ {
@ -667,7 +675,7 @@ public enum SpellType // ❤
return _slot; return _slot;
} }
public ItemStack getSpellBook(WizardBattles wizards) public ItemStack getSpellBook(Wizards wizards)
{ {
return makeSpell(wizards, new ItemBuilder(Material.ENCHANTED_BOOK).addLore(C.cAqua + "Click to level up this spell") return makeSpell(wizards, new ItemBuilder(Material.ENCHANTED_BOOK).addLore(C.cAqua + "Click to level up this spell")
@ -702,7 +710,7 @@ public enum SpellType // ❤
return _spellName; return _spellName;
} }
public ItemStack makeSpell(WizardBattles wizards, ItemStack item) public ItemStack makeSpell(Wizards wizards, ItemStack item)
{ {
ItemBuilder builder = new ItemBuilder(item); ItemBuilder builder = new ItemBuilder(item);
builder.setTitle(C.cDBlue + C.Bold + "Spell: " + _type._chatColor + getSpellName() + wizards.buildTime()); builder.setTitle(C.cDBlue + C.Bold + "Spell: " + _type._chatColor + getSpellName() + wizards.buildTime());

Some files were not shown because too many files have changed in this diff Show More