Merge branches 'develop' and 'feature/report' of ssh://dev.mineplex.com:7999/min/mineplex into feature/report

This commit is contained in:
Keir Nellyer 2016-01-30 00:46:43 +00:00
commit 8cf32ef8bf
125 changed files with 5214 additions and 549 deletions

View File

@ -0,0 +1,31 @@
From 3d0c2e6b1409ca0c42b7aafbffae4b517d7db48c Mon Sep 17 00:00:00 2001
From: libraryaddict <libraryaddict115@yahoo.co.nz>
Date: Fri, 29 Jan 2016 16:59:00 +1300
Subject: [PATCH] md_5's player interaction for specs patch
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index d3b1586..6fd49b3 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -1206,6 +1206,17 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList
if (movingobjectposition == null || movingobjectposition.type != MovingObjectPosition.EnumMovingObjectType.BLOCK) {
CraftEventFactory.callPlayerInteractEvent(this.player, Action.LEFT_CLICK_AIR, this.player.inventory.getItemInHand());
}
+ // Spigot start
+ else if (movingobjectposition.type == MovingObjectPosition.EnumMovingObjectType.BLOCK
+ && (player.playerInteractManager.getGameMode() == WorldSettings.EnumGamemode.ADVENTURE || player.playerInteractManager.getGameMode() == WorldSettings.EnumGamemode.SPECTATOR)) {
+ // RIGHT_CLICK_BLOCK sets this flag
+ if (player.playerInteractManager.firedInteract) {
+ player.playerInteractManager.firedInteract = false;
+ } else {
+ CraftEventFactory.callPlayerInteractEvent(this.player, Action.LEFT_CLICK_BLOCK, movingobjectposition.a(), movingobjectposition.direction, player.inventory.getItemInHand(), true);
+ }
+ }
+ // Spigot end
// Arm swing animation
PlayerAnimationEvent event = new PlayerAnimationEvent(this.getPlayer());
--
1.9.5.msysgit.0

View File

@ -0,0 +1,25 @@
From c0e8d43f419d7f489cd0ae348618f897e95b0402 Mon Sep 17 00:00:00 2001
From: libraryaddict <libraryaddict115@yahoo.co.nz>
Date: Fri, 29 Jan 2016 16:59:12 +1300
Subject: [PATCH] Fix enderman teleporting when vegetated
diff --git a/src/main/java/net/minecraft/server/EntityEnderman.java b/src/main/java/net/minecraft/server/EntityEnderman.java
index a250062..5ad2d07 100644
--- a/src/main/java/net/minecraft/server/EntityEnderman.java
+++ b/src/main/java/net/minecraft/server/EntityEnderman.java
@@ -157,6 +157,11 @@ public class EntityEnderman extends EntityMonster {
}
protected boolean k(double d0, double d1, double d2) {
+ if (isVegetated())
+ {
+ return false;
+ }
+
double d3 = this.locX;
double d4 = this.locY;
double d5 = this.locZ;
--
1.9.5.msysgit.0

Binary file not shown.

View File

@ -4,77 +4,86 @@ import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer;
public enum Rank
{
//Staff
LT("Leader", ChatColor.GOLD, "Leaders are in charge of special teams\nsuch as the whole staff team or the support!"),
OWNER("Owner", ChatColor.GOLD, "Owners are the Founders of Mineplex\nand they all manage different parts of it!"),
DEVELOPER("Dev", ChatColor.GOLD, "Developers make new games,\nand new features for you to enjoy"),
ADMIN("Admin", ChatColor.GOLD, "Administrators have their own\nSenior Moderator team that they lead!"),
JNR_DEV("Jr.Dev", ChatColor.GOLD, "Junior Developers make new games,\nand new features for you to enjoy"),
SUPPORT("Support", ChatColor.BLUE, "Support Agents take care of all the tickets\nthat get sent to mineplex.com/support"),
CMOD("C.Mod", ChatColor.GOLD, "Clan Moderators are Senior Moderators in\nthe Clans Management team.\nThey mainly moderate only the Clans servers.\nThey are around to help you with any problems on Clans servers."),
SNR_MODERATOR("Sr.Mod", ChatColor.GOLD, "Senior Moderators are in a special\nSenior Moderator team where they have to fulfill team tasks.\nThey are similar to Moderators who you can always ask for help!\nIf you have any questions, just message them using /a"),
MODERATOR("Mod", ChatColor.GOLD, "Moderators are here to moderate\nand help players with any concerns they have.\nIf you have any questions, just message them using /a"),
HELPER("Trainee", ChatColor.DARK_AQUA, "Trainees are staff in training,\nand are here to help players and moderate!\nIf you have any questions, just message them using /a"),
MAPLEAD("MapLead", ChatColor.BLUE, "Leader of the Official Build team"),
MAPDEV("Builder", ChatColor.BLUE, "Official Mineplex Map Builders"),
MEDIA("Media", ChatColor.BLUE, "Official Mineplex Artist and/or Designer"),
EVENT("Event", ChatColor.WHITE, "???"),
LT("Leader", ChatColor.GOLD, "Leaders manage the operation of their respective team \nor projects. They usually operate on affairs within \nthe staff, development, or management team."),
OWNER("Owner", ChatColor.GOLD, "Owners are the founders of Mineplex. \nEach owner manages a different aspect of the \nserver and ensures its efficient operation."),
DEVELOPER("Dev", ChatColor.GOLD, "Developers work behind the scenes to \ncreate new games and features, and fix bugs to \ngive the best experience."),
ADMIN("Admin", ChatColor.GOLD, "An Administrators role is to manage \ntheir respective Senior Moderator team \nand all moderators within it."),
JNR_DEV("Jr.Dev", ChatColor.GOLD, "Junior Developers work behind the scenes to \ncreate new games and features, and fix bugs to \ngive the best experience."),
SUPPORT("Support", ChatColor.BLUE, "Support agents handle tickets and \nprovide customer service."),
CMOD("C.Mod", ChatColor.GOLD, "Clans Moderators are members of the Clans Management Senior Mod team. \nTheir duties include moderation and support within the Clans servers. \n\nFor assistance, contact them using " + F.elem("/a <message>") + "."),
SNR_MODERATOR("Sr.Mod", ChatColor.GOLD, "Senior Moderators are members of a special \nSenior Moderator team where they have to fulfill specific tasks. \nJust like Moderators, you can always ask them for help. \n\nFor assistance, contact them using " + F.elem("/a <message>") + "."),
MODERATOR("Mod", ChatColor.GOLD, "Moderators enforce rules and provide help to \nanyone with questions or concerns. \n\nFor assistance, contact them using " + F.elem("/a <message>") + "."),
HELPER("Trainee", ChatColor.DARK_AQUA, "Trainees are moderators-in-training. \nTheir duties include enforcing the rules and \nproviding help to anyone with questions or concerns. \n\nFor assistance, contact them using " + F.elem("/a <message>") + "."),
MAPLEAD("MapLead", ChatColor.BLUE, "Map Leaders are leaders of the Mineplex Build Team. \nThey oversee the creation of new maps and manage Builders."),
MAPDEV("Builder", ChatColor.BLUE, "Builders are members of the Mineplex Build Team. \nThey create many of the maps used across Mineplex."),
MEDIA("Media", ChatColor.BLUE, "The Media rank is given to talented artists who are\n endorsed to create content for Mineplex."),
EVENT("Event", ChatColor.WHITE, "A member of the official Mineplex Events team!"),
//Media
YOUTUBE("YouTube", ChatColor.RED, "Official Mineplex Youtuber"),
YOUTUBE_SMALL("YT", ChatColor.DARK_PURPLE, "Youtube Content Creators"),
TWITCH("Twitch", ChatColor.DARK_PURPLE, "Official Twitch Live Streamer"),
YOUTUBE("YouTube", ChatColor.RED, "A YouTuber who creates content for \nor related to Mineplex."),
YOUTUBE_SMALL("YT", ChatColor.DARK_PURPLE, "A YouTuber who creates content for \nor related to Mineplex. \n\nThey have fewer subscribers than full YouTubers."),
TWITCH("Twitch", ChatColor.DARK_PURPLE, "A Twitch streamer who often features \nMineplex in their streams."),
//Player
TITAN("Titan", ChatColor.RED, true, "Mineplex's fourth premium rank\nBuy Titan at mineplex.com/shop"),
LEGEND("Legend", ChatColor.GREEN, true, "Mineplex's third premium rank\nBuy Legend at mineplex.com/shop"),
HERO("Hero", ChatColor.LIGHT_PURPLE, true, "Mineplex's second premium rank\nBuy Hero at mineplex.com/shop"),
ULTRA("Ultra", ChatColor.AQUA, true, "Mineplex's first premium rank\nBuy Ultra at mineplex.com/shop"),
TITAN("Titan", ChatColor.RED, true, "Ancient myths spoke of a gigantic being \nwith immense power... \n\nPurchase Titan at www.mineplex.com/shop"),
LEGEND("Legend", ChatColor.GREEN, true, "Mineplex's third premium rank. \n\nPurchase Legend at www.mineplex.com/shop"),
HERO("Hero", ChatColor.LIGHT_PURPLE, true, "There are many stories of a \nvaliant Hero who was brave enough to \ntame the most fearsome dragon in the land. \n\nPurchase Hero at www.mineplex.com/shop"),
ULTRA("Ultra", ChatColor.AQUA, true, "Mineplex's first premium rank. \n\nPurchase Ultra at www.mineplex.com/shop"),
ALL("", ChatColor.WHITE, null);
private ChatColor _color;
private boolean _donor;
private String _info;
private String _description;
public String Name;
Rank(String name, ChatColor color, String info)
Rank(String name, ChatColor color, String description)
{
_color = color;
Name = name;
_donor = false;
_info = info;
_description = description;
}
Rank(String name, ChatColor color, boolean donor, String info)
Rank(String name, ChatColor color, boolean donor, String description)
{
_color = color;
Name = name;
_donor = donor;
_info = info;
_description = description;
}
public String getInfo()
public String getDescription()
{
return _info;
return _description;
}
public String getRawTag()
{
if (Name.equalsIgnoreCase("ALL"))
return "";
return Name;
}
public boolean has(Rank rank)
{
return has(null, rank, false);
}
public boolean has(Player player, Rank rank, boolean inform)
public boolean has(Player player, Rank rank, boolean inform)
{
return has(player, rank, null, inform);
}
public boolean has(Player player, Rank rank, Rank[] specific, boolean inform)
public boolean has(Player player, Rank rank, Rank[] specific, boolean inform)
{
//Specific Rank
if (specific != null)
@ -85,52 +94,44 @@ public enum Rank
{
return true;
}
}
}
}
//
if (compareTo(rank) <= 0)
return true;
if (inform)
{
UtilPlayer.message(player, C.mHead + "Permissions> " +
C.mBody + "This requires Permission Rank [" +
UtilPlayer.message(player, C.mHead + "Permissions> " +
C.mBody + "This requires Permission Rank [" +
C.mHead + rank.Name.toUpperCase() +
C.mBody + "].");
}
return false;
}
public String getTag(boolean bold, boolean uppercase)
{
if (Name.equalsIgnoreCase("ALL"))
return "";
String name = Name;
if (uppercase)
name = Name.toUpperCase();
if (bold) return _color + C.Bold + name;
else return _color + name;
}
public ChatColor getColor()
{
return _color;
}
public boolean isDonor()
public boolean isDonor()
{
return _donor;
}
public String getRawTag()
{
if (Name.equalsIgnoreCase("ALL"))
return "";
return Name;
}
}

View File

@ -152,6 +152,21 @@ public class UtilAlg
return list.get(UtilMath.r(list.size()));
}
public static <T> T Random(List<T> list, List<T> exclude)
{
int attempts = 0;
T element;
do
{
element = Random(list);
attempts++;
}
while (element != null && exclude.contains(element) && attempts < 15);
return element;
}
public static boolean inBoundingBox(Location loc, Location cornerA, Location cornerB)
{
if (loc.getX() <= Math.min(cornerA.getX(), cornerB.getX())) return false;
@ -515,4 +530,5 @@ public class UtilAlg
{
return new AxisAlignedBB(a.getX(), a.getY(), a.getZ(), b.getX(), b.getY(), b.getZ());
}
}

View File

@ -1405,6 +1405,9 @@ public class UtilBlock
itemStack.setType(Material.DARK_OAK_DOOR_ITEM);
itemStack.setDurability((short) 0);
break;
case ANVIL:
itemStack.setDurability((short) (itemStack.getDurability() / 4));
break;
}
return itemStacks;

View File

@ -854,7 +854,37 @@ public enum Achievement
new String[]{"Type Wars.Wins"},
new String[]{"Win 30 Games"},
new int[]{30},
AchievementCategory.TYPE_WARS);
AchievementCategory.TYPE_WARS),
SPEED_BUILDERS_SPEED_MASTER("Speed Master", 800,
new String[]{"Speed Builders.Wins"},
new String[]{"Win 10 Games of Speed Builder"},
new int[]{10},
AchievementCategory.SPEED_BUILDERS),
SPEED_BUILDERS_DEPENDABLE("Dependable", 1200,
new String[]{"Speed Builders.PerfectBuild"},
new String[]{"Complete 50 Perfect Builds"},
new int[]{50},
AchievementCategory.SPEED_BUILDERS),
SPEED_BUILDERS_FIRST_BUILD("First Build!", 1800,
new String[]{"Speed Builders.PerfectFirst"},
new String[]{"Be the first person to complete a build in the game 10 times"},
new int[]{10},
AchievementCategory.SPEED_BUILDERS),
SPEED_BUILDERS_PERFECTIONIST("Perfectionist", 2200,
new String[]{"Speed Builders.PerfectWins"},
new String[]{"Win a game of Speed Builder with a perfect build every round"},
new int[]{1},
AchievementCategory.SPEED_BUILDERS),
SPEED_BUILDERS_SPEEDIEST("Speediest Builderizer", 2000,
new String[]{"Speed Builders.SpeediestBuilderizer"},
new String[]{"Perfect a build in less than 10 seconds"},
new int[]{1},
AchievementCategory.SPEED_BUILDERS);
private String _name;
private String[] _desc;

View File

@ -2,10 +2,6 @@ package mineplex.core.achievement;
import java.util.List;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.Rank;
import mineplex.core.common.util.C;
@ -14,6 +10,10 @@ import mineplex.core.game.GameDisplay;
import mineplex.core.stats.PlayerStats;
import mineplex.core.stats.StatsManager;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.entity.Player;
public enum AchievementCategory
{
GLOBAL("Global", null,
@ -157,7 +157,11 @@ public enum AchievementCategory
TYPE_WARS("Type Wars", null,
new StatDisplay[] {StatDisplay.WINS, StatDisplay.GAMES_PLAYED, new StatDisplay("Minions killed", "MinionKills"), new StatDisplay("Words Per Minute", false, true, "MinionKills", "TimeInGame"), StatDisplay.GEMS_EARNED},
Material.NAME_TAG, 0, GameCategory.CLASSICS, null);
Material.NAME_TAG, 0, GameCategory.CLASSICS, null),
SPEED_BUILDERS("Speed Builders", null,
new StatDisplay[] {StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.GEMS_EARNED, null, new StatDisplay("Perfect Builds", "PerfectBuild")},
Material.QUARTZ_BLOCK, 0, GameCategory.CLASSICS, null);
private String _name;

View File

@ -49,7 +49,7 @@ public class AchievementMainPage extends ShopPageBase<AchievementManager, Achiev
"XXXXOXXXO",
"OXOXOXOXO",
"OXOXOXOXO",
"XOXOXOXOX").getItemSlots();
"OXOXOXOXO").getItemSlots();
int listSlot = 0;
for (AchievementCategory category : AchievementCategory.values())

View File

@ -32,6 +32,7 @@ import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.database.DBPool;
import mineplex.core.donation.DonationManager;
import mineplex.core.facebook.FacebookManager;
import mineplex.core.giveaway.GiveawayManager;
import mineplex.core.hologram.Hologram;
import mineplex.core.hologram.HologramManager;
@ -130,6 +131,7 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
private HologramManager _hologramManager;
private RewardManager _rewardManager;
private StatsManager _statsManager;
private FacebookManager _facebookManager;
public boolean _enabled;
private Npc _carlNpc;
private AnimationCarl _animation;
@ -168,7 +170,7 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
updateOffSet();
}
public BonusManager(JavaPlugin plugin, CoreClientManager clientManager, ServerStatusManager statusManager, DonationManager donationManager, PollManager pollManager, NpcManager npcManager, HologramManager hologramManager, StatsManager statsManager, InventoryManager inventoryManager, PetManager petManager, GiveawayManager giveawayManager)
public BonusManager(JavaPlugin plugin, CoreClientManager clientManager, ServerStatusManager statusManager, DonationManager donationManager, PollManager pollManager, NpcManager npcManager, HologramManager hologramManager, StatsManager statsManager, InventoryManager inventoryManager, PetManager petManager, GiveawayManager giveawayManager, FacebookManager facebookManager)
{
super("Bonus", plugin);
_repository = new BonusRepository(plugin, this, donationManager);
@ -187,6 +189,7 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
_pollManager = pollManager;
_statsManager = statsManager;
_facebookManager = facebookManager;
_voteList = new ArrayList<String>();
_voteList.add("http://vote1.mineplex.com");
@ -828,7 +831,7 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
if (entity.equals(_carlNpc.getEntity()))
{
updateDailyStreak(event.getPlayer());
new BonusGui(_plugin, event.getPlayer(), this, _rewardManager).openInventory();
new BonusGui(_plugin, event.getPlayer(), this, _rewardManager, _facebookManager).openInventory();
}
}
@ -844,7 +847,7 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
if (event.getEntity().equals(_carlNpc.getEntity()))
{
updateDailyStreak(player);
new BonusGui(_plugin, player, this, _rewardManager).openInventory();
new BonusGui(_plugin, player, this, _rewardManager, _facebookManager).openInventory();
}
}
}
@ -909,6 +912,7 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
if (canRank(player) && _clientManager.hasRank(player, Rank.ULTRA) && isPastAugust()) availableRewards++;
if (canDaily(player)) availableRewards++;
if (getPollManager().getNextPoll(_pollManager.Get(player), _clientManager.Get(player).GetRank()) != null) availableRewards++;
if (!_facebookManager.hasRedeemed(player)) availableRewards++;
Hologram hologram;
@ -1045,9 +1049,12 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
{
return _pollManager;
}
public FacebookManager getFacebookManager()
{
return _facebookManager;
}
@EventHandler
public void Join(final PlayerJoinEvent event)
{

View File

@ -17,7 +17,7 @@ public class GuiCommand extends CommandBase<BonusManager>{
@Override
public void Execute(Player caller, String[] args)
{
new BonusGui(Plugin.getPlugin(), caller, Plugin, Plugin.getRewardManager()).openInventory();
new BonusGui(Plugin.getPlugin(), caller, Plugin, Plugin.getRewardManager(), Plugin.getFacebookManager()).openInventory();
}
}

View File

@ -1,5 +1,7 @@
package mineplex.core.bonuses.gui;
import mineplex.core.bonuses.gui.buttons.FacebookButton;
import mineplex.core.facebook.FacebookManager;
import mineplex.core.gui.SimpleGui;
import mineplex.core.reward.RewardManager;
import mineplex.core.bonuses.BonusManager;
@ -17,19 +19,21 @@ public class BonusGui extends SimpleGui
private BonusManager manager;
public BonusGui(Plugin plugin, Player player, BonusManager manager, RewardManager rewardManager)
public BonusGui(Plugin plugin, Player player, BonusManager manager, RewardManager rewardManager, FacebookManager facebookManager)
{
super(plugin, player, player.getName() + "'s Bonuses", 5 * 9);
this.manager = manager;
setItem(10, new VoteButton(plugin, player, this, manager));
setItem(9, new VoteButton(plugin, player, this, manager));
setItem(12, new RankBonusButton(getPlugin(), player, this, manager));
setItem(11, new RankBonusButton(getPlugin(), player, this, manager));
setItem(14, new DailyBonusButton(getPlugin(), player, this, manager));
setItem(13, new DailyBonusButton(getPlugin(), player, this, manager));
setItem(16, new PollButton(getPlugin(), player, manager.getPollManager(), manager.getClientManager(), this, manager));
setItem(15, new PollButton(getPlugin(), player, manager.getPollManager(), manager.getClientManager(), this, manager));
setItem(17, new FacebookButton(player, facebookManager));
setItem(31, new CarlSpinButton(getPlugin(), player, manager, rewardManager));
}

View File

@ -0,0 +1,77 @@
package mineplex.core.bonuses.gui.buttons;
import java.util.ArrayList;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import org.bukkit.inventory.ItemStack;
import mineplex.core.bonuses.BonusAmount;
import mineplex.core.common.jsonchat.ClickEvent;
import mineplex.core.common.jsonchat.JsonMessage;
import mineplex.core.common.util.C;
import mineplex.core.facebook.FacebookManager;
import mineplex.core.gui.GuiItem;
import mineplex.core.itemstack.ItemStackFactory;
public class FacebookButton implements GuiItem
{
private Player _player;
private FacebookManager _facebookManager;
public FacebookButton(Player player, FacebookManager facebookManager)
{
_player = player;
_facebookManager = facebookManager;
}
@Override
public void setup()
{
}
@Override
public void close()
{
}
@Override
public void click(ClickType clickType)
{
_player.closeInventory();
new JsonMessage(C.cAquaB + "Click here to claim Facebook Prize!").click(ClickEvent.OPEN_URL, "https://www.facebook.com/MineplexGames/app/185301094822359/").sendToPlayer(_player);
}
private boolean isAvailable()
{
return !_facebookManager.hasRedeemed(_player);
}
@Override
public ItemStack getObject()
{
ArrayList<String> lore = new ArrayList<String>();
if (isAvailable())
{
lore.add(" ");
BonusAmount bonus = new BonusAmount();
bonus.setAncientChests(10);
bonus.addLore(lore);
lore.add(" ");
lore.add(C.cGreen + "Click to visit us on Facebook!");
return ItemStackFactory.Instance.CreateStack(Material.WATER_BUCKET, (byte) 0, 1, C.cGreen + C.Bold + "Visit us on Facebook", lore);
}
else
{
lore.add(" ");
lore.add(C.cWhite + "You have already claimed the Facebook reward!");
return ItemStackFactory.Instance.CreateStack(Material.REDSTONE_BLOCK, (byte) 0, 1, ChatColor.RED + C.Bold + "Visit us on Facebook", lore);
}
}
}

View File

@ -232,7 +232,7 @@ public class Chat extends MiniPlugin
}
}
@EventHandler(priority = EventPriority.HIGHEST)
@EventHandler(priority = EventPriority.LOWEST)
public void filterChat(AsyncPlayerChatEvent event)
{
if (event.isCancelled())
@ -240,14 +240,7 @@ public class Chat extends MiniPlugin
if (event.isAsynchronous())
{
String filteredMessage = getFilteredMessage(event.getPlayer(), event.getMessage());
for (Player onlinePlayer : event.getRecipients())
{
onlinePlayer.sendMessage(String.format(event.getFormat(), event.getPlayer().getDisplayName(), filteredMessage));
}
event.setCancelled(true);
event.setMessage(getFilteredMessage(event.getPlayer(), event.getMessage()));
}
}

View File

@ -0,0 +1,26 @@
package mineplex.core.facebook;
/**
* Created by phict on 1/28/2016.
*/
public class FacebookClient
{
// Has the player already redeemed a facebook code
// This is used so we have instant access for Carl the Creeper
private boolean _redeemed;
public FacebookClient(boolean redeemed)
{
_redeemed = redeemed;
}
public boolean hasRedeemed()
{
return _redeemed;
}
public void setRedeemed(boolean redeemed)
{
_redeemed = redeemed;
}
}

View File

@ -0,0 +1,23 @@
package mineplex.core.facebook;
public class FacebookCode
{
private final String _code;
private final boolean _activated;
public FacebookCode(String code, boolean activated)
{
_code = code;
_activated = activated;
}
public String getCode()
{
return _code;
}
public boolean isActivated()
{
return _activated;
}
}

View File

@ -0,0 +1,126 @@
package mineplex.core.facebook;
import java.sql.ResultSet;
import java.sql.SQLException;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
import mineplex.core.MiniClientPlugin;
import mineplex.core.MiniDbClientPlugin;
import mineplex.core.MiniPlugin;
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.util.Callback;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.donation.DonationManager;
import mineplex.core.facebook.command.FacebookCommand;
import mineplex.core.inventory.InventoryManager;
import mineplex.core.treasure.TreasureType;
import org.apache.commons.lang.StringUtils;
public class FacebookManager extends MiniDbClientPlugin<FacebookClient>
{
private CoreClientManager _clientManager;
private DonationManager _donationManager;
private InventoryManager _inventoryManager;
private FacebookRepository _repository;
public FacebookManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager, InventoryManager inventoryManager)
{
super("Facebook", plugin, clientManager);
_clientManager = clientManager;
_donationManager = donationManager;
_inventoryManager = inventoryManager;
_repository = new FacebookRepository(plugin);
}
@Override
public void addCommands()
{
addCommand(new FacebookCommand(this));
}
public void tryCode(Player player, String code)
{
if (!StringUtils.isAlphanumeric(code) || code.length() != 8)
{
message(player, "Invalid Code");
return;
}
final int accountId = _clientManager.getAccountId(player);
runAsync(new Runnable()
{
@Override
public void run()
{
_repository.getCode(code, new Callback<FacebookCode>()
{
@Override
public void run(FacebookCode data)
{
if (data == null)
{
message(player, "Invalid Code");
}
else if (data.isActivated())
{
message(player, "Code has already been redeemed");
}
else
{
boolean completed = _repository.activateCode(code, accountId);
if (completed)
{
_inventoryManager.addItemToInventory(player, TreasureType.ANCIENT.getItemName(), 10);
message(player, "Thanks! You earned " + F.elem("10 Ancient Chests"));
player.playSound(player.getLocation(), Sound.NOTE_PIANO, 1f, 1f);
// _donationManager.RewardCoinsLater(getName(), player, 20000);
}
else
{
message(player, "You have already redeemed a code!");
}
}
}
});
}
});
}
public boolean hasRedeemed(Player player)
{
return Get(player).hasRedeemed();
}
private void message(Player player, String message)
{
UtilPlayer.message(player, F.main("Facebook", message));
}
@Override
protected FacebookClient AddPlayer(String player)
{
return new FacebookClient(false);
}
@Override
public void processLoginResultSet(String playerName, int accountId, ResultSet resultSet) throws SQLException
{
boolean hasRow = resultSet.next();
Set(playerName, new FacebookClient(hasRow));
}
@Override
public String getQuery(int accountId, String uuid, String name)
{
return "SELECT * FROM facebook WHERE accountId = " + accountId + ";";
}
}

View File

@ -0,0 +1,62 @@
package mineplex.core.facebook;
import java.sql.ResultSet;
import java.sql.SQLException;
import org.bukkit.plugin.java.JavaPlugin;
import mineplex.core.common.util.Callback;
import mineplex.core.database.DBPool;
import mineplex.core.database.RepositoryBase;
import mineplex.core.database.ResultSetCallable;
import mineplex.core.database.column.ColumnInt;
import mineplex.core.database.column.ColumnVarChar;
public class FacebookRepository extends RepositoryBase
{
private static final String GET_CODE = "SELECT code, activated FROM facebook WHERE code = ?";
private static final String ACTIVATE_CODE = "UPDATE facebook SET activated = 1, accountId = ?, activationTime = NOW() WHERE code = ?";
public FacebookRepository(JavaPlugin plugin)
{
super(plugin, DBPool.getAccount());
}
@Override
protected void initialize()
{
}
@Override
protected void update()
{
}
public void getCode(String codeName, Callback<FacebookCode> callback)
{
executeQuery(GET_CODE, new ResultSetCallable()
{
@Override
public void processResultSet(ResultSet resultSet) throws SQLException
{
FacebookCode facebookCode = null;
while (resultSet.next())
{
String code = resultSet.getString(1);
boolean activated = resultSet.getBoolean(2);
facebookCode = new FacebookCode(code, activated);
}
callback.run(facebookCode);
}
}, new ColumnVarChar("code", 8, codeName));
}
public boolean activateCode(String codeName, int accountId)
{
return executeUpdate(ACTIVATE_CODE, new ColumnInt("accountId", accountId), new ColumnVarChar("code", 8, codeName)) == 1;
}
}

View File

@ -0,0 +1,36 @@
package mineplex.core.facebook.command;
import org.bukkit.entity.Player;
import mineplex.core.command.CommandBase;
import mineplex.core.common.Rank;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.facebook.FacebookManager;
import mineplex.core.recharge.Recharge;
public class FacebookCommand extends CommandBase<FacebookManager>
{
public FacebookCommand(FacebookManager plugin)
{
super(plugin, Rank.ALL, "facebook", "redeem");
}
@Override
public void Execute(Player caller, String[] args)
{
if (args == null || args.length != 1)
{
UtilPlayer.message(caller, F.main("Facebook", "Usage: /facebook <code>"));
UtilPlayer.message(caller, F.main("Facebook", "Get a redemption code at " + F.elem("facebook.com/MineplexGames")));
return;
}
if (!Recharge.Instance.use(caller, "Facebook Command", 10000, true, false, false))
{
return;
}
Plugin.tryCode(caller, args[0]);
}
}

View File

@ -33,6 +33,9 @@ public class ParticleCoalFumes extends ParticleGadget
for(Player p : GetActive())
{
if (!shouldDisplay(p))
continue;
UtilParticle.PlayParticleToAll(ParticleType.LARGE_SMOKE, p.getLocation(), 0.8f, 0, 0.8f, 0, 12, ViewDist.NORMAL);
}
}

View File

@ -102,9 +102,8 @@ public abstract class Gadget extends SalesPackageBase implements Listener
Manager.removeActive(player, this);
GadgetDisableEvent event = new GadgetDisableEvent(player, this);
Bukkit.getServer().getPluginManager().callEvent(event);
DisableCustom(player);
}
DisableCustom(player);
}
public abstract void EnableCustom(Player player);

View File

@ -67,6 +67,9 @@ public enum GameDisplay
MonsterLeague("Monster League", Material.MINECART, (byte)0, GameCategory.ARCADE, 56),
Lobbers("Bomb Lobbers", Material.FIREBALL, (byte) 0, GameCategory.ARCADE, 54),
SpeedBuilders("Speed Builders", Material.QUARTZ_BLOCK, (byte) 0, GameCategory.CLASSICS, 60),
ChampionsCTF("Champions CTF", "Champions", Material.BANNER, DyeColor.RED.getDyeData(), GameCategory.CHAMPIONS, 56),
BouncyBalls("Bouncy Balls", Material.SLIME_BALL, (byte)0, GameCategory.ARCADE, 57),
Gladiators("Gladiators", Material.IRON_SWORD, (byte)0, GameCategory.ARCADE, 58),

View File

@ -58,7 +58,7 @@ import net.minecraft.server.v1_8_R3.MinecraftServer;
public class Clans extends JavaPlugin
{
public static final String VERSION = "0.18b";
public static final String VERSION = "0.19";
private String WEB_CONFIG = "webServer";
// Modules

View File

@ -254,7 +254,7 @@ public class ClansManager extends MiniClientPlugin<ClientClan>implements IRelati
_explosion = new Explosion(plugin, blockRestore);
new ClansLoginManager(getPlugin(), clientManager, _serverName);
// new ClansLoginManager(getPlugin(), clientManager, _serverName);
_clanShop = new ClanShop(this, clientManager, donationManager);

View File

@ -18,6 +18,7 @@ import mineplex.core.blockrestore.BlockRestore;
import mineplex.core.bonuses.BonusManager;
import mineplex.core.botspam.BotSpamManager;
import mineplex.core.common.Rank;
import mineplex.core.common.jsonchat.JsonMessage;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilInv;
@ -33,6 +34,7 @@ import mineplex.core.disguise.DisguiseManager;
import mineplex.core.disguise.PlayerDisguiseManager;
import mineplex.core.disguise.disguises.DisguiseSlime;
import mineplex.core.donation.DonationManager;
import mineplex.core.facebook.FacebookManager;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.event.GadgetCollideEntityEvent;
import mineplex.core.gadget.event.GadgetEnableEvent;
@ -88,8 +90,18 @@ import mineplex.minecraft.game.classcombat.item.event.ItemTriggerEvent;
import mineplex.minecraft.game.core.combat.DeathMessageType;
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
import mineplex.minecraft.game.core.condition.ConditionManager;
import net.md_5.bungee.api.chat.BaseComponent;
import net.md_5.bungee.api.chat.ClickEvent;
import net.md_5.bungee.api.chat.ComponentBuilder;
import net.md_5.bungee.api.chat.HoverEvent;
import net.md_5.bungee.api.chat.HoverEvent.Action;
import net.md_5.bungee.api.chat.TextComponent;
import org.jooq.tools.json.JSONObject;
import net.minecraft.server.v1_8_R3.ChatMessage;
import net.minecraft.server.v1_8_R3.EntityInsentient;
import net.minecraft.server.v1_8_R3.EntityPlayer;
import net.minecraft.server.v1_8_R3.IChatBaseComponent;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
@ -238,7 +250,8 @@ public class HubManager extends MiniClientPlugin<HubClient>
((CraftWorld)Bukkit.getWorlds().get(0)).getHandle().pvpMode = true;
new BonusManager(plugin, clientManager, serverStatusManager, donationManager, pollManager , npcManager, hologramManager, statsManager, _inventoryManager, petManager, giveawayManager);
FacebookManager facebookManager = new FacebookManager(plugin, clientManager, donationManager, inventoryManager);
new BonusManager(plugin, clientManager, serverStatusManager, donationManager, pollManager , npcManager, hologramManager, statsManager, _inventoryManager, petManager, giveawayManager, facebookManager);
// _halloweenManager = new HalloweenSpookinessManager(this);
@ -625,6 +638,21 @@ public class HubManager extends MiniClientPlugin<HubClient>
}
else
{
TextComponent rankComponent = new TextComponent(rankStr);
TextComponent playerNameText = new TextComponent(ChatColor.YELLOW + playerName);
TextComponent component = new TextComponent();
rankComponent.setHoverEvent(new HoverEvent(Action.SHOW_TEXT, new ComponentBuilder(rank.getColor() + rank.getTag(true, true) + ChatColor.WHITE + "\n" + rank.getDescription()).create()));
component.setText(levelStr);
component.addExtra(rankComponent);
component.addExtra(playerNameText);
component.addExtra(" " + ChatColor.WHITE + event.getMessage());
// JsonMessage jsonMessage = new JsonMessage(levelStr)
// .extra(JSONObject.escape(rankStr)).hover("show_text", rank.getColor() + rank.getTag(true, true) + ChatColor.WHITE + "\n" + rank.getDescription())
// .add(JSONObject.escape(C.cYellow + playerName + " " + ChatColor.WHITE + event.getMessage()));
for (Player other : UtilServer.getPlayers())
{
if (_tutorialManager.InTutorial(other))
@ -633,9 +661,12 @@ public class HubManager extends MiniClientPlugin<HubClient>
continue;
}
event.setMessage(event.getMessage());
event.setFormat(levelStr + rankStr + C.cYellow + playerName + " " + C.cWhite + "%2$s");
// event.setMessage(event.getMessage());
// event.setFormat(levelStr + rankStr + C.cYellow + playerName + " " + C.cWhite + "%2$s");
if(!event.isCancelled())
other.spigot().sendMessage(component);
}
event.setCancelled(true);
}
}

View File

@ -808,6 +808,11 @@ public class ServerManager extends MiniPlugin
return _serverNpcShopMap.get("Survival Games");
}
public ServerNpcShop getSpeedBuildersShop()
{
return _serverNpcShopMap.get("Speed Builders");
}
public ServerNpcShop getBlockHuntShop()
{
return _serverNpcShopMap.get("Block Hunt");

View File

@ -15,26 +15,7 @@ import mineplex.core.donation.DonationManager;
import mineplex.core.itemstack.ItemBuilder;
import mineplex.core.shop.page.ShopPageBase;
import mineplex.hub.server.ServerManager;
import mineplex.hub.server.ui.button.SelectBETAButton;
import mineplex.hub.server.ui.button.SelectBHButton;
import mineplex.hub.server.ui.button.SelectBLDButton;
import mineplex.hub.server.ui.button.SelectBRButton;
import mineplex.hub.server.ui.button.SelectCLANSButton;
import mineplex.hub.server.ui.button.SelectCSButton;
import mineplex.hub.server.ui.button.SelectCTFButton;
import mineplex.hub.server.ui.button.SelectDMTButton;
import mineplex.hub.server.ui.button.SelectDOMButton;
import mineplex.hub.server.ui.button.SelectFEATButton;
import mineplex.hub.server.ui.button.SelectMINButton;
import mineplex.hub.server.ui.button.SelectMSButton;
import mineplex.hub.server.ui.button.SelectPLAYERButton;
import mineplex.hub.server.ui.button.SelectSGButton;
import mineplex.hub.server.ui.button.SelectSKYButton;
import mineplex.hub.server.ui.button.SelectSSMButton;
import mineplex.hub.server.ui.button.SelectTDMButton;
import mineplex.hub.server.ui.button.SelectTWButton;
import mineplex.hub.server.ui.button.SelectUHCButton;
import mineplex.hub.server.ui.button.SelectWIZButton;
import mineplex.hub.server.ui.button.*;
public class ServerGameMenu extends ShopPageBase<ServerManager, QuickShop>
{
@ -59,7 +40,7 @@ public class ServerGameMenu extends ShopPageBase<ServerManager, QuickShop>
@Override
protected void buildPage()
{
addButton(3, new ItemBuilder(Material.NAME_TAG).setTitle(C.cYellowB + "Type Wars " + C.cGray + "Team Deathmatch").addLore(new String[]
addButton(2, new ItemBuilder(Material.NAME_TAG).setTitle(C.cYellowB + "Type Wars " + C.cGray + "Team Deathmatch").addLore(new String[]
{
(_extraValue ? C.cAquaB : C.cWhiteB) + "NEW GAME",
C.Reset + "",
@ -71,7 +52,19 @@ public class ServerGameMenu extends ShopPageBase<ServerManager, QuickShop>
C.Reset + "Join " + ChatColor.GREEN + getPlugin().getGroupTagPlayerCount("TW") + C.Reset + " other players!",
}).setHideInfo(true).build(), new SelectTWButton(this));
addButton(5, new ItemBuilder(Material.IRON_SWORD).setTitle(C.cYellowB + "Gladiators" + C.cGray + " Bracketted Deathmatch").addLore(new String[]
addButton(4, new ItemBuilder(Material.QUARTZ_BLOCK).setTitle(C.cYellowB + "Speed Builders " + C.cGray + "Competitive Building").addLore(new String[]
{
(_extraValue ? C.cAquaB : C.cWhiteB) + "NEW GAME",
C.Reset + "",
C.Reset + "Memorize Gwen the Guardian's builds",
C.Reset + "Then recreate them in a short amount of time.",
C.Reset + "The least correct builder is eliminated.",
C.Reset + "",
C.Reset + "Join " + ChatColor.GREEN + getPlugin().getGroupTagPlayerCount("SB") + C.Reset + " other players!",
}).setHideInfo(true).build(), new SelectSBButton(this));
/*
addButton(6, new ItemBuilder(Material.IRON_SWORD).setTitle(C.cYellowB + "Gladiators" + C.cGray + " Bracketted Deathmatch").addLore(new String[]
{
(_extraValue ? C.cAquaB : C.cWhiteB) + "FEATURED ARCADE GAME",
C.Reset + "",
@ -81,6 +74,18 @@ public class ServerGameMenu extends ShopPageBase<ServerManager, QuickShop>
C.Reset + "",
C.Reset + "Join " + C.cGreen + getPlugin().getGroupTagPlayerCount("GLD") + C.Reset + " other players!"
}).setHideInfo(true).build(), new SelectFEATButton(this, "Gladiators"));
*/
addButton(6, new ItemBuilder(Material.LAVA_BUCKET).setTitle(C.cYellowB + "Micro Battle" + C.cGray + " 4 Team Deathmatch").addLore(new String[]
{
(_extraValue ? C.cAquaB : C.cWhiteB) + "FEATURED ARCADE GAME",
C.Reset + "",
C.Reset + "4 teams stand alone",
C.Reset + "Who shall remain victorious",
C.Reset + "You decide",
C.Reset + "",
C.Reset + "Join " + C.cGreen + getPlugin().getGroupTagPlayerCount("MB") + C.Reset + " other players!"
}).setHideInfo(true).build(), new SelectFEATButton(this, "Micro Battle"));
addButton(9, new ItemBuilder(Material.IRON_PICKAXE).setTitle(C.cYellowB + "The Bridges " + C.cGray + "4 Team Survival").addLore(new String[]
{
@ -219,6 +224,7 @@ public class ServerGameMenu extends ShopPageBase<ServerManager, QuickShop>
C.Reset + "Join " + ChatColor.GREEN + getPlugin().getGroupTagPlayerCount("BLD") + C.Reset + " other players!",
}).setHideInfo(true).build(), new SelectBLDButton(this));
/*
addButton(37, new ItemBuilder(Material.SNOW_BALL).setTitle(C.cYellowB + "Snow Fight " + C.cGray + "Team Survival").addLore(new String[]
{
(_extraValue ? C.cAquaB : C.cWhiteB) + "LIMITED TIME",
@ -229,6 +235,7 @@ public class ServerGameMenu extends ShopPageBase<ServerManager, QuickShop>
C.Reset + "",
C.Reset + "Join " + ChatColor.GREEN + getPlugin().getGroupTagPlayerCount("SF") + C.Reset + " other players!",
}).setHideInfo(true).build(), new SelectFEATButton(this, "Snow Fight"));
*/
addButton(39, new ItemBuilder(Material.SKULL_ITEM, 1, (byte) 3).setTitle(C.cYellowB + "Player Servers " + C.cGray + "Player Hosted Games").addLore(new String[]
{
@ -260,6 +267,7 @@ public class ServerGameMenu extends ShopPageBase<ServerManager, QuickShop>
C.Reset + "Join " + ChatColor.GREEN + getPlugin().getGroupTagPlayerCount("BETA") + C.Reset + " other players!",
}).setHideInfo(true).build(), new SelectBETAButton(this));
/*
addButton(43, new ItemBuilder(Material.BOOKSHELF).setTitle(C.cYellowB + "Christmas Chaos " + C.cGray + "Help Save Christmas").addLore(new String[]
{
(_extraValue ? C.cAquaB : C.cWhiteB) + "LIMITED TIME",
@ -270,6 +278,7 @@ public class ServerGameMenu extends ShopPageBase<ServerManager, QuickShop>
C.Reset + "",
C.Reset + "Join " + ChatColor.GREEN + getPlugin().getGroupTagPlayerCount("CC") + C.Reset + " other players!",
}).setHideInfo(true).build(), new SelectFEATButton(this, "Christmas Chaos"));
*/
}
private void createMinigameCycle()
@ -608,6 +617,11 @@ public class ServerGameMenu extends ShopPageBase<ServerManager, QuickShop>
getPlugin().getSurvivalGamesShop().attemptShopOpen(player);
}
public void OpenSB(Player player)
{
getPlugin().getSpeedBuildersShop().attemptShopOpen(player);
}
public void openDMT(Player player)
{
getPlugin().getDrawMyThingShop().attemptShopOpen(player);

View File

@ -0,0 +1,23 @@
package mineplex.hub.server.ui.button;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import mineplex.core.shop.item.IButton;
import mineplex.hub.server.ui.ServerGameMenu;
public class SelectSBButton implements IButton
{
private ServerGameMenu _menu;
public SelectSBButton(ServerGameMenu menu)
{
_menu = menu;
}
@Override
public void onClick(Player player, ClickType clickType)
{
_menu.OpenSB(player);
}
}

View File

@ -128,8 +128,19 @@ public class Parse
String name = "";
try
{
{
name = s.getLine(0);
if (s.getLine(1) != null && s.getLine(1).length() > 0)
name += " " + s.getLine(1);
if (s.getLine(2) != null && s.getLine(2).length() > 0)
name += " " + s.getLine(2);
if (s.getLine(3) != null && s.getLine(3).length() > 0)
name += " " + s.getLine(3);
System.out.println("Custom Location: " + name);
}
catch (Exception e)
{

View File

@ -30,6 +30,9 @@ import mineplex.core.elo.EloManager;
import mineplex.core.energy.Energy;
import mineplex.core.explosion.Explosion;
import mineplex.core.explosion.ExplosionEvent;
import mineplex.core.facebook.FacebookManager;
import mineplex.core.gadget.types.Gadget;
import mineplex.core.gadget.types.GadgetType;
import mineplex.core.giveaway.GiveawayManager;
import mineplex.core.hologram.HologramManager;
import mineplex.core.inventory.InventoryManager;
@ -82,7 +85,7 @@ import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.games.event.EventModule;
import nautilus.game.arcade.game.games.uhc.UHC;
import nautilus.game.arcade.managers.GameAchievementManager;
import nautilus.game.arcade.managers.GameChatManager;
import nautilus.game.arcade.managers.chat.GameChatManager;
import nautilus.game.arcade.managers.GameCreationManager;
import nautilus.game.arcade.managers.GameFlagManager;
import nautilus.game.arcade.managers.GameGemManager;
@ -171,6 +174,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation
private GameTournamentManager _gameTournamentManager;
private GameWorldManager _gameWorldManager;
private GameHostManager _gameHostManager;
private GameChatManager _gameChatManager;
private ServerStatusManager _serverStatusManager;
private InventoryManager _inventoryManager;
private CosmeticManager _cosmeticManager;
@ -275,7 +279,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation
_arcadeShop = new ArcadeShop(this, clientManager, donationManager);
// Managers
new GameChatManager(this);
_gameChatManager = new GameChatManager(this);
_gameCreationManager = new GameCreationManager(this);
_gameGemManager = new GameGemManager(this);
_gameManager = new GameManager(this);
@ -301,9 +305,10 @@ public class ArcadeManager extends MiniPlugin implements IRelation
new CompassAddon(plugin, this);
new SoupAddon(plugin, this);
new TeamArmorAddon(plugin, this);
new BonusManager(plugin, clientManager, serverStatusManager, donationManager, pollManager , npcManager, hologramManager, statsManager, _inventoryManager, petManager, giveawayManager);
FacebookManager facebookManager = new FacebookManager(plugin, clientManager, donationManager, inventoryManager);
new BonusManager(plugin, clientManager, serverStatusManager, donationManager, pollManager , npcManager, hologramManager, statsManager, _inventoryManager, petManager, giveawayManager, facebookManager);
//Champions Modules
_energy = new Energy(plugin);
@ -349,6 +354,11 @@ public class ArcadeManager extends MiniPlugin implements IRelation
addCommand(new RequiredRankCommand(this));
}
public GameChatManager getGameChatManager()
{
return _gameChatManager;
}
public GameServerConfig GetServerConfig()
{
return _serverConfig;
@ -899,6 +909,10 @@ public class ArcadeManager extends MiniPlugin implements IRelation
HubClock(player);
GetDisguise().undisguise(player);
Gadget morph = getCosmeticManager().getGadgetManager().getActive(player, GadgetType.Morph);
if (morph != null && morph.IsActive(player))
morph.Disable(player);
}
public ArrayList<String> LoadFiles(String gameName)
@ -1164,6 +1178,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation
if (event.GetState() == GameState.Recruit)
{
getCosmeticManager().setActive(true);
getCosmeticManager().setHideParticles(false);
}
else if (event.GetState() == GameState.Prepare || event.GetState() == GameState.Loading || event.GetState() == GameState.Dead)
{
@ -1175,6 +1190,9 @@ public class ArcadeManager extends MiniPlugin implements IRelation
getCosmeticManager().disableItemsForGame();
}
}
if (!event.GetGame().AllowParticles)
getCosmeticManager().setHideParticles(true);
}
}

View File

@ -1,7 +1,5 @@
package nautilus.game.arcade;
import org.bukkit.Material;
import mineplex.core.game.GameCategory;
import mineplex.core.game.GameDisplay;
import nautilus.game.arcade.game.Game;
@ -54,6 +52,7 @@ import nautilus.game.arcade.game.games.smash.TeamSuperSmash;
import nautilus.game.arcade.game.games.snake.Snake;
import nautilus.game.arcade.game.games.sneakyassassins.SneakyAssassins;
import nautilus.game.arcade.game.games.snowfight.SnowFight;
import nautilus.game.arcade.game.games.speedbuilders.SpeedBuilders;
import nautilus.game.arcade.game.games.spleef.Spleef;
import nautilus.game.arcade.game.games.spleef.SpleefTeams;
import nautilus.game.arcade.game.games.squidshooter.SquidShooter;
@ -68,6 +67,8 @@ import nautilus.game.arcade.game.games.wither.WitherGame;
import nautilus.game.arcade.game.games.wizards.Wizards;
import nautilus.game.arcade.game.games.zombiesurvival.ZombieSurvival;
import org.bukkit.Material;
public enum GameType
{
//Mini
@ -113,6 +114,7 @@ public enum GameType
Snake(Snake.class, GameDisplay.Snake),
SneakyAssassins(SneakyAssassins.class, GameDisplay.SneakyAssassins),
SnowFight(SnowFight.class, GameDisplay.SnowFight),
SpeedBuilders(SpeedBuilders.class, GameDisplay.SpeedBuilders),
Spleef(Spleef.class, GameDisplay.Spleef),
SpleefTeams(SpleefTeams.class, GameDisplay.SpleefTeams),
SquidShooter(SquidShooter.class, GameDisplay.SquidShooter),

View File

@ -74,6 +74,7 @@ import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.managers.GameLobbyManager;
import nautilus.game.arcade.managers.chat.ChatStatData;
import nautilus.game.arcade.scoreboard.GameScoreboard;
import nautilus.game.arcade.stats.AssistsStatTracker;
import nautilus.game.arcade.stats.DamageDealtStatTracker;
@ -271,6 +272,21 @@ public abstract class Game implements Listener
public long PrepareTime = 9000;
public boolean PlaySoundGameStart = true;
// Chat Stats
public final ChatStatData Kills = new ChatStatData("Kills", "Kills", true);
public final ChatStatData Assists = new ChatStatData("Assists", "Assists", true);
public final ChatStatData DamageDealt = new ChatStatData("Damage Dealt", "Damage Dealt", true);
public final ChatStatData DamageTaken = new ChatStatData("Damage Taken", "Damage Taken", true);
public final ChatStatData DamageTakenPVP = new ChatStatData("Damage Taken PvP", "Damage Taken", true);
public final ChatStatData Deaths = new ChatStatData("Deaths", "Deaths", true);
public final ChatStatData ExpEarned = new ChatStatData("ExpEarned", "Exp Earned", true);
public final ChatStatData GamesPlayed = new ChatStatData("GamesPlayed", "Games Played", true);
public final ChatStatData GemsEarned = new ChatStatData("GemsEarned", "Gems Earned", true);
public final ChatStatData Losses = new ChatStatData("Losses", "Losses", true);
public final ChatStatData Wins = new ChatStatData("Wins", "Wins", true);
public final ChatStatData KDRatio = new ChatStatData("KDRatio", "KD-Ratio", true);
public final ChatStatData BlankLine = new ChatStatData().blankLine();
// Gems
public double GemMultiplier = 1;
public boolean GemHunterEnabled = true;
@ -311,6 +327,8 @@ public abstract class Game implements Listener
public boolean EnableTutorials = false;
public boolean FixSpawnFacing = true;
public boolean AllowEntitySpectate = true;
private IPacketHandler _useEntityPacketHandler;
private int _deadBodyCount;
@ -1420,6 +1438,11 @@ public abstract class Game implements Listener
}
}
public void registerChatStats(ChatStatData... stats)
{
Manager.getGameChatManager().setGameChatStats(stats);
}
public Collection<StatTracker<? extends Game>> getStatTrackers()
{
return _statTrackers;
@ -1751,4 +1774,6 @@ public abstract class Game implements Listener
}
public void addTutorials(){}
public void disable(){}
}

View File

@ -38,6 +38,16 @@ public class BaconBrawl extends SoloGame
DamageTeamSelf = true;
HungerSet = 20;
PrepareFreeze = false;
registerChatStats(
Kills,
Deaths,
KDRatio,
BlankLine,
Assists,
DamageDealt,
DamageTaken
);
}
@EventHandler

View File

@ -15,6 +15,8 @@ import nautilus.game.arcade.GameType;
import nautilus.game.arcade.game.SoloGame;
import nautilus.game.arcade.game.games.barbarians.kits.*;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.managers.chat.ChatStatData;
import nautilus.game.arcade.stats.BlockBreakStatTracker;
public class Barbarians extends SoloGame
{
@ -58,6 +60,22 @@ public class Barbarians extends SoloGame
this.BlockBreakAllow.add(134);
this.BlockBreakAllow.add(135);
this.BlockBreakAllow.add(136);
registerStatTrackers(
new BlockBreakStatTracker(this, true)
);
registerChatStats(
Kills,
Deaths,
KDRatio,
BlankLine,
Assists,
DamageDealt,
DamageTaken,
BlankLine,
new ChatStatData("BlockBreak", "Blocks Broken", true)
);
}
@EventHandler

View File

@ -58,6 +58,9 @@ public class BossBattles extends TeamGame
HungerSet = 20;
CreatureAllowOverride = true;
PrepareFreeze = false;
// registerChatStats(Kills);
// Game giving constant errors when loading.
}
@EventHandler

View File

@ -15,6 +15,7 @@ import nautilus.game.arcade.game.SoloGame;
import nautilus.game.arcade.game.games.bouncyballs.kits.*;
import nautilus.game.arcade.game.games.bouncyballs.Ball;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.managers.chat.ChatStatData;
public class BouncyBalls extends SoloGame
{
@ -35,6 +36,8 @@ public class BouncyBalls extends SoloGame
});
this.HungerSet = 20;
// registerChatStats();
}
@EventHandler

View File

@ -5,7 +5,6 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.UUID;
import mineplex.core.common.Rank;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
@ -24,6 +23,7 @@ import mineplex.core.common.util.UtilTextMiddle;
import mineplex.core.common.util.UtilTime;
import mineplex.core.common.util.UtilWorld;
import mineplex.core.explosion.ExplosionEvent;
import mineplex.core.itemstack.ItemBuilder;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
@ -51,9 +51,9 @@ import nautilus.game.arcade.stats.DeathBomberStatTracker;
import nautilus.game.arcade.stats.FoodForTheMassesStatTracker;
import nautilus.game.arcade.stats.KillFastStatTracker;
import nautilus.game.arcade.stats.TntMinerStatTracker;
import org.bukkit.ChatColor;
import org.bukkit.Effect;
import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
@ -144,10 +144,6 @@ public class Bridge extends TeamGame implements OreObsfucation
private HashMap<GameTeam, Integer> _tournamentKills = new HashMap<GameTeam, Integer>();
private long _tournamentKillMessageTimer = 0;
//Item pickup delay for players that don't break the block
private HashMap<Block, UUID> _blockToUUIDMap = new HashMap<Block, UUID>();
public Bridge(ArcadeManager manager)
{
super(manager, GameType.Bridge,
@ -233,6 +229,16 @@ public class Bridge extends TeamGame implements OreObsfucation
new KillFastStatTracker(this, 4, 10, "Rampage"),
new DeathBomberStatTracker(this, 5)
);
registerChatStats(
Kills,
Deaths,
KDRatio,
BlankLine,
Assists,
DamageTaken,
DamageDealt
);
}
@EventHandler
@ -1130,11 +1136,13 @@ public class Bridge extends TeamGame implements OreObsfucation
{
// Reveal ore that are inside the explosion
_ore.Explosion(event);
NautHashMap<Block, Material> lootDrops = new NautHashMap<Block, Material>();
// Handle block ownership for explosion
if (event.getOwner() != null)
{
for (Block cur : event.GetBlocks())
for (Block cur : new HashSet<Block>(event.GetBlocks()))
{
// These are the only blocks that will drop from the explosion so they are the only ones
// we need to worry about for keeping owner data of
@ -1143,10 +1151,36 @@ public class Bridge extends TeamGame implements OreObsfucation
cur.getType() == Material.GOLD_ORE ||
cur.getType() == Material.DIAMOND_ORE)
{
_blockToUUIDMap.put(cur, event.getOwner().getUniqueId());
event.GetBlocks().remove(cur);
switch (cur.getType())
{
case DIAMOND_ORE:
lootDrops.put(cur, Material.DIAMOND);
case COAL_ORE:
lootDrops.put(cur, Material.COAL);
default:
lootDrops.put(cur, cur.getType());
}
}
}
}
Manager.runSyncLater(new Runnable() // Run after the explosion has already happened
{
@Override
public void run()
{
for (Block block : new HashSet<Block>(lootDrops.keySet()))
{
block.setType(Material.AIR);
Location drop = block.getLocation().clone().add(.5, .5, .5);
Item item = block.getWorld().dropItem(drop, new ItemStack(lootDrops.remove(block)));
item.setMetadata("owner", new FixedMetadataValue(Manager.getPlugin(), event.getOwner().getUniqueId()));
}
}
}, 1);
}
@EventHandler(priority = EventPriority.MONITOR)
@ -1280,41 +1314,44 @@ public class Bridge extends TeamGame implements OreObsfucation
}
}
private void addBlockPickupDelay(Player owner, Block block)
@SuppressWarnings("deprecation")
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void dropItem(BlockBreakEvent event)
{
Material blockMaterial = block.getType();
boolean shouldAddToMap = false;
_ore.BlockBreak(event);
for (int i = 0; i < PLAYER_DROP_DELAY_MATERIALS.length && !shouldAddToMap; i++)
if (!IsLive())
return;
if (!IsAlive(event.getPlayer()))
return;
if (event.getPlayer().getGameMode() == GameMode.CREATIVE)
return;
Material drop = null;
byte data = (byte) 0;
for (Material mat : PLAYER_DROP_DELAY_MATERIALS)
{
if (blockMaterial.equals(PLAYER_DROP_DELAY_MATERIALS[i]))
if (event.getBlock().getType() == mat)
{
shouldAddToMap = true;
drop = mat;
data = event.getBlock().getData();
break;
}
}
if (shouldAddToMap)
_blockToUUIDMap.put(block, owner.getUniqueId());
}
if (drop == null)
return;
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void dropItem(BlockBreakEvent event)
{
addBlockPickupDelay(event.getPlayer(), event.getBlock());
}
event.setCancelled(true);
event.getBlock().setType(Material.AIR);
@EventHandler
public void itemSpawn(ItemSpawnEvent event)
{
Item item = event.getEntity();
Block block = event.getLocation().getBlock();
Location loc = event.getBlock().getLocation().clone().add(.5, .5, .5);
UUID uuid = _blockToUUIDMap.remove(block);
if (uuid != null)
{
item.setMetadata("owner", new FixedMetadataValue(Manager.getPlugin(), uuid));
}
Item item = loc.getWorld().dropItem(loc, new ItemBuilder(drop, data).build());
item.setMetadata("owner", new FixedMetadataValue(Manager.getPlugin(), event.getPlayer().getUniqueId()));
}
@EventHandler

View File

@ -5,6 +5,43 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map.Entry;
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.UtilEvent;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.common.util.UtilGear;
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.common.util.UtilParticle.ViewDist;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTextBottom;
import mineplex.core.common.util.UtilTextMiddle;
import mineplex.core.common.util.UtilTime;
import mineplex.core.explosion.ExplosionEvent;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.events.PlayerPrepareTeleportEvent;
import nautilus.game.arcade.game.SoloGame;
import nautilus.game.arcade.game.games.build.gui.MobShop;
import nautilus.game.arcade.game.games.build.gui.OptionsShop;
import nautilus.game.arcade.game.games.build.kits.KitBuilder;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.managers.chat.ChatStatData;
import nautilus.game.arcade.stats.BlockBreakStatTracker;
import nautilus.game.arcade.stats.BlockPlaceStatTracker;
import java.util.UUID;
import org.bukkit.ChatColor;
@ -69,40 +106,6 @@ import org.bukkit.event.vehicle.VehicleCreateEvent;
import org.bukkit.event.vehicle.VehicleDamageEvent;
import org.bukkit.inventory.ItemStack;
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.UtilEvent;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.common.util.UtilGear;
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.common.util.UtilParticle.ViewDist;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTextBottom;
import mineplex.core.common.util.UtilTextMiddle;
import mineplex.core.common.util.UtilTime;
import mineplex.core.explosion.ExplosionEvent;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.events.PlayerPrepareTeleportEvent;
import nautilus.game.arcade.game.SoloGame;
import nautilus.game.arcade.game.games.build.gui.MobShop;
import nautilus.game.arcade.game.games.build.gui.OptionsShop;
import nautilus.game.arcade.game.games.build.kits.KitBuilder;
import nautilus.game.arcade.kit.Kit;
public class Build extends SoloGame
{
private NautHashMap<Player, BuildData> _data = new NautHashMap<Player, BuildData>();
@ -146,7 +149,7 @@ public class Build extends SoloGame
private ChatColor _firstHintColor = ChatColor.YELLOW;
private UUID _winnerUUID = null;
public Build(ArcadeManager manager)
{
super(manager, GameType.Build,
@ -221,6 +224,16 @@ public class Build extends SoloGame
_mobShop = new MobShop(getArcadeManager(), getArcadeManager().GetClients(), getArcadeManager().GetDonation());
_optionsShop = new OptionsShop(this, getArcadeManager(), getArcadeManager().GetClients(), getArcadeManager().GetDonation());
_shopItem = ItemStackFactory.Instance.CreateStack(Material.DIAMOND, (byte) 0, 1, C.cGreen + "Options");
registerStatTrackers(
new BlockBreakStatTracker(this, false),
new BlockPlaceStatTracker(this, new Material[]{})
);
registerChatStats(
new ChatStatData("BlocksPlaced", "Blocks Placed", true),
new ChatStatData("BlocksBroken", "Blocks Broken", true)
);
}
@EventHandler
@ -1550,14 +1563,14 @@ public class Build extends SoloGame
}
}
}
@Override
public List<Player> getWinners()
{
Player player = UtilPlayer.searchExact(_winnerUUID);
if (player == null)
return null;
return Arrays.asList(player);
}
}

View File

@ -70,6 +70,8 @@ public class Cards extends SoloGame
this.PrepareFreeze = false;
_cardFactory = new CardFactory();
registerChatStats();
}
@Override

View File

@ -71,6 +71,7 @@ import nautilus.game.arcade.game.games.castlesiege.kits.KitUndeadGhoul;
import nautilus.game.arcade.game.games.castlesiege.kits.KitUndeadZombie;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.NullKit;
import nautilus.game.arcade.managers.chat.ChatStatData;
import nautilus.game.arcade.stats.BloodThirstyStatTracker;
import nautilus.game.arcade.stats.KingDamageStatTracker;
import nautilus.game.arcade.stats.KingSlayerStatTracker;
@ -211,7 +212,6 @@ public class CastleSiege extends TeamGame
}
registerStatTrackers(
new WinAsTeamStatTracker(this, notRedTeam, "ForTheKing"),
new KingSlayerStatTracker(this),
new BloodThirstyStatTracker(this),
new KingDamageStatTracker(this),
@ -219,6 +219,18 @@ public class CastleSiege extends TeamGame
new TeamDeathsStatTracker(this),
new TeamKillsStatTracker(this)
);
registerChatStats(
Kills,
Deaths,
KDRatio,
BlankLine,
Assists,
DamageDealt,
DamageTaken
);
registerChatStats();
}
@Override
@ -260,6 +272,30 @@ public class CastleSiege extends TeamGame
}
}
@EventHandler(priority = EventPriority.HIGH)
public void registerTeamTracker(GameStateChangeEvent event)
{
if (event.GetState() == GameState.Recruit)
{
GameTeam notRed = null;
for (GameTeam team : GetTeamList())
{
if (team.GetColor() == ChatColor.RED)
continue;
notRed = team;
break;
}
if (notRed != null)
{
registerStatTrackers(new WinAsTeamStatTracker(this, notRed, "ForTheKing"));
System.out.println("Successfully registered For the King StatTrak");
}
}
}
@EventHandler
public void MoveKits(GameStateChangeEvent event)
{

View File

@ -18,6 +18,7 @@ import nautilus.game.arcade.game.games.champions.kits.KitMage;
import nautilus.game.arcade.game.games.champions.kits.KitRanger;
import nautilus.game.arcade.game.games.common.CaptureTheFlag;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.managers.chat.ChatStatData;
import nautilus.game.arcade.stats.CapturesStatTracker;
import nautilus.game.arcade.stats.ClutchStatTracker;
import nautilus.game.arcade.stats.ElectrocutionStatTracker;
@ -37,20 +38,20 @@ import org.bukkit.event.inventory.InventoryType;
public class ChampionsCTF extends CaptureTheFlag
{
public ChampionsCTF(ArcadeManager manager)
{
{
super(manager, GameType.ChampionsCTF,
new Kit[]
{
new KitBrute(manager),
new KitRanger(manager),
new Kit[]
{
new KitBrute(manager),
new KitRanger(manager),
new KitKnight(manager),
new KitMage(manager),
new KitAssassin(manager),
});
_help = new String[]
{
_help = new String[]
{
"Make sure you use all of your Skill/Item Tokens",
"Collect Resupply Chests to restock your inventory",
"Customize your Class to suit your play style",
@ -59,7 +60,7 @@ public class ChampionsCTF extends CaptureTheFlag
"Gold/Iron Weapons deal 6 damage",
"Diamond Weapons deal 7 damage",
};
};
Manager.GetDamage().UseSimpleWeaponDamage = false;
Manager.getCosmeticManager().setHideParticles(true);
@ -86,6 +87,18 @@ public class ChampionsCTF extends CaptureTheFlag
new ClutchStatTracker(this, "Clutch"),
new SpecialWinStatTracker(this, "SpecialWin")
);
registerChatStats(
Kills,
Deaths,
KDRatio,
BlankLine,
Assists,
DamageDealt,
DamageTaken,
BlankLine,
new ChatStatData("Captures", "Flag Captures", true)
);
new ChampionsFixes(this);
}

View File

@ -16,6 +16,7 @@ import nautilus.game.arcade.game.games.champions.kits.KitMage;
import nautilus.game.arcade.game.games.champions.kits.KitRanger;
import nautilus.game.arcade.game.games.common.Domination;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.managers.chat.ChatStatData;
import nautilus.game.arcade.stats.ElectrocutionStatTracker;
import nautilus.game.arcade.stats.KillReasonStatTracker;
import nautilus.game.arcade.stats.SeismicSlamStatTracker;
@ -78,6 +79,16 @@ public class ChampionsDominate extends Domination
new TheLongestShotStatTracker(this),
new SeismicSlamStatTracker(this)
);
registerChatStats(
Kills,
Deaths,
KDRatio,
BlankLine,
Assists,
DamageDealt,
DamageTaken
);
new ChampionsFixes(this);
}

View File

@ -16,6 +16,7 @@ import nautilus.game.arcade.game.games.champions.kits.KitMage;
import nautilus.game.arcade.game.games.champions.kits.KitRanger;
import nautilus.game.arcade.game.games.common.TeamDeathmatch;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.managers.chat.ChatStatData;
import nautilus.game.arcade.stats.ElectrocutionStatTracker;
import nautilus.game.arcade.stats.KillAllOpposingStatTracker;
import nautilus.game.arcade.stats.KillReasonStatTracker;
@ -78,6 +79,16 @@ public class ChampionsTDM extends TeamDeathmatch
new TheLongestShotStatTracker(this),
new SeismicSlamStatTracker(this)
);
registerChatStats(
Kills,
Deaths,
KDRatio,
BlankLine,
Assists,
DamageDealt,
DamageTaken
);
new ChampionsFixes(this);
}

View File

@ -152,6 +152,11 @@ public class Christmas extends SoloGame
HungerSet = 20;
WorldTimeSet = 2000;
PrepareFreeze = false;
registerChatStats(
DamageDealt,
DamageTaken
);
}
//parse 129 19 47 48 103 86 137 56 22 45 121 14 15 16 87 88 89 153 173 172 162

View File

@ -73,6 +73,12 @@ public class DeathTag extends SoloGame
this.PrepareFreeze = false;
registerStatTrackers(new ComeAtMeBroStatTracker(this));
registerChatStats(
Kills,
Deaths,
KDRatio
);
}
@Override

View File

@ -52,6 +52,8 @@ import nautilus.game.arcade.events.PlayerKitGiveEvent;
import nautilus.game.arcade.game.SoloGame;
import nautilus.game.arcade.game.games.dragonescape.kits.*;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.managers.chat.ChatStatData;
import nautilus.game.arcade.stats.DistanceTraveledStatTracker;
import nautilus.game.arcade.stats.ParalympicsStatTracker;
import nautilus.game.arcade.stats.WinMapStatTracker;
@ -118,7 +120,14 @@ public class DragonEscape extends SoloGame
registerStatTrackers(
new ParalympicsStatTracker(this),
new WinMapStatTracker(this)
new WinMapStatTracker(this),
new DistanceTraveledStatTracker(this, "MarathonRunner")
);
registerChatStats(
new ChatStatData("MarathonRunner", "Distance ran", true),
BlankLine,
new ChatStatData("kit", "Kit", true)
);
}

View File

@ -45,6 +45,7 @@ import nautilus.game.arcade.game.TeamGame;
import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.game.games.dragonescape.kits.*;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.managers.chat.ChatStatData;
public class DragonEscapeTeams extends TeamGame
{
@ -84,6 +85,13 @@ public class DragonEscapeTeams extends TeamGame
this.HungerSet = 20;
this.TeamArmorHotbar = true;
registerChatStats(
Deaths,
DamageTaken,
BlankLine,
new ChatStatData("kit", "Kit", true)
);
}
@Override

View File

@ -24,5 +24,8 @@ public class DragonRiders extends SoloGame
this.Damage = false;
this.HungerSet = 20;
//Chat stats
registerChatStats();
}
}

View File

@ -18,11 +18,7 @@ import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTime;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
@ -31,11 +27,11 @@ import nautilus.game.arcade.GameType;
import nautilus.game.arcade.events.PlayerStateChangeEvent;
import nautilus.game.arcade.game.SoloGame;
import nautilus.game.arcade.game.GameTeam.PlayerState;
import nautilus.game.arcade.game.games.dragons.DragonData;
import nautilus.game.arcade.game.games.dragons.kits.*;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.perks.PerkSparkler;
import nautilus.game.arcade.managers.chat.ChatStatData;
import nautilus.game.arcade.stats.SparklezStatTracker;
public class Dragons extends SoloGame
@ -70,6 +66,13 @@ public class Dragons extends SoloGame
registerStatTrackers(
new SparklezStatTracker(this)
);
registerChatStats(
DamageDealt,
DamageTaken,
BlankLine,
new ChatStatData("kit", "Kit", true)
);
}
@Override

View File

@ -35,6 +35,7 @@ import nautilus.game.arcade.game.games.dragons.kits.*;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.perks.PerkSparkler;
import nautilus.game.arcade.managers.chat.ChatStatData;
public class DragonsTeams extends TeamGame
{
@ -72,6 +73,13 @@ public class DragonsTeams extends TeamGame
this.TeamArmor = true;
this.TeamArmorHotbar = true;
registerChatStats(
Deaths,
DamageTaken,
BlankLine,
new ChatStatData("kit", "Kit", true)
);
}
@Override

View File

@ -51,6 +51,8 @@ import nautilus.game.arcade.game.games.GameScore;
import nautilus.game.arcade.game.games.draw.kits.*;
import nautilus.game.arcade.game.games.draw.tools.*;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.managers.chat.ChatStatData;
import nautilus.game.arcade.stats.DrawGuessStatTracker;
import nautilus.game.arcade.stats.KeenEyeStatTracker;
import nautilus.game.arcade.stats.MrSquiggleStatTracker;
import nautilus.game.arcade.stats.PureLuckStatTracker;
@ -133,7 +135,13 @@ public class Draw extends SoloGame
registerStatTrackers(
new MrSquiggleStatTracker(this),
new KeenEyeStatTracker(this),
new PureLuckStatTracker(this)
new PureLuckStatTracker(this),
new DrawGuessStatTracker(this)
);
registerChatStats(
new ChatStatData("TotalGuess", "Total Guess'", true),
new ChatStatData("PureLuck", "Lucky Guess'", true)
);
Manager.GetChat().setThreeSecondDelay(false);

View File

@ -162,6 +162,16 @@ public class Evolution extends SoloGame
new NoMeleeTracker(this),
new KillsWhileEvolvingTracker(this)
);
registerChatStats(
Kills,
Deaths,
KDRatio,
BlankLine,
Assists,
DamageDealt,
DamageTaken
);
}
public EvolveManager getEvolve()

View File

@ -67,6 +67,7 @@ import nautilus.game.arcade.game.games.gladiators.trackers.UntouchableTracker;
import nautilus.game.arcade.game.games.gladiators.tutorial.TutorialGladiators;
import nautilus.game.arcade.gametutorial.events.GameTutorialStartEvent;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.managers.chat.ChatStatData;
/**
* Created by William (WilliamTiger).
@ -123,6 +124,16 @@ public class Gladiators extends SoloGame
new SwiftKillTracker(this)
);
registerChatStats(
Kills,
Assists,
BlankLine,
new ChatStatData("Untouchable", "Untouchable", true),
BlankLine,
DamageDealt,
DamageTaken
);
_playerArenas = new HashMap<>();
_roundState = RoundState.WAITING;
@ -1095,4 +1106,11 @@ public class Gladiators extends SoloGame
Scoreboard.Draw();
}
@Override
public void disable()
{
_hotbarEditor.deregisterSelf(); // De-register as listener
_hotbarEditor.onDisable(); // Fully disable
}
}

View File

@ -9,6 +9,8 @@ import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.HandlerList;
import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
@ -37,6 +39,7 @@ public class HotbarEditor extends MiniPlugin
{
private Gladiators _host;
private ItemStack _item;
private Listener _pageListener;
public HotbarEditor(JavaPlugin plugin, Gladiators gladiators)
{
@ -46,7 +49,14 @@ public class HotbarEditor extends MiniPlugin
_item = new ItemBuilder(Material.NAME_TAG).setTitle(C.cGold + "Hotbar Editor")
.addLore(C.cGray + "Right click to edit your Gladiators hotbar").build();
getPluginManager().registerEvents(new HotbarPageListener(this), getPlugin());
_pageListener = new HotbarPageListener(this);
getPluginManager().registerEvents(_pageListener, getPlugin());
}
@Override
public void disable()
{
HandlerList.unregisterAll(_pageListener);
}
@EventHandler
@ -81,6 +91,9 @@ public class HotbarEditor extends MiniPlugin
{
if (event.getMessage().equalsIgnoreCase("/spec"))
{
if (_host == null)
return;
if (!_host.IsAlive(event.getPlayer())
&& !UtilInv.contains(event.getPlayer(), _item.getType(), (byte) 0, 1))
{

View File

@ -1,16 +1,18 @@
package nautilus.game.arcade.game.games.gladiators.trackers;
import java.util.HashMap;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.EntityShootBowEvent;
import org.bukkit.event.entity.ProjectileHitEvent;
import java.util.List;
import java.util.UUID;
import mineplex.core.common.util.NautHashMap;
import mineplex.core.common.util.UtilPlayer;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.games.gladiators.Gladiators;
import nautilus.game.arcade.stats.StatTracker;
import org.bukkit.entity.Player;
import org.bukkit.entity.Projectile;
import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.EntityShootBowEvent;
import org.bukkit.event.entity.ProjectileHitEvent;
/**
* Created by William (WilliamTiger).
@ -18,15 +20,13 @@ import nautilus.game.arcade.stats.StatTracker;
*/
public class PrecisionTracker extends StatTracker<Gladiators>
{
private HashMap<String, Integer> _shot;
private HashMap<String, Integer> _hit;
private NautHashMap<Projectile, UUID> _current = new NautHashMap<Projectile, UUID>();
private NautHashMap<UUID, Integer> _shot = new NautHashMap<UUID, Integer>();
private NautHashMap<UUID, Integer> _hit = new NautHashMap<UUID, Integer>();
public PrecisionTracker(Gladiators game)
{
super(game);
_shot = new HashMap<>();
_hit = new HashMap<>();
}
@EventHandler
@ -35,15 +35,15 @@ public class PrecisionTracker extends StatTracker<Gladiators>
if (e.GetState() != Game.GameState.End)
return;
for (Player p : getGame().getWinners())
List<Player> winners = getGame().getWinners();
if (winners == null)
return;
for (Player p : winners)
{
if (_shot.containsKey(p.getName()) && _hit.containsKey(p.getName()))
if (getShot(p) == getHit(p) && getShot(p) >= 3)
{
if (_shot.get(p.getName()) == _hit.get(p.getName()))
{
if (_shot.get(p.getName()) >= 3)
addStat(p, "Precision", 1, true, false);
}
addStat(p, "Precision", 1, true, false);
}
}
}
@ -56,24 +56,30 @@ public class PrecisionTracker extends StatTracker<Gladiators>
Player p = (Player) e.getEntity();
if (_shot.containsKey(p.getName()))
_shot.put(p.getName(), _shot.get(p.getName()) + 1);
else
_shot.put(p.getName(), 1);
_shot.put(p.getUniqueId(), getShot(p) + 1);
_current.put((Projectile) e.getProjectile(), p.getUniqueId());
}
@EventHandler
public void hit(ProjectileHitEvent e)
{
if (e.getEntity().getShooter() instanceof Player)
{
Player p = (Player) e.getEntity().getShooter();
if (!_current.containsKey(e.getEntity()))
return;
if (_hit.containsKey(p.getName()))
_hit.put(p.getName(), _hit.get(p.getName()) + 1);
else
_hit.put(p.getName(), 1);
}
Player player = UtilPlayer.searchExact(_current.remove(e.getEntity()));
if (player == null)
return;
_hit.put(player.getUniqueId(), getHit(player) + 1);
}
private int getShot(Player player)
{
return _shot.containsKey(player.getUniqueId()) ? _shot.get(player.getUniqueId()) : 0;
}
private int getHit(Player player)
{
return _hit.containsKey(player.getUniqueId()) ? _hit.get(player.getUniqueId()) : 0;
}
}

View File

@ -115,6 +115,11 @@ public class Gravity extends SoloGame
this.CompassEnabled = true;
this.WorldBoundaryKill = false;
registerChatStats(
Kills,
Assists
);
}
@Override

View File

@ -38,6 +38,8 @@ import nautilus.game.arcade.game.games.halloween.waves.WaveBase;
import nautilus.game.arcade.game.games.halloween.waves.WaveBoss;
import nautilus.game.arcade.game.games.halloween.waves.WaveVictory;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.managers.chat.ChatStatData;
import net.minecraft.server.v1_8_R3.PacketPlayOutNamedSoundEffect;
import org.bukkit.ChatColor;
@ -135,6 +137,13 @@ public class Halloween extends SoloGame
this.WorldBoundaryKill = false;
this.DontAllowOverfill = true;
registerChatStats(
DamageDealt,
DamageTaken,
BlankLine,
new ChatStatData("kit", "Kit", true)
);
}
@Override

View File

@ -341,8 +341,16 @@ public class HideSeek extends TeamGame
Manager.GetExplosion().SetTNTSpread(false);
Manager.getCosmeticManager().setHideParticles(true);
registerStatTrackers(new HunterKillerStatTracker(this), new MeowStatTracker(this), new HunterKillerStatTracker(this),
new HunterOfTheYearStatTracker(this), new BadHiderStatTracker(this));
registerStatTrackers(
new HunterKillerStatTracker(this),
new MeowStatTracker(this),
new HunterKillerStatTracker(this),
new HunterOfTheYearStatTracker(this),
new BadHiderStatTracker(this)
);
//Need ideas for this one
registerChatStats();
}
@EventHandler

View File

@ -57,6 +57,8 @@ public class HoleInTheWall extends SoloGame
DamageFall = false;
HungerSet = 20;
WorldTimeSet = 8000;
registerChatStats();
}
private ArrayList<Entry<Integer, Integer>> getWall()

View File

@ -18,23 +18,25 @@ public class Horse extends TeamGame
{
super(manager, GameType.Horse,
new Kit[]
{
new KitHorseKnight(manager),
new NullKit(manager),
new KitDefenceArcher(manager),
},
new Kit[]
{
new KitHorseKnight(manager),
new NullKit(manager),
new KitDefenceArcher(manager),
},
new String[]
{
"Horsemen must charge the ruins",
"Horsemen win if they rid the ruins of Undead.",
"",
"Undead must defend the ruins",
"Undead win when all Horsemen are dead.",
"",
"Teams swap after game is over"
});
new String[]
{
"Horsemen must charge the ruins",
"Horsemen win if they rid the ruins of Undead.",
"",
"Undead must defend the ruins",
"Undead win when all Horsemen are dead.",
"",
"Teams swap after game is over"
});
registerChatStats();
}
@Override

View File

@ -42,6 +42,7 @@ import nautilus.game.arcade.game.games.lobbers.trackers.TrackerDirectHit;
import nautilus.game.arcade.game.games.lobbers.trackers.TrackerNoDamage;
import nautilus.game.arcade.game.games.lobbers.trackers.TrackerTNTThrown;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.managers.chat.ChatStatData;
import org.bukkit.ChatColor;
import org.bukkit.Location;
@ -74,19 +75,23 @@ public class BombLobbers extends TeamGame implements IThrown
@SuppressWarnings("unchecked")
public BombLobbers(ArcadeManager manager)
{
super(manager, GameType.Lobbers, new Kit[]
{
new KitJumper(manager),
new KitArmorer(manager),
new KitPitcher(manager),
new KitWaller(manager)
}, new String[]
{
"Fight against your enemies using",
"the power of explosives!",
"Left click TNT to throw at your enemy.",
"Last team alive wins!"
});
super(manager, GameType.Lobbers,
new Kit[]
{
new KitJumper(manager),
new KitArmorer(manager),
new KitPitcher(manager),
new KitWaller(manager)
},
new String[]
{
"Fight against your enemies using",
"the power of explosives!",
"Left click TNT to throw at your enemy.",
"Last team alive wins!"
});
DamageFall = true;
DamageEvP = true;
@ -110,7 +115,21 @@ public class BombLobbers extends TeamGame implements IThrown
WorldTimeSet = 6000;
registerStatTrackers(new Tracker6Kill(this), new TrackerBlastProof(this), new TrackerNoDamage(this), new TrackerTNTThrown(this), new TrackerDirectHit(this));
registerStatTrackers(
new Tracker6Kill(this),
new TrackerBlastProof(this),
new TrackerNoDamage(this),
new TrackerTNTThrown(this),
new TrackerDirectHit(this)
);
registerChatStats(
Kills,
Assists,
DamageTaken,
BlankLine,
new ChatStatData("Thrown", "Bombs Lobbed", true)
);
}
@EventHandler

View File

@ -22,6 +22,7 @@ import nautilus.game.arcade.GameType;
import nautilus.game.arcade.game.TeamGame;
import nautilus.game.arcade.game.games.micro.kits.*;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.managers.chat.ChatStatData;
import nautilus.game.arcade.stats.KillsWithinGameStatTracker;
public class Micro extends TeamGame
@ -58,7 +59,17 @@ public class Micro extends TeamGame
this.BlockBreak = true;
this.BlockPlace = true;
registerStatTrackers(new KillsWithinGameStatTracker(this, 8, "Annihilation"));
registerStatTrackers(
new KillsWithinGameStatTracker(this, 8, "Annihilation")
);
registerChatStats(
Kills,
Assists,
BlankLine,
DamageTaken,
DamageDealt
);
}
@Override

View File

@ -74,29 +74,33 @@ public class MilkCow extends SoloGame
super(manager, GameType.MilkCow,
new Kit[]
{
new KitFarmerJump(manager),
new KitSturdyFarmhand(manager),
new NullKit(manager),
new KitCow(manager),
},
{
new KitFarmerJump(manager),
new KitSturdyFarmhand(manager),
new NullKit(manager),
new KitCow(manager),
},
new String[]
{
"Farmers get 1 point for drinking milk.",
"You lose 5 points for dying!",
"",
"Cows get 1 point for killing farmers.",
"Defend your herd to stop farmers!",
"",
"First player to 15 points wins!"
});
new String[]
{
"Farmers get 1 point for drinking milk.",
"You lose 5 points for dying!",
"",
"Cows get 1 point for killing farmers.",
"Defend your herd to stop farmers!",
"",
"First player to 15 points wins!"
});
this.CompassEnabled = true;
this.DeathOut = false;
_scoreObj = Scoreboard.GetScoreboard().registerNewObjective("Milk", "dummy");
_scoreObj.setDisplaySlot(DisplaySlot.BELOW_NAME);
registerChatStats(
Kills
);
}
@Override

View File

@ -104,6 +104,7 @@ import nautilus.game.arcade.game.games.minestrike.items.guns.GunStats;
import nautilus.game.arcade.game.games.minestrike.items.guns.GunType;
import nautilus.game.arcade.game.games.minestrike.kits.KitPlayer;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.managers.chat.ChatStatData;
import nautilus.game.arcade.stats.KaboomStatTracker;
import nautilus.game.arcade.stats.KillAllOpposingMineStrikeRoundStatTracker;
import nautilus.game.arcade.stats.KillFastStatTracker;
@ -243,57 +244,57 @@ public class MineStrike extends TeamGame
{
super(manager, GameType.MineStrike,
new Kit[]
{
new KitPlayer(manager),
new Kit[]
{
new KitPlayer(manager),
},
new String[]
{
C.cAqua + "SWAT" + C.cWhite + " Defend the Bomb Sites",
C.cAqua + "SWAT" + C.cWhite + " Kill the Bombers",
" ",
C.cRed + "Bombers" + C.cWhite + " Plant the Bomb at Bomb Site",
C.cRed + "Bombers" + C.cWhite + " Kill the SWAT Team",
});
new String[]
{
C.cAqua + "SWAT" + C.cWhite + " Defend the Bomb Sites",
C.cAqua + "SWAT" + C.cWhite + " Kill the Bombers",
" ",
C.cRed + "Bombers" + C.cWhite + " Plant the Bomb at Bomb Site",
C.cRed + "Bombers" + C.cWhite + " Kill the SWAT Team",
});
_shopManager = new ShopManager(this);
this.StrictAntiHack = true;
AnnounceStay = false;
this.HungerSet = 20;
this.ItemDrop = true;
this.DeathTeleport = false;
this.InventoryClick = true;
this.JoinInProgress = true;
this.DontAllowOverfill = true;
_scoreObj = Scoreboard.GetScoreboard().registerNewObjective("HP", "dummy");
_scoreObj.setDisplaySlot(DisplaySlot.BELOW_NAME);
this._help = new String[]
this._help = new String[]
{
//"Tap Crouch when close to an ally to Boost",
"Open Inventory at spawn to buy guns",
"Hold Right-Click to Plant Bomb",
"Look at the Bomb to Defuse it",
"Moving decreases accuracy",
"Sprinting heavily decreases accuracy",
"Jumping massively decreases accuracy",
"Crouching increases accuracy",
"Left-Click to drop Grenades",
"Right-Click to throw Grenades",
"Burst Fire for greater accuracy",
"Sniper Rifles are only accurate while scoped",
"Rifles have 30% recoil reduction while scoped",
"Pick up better weapons from dead players"
//"Tap Crouch when close to an ally to Boost",
"Open Inventory at spawn to buy guns",
"Hold Right-Click to Plant Bomb",
"Look at the Bomb to Defuse it",
"Moving decreases accuracy",
"Sprinting heavily decreases accuracy",
"Jumping massively decreases accuracy",
"Crouching increases accuracy",
"Left-Click to drop Grenades",
"Right-Click to throw Grenades",
"Burst Fire for greater accuracy",
"Sniper Rifles are only accurate while scoped",
"Rifles have 30% recoil reduction while scoped",
"Pick up better weapons from dead players"
};
registerStatTrackers(
@ -304,10 +305,19 @@ public class MineStrike extends TeamGame
new MineStrikeLastAliveKillStatTracker(this),
new KillFastStatTracker(this, 4, 5, "KillingSpree"),
new KillsWithConditionStatTracker(this, "Blindfolded", ConditionType.BLINDNESS, "Flash Bang", 2),
new TeamDeathsStatTracker(this),
new TeamKillsStatTracker(this)
);
registerChatStats(
Kills,
Deaths,
KDRatio,
BlankLine,
new ChatStatData("BoomHeadshot", "Headshots", true),
Assists
);
}
@Override

View File

@ -84,6 +84,8 @@ public class MineWare extends SoloGame
Manager.GetCreature().SetDisableCustomDrops(true);
PopulateOrders();
registerChatStats();
}
@Override

View File

@ -31,6 +31,8 @@ public class Moba extends TeamGame
this.DeathSpectateSecs = 8;
this.HungerSet = 20;
registerChatStats();
}
@Override

View File

@ -63,6 +63,8 @@ public class MonsterLeague extends TeamGame
this.TeamArmor = true;
this.TeamArmorHotbar = true;
registerChatStats();
}
//Supports anywhere from 2-4 teams on a map

View File

@ -33,6 +33,7 @@ import nautilus.game.arcade.game.games.monstermaze.trackers.PilotTracker;
import nautilus.game.arcade.game.games.monstermaze.trackers.SnowmanHitTracker;
import nautilus.game.arcade.game.games.monstermaze.trackers.SurvivePast10thSafepadTracker;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.managers.chat.ChatStatData;
import org.bukkit.Bukkit;
import org.bukkit.Effect;
@ -101,6 +102,13 @@ public class MonsterMaze extends SoloGame
new SurvivePast10thSafepadTracker(this)
);
//_maze = new SnowmanMaze(this, WorldData.GetDataLocs("GRAY")/*, WorldData.GetCustomLocs("103")*/);
registerChatStats(//first to beacon
new ChatStatData("Ninja", "Times Hit", true),
new ChatStatData("Speed", "First to safe pad", true),
BlankLine,
new ChatStatData("kit", "Kit", true)
);
}
public Maze getMaze()

View File

@ -88,6 +88,8 @@ public class OldMineWare extends SoloGame
InventoryClick = true;
PopulateOrders();
registerChatStats();
}
@Override

View File

@ -114,6 +114,16 @@ public class Paintball extends TeamGame
new WinFastStatTracker(this, 30, "Speedrunner"),
new LastStandStatTracker(this)
);
registerChatStats(
Kills,
Deaths,
KDRatio,
BlankLine,
Assists,
DamageTaken,
DamageDealt
);
}
@EventHandler

View File

@ -92,6 +92,16 @@ public class Quiver extends SoloGame
new SharpShooterStatTracker(this),
new WinWithoutBowStatTracker(this, "WhatsABow")
);
registerChatStats(
Kills,
Deaths,
KDRatio,
BlankLine,
Assists,
DamageTaken,
DamageDealt
);
}
@EventHandler(priority = EventPriority.HIGH)

View File

@ -65,6 +65,16 @@ public class QuiverTeams extends TeamGame
this.TeamArmor = true;
this.TeamArmorHotbar = true;
registerChatStats(
Kills,
Deaths,
KDRatio,
BlankLine,
Assists,
DamageTaken,
DamageDealt
);
}
@EventHandler(priority = EventPriority.HIGH)

View File

@ -32,6 +32,7 @@ import nautilus.game.arcade.GameType;
import nautilus.game.arcade.game.SoloGame;
import nautilus.game.arcade.game.games.runner.kits.*;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.managers.chat.ChatStatData;
import nautilus.game.arcade.stats.DistanceTraveledStatTracker;
import net.minecraft.server.v1_8_R3.EntityArrow;
@ -66,6 +67,12 @@ public class Runner extends SoloGame implements IThrown
this.PrepareFreeze = false;
registerStatTrackers(new DistanceTraveledStatTracker(this, "MarathonRunner"));
registerChatStats(
new ChatStatData("MarathonRunner", "Distance ran", true),
BlankLine,
new ChatStatData("kit", "Kit", true)
);
}
@EventHandler

View File

@ -72,6 +72,11 @@ public class SearchAndDestroy extends TeamGame
DamageSelf = false;
Manager.GetDamage().GetCombatManager().setUseWeaponName(AttackReason.DefaultWeaponName);
registerChatStats(
Kills,
Assists
);
}
public ArrayList<TeamBomb> getBombs()

View File

@ -53,6 +53,7 @@ import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.TeamGame;
import nautilus.game.arcade.game.games.sheep.kits.*;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.managers.chat.ChatStatData;
import nautilus.game.arcade.stats.SheepDropStatTracker;
import nautilus.game.arcade.stats.SheepThiefStatTracker;
import nautilus.game.arcade.stats.WinWithSheepStatTracker;
@ -155,6 +156,15 @@ public class SheepGame extends TeamGame
new SheepDropStatTracker(this),
new WinWithSheepStatTracker(this)
);
registerChatStats(
new ChatStatData("AnimalRescue", "Captures", true),
new ChatStatData("Thief", "Stolen", true),
BlankLine,
Kills,
Deaths,
KDRatio
);
}
@Override

View File

@ -46,6 +46,7 @@ import nautilus.game.arcade.game.games.skywars.kits.KitDestructor;
import nautilus.game.arcade.game.games.skywars.kits.KitMiner;
import nautilus.game.arcade.game.games.skywars.kits.KitMadScientist;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.managers.chat.ChatStatData;
import nautilus.game.arcade.ore.OreHider;
import nautilus.game.arcade.stats.DeathBomberStatTracker;
import nautilus.game.arcade.stats.SkywarsKillZombieStatTracker;
@ -204,6 +205,16 @@ public abstract class Skywars extends Game
new WinWithoutOpeningChestStatTracker(this),
new WinWithoutWearingArmorStatTracker(this));
registerChatStats(
Kills,
Deaths,
KDRatio,
BlankLine,
Assists,
DamageTaken,
DamageDealt
);
}
public void ParseData()

View File

@ -16,6 +16,7 @@ import nautilus.game.arcade.GameType;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.managers.chat.ChatStatData;
public class SoloSuperSmash extends SuperSmash
{
@ -32,6 +33,18 @@ public class SoloSuperSmash extends SuperSmash
});
this.DamageTeamSelf = true;
registerChatStats(
Kills,
Deaths,
KDRatio,
BlankLine,
Assists,
DamageTaken,
DamageDealt,
BlankLine,
new ChatStatData("kit", "Kit", true)
);
}
@EventHandler

View File

@ -24,7 +24,8 @@ import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.game.games.common.Domination;
import nautilus.game.arcade.game.games.smash.kits.*;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.managers.chat.ChatStatData;
public class SuperSmashDominate extends Domination
{
public SuperSmashDominate(ArcadeManager manager)
@ -55,6 +56,18 @@ public class SuperSmashDominate extends Domination
new KitMagmaCube(manager),
});
registerChatStats(
Kills,
Deaths,
KDRatio,
BlankLine,
Assists,
DamageTaken,
DamageDealt,
BlankLine,
new ChatStatData("kit", "Kit", true)
);
}
@EventHandler(priority = EventPriority.LOWEST)

View File

@ -15,6 +15,7 @@ import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.managers.chat.ChatStatData;
import org.bukkit.ChatColor;
import org.bukkit.Location;
@ -53,6 +54,18 @@ public class TeamSuperSmash extends SuperSmash
this.TeamArmorHotbar = true;
this.DontAllowOverfill = true;
registerChatStats(
Kills,
Deaths,
KDRatio,
BlankLine,
Assists,
DamageTaken,
DamageDealt,
BlankLine,
new ChatStatData("kit", "Kit", true)
);
}
@Override

View File

@ -56,6 +56,7 @@ import nautilus.game.arcade.game.games.snake.kits.KitInvulnerable;
import nautilus.game.arcade.game.games.snake.kits.KitReverser;
import nautilus.game.arcade.game.games.snake.kits.KitSpeed;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.managers.chat.ChatStatData;
import nautilus.game.arcade.stats.ChooChooStatTracker;
import nautilus.game.arcade.stats.KillsWithinGameStatTracker;
import nautilus.game.arcade.stats.SlimySheepStatTracker;
@ -157,6 +158,15 @@ public class Snake extends SoloGame
new ChooChooStatTracker(this),
new SlimySheepStatTracker(this)
);
registerChatStats(//slimes eaten, kills, length
new ChatStatData("Cannibal", "Kills", true),
BlankLine,
new ChatStatData("ChooChoo", "Tail Length", true),
new ChatStatData("SlimySheep", "Slimes Eaten", true),
BlankLine,
new ChatStatData("kit", "Kit", true)
);
}
@EventHandler

View File

@ -92,6 +92,14 @@ public class SneakyAssassins extends SoloGame
new RevealStatTracker(this, "ISeeYou"),
_killEntityStatTracker
);
registerChatStats(//assists
Kills,
Assists,
BlankLine,
DamageTaken,
DamageDealt
);
}
@Override

View File

@ -104,6 +104,14 @@ public class SnowFight extends TeamGame
this.TeamArmor = true;
this.TeamArmorHotbar = true;
registerChatStats(//damage, collected
Kills,
Assists,
BlankLine,
DamageTaken,
DamageDealt
);
// this.WorldWeatherEnabled = true;
// this.WorldTimeSet = 4000;

View File

@ -0,0 +1,10 @@
package nautilus.game.arcade.game.games.speedbuilders;
public enum SpeedBuildersState
{
VIEWING,
BUILDING,
REVIEWING;
}

View File

@ -0,0 +1,198 @@
package nautilus.game.arcade.game.games.speedbuilders.data;
import java.util.ArrayList;
import mineplex.core.common.util.MapUtil;
import nautilus.game.arcade.game.games.speedbuilders.SpeedBuilders;
import net.minecraft.server.v1_8_R3.BlockPosition;
import net.minecraft.server.v1_8_R3.BlockStairs;
import net.minecraft.server.v1_8_R3.BlockStairs.EnumStairShape;
import net.minecraft.server.v1_8_R3.IBlockData;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.BlockState;
import org.bukkit.block.Sign;
import org.bukkit.craftbukkit.v1_8_R3.CraftWorld;
import org.bukkit.craftbukkit.v1_8_R3.util.CraftMagicNumbers;
import org.bukkit.entity.EntityType;
import org.bukkit.material.Stairs;
public class BuildData
{
public SpeedBuilders Game;
public Location BuildMin;
public BlockState[][][] Build;
public BlockState[][] Ground;
//Store stair shapes for stair fix
public EnumStairShape[][][] StairShapes;
public String BuildText;
public ArrayList<MobData> Mobs = new ArrayList<MobData>();
private int _timeAdd = 0;
private int _timeSubtract = 0;
private int _timeEqual = -1;
private double _timeMultiplier = 1.0;
public BuildData(Location loc, String buildText, SpeedBuilders game)
{
Build = new BlockState[game.BuildSize][game.BuildSize][game.BuildSize];
Ground = new BlockState[game.BuildSize][game.BuildSize];
StairShapes = new EnumStairShape[game.BuildSize][game.BuildSize][game.BuildSize];
Game = game;
Location groundMin = loc.clone().subtract(game.BuildSizeDiv2, 11, game.BuildSizeDiv2);
for (int x = 0; x < game.BuildSize; x++)
{
for (int z = 0; z < game.BuildSize; z++)
{
Ground[x][z] = groundMin.clone().add(x, 0, z).getBlock().getState();
}
}
parseText(buildText);
Location buildMin = loc.clone().subtract(game.BuildSizeDiv2, 10, game.BuildSizeDiv2);
BuildMin = buildMin;
for (int x = 0; x < game.BuildSize; x++)
{
for (int y = 0; y < game.BuildSize; y++)
{
for (int z = 0; z < game.BuildSize; z++)
{
Block block = buildMin.clone().add(x, y, z).getBlock();
if (block.getType() == Material.SIGN_POST)
{
Sign sign = (Sign) block.getState();
EntityType type = null;
try
{
type = EntityType.valueOf(sign.getLine(0).toUpperCase());
}
catch (IllegalArgumentException e)
{
// Not a entity sign or someone messed up...
}
if (type != null)
{
Mobs.add(new MobData(type, x, y, z));
MapUtil.QuickChangeBlockAt(block.getLocation(), Material.AIR);
}
}
Build[x][y][z] = block.getState();
if (block.getState().getData() instanceof Stairs)
{
net.minecraft.server.v1_8_R3.Block nmsBlock = CraftMagicNumbers.getBlock(block);
IBlockData blockData = nmsBlock.getBlockData();
blockData = nmsBlock.updateState(blockData, ((CraftWorld) block.getWorld()).getHandle(), new BlockPosition(block.getX(), block.getY(), block.getZ()));
StairShapes[x][y][z] = blockData.get(BlockStairs.SHAPE);
}
}
}
}
}
private void parseText(String buildText)
{
StringBuilder sb = new StringBuilder();
for (String part : buildText.split(" "))
{
if (part.matches("^time[\\Q+-=\\E][0-9]+$"))
{
// + - = add subtract or set seconds
try
{
int num = Integer.parseInt(part.substring(5));
switch (part.charAt(4))
{
case '-':
_timeSubtract = num;
break;
case '=':
_timeEqual = num;
break;
default:
_timeAdd = num;
}
}
catch (NumberFormatException e)
{
System.out.println("Failed parsing data for customloc: " + buildText);
e.printStackTrace();
}
}
else if (part.matches("^time\\*[0-9]*\\.?[0-9]+$"))
{
// * multiply by a number
try
{
double num = Double.parseDouble(part.substring(5));
_timeMultiplier = num;
}
catch (NumberFormatException e)
{
System.out.println("Failed parsing data for customloc: " + buildText);
e.printStackTrace();
}
}
else
{
sb.append(part + " ");
}
}
BuildText = sb.toString().trim();
}
public int getBuildTime(int unmodified)
{
int newTime = unmodified;
newTime += _timeAdd;
newTime -= _timeSubtract;
newTime = (int) (_timeMultiplier * newTime);
if (_timeEqual != -1) newTime = _timeEqual;
// limit to range of 5-60 seconds
return Math.min(Math.max(newTime, 5), 60);
}
public int getPerfectScore()
{
int nonAirBlocks = 0;
for (int x = 0; x < Game.BuildSize; x++)
{
for (int y = 0; y < Game.BuildSize; y++)
{
for (int z = 0; z < Game.BuildSize; z++)
{
if (Build[x][y][z].getType() != Material.AIR)
nonAirBlocks++;
}
}
}
return nonAirBlocks + Mobs.size();
}
}

View File

@ -0,0 +1,227 @@
package nautilus.game.arcade.game.games.speedbuilders.data;
import java.util.ArrayList;
import mineplex.core.common.util.MapUtil;
import mineplex.core.common.util.NautHashMap;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilTime;
import mineplex.core.hologram.Hologram;
import org.bukkit.Effect;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.block.BlockState;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Item;
import org.bukkit.inventory.ItemStack;
import org.bukkit.material.Bed;
import org.bukkit.material.Door;
public class DemolitionData
{
public RecreationData Parent;
public NautHashMap<Block, BlockState> Blocks;
public ArrayList<Entity> Mobs;
public long Start;
private Hologram _hologram;
private boolean _flickerAir = true;
private long _lastFlicker = System.currentTimeMillis();
public DemolitionData(RecreationData parent, ArrayList<Block> blocks, ArrayList<Entity> mobs)
{
Parent = parent;
Blocks = new NautHashMap<Block, BlockState>();
Mobs = mobs;
for (Block block : blocks)
{
Blocks.put(block, block.getState());
}
Start = System.currentTimeMillis();
spawnHologram();
}
public void spawnHologram()
{
if (Parent.Game.InstaBreak)
return;
Location loc = Parent.getMidpoint();
if (!Blocks.isEmpty())
loc = Blocks.keySet().iterator().next().getLocation().add(0.5, 0.5, 0.5);
else if (!Mobs.isEmpty())
loc = UtilAlg.Random(Mobs).getLocation().add(0, 1, 0);
_hologram = new Hologram(Parent.Game.Manager.getHologramManager(), loc, "3");
_hologram.start();
}
public void despawnHologram()
{
if (_hologram == null)
return;
_hologram.stop();
_hologram = null;
}
public void update()
{
if (Parent.Game.InstaBreak)
{
breakBlocks();
return;
}
if (_hologram == null)
spawnHologram();
int secondsLeft = (int) Math.ceil((3000 - (System.currentTimeMillis() - Start)) / 1000.0D);
if (secondsLeft < 0)
secondsLeft = 0;
_hologram.setText("" + secondsLeft);
if (UtilTime.elapsed(_lastFlicker, 500))
{
_lastFlicker = System.currentTimeMillis();
for (Block block : Blocks.keySet())
{
if (_flickerAir)
MapUtil.QuickChangeBlockAt(block.getLocation(), Material.AIR);
else
Blocks.get(block).update(true, false);
}
for (Entity entity : Mobs)
{
if (_flickerAir)
UtilEnt.ghost(entity, true, true);
else
UtilEnt.ghost(entity, true, false);
}
_flickerAir = !_flickerAir;
}
if (secondsLeft == 0)
breakBlocks();
}
public void cancelBreak()
{
despawnHologram();
for (Block block : Blocks.keySet())
{
Blocks.get(block).update(true, false);
}
for (Entity entity : Mobs)
{
UtilEnt.ghost(entity, true, false);
}
Parent.BlocksForDemolition.remove(this);
}
public void breakBlocks()
{
despawnHologram();
//Effect will play for all blocks even two-parted ones
for (Block block : Blocks.keySet())
{
Blocks.get(block).update(true, false);
block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, block.getTypeId());
}
for (Block block : Blocks.keySet())
{
if (block.getType() == Material.AIR)
continue;
//Ignore top double plant blocks
if (block.getType() == Material.DOUBLE_PLANT)
{
if (block.getData() > 7)
continue;
}
for (ItemStack itemStack : UtilBlock.blockToInventoryItemStacks(block))
{
Item item = block.getWorld().dropItem(block.getLocation().add(0.5, 0.5, 0.5), itemStack);
Parent.DroppedItems.put(item, System.currentTimeMillis());
}
//Destroy the other part
if (block.getType() == Material.BED_BLOCK)
{
Bed bed = (Bed) block.getState().getData();
if (bed.isHeadOfBed())
MapUtil.QuickChangeBlockAt(block.getRelative(bed.getFacing().getOppositeFace()).getLocation(), Material.AIR);
else
MapUtil.QuickChangeBlockAt(block.getRelative(bed.getFacing()).getLocation(), Material.AIR);
}
else if (block.getType() == Material.WOODEN_DOOR || block.getType() == Material.IRON_DOOR_BLOCK || block.getType() == Material.SPRUCE_DOOR || block.getType() == Material.BIRCH_DOOR || block.getType() == Material.JUNGLE_DOOR || block.getType() == Material.ACACIA_DOOR || block.getType() == Material.DARK_OAK_DOOR)
{
Door door = (Door) block.getState().getData();
if (door.isTopHalf())
MapUtil.QuickChangeBlockAt(block.getRelative(BlockFace.DOWN).getLocation(), Material.AIR);
else
MapUtil.QuickChangeBlockAt(block.getRelative(BlockFace.UP).getLocation(), Material.AIR);
}
else if (block.getType() == Material.DOUBLE_PLANT)
{
//The top block does not carry the correct data
if (block.getData() <= 7)
MapUtil.QuickChangeBlockAt(block.getRelative(BlockFace.UP).getLocation(), Material.AIR);
else
MapUtil.QuickChangeBlockAt(block.getLocation(), Material.AIR);
}
MapUtil.QuickChangeBlockAt(block.getLocation(), Material.AIR);
}
for (Entity entity : Mobs)
{
ItemStack spawnEgg = new ItemStack(Material.MONSTER_EGG, 1, entity.getType().getTypeId());
Item item = entity.getWorld().dropItem(entity.getLocation().add(0, 1, 0), spawnEgg);
Parent.DroppedItems.put(item, System.currentTimeMillis());
entity.remove();
Parent.Mobs.remove(entity);
}
Parent.BlocksForDemolition.remove(this);
Parent.Game.checkPerfectBuild(Parent.Player);
}
}

View File

@ -0,0 +1,23 @@
package nautilus.game.arcade.game.games.speedbuilders.data;
import org.bukkit.entity.EntityType;
public class MobData
{
public EntityType EntityType;
public int DX;
public int DY;
public int DZ;
public MobData(EntityType entityType, int dx, int dy, int dz)
{
EntityType = entityType;
DX = dx;
DY = dy;
DZ = dz;
}
}

View File

@ -0,0 +1,444 @@
package nautilus.game.arcade.game.games.speedbuilders.data;
import java.util.ArrayList;
import java.util.List;
import mineplex.core.common.util.C;
import mineplex.core.common.util.MapUtil;
import mineplex.core.common.util.NautHashMap;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilInv;
import mineplex.core.hologram.Hologram;
import nautilus.game.arcade.game.games.speedbuilders.SpeedBuilders;
import net.minecraft.server.v1_8_R3.BlockPosition;
import net.minecraft.server.v1_8_R3.BlockStairs;
import net.minecraft.server.v1_8_R3.BlockStairs.EnumStairShape;
import net.minecraft.server.v1_8_R3.IBlockData;
import org.bukkit.Effect;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.block.BlockState;
import org.bukkit.craftbukkit.v1_8_R3.CraftWorld;
import org.bukkit.craftbukkit.v1_8_R3.util.CraftMagicNumbers;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Item;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.material.Bed;
import org.bukkit.material.Door;
import org.bukkit.material.Stairs;
import org.bukkit.util.Vector;
public class RecreationData
{
public SpeedBuilders Game;
public Player Player;
public BlockState[][] DefaultGround;
public Location OriginalBuildLocation;
public Location CornerA;
public Location CornerB;
public Location PlayerSpawn;
public NautHashMap<Item, Long> DroppedItems = new NautHashMap<Item, Long>();
public ArrayList<DemolitionData> BlocksForDemolition = new ArrayList<DemolitionData>();
public ArrayList<Entity> Mobs = new ArrayList<Entity>();
private Hologram _hologram;
public RecreationData(SpeedBuilders game, Player player, Location loc, Location playerSpawn)
{
Game = game;
DefaultGround = new BlockState[game.BuildSize][game.BuildSize];
Player = player;
OriginalBuildLocation = loc;
CornerA = loc.clone().subtract(game.BuildSizeDiv2, 0, game.BuildSizeDiv2);
CornerB = loc.clone().add(game.BuildSizeDiv2, game.BuildSizeMin1, game.BuildSizeDiv2);
PlayerSpawn = playerSpawn;
for (int x = 0; x < game.BuildSize; x++)
{
for (int z = 0; z < game.BuildSize; z++)
{
DefaultGround[x][z] = CornerA.clone().add(x, -1, z).getBlock().getState();
}
}
Vector mid = game.getJudgeSpawn().toVector().subtract(loc.toVector()).multiply(0.4);
Location hologramLocation = loc.clone().add(mid).add(0, 1, 0);
Location above = loc.clone().add(0.5, game.BuildSize + 0.5, 0.5);
_hologram = new Hologram(game.getArcadeManager().getHologramManager(), hologramLocation, C.cYellow + player.getName());
_hologram.start();
}
public boolean inBuildArea(Block block)
{
if (block.getX() < Math.min(CornerA.getBlockX(), CornerB.getBlockX()))
return false;
if (block.getY() < Math.min(CornerA.getBlockY(), CornerB.getBlockY()))
return false;
if (block.getZ() < Math.min(CornerA.getBlockZ(), CornerB.getBlockZ()))
return false;
if (block.getX() > Math.max(CornerA.getBlockX(), CornerB.getBlockX()))
return false;
if (block.getY() > Math.max(CornerA.getBlockY(), CornerB.getBlockY()))
return false;
if (block.getZ() > Math.max(CornerA.getBlockZ(), CornerB.getBlockZ()))
return false;
return true;
}
public boolean inBuildArea(Location loc)
{
if (loc.getX() < Math.min(CornerA.getBlockX(), CornerB.getBlockX()))
return false;
if (loc.getY() < Math.min(CornerA.getBlockY(), CornerB.getBlockY()))
return false;
if (loc.getZ() < Math.min(CornerA.getBlockZ(), CornerB.getBlockZ()))
return false;
if (loc.getX() > Math.max(CornerA.getBlockX(), CornerB.getBlockX()) + 1)
return false;
if (loc.getY() > Math.max(CornerA.getBlockY(), CornerB.getBlockY()) + 1)
return false;
if (loc.getZ() > Math.max(CornerA.getBlockZ(), CornerB.getBlockZ()) + 1)
return false;
return true;
}
public void clearBuildArea(boolean resetGround)
{
for (Block block : getBlocks())
{
MapUtil.QuickChangeBlockAt(block.getLocation(), Material.AIR);
}
for (Entity entity : Mobs)
{
entity.remove();
}
Mobs.clear();
if (resetGround)
{
for (int x = 0; x < Game.BuildSize; x++)
{
for (int z = 0; z < Game.BuildSize; z++)
{
MapUtil.QuickChangeBlockAt(CornerA.clone().add(x, -1, z), DefaultGround[x][z].getType(), DefaultGround[x][z].getRawData());
}
}
}
}
public void pasteBuildData(BuildData buildData)
{
clearBuildArea(true);
for (int x = 0; x < Game.BuildSize; x++)
{
for (int z = 0; z < Game.BuildSize; z++)
{
MapUtil.QuickChangeBlockAt(CornerA.clone().add(x, -1, z), buildData.Ground[x][z].getType(), buildData.Ground[x][z].getRawData());
}
}
for (int x = 0; x < Game.BuildSize; x++)
{
for (int y = 0; y < Game.BuildSize; y++)
{
for (int z = 0; z < Game.BuildSize; z++)
{
MapUtil.QuickChangeBlockAt(CornerA.clone().add(x, y, z), buildData.Build[x][y][z].getType(), buildData.Build[x][y][z].getRawData());
}
}
}
Game.CreatureAllowOverride = true;
for (MobData mobData : buildData.Mobs)
{
Location loc = CornerA.clone().add(mobData.DX + 0.5, mobData.DY, mobData.DZ + 0.5);
Entity entity = loc.getWorld().spawnEntity(loc, mobData.EntityType);
UtilEnt.Vegetate(entity, true);
UtilEnt.ghost(entity, true, false);
Mobs.add(entity);
}
Game.CreatureAllowOverride = false;
}
public void breakAndDropItems()
{
for (Block block : getBlocks())
{
if (block.getType() == Material.AIR)
continue;
//Ignore top double plant blocks
if (block.getType() == Material.DOUBLE_PLANT)
{
if (block.getData() > 7)
continue;
}
for (ItemStack itemStack : UtilBlock.blockToInventoryItemStacks(block))
{
UtilInv.insert(Player, itemStack);
}
//Destroy the other part
if (block.getType() == Material.BED_BLOCK)
{
Bed bed = (Bed) block.getState().getData();
if (bed.isHeadOfBed())
MapUtil.QuickChangeBlockAt(block.getRelative(bed.getFacing().getOppositeFace()).getLocation(), Material.AIR);
else
MapUtil.QuickChangeBlockAt(block.getRelative(bed.getFacing()).getLocation(), Material.AIR);
}
else if (block.getType() == Material.WOODEN_DOOR || block.getType() == Material.IRON_DOOR_BLOCK || block.getType() == Material.SPRUCE_DOOR || block.getType() == Material.BIRCH_DOOR || block.getType() == Material.JUNGLE_DOOR || block.getType() == Material.ACACIA_DOOR || block.getType() == Material.DARK_OAK_DOOR)
{
Door door = (Door) block.getState().getData();
if (door.isTopHalf())
MapUtil.QuickChangeBlockAt(block.getRelative(BlockFace.DOWN).getLocation(), Material.AIR);
else
MapUtil.QuickChangeBlockAt(block.getRelative(BlockFace.UP).getLocation(), Material.AIR);
}
else if (block.getType() == Material.DOUBLE_PLANT)
{
//The top block does not carry the correct data
if (block.getData() <= 7)
MapUtil.QuickChangeBlockAt(block.getRelative(BlockFace.UP).getLocation(), Material.AIR);
else
MapUtil.QuickChangeBlockAt(block.getLocation(), Material.AIR);
}
}
for (Entity entity : Mobs)
{
ItemStack spawnEgg = new ItemStack(Material.MONSTER_EGG, 1, entity.getType().getTypeId());
UtilInv.insert(Player, spawnEgg);
}
CornerA.getWorld().playEffect(getMidpoint(), Effect.STEP_SOUND, Material.LOG.getId());
clearBuildArea(false);
}
public boolean isEmptyBuild(BuildData buildData)
{
for (Block block : getBlocks())
{
if (block.getType() != Material.AIR)
return false;
}
if (!buildData.Mobs.isEmpty())
return Mobs.isEmpty();
return true;
}
public int calculateScoreFromBuild(BuildData buildData)
{
int score = 0;
for (int x = 0; x < Game.BuildSize; x++)
{
for (int y = 0; y < Game.BuildSize; y++)
{
for (int z = 0; z < Game.BuildSize; z++)
{
Block currentBlock = CornerA.clone().add(x, y, z).getBlock();
BlockState expectedState = buildData.Build[x][y][z];
if (expectedState.getType() == Material.AIR)
continue;
if (expectedState.getType() == currentBlock.getType() && expectedState.getRawData() == currentBlock.getData())
{
score++;
continue;
}
//Ender portal direction fix & 0x4 is a check to see if the frame has an ender eye in it
if (currentBlock.getType() == Material.ENDER_PORTAL_FRAME && expectedState.getType() == Material.ENDER_PORTAL_FRAME && (currentBlock.getData() & 0x4) == (expectedState.getRawData() & 0x4))
{
score++;
continue;
}
//Sapling growth fix
if (expectedState.getType() == Material.SAPLING && currentBlock.getType() == Material.SAPLING)
{
if (currentBlock.getData() % 8 == expectedState.getRawData() % 8)
score++;
}
//Fix for leaves decay flags
if ((expectedState.getType() == Material.LEAVES && currentBlock.getType() == Material.LEAVES) || ((expectedState.getType() == Material.LEAVES_2 && currentBlock.getType() == Material.LEAVES_2)))
{
if (currentBlock.getData() % 4 == expectedState.getRawData() % 4)
score++;
}
//Fix for corner stair shape
if (currentBlock.getState().getData() instanceof Stairs && expectedState.getData() instanceof Stairs)
{
net.minecraft.server.v1_8_R3.Block nmsBlock = CraftMagicNumbers.getBlock(currentBlock);
IBlockData blockData = nmsBlock.getBlockData();
blockData = nmsBlock.updateState(blockData, ((CraftWorld) currentBlock.getWorld()).getHandle(), new BlockPosition(currentBlock.getX(), currentBlock.getY(), currentBlock.getZ()));
EnumStairShape expectedShape = buildData.StairShapes[x][y][z];
EnumStairShape currentShape = blockData.get(BlockStairs.SHAPE);
if ((expectedShape == EnumStairShape.INNER_LEFT && currentShape == EnumStairShape.INNER_RIGHT) || (expectedShape == EnumStairShape.INNER_RIGHT && currentShape == EnumStairShape.INNER_LEFT) || (expectedShape == EnumStairShape.OUTER_LEFT && currentShape == EnumStairShape.OUTER_RIGHT) || (expectedShape == EnumStairShape.OUTER_RIGHT && currentShape == EnumStairShape.OUTER_LEFT))
score++;
}
}
}
}
for (MobData mobData : buildData.Mobs)
{
for (Entity entity : Mobs)
{
int dx = (int) (entity.getLocation().getX() - (CornerA.getX() + 0.5));
int dy = (int) (entity.getLocation().getY() - CornerA.getY());
int dz = (int) (entity.getLocation().getZ() - (CornerA.getZ() + 0.5));
if (mobData.EntityType == entity.getType() && mobData.DX == dx && mobData.DY == dy && mobData.DZ == dz)
{
score++;
break;
}
}
}
return score;
}
public Location getMidpoint()
{
return UtilAlg.getMidpoint(CornerA, CornerB.clone().add(1, 1, 1));
}
public List<Block> getBlocks()
{
return UtilBlock.getInBoundingBox(CornerA, CornerB);
}
public boolean isQueuedForDemolition(Block block)
{
for (DemolitionData demolition : BlocksForDemolition)
{
if (demolition.Blocks.containsKey(block))
return true;
}
return false;
}
public boolean isQueuedForDemolition(Entity entity)
{
for (DemolitionData demolition : BlocksForDemolition)
{
if (demolition.Mobs.contains(entity))
return true;
}
return false;
}
public void addToDemolition(Block block)
{
if (isQueuedForDemolition(block))
return;
ArrayList<Block> blocks = new ArrayList<Block>();
blocks.add(block);
//Add the other part of the block
if (block.getType() == Material.BED_BLOCK)
{
Bed bed = (Bed) block.getState().getData();
if (bed.isHeadOfBed())
blocks.add(block.getRelative(bed.getFacing().getOppositeFace()));
else
blocks.add(block.getRelative(bed.getFacing()));
}
else if (block.getType() == Material.WOODEN_DOOR || block.getType() == Material.IRON_DOOR_BLOCK || block.getType() == Material.SPRUCE_DOOR || block.getType() == Material.BIRCH_DOOR || block.getType() == Material.JUNGLE_DOOR || block.getType() == Material.ACACIA_DOOR || block.getType() == Material.DARK_OAK_DOOR)
{
Door door = (Door) block.getState().getData();
if (door.isTopHalf())
blocks.add(block.getRelative(BlockFace.DOWN));
else
blocks.add(block.getRelative(BlockFace.UP));
}
else if (block.getType() == Material.DOUBLE_PLANT)
{
if (block.getData() > 7)
blocks.add(block.getRelative(BlockFace.DOWN));
else
blocks.add(block.getRelative(BlockFace.UP));
}
BlocksForDemolition.add(new DemolitionData(this, blocks, new ArrayList<Entity>()));
}
public void addToDemolition(Entity entity)
{
if (isQueuedForDemolition(entity))
return;
ArrayList<Entity> mobs = new ArrayList<Entity>();
mobs.add(entity);
BlocksForDemolition.add(new DemolitionData(this, new ArrayList<Block>(), mobs));
}
public void removeHologram()
{
_hologram.stop();
}
}

View File

@ -0,0 +1,50 @@
package nautilus.game.arcade.game.games.speedbuilders.events;
import nautilus.game.arcade.game.games.speedbuilders.SpeedBuilders;
import org.bukkit.entity.Player;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
public class PerfectBuildEvent extends Event
{
private static final HandlerList handlers = new HandlerList();
private Player _player;
private SpeedBuilders _game;
private long _timeElapsed; // Build time elapsed in ms
public PerfectBuildEvent(Player player, long timeElapsed, SpeedBuilders game)
{
_player = player;
_timeElapsed = timeElapsed;
_game = game;
}
public Player getPlayer()
{
return _player;
}
public long getTimeElapsed()
{
return _timeElapsed;
}
public SpeedBuilders getGame()
{
return _game;
}
public static HandlerList getHandlerList()
{
return handlers;
}
@Override
public HandlerList getHandlers()
{
return handlers;
}
}

View File

@ -0,0 +1,34 @@
package nautilus.game.arcade.game.games.speedbuilders.kits;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
public class DefaultKit extends Kit
{
public DefaultKit(ArcadeManager manager)
{
super(manager, "Speed Builder", KitAvailability.Free,
new String[]
{
"Professional build recreator!",
},
new Perk[]
{
},
EntityType.ZOMBIE, null);
}
@Override
public void GiveItems(Player player)
{
}
}

View File

@ -0,0 +1,23 @@
package nautilus.game.arcade.game.games.speedbuilders.stattrackers;
import nautilus.game.arcade.game.games.speedbuilders.SpeedBuilders;
import nautilus.game.arcade.game.games.speedbuilders.events.PerfectBuildEvent;
import nautilus.game.arcade.stats.StatTracker;
import org.bukkit.event.EventHandler;
public class DependableTracker extends StatTracker<SpeedBuilders>
{
public DependableTracker(SpeedBuilders game)
{
super(game);
}
@EventHandler
public void onPerfectBuild(PerfectBuildEvent event)
{
addStat(event.getPlayer(), "PerfectBuild", 1, false, false);
}
}

View File

@ -0,0 +1,30 @@
package nautilus.game.arcade.game.games.speedbuilders.stattrackers;
import org.bukkit.event.EventHandler;
import nautilus.game.arcade.game.games.speedbuilders.SpeedBuilders;
import nautilus.game.arcade.game.games.speedbuilders.events.PerfectBuildEvent;
import nautilus.game.arcade.stats.StatTracker;
public class FirstBuildTracker extends StatTracker<SpeedBuilders>
{
private boolean _first = true;
public FirstBuildTracker(SpeedBuilders game)
{
super(game);
}
@EventHandler
public void onPerfectBuild(PerfectBuildEvent event)
{
if (_first)
{
addStat(event.getPlayer(), "PerfectFirst", 1, false, false);
_first = false;
}
}
}

View File

@ -0,0 +1,50 @@
package nautilus.game.arcade.game.games.speedbuilders.stattrackers;
import java.util.Map.Entry;
import mineplex.core.common.util.NautHashMap;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.game.games.speedbuilders.SpeedBuilders;
import nautilus.game.arcade.game.games.speedbuilders.events.PerfectBuildEvent;
import nautilus.game.arcade.stats.StatTracker;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
public class PerfectionistTracker extends StatTracker<SpeedBuilders>
{
private SpeedBuilders _game;
private NautHashMap<Player, Integer> _perfectBuilds = new NautHashMap<Player, Integer>();
public PerfectionistTracker(SpeedBuilders game)
{
super(game);
_game = game;
}
@EventHandler
public void onPerfectBuild(PerfectBuildEvent event)
{
int previousPerfectBuilds = _perfectBuilds.containsKey(event.getPlayer()) ? _perfectBuilds.get(event.getPlayer()) : 0;
_perfectBuilds.put(event.getPlayer(), previousPerfectBuilds + 1);
}
@EventHandler
public void onEnd(GameStateChangeEvent event)
{
if (event.GetState() != GameState.End)
return;
for (Entry<Player, Integer> entry : _perfectBuilds.entrySet())
{
if (entry.getValue().intValue() == _game.getRoundsPlayed())
addStat(entry.getKey(), "PerfectWins", 1, true, false);
}
}
}

View File

@ -0,0 +1,23 @@
package nautilus.game.arcade.game.games.speedbuilders.stattrackers;
import org.bukkit.event.EventHandler;
import nautilus.game.arcade.game.games.speedbuilders.SpeedBuilders;
import nautilus.game.arcade.game.games.speedbuilders.events.PerfectBuildEvent;
import nautilus.game.arcade.stats.StatTracker;
public class SpeediestBuilderizerTracker extends StatTracker<SpeedBuilders>
{
public SpeediestBuilderizerTracker(SpeedBuilders game)
{
super(game);
}
@EventHandler
public void onPerfectBuild(PerfectBuildEvent event)
{
if (event.getTimeElapsed() < 10000) // 10 Seconds
addStat(event.getPlayer(), "SpeediestBuilderizer", 1, true, false);
}
}

View File

@ -32,6 +32,7 @@ import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.game.SoloGame;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.managers.chat.ChatStatData;
import nautilus.game.arcade.stats.SpleefBlockDestroyStatTracker;
import net.minecraft.server.v1_8_R3.EntityArrow;
@ -62,6 +63,15 @@ public class Spleef extends SoloGame
this.PrepareFreeze = false;
registerStatTrackers(new SpleefBlockDestroyStatTracker(this));
registerChatStats(
DamageTaken,
DamageDealt,
BlankLine,
new ChatStatData("SpleefBlocks", "Blocks Broken", true),
BlankLine,
new ChatStatData("kit", "Kit", true)
);
}
@EventHandler

View File

@ -30,6 +30,7 @@ import nautilus.game.arcade.GameType;
import nautilus.game.arcade.game.TeamGame;
import nautilus.game.arcade.game.games.spleef.kits.*;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.managers.chat.ChatStatData;
import net.minecraft.server.v1_8_R3.EntityArrow;
@ -59,6 +60,15 @@ public class SpleefTeams extends TeamGame
this.TeamArmor = true;
this.TeamArmorHotbar = true;
registerChatStats(
Kills,
Assists,
BlankLine,
new ChatStatData("BlocksBroken", "Blocks Broken", true),
BlankLine,
new ChatStatData("kit", "Kit", true)
);
}
@EventHandler

View File

@ -50,6 +50,8 @@ public class SquidShooter extends SoloGame
this.PrepareFreeze = false;
this.CompassEnabled = true;
this.KitRegisterState = GameState.Prepare;
registerChatStats();
}
@EventHandler
public void Death(CombatDeathEvent event)

View File

@ -54,6 +54,8 @@ public class Stacker extends SoloGame implements IThrown
"Players lose 5 stacked animals if they get hit.",
"First to stack 16 high wins!"
});
registerChatStats();
}
@EventHandler

View File

@ -14,6 +14,7 @@ import nautilus.game.arcade.GameType;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.managers.chat.ChatStatData;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;

View File

@ -87,6 +87,7 @@ import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.games.survivalgames.kit.*;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.managers.chat.ChatStatData;
import nautilus.game.arcade.stats.FirstSupplyDropOpenStatTracker;
import nautilus.game.arcade.stats.KillsWithinTimeLimitStatTracker;
import nautilus.game.arcade.stats.SimultaneousSkeletonStatTracker;
@ -260,6 +261,16 @@ public abstract class SurvivalGames extends Game
new KillsWithinTimeLimitStatTracker(this, 3, 60, "Bloodlust"),
new FirstSupplyDropOpenStatTracker(this),
new SimultaneousSkeletonStatTracker(this, 5));
registerChatStats(
Kills,
Assists,
BlankLine,
DamageTaken,
DamageDealt,
BlankLine,
new ChatStatData("SupplyDropsOpened", "Event chests opened", true)
);
}
@EventHandler

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