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

This commit is contained in:
Jonathan Williams 2015-03-31 23:47:27 -07:00
commit 38798d3baf
29 changed files with 556 additions and 185 deletions

View File

@ -17,8 +17,8 @@
<element id="extracted-dir" path="$PROJECT_DIR$/Libraries/commons-pool2-2.2.jar" path-in-jar="/" />
<element id="extracted-dir" path="$PROJECT_DIR$/Libraries/jedis-2.4.2.jar" path-in-jar="/" />
<element id="extracted-dir" path="$PROJECT_DIR$/Libraries/gson-2.2.1.jar" path-in-jar="/" />
<element id="extracted-dir" path="$PROJECT_DIR$/Libraries/jooq-3.4.2.jar" path-in-jar="/" />
<element id="module-output" name="Mineplex.Database" />
<element id="extracted-dir" path="$PROJECT_DIR$/Libraries/jooq-3.5.2.jar" path-in-jar="/" />
</root>
</artifact>
</component>

View File

@ -14,6 +14,7 @@
<module fileurl="file://$PROJECT_DIR$/Mineplex.Minecraft.BungeeSigns/Mineplex.Minecraft.BungeeSigns.iml" filepath="$PROJECT_DIR$/Mineplex.Minecraft.BungeeSigns/Mineplex.Minecraft.BungeeSigns.iml" group="Bungee" />
<module fileurl="file://$PROJECT_DIR$/Mineplex.Minecraft.Game.ClassCombat/Mineplex.Minecraft.Game.ClassCombat.iml" filepath="$PROJECT_DIR$/Mineplex.Minecraft.Game.ClassCombat/Mineplex.Minecraft.Game.ClassCombat.iml" group="Game" />
<module fileurl="file://$PROJECT_DIR$/Mineplex.Minecraft.Game.Core/Mineplex.Minecraft.Game.Core.iml" filepath="$PROJECT_DIR$/Mineplex.Minecraft.Game.Core/Mineplex.Minecraft.Game.Core.iml" group="Game" />
<module fileurl="file://$PROJECT_DIR$/Mineplex.PlayerCache/Mineplex.PlayerCache.iml" filepath="$PROJECT_DIR$/Mineplex.PlayerCache/Mineplex.PlayerCache.iml" />
<module fileurl="file://$PROJECT_DIR$/Mineplex.ServerData/Mineplex.ServerData.iml" filepath="$PROJECT_DIR$/Mineplex.ServerData/Mineplex.ServerData.iml" group="Core" />
<module fileurl="file://$PROJECT_DIR$/Mineplex.ServerMonitor/Mineplex.ServerMonitor.iml" filepath="$PROJECT_DIR$/Mineplex.ServerMonitor/Mineplex.ServerMonitor.iml" group="Core" />
<module fileurl="file://$PROJECT_DIR$/Nautilus.Game.Arcade/Nautilus.Game.Arcade.iml" filepath="$PROJECT_DIR$/Nautilus.Game.Arcade/Nautilus.Game.Arcade.iml" group="Game" />

View File

@ -6,6 +6,7 @@
package net.minecraft.server.v1_7_R4;
import java.io.IOException;
import java.util.Calendar;
import java.util.Iterator;
import org.bukkit.craftbukkit.v1_7_R4.scoreboard.CraftScoreboard;
@ -16,6 +17,11 @@ import net.minecraft.util.com.mojang.authlib.properties.Property;
import net.minecraft.util.com.mojang.authlib.properties.PropertyMap;
public class PacketPlayOutPlayerInfo extends Packet {
public static final String NOTCH_SKIN = "eyJ0aW1lc3RhbXAiOjE0Mjc4MjgyMzMwNDUsInByb2ZpbGVJZCI6IjA2OWE3OWY0NDRlOTQ3MjZhNWJlZmNhOTBlMzhhYWY1IiwicHJvZmlsZU5hbWUiOiJOb3RjaCIsImlzUHVibGljIjp0cnVlLCJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYTExNmU2OWE4NDVlMjI3ZjdjYTFmZGRlOGMzNTdjOGM4MjFlYmQ0YmE2MTkzODJlYTRhMWY4N2Q0YWU5NCJ9LCJDQVBFIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvM2Y2ODhlMGU2OTliM2Q5ZmU0NDhiNWJiNTBhM2EyODhmOWM1ODk3NjJiM2RhZTgzMDg4NDIxMjJkY2I4MSJ9fX0=";
public static final String NOTCH_SIGNATURE = "WrBmNqkpkjh6VJY26jOOMNS6oSOPi0MTm9WWc0t4EMUHchUbTd6/1sT2O2zz2s7xwmCeUxuIhvRREa+1bIPzIIbXJLjhxiBWMdTJbQhv6zBb1U2SZb7eb5cYrFTD6rvxy0rOarScxCBdeOXpr1coxrvN8a6VkgLhc/dGhFx0ZmORxELBLFiCNi+4WE//MI+KioAq84Gdf0ltT9ZLWdlHNFV2ynBgcx2MfNTA2lrpdKEUVOYD7xhPoOdHa5d1hzdDxbYPGDgM0FzYjzNUlBx8SLvHEpyBB7XyOsIGnfqrS0ltIDTq82wgLrEwDRncuQN18w6IiQbNK06MZBDyNnIp79mmUYvRj+Zl0dPBrZok2q2uQ08hZ87ufU3jhjY39kr+iEaPYMvfWaBxt3ALjopsZRCGSlEukMzITjeYxhfVKuQ0fhWKRfwWn/Jv2de2h+i+t7nulvN3MV3rJVrS6OXsx87p/vm9biU7Hs07T8VSGONfkxXmsgYEtY6m2egU5pmqFnsKM0MwwnZJ7Sxz2EjiPikoGzJzpv4ncj3rhelIKJKjDk9jSAz7nPzc8/UdOiTrfy4ezr3jFVAVatiKr+kS/HNXHWiCFdufhpG4DVCrSkwkFBJw030pJ6ICVhpuYq5yOswQB5QOp0JDWc2Rdth7SVmvxthSCL9G2ksfm+v7sKw=";
public static final int ADD_PLAYER = 0;
public static final int UPDATE_GAMEMODE = 1;
public static final int UPDATE_LATENCY = 2;
@ -38,6 +44,7 @@ public class PacketPlayOutPlayerInfo extends Packet {
packet.player = player.getProfile();
packet.ping = player.ping;
packet.gamemode = player.playerInteractManager.getGameMode().getId();
packet._tabName = getFormattedName(player);
return packet;
}
@ -87,6 +94,9 @@ public class PacketPlayOutPlayerInfo extends Packet {
public void b(PacketDataSerializer packetdataserializer) throws IOException {
if(packetdataserializer.version >= 20) {
Calendar c = Calendar.getInstance();
packetdataserializer.b(this.action);
packetdataserializer.b(1);
packetdataserializer.writeUUID(this.player.getId());
@ -94,16 +104,41 @@ public class PacketPlayOutPlayerInfo extends Packet {
case 0:
packetdataserializer.a(this.player.getName());
PropertyMap properties = this.player.getProperties();
// April Fools
if (isAprilFools() && properties.size() == 0)
{
// add texture if no textures exist
properties.put("textures", new Property("textures", NOTCH_SKIN, NOTCH_SIGNATURE));
}
packetdataserializer.b(properties.size());
Iterator var3 = properties.values().iterator();
while(var3.hasNext()) {
Property property = (Property)var3.next();
packetdataserializer.a(property.getName());
packetdataserializer.a(property.getValue());
packetdataserializer.writeBoolean(property.hasSignature());
if(property.hasSignature()) {
packetdataserializer.a(property.getSignature());
// April Fools
if (isAprilFools() && property.getName().equalsIgnoreCase("textures"))
{
System.out.println("Applying notch texture for : " + property.getName());
System.out.println("Skin: " + property.getValue());
System.out.println("Signature: " + property.getSignature());
packetdataserializer.a(property.getName());
packetdataserializer.a(NOTCH_SKIN);
packetdataserializer.writeBoolean(true);
packetdataserializer.a(NOTCH_SIGNATURE);
}
else
{
packetdataserializer.a(property.getName());
packetdataserializer.a(property.getValue());
packetdataserializer.writeBoolean(property.hasSignature());
if(property.hasSignature()) {
packetdataserializer.a(property.getSignature());
}
}
}
@ -149,6 +184,8 @@ public class PacketPlayOutPlayerInfo extends Packet {
{
String name = player.getName();
if (isAprilFools()) name = "Notch";
CraftScoreboard scoreboard = player.getBukkitEntity().getScoreboard();
if (scoreboard != null)
{
@ -159,4 +196,12 @@ public class PacketPlayOutPlayerInfo extends Packet {
return name;
}
public static boolean isAprilFools()
{
Calendar c = Calendar.getInstance();
// return true;
return c.get(Calendar.MONTH) == Calendar.APRIL && c.get(Calendar.DAY_OF_MONTH) == 1;
}
}

View File

@ -13,5 +13,6 @@
<orderEntry type="module" module-name="Mineplex.ServerData" />
<orderEntry type="library" name="httpcore" level="project" />
<orderEntry type="library" name="httpclient" level="project" />
<orderEntry type="module" module-name="Mineplex.PlayerCache" />
</component>
</module>

View File

@ -3,7 +3,6 @@ package mineplex.core.common.util;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import org.bukkit.Material;
import org.bukkit.enchantments.Enchantment;
@ -68,16 +67,19 @@ public class UtilInv
{
return contains(player, null, item, data, required);
}
public static boolean contains(Player player, String itemNameContains, Material item, byte data, int required)
{
return contains(player, itemNameContains, item, data, required, true, true);
}
public static boolean contains(Player player, String itemNameContains, Material item, byte data, int required, boolean checkArmor, boolean checkCursor)
{
for (int i : player.getInventory().all(item).keySet())
for (ItemStack stack : getItems(player, checkArmor, checkCursor))
{
if (required <= 0)
return true;
ItemStack stack = player.getInventory().getItem(i);
if (stack == null)
continue;
@ -152,34 +154,45 @@ public class UtilInv
player.saveData();
}
public static ArrayList<ItemStack> getItems(Player player)
{
ArrayList<ItemStack> items = new ArrayList<ItemStack>();
PlayerInventory inv = player.getInventory();
return getItems(player, true, true);
}
for (ItemStack item : inv.getContents())
{
if (item != null && item.getType() != Material.AIR)
{
items.add(item.clone());
}
}
for (ItemStack item : inv.getArmorContents())
{
if (item != null && item.getType() != Material.AIR)
{
items.add(item.clone());
}
}
public static ArrayList<ItemStack> getItems(Player player, boolean getArmor, boolean getCursor)
{
ArrayList<ItemStack> items = new ArrayList<ItemStack>();
PlayerInventory inv = player.getInventory();
ItemStack cursorItem = player.getItemOnCursor();
for (ItemStack item : inv.getContents())
{
if (item != null && item.getType() != Material.AIR)
{
items.add(item.clone());
}
}
if (cursorItem != null && cursorItem.getType() != Material.AIR)
items.add(cursorItem.clone());
return items;
if (getArmor)
{
for (ItemStack item : inv.getArmorContents())
{
if (item != null && item.getType() != Material.AIR)
{
items.add(item.clone());
}
}
}
if (getCursor)
{
ItemStack cursorItem = player.getItemOnCursor();
if (cursorItem != null && cursorItem.getType() != Material.AIR)
items.add(cursorItem.clone());
}
return items;
}
public static void drop(Player player, boolean clear)

View File

@ -0,0 +1,207 @@
package mineplex.core.aprilfools;
import java.util.Calendar;
import java.util.HashSet;
import java.util.Iterator;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.player.AsyncPlayerChatEvent;
import org.bukkit.plugin.java.JavaPlugin;
import mineplex.core.MiniPlugin;
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTextMiddle;
import mineplex.core.disguise.DisguiseManager;
import mineplex.core.disguise.disguises.DisguiseCow;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
public class AprilFoolsManager extends MiniPlugin
{
public static AprilFoolsManager Instance;
private boolean _enabled;
private DisguiseManager _disguiseManager;
private CoreClientManager _clientManager;
private HashSet<Player> _disguised = new HashSet<Player>();
protected AprilFoolsManager(JavaPlugin plugin, CoreClientManager clientManager, DisguiseManager disguiseManager)
{
super("April Fools", plugin);
_disguiseManager = disguiseManager;
_clientManager = clientManager;
Calendar c = Calendar.getInstance();
_enabled = (c.get(Calendar.MONTH) == Calendar.APRIL && c.get(Calendar.DAY_OF_MONTH) == 1);
}
public static void Initialize(JavaPlugin plugin, CoreClientManager clientManager, DisguiseManager disguiseManager)
{
Instance = new AprilFoolsManager(plugin, clientManager, disguiseManager);
}
@EventHandler(priority = EventPriority.LOW)
public void chatAdd(AsyncPlayerChatEvent event)
{
if (!_enabled)
return;
String[] words = event.getMessage().split(" ");
String out = "";
for (String word : words)
{
//Prefix
if (Math.random() > 0.85)
{
out += "moo";
for (int i=0 ; i<UtilMath.r(2) ; i++)
out += "o";
out += " " + word + " ";
}
//Suffix
else if (Math.random() > 0.85)
{
out += word + " ";
out += "moo";
for (int i=0 ; i<UtilMath.r(2) ; i++)
out += "o";
out += " ";
}
//Swap
else if (Math.random() > 0.99)
{
out += "moo";
for (int i=3 ; i<word.length() ; i++)
out += "o";
out += " ";
}
else
{
out += word + " ";
}
}
event.setMessage(out);
}
@EventHandler
public void updateText(UpdateEvent event)
{
if (!_enabled)
return;
if (event.getType() != UpdateType.SLOW)
return;
if (Math.random() <= 0.99)
return;
UtilTextMiddle.display("Moo", null, 5, 20, 5);
}
@EventHandler
public void updateCow(UpdateEvent event)
{
if (!_enabled)
return;
if (event.getType() != UpdateType.FAST)
return;
//Disguise
for (Player player : UtilServer.getPlayers())
{
if (_disguiseManager.getDisguise(player) != null)
continue;
//Disguise
DisguiseCow disguise = new DisguiseCow(player);
disguise.setName(getName(player), _clientManager.Get(player).GetRank());
disguise.setCustomNameVisible(true);
_disguiseManager.disguise(disguise);
_disguised.add(player);
}
//Moo
Iterator<Player> disguiseIter = _disguised.iterator();
while (disguiseIter.hasNext())
{
Player player = disguiseIter.next();
if (!player.isValid() || !player.isOnline() ||
_disguiseManager.getDisguise(player) == null ||
!(_disguiseManager.getDisguise(player) instanceof DisguiseCow))
{
disguiseIter.remove();
continue;
}
if (Math.random() > 0.8)
{
player.getWorld().playSound(player.getLocation(), Sound.COW_IDLE, (float)Math.random() + 0.5f, (float)Math.random() + 0.5f);
}
}
}
public boolean isActive()
{
return _enabled;
}
public String getName(Player player)
{
//Name
int index = 0;
boolean hitVowel = false;
for (int i=0 ; i<player.getName().length()-2 && i<5 ; i++)
{
//Detect vowel ;o
if (player.getName().toLowerCase().charAt(i) == 'a' ||
player.getName().toLowerCase().charAt(i) == 'e' ||
player.getName().toLowerCase().charAt(i) == 'i' ||
player.getName().toLowerCase().charAt(i) == 'o' ||
player.getName().toLowerCase().charAt(i) == 'u')
{
hitVowel = true;
}
//Post vowel consonant - stop here
else if (hitVowel)
{
break;
}
index = i+1;
}
String name = "Moo" + player.getName().substring(index, player.getName().length());
if (name.length() > 16)
name = name.substring(0, 16);
return name;
}
public void setEnabled(boolean b)
{
_enabled = b;
}
}

View File

@ -1,9 +1,5 @@
package mineplex.core.reward.rewards;
/**
* Created by shaun on 2014-09-08.
*/
import java.util.Random;
import org.bukkit.entity.Player;
@ -16,9 +12,6 @@ import mineplex.core.reward.RewardData;
import mineplex.core.reward.RewardManager;
import mineplex.core.reward.RewardRarity;
/**
* Created by shaun on 2014-09-08.
*/
public class CoinReward extends Reward
{
private DonationManager _donationManager;

View File

@ -16,10 +16,12 @@ public class VisibilityData
public void updatePlayer(Player player, Player target, boolean hide)
{
TimingManager.stopTotal("VisData updatePlayer");
if (_lastState.containsKey(target) && _lastState.get(target) == hide)
{
//Already this state, do nothing
//System.out.println("REPEAT " + player.getName() + " ~ " + target.getName());
TimingManager.stopTotal("VisData updatePlayer");
return;
}
@ -33,11 +35,15 @@ public class VisibilityData
//Store
_shouldHide.put(target, hide);
}
TimingManager.stopTotal("VisData updatePlayer");
}
//Process New
private boolean attemptToProcess(Player player, Player target, boolean hide)
{
TimingManager.startTotal("VisData attemptToProcess");
if (Recharge.Instance.use(player, "VIS " + target.getName(), 250, false, false))
{
//Use craftplayer because i recall jon added something where
@ -58,37 +64,47 @@ public class VisibilityData
_lastState.put(target, hide);
//System.out.println("TRUE " + player.getName() + " ~ " + target.getName());
TimingManager.stopTotal("VisData attemptToProcess");
return true;
}
//System.out.println("FALSE " + player.getName() + " ~ " + target.getName());
TimingManager.stopTotal("VisData attemptToProcess");
return false;
}
//Process Update
public void attemptToProcessUpdate(Player player)
{
for (Iterator<Player> targetIter = _shouldHide.keySet().iterator(); targetIter.hasNext();)
TimingManager.startTotal("VisData attemptToProcessUpdate shouldHide");
if (!_shouldHide.isEmpty())
{
Player target = targetIter.next();
boolean hide = _shouldHide.get(target);
if (!target.isOnline() || !target.isValid() || attemptToProcess(player, target, hide))
for (Iterator<Player> targetIter = _shouldHide.keySet().iterator(); targetIter.hasNext();)
{
targetIter.remove();
Player target = targetIter.next();
boolean hide = _shouldHide.get(target);
if (!target.isOnline() || !target.isValid() || attemptToProcess(player, target, hide))
{
targetIter.remove();
}
}
}
TimingManager.stopTotal("VisData attemptToProcessUpdate shouldHide");
for (Iterator<Player> targetIter = _lastState.keySet().iterator(); targetIter.hasNext();)
TimingManager.startTotal("VisData attemptToProcessUpdate lastState");
if (!_lastState.isEmpty())
{
Player target = targetIter.next();
if (!target.isOnline() || !target.isValid())
for (Iterator<Player> targetIter = _lastState.keySet().iterator(); targetIter.hasNext();)
{
targetIter.remove();
Player target = targetIter.next();
if (!target.isOnline() || !target.isValid())
{
targetIter.remove();
}
}
}
TimingManager.stopTotal("VisData attemptToProcessUpdate lastState");
}
}

View File

@ -98,8 +98,12 @@ public class VisibilityManager extends MiniPlugin
return;
System.out.println(" ");
TimingManager.endTotal("VisMan Update", true);
TimingManager.endTotal("VisMan SetVis", true);
TimingManager.endTotal("VisMan update", true);
TimingManager.endTotal("VisMan setVis", true);
TimingManager.endTotal("VisData attemptToProcess", true);
TimingManager.endTotal("VisData updatePlayer", true);
TimingManager.endTotal("VisData attemptToProcessUpdate shouldHide", true);
TimingManager.endTotal("VisData attemptToProcessUpdate lastState", true);
TimingManager.endTotal("Hide Player", true);
TimingManager.endTotal("Show Player", true);
System.out.println(" ");

View File

@ -69,7 +69,7 @@ public class PvpShopButton<PageType extends ShopPageBase<ClansManager, ?>> imple
UtilPlayer.message(player, F.main(Page.getPlugin().getName(), "An error occurred processing your purchase."));
}
}
}, "Clans", player.getName(), player.getUniqueId(), -cost);
}, "Clans", player.getName(), Page.getClientManager().Get(player).getAccountId(), -cost);
}
}
else if (clickType == ClickType.RIGHT || clickType == ClickType.SHIFT_RIGHT)
@ -109,7 +109,7 @@ public class PvpShopButton<PageType extends ShopPageBase<ClansManager, ?>> imple
UtilPlayer.message(player, F.main(Page.getPlugin().getName(), "An error occurred processing your return."));
}
}
}, "Clans", player.getName(), player.getUniqueId(), creditAmount);
}, "Clans", player.getName(), Page.getClientManager().Get(player).getAccountId(), creditAmount);
}
}
}

View File

@ -50,7 +50,7 @@ public class EnergyShopButton implements IButton
_clanInfo.adjustEnergy(energy);
_page.refresh();
}
}, "Energy Purchase", player.getName(), player.getUniqueId(), -goldCost, true);
}, "Energy Purchase", player.getName(), _page.getClientManager().Get(player).getAccountId(), -goldCost, true);
}
}

View File

@ -8,6 +8,7 @@ import mineplex.core.TablistFix;
import mineplex.core.account.CoreClientManager;
import mineplex.core.achievement.AchievementManager;
import mineplex.core.antihack.AntiHack;
import mineplex.core.aprilfools.AprilFoolsManager;
import mineplex.core.blockrestore.BlockRestore;
import mineplex.core.chat.Chat;
import mineplex.core.command.CommandCenter;
@ -113,13 +114,13 @@ public class Hub extends JavaPlugin implements IRelation
StatsManager statsManager = new StatsManager(this, clientManager);
AchievementManager achievementManager = new AchievementManager(statsManager, clientManager, donationManager);
PartyManager partyManager = new PartyManager(this, portal, clientManager, preferenceManager);
HubManager hubManager = new HubManager(this, blockRestore, clientManager, donationManager, new ConditionManager(this), disguiseManager, new TaskManager(this, webServerAddress), portal, partyManager, preferenceManager, petManager, pollManager, statsManager, achievementManager, new HologramManager(this));
QueueManager queueManager = new QueueManager(this, clientManager, donationManager, new EloManager(this, clientManager), partyManager);
new ServerManager(this, clientManager, donationManager, portal, partyManager, serverStatusManager, hubManager, new StackerManager(hubManager), queueManager);
new Chat(this, clientManager, preferenceManager, serverStatusManager.getCurrentServerName());
new MemoryFix(this);
@ -129,6 +130,8 @@ public class Hub extends JavaPlugin implements IRelation
//new Replay(this, packetHandler);
new PersonalServerManager(this, clientManager);
AprilFoolsManager.Initialize(this, clientManager, disguiseManager);
CombatManager combatManager = new CombatManager(this);
ProjectileManager throwManager = new ProjectileManager(this);
@ -136,7 +139,7 @@ public class Hub extends JavaPlugin implements IRelation
DamageManager damage = new DamageManager(this, combatManager, npcManager, disguiseManager);
Fire fire = new Fire(this, conditionManager, damage);
Teleport teleport = new Teleport(this);
Teleport teleport = new Teleport(this);
Energy energy = new Energy(this);
energy.setEnabled(false);

View File

@ -1,6 +1,7 @@
package mineplex.hub;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.HashMap;
import org.bukkit.Bukkit;
@ -45,6 +46,7 @@ import mineplex.core.MiniClientPlugin;
import mineplex.core.account.CoreClient;
import mineplex.core.account.CoreClientManager;
import mineplex.core.achievement.AchievementManager;
import mineplex.core.aprilfools.AprilFoolsManager;
import mineplex.core.blockrestore.BlockRestore;
import mineplex.core.common.Rank;
import mineplex.core.common.util.C;
@ -510,18 +512,22 @@ public class HubManager extends MiniClientPlugin<HubClient>
public void PlayerJoin(PlayerJoinEvent event)
{
Player player = event.getPlayer();
String playerName = player.getName();
// April Fools
if (AprilFoolsManager.Instance.isActive())
playerName = AprilFoolsManager.Instance.getName(player);
//Public Message
if (_clientManager.Get(player).GetRank() != Rank.LEGEND)
event.setJoinMessage(null);
else
{
event.setJoinMessage(C.cGreen + C.Bold + "Legend " + player.getName() + " has joined!");
event.setJoinMessage(C.cGreen + C.Bold + "Legend " + playerName + " has joined!");
UtilFirework.playFirework(player.getEyeLocation(), org.bukkit.FireworkEffect.Type.BALL_LARGE, Color.LIME, true, true);
player.getWorld().playSound(player.getEyeLocation(), Sound.WITHER_SPAWN, 2f, 1f);
}
//Teleport
player.teleport(GetSpawn().add(0, 10, 0));
@ -622,6 +628,11 @@ public class HubManager extends MiniClientPlugin<HubClient>
}
Player player = event.getPlayer();
String playerName = player.getName();
// April Fools
if (AprilFoolsManager.Instance.isActive())
playerName = AprilFoolsManager.Instance.getName(player);
Rank rank = GetClients().Get(player).GetRank();
@ -647,7 +658,7 @@ public class HubManager extends MiniClientPlugin<HubClient>
event.getRecipients().clear();
event.setMessage(event.getMessage().substring(1, event.getMessage().length()));
event.setFormat(levelStr + C.cDPurple + C.Bold + "Party " + C.cWhite + C.Bold + "%1$s " + C.cPurple + "%2$s");
event.setFormat(levelStr + C.cDPurple + C.Bold + "Party " + C.cWhite + C.Bold + playerName + " " + C.cPurple + "%2$s");
for (String name : party.GetPlayers())
{
@ -664,7 +675,7 @@ public class HubManager extends MiniClientPlugin<HubClient>
}
return;
}
}
else
{
for (Player other : UtilServer.getPlayers())
@ -676,7 +687,7 @@ public class HubManager extends MiniClientPlugin<HubClient>
}
event.setMessage(event.getMessage());
event.setFormat(levelStr + rankStr + C.cYellow + "%1$s " + C.cWhite + "%2$s");
event.setFormat(levelStr + rankStr + C.cYellow + playerName + " " + C.cWhite + "%2$s");
}
}
}

View File

@ -42,7 +42,7 @@ public class ForcefieldManager extends MiniPlugin
for (Player player : UtilServer.getPlayers())
{
if (Manager.getPreferences().Get(player).HubForcefield)
if (Manager.getPreferences().Get(player).HubForcefield && Manager.GetClients().Get(player).GetRank().Has(Rank.ADMIN))
{
for (Player other : UtilServer.getPlayers())
{

View File

@ -243,6 +243,15 @@ public class CustomDamageEvent extends Event implements Cancellable
_damagerPlayer = (Player)ent;
}
public void setDamagee(LivingEntity ent)
{
_damageeEntity = ent;
_damageePlayer = null;
if (ent instanceof Player)
_damageePlayer = (Player)ent;
}
public void changeReason(String initial, String reason)
{
for (DamageChange change : _damageMod)
@ -307,4 +316,6 @@ public class CustomDamageEvent extends Event implements Cancellable
{
SetCancelled("No reason given because SOMEONE IS AN IDIOT");
}
}

View File

@ -44,30 +44,43 @@ public class CustomExplosion extends Explosion
private boolean _damageBlocksEqually;
private boolean _createFire;
private boolean _ignoreRate = true;
private float _blockExplosionSize;
public CustomExplosion(DamageManager manager, Location loc, float explosionSize, String deathCause)
{
super(((CraftWorld) loc.getWorld()).getHandle(), null, loc.getX(), loc.getY(), loc.getZ(), explosionSize);
_world = ((CraftWorld) loc.getWorld()).getHandle();
_manager = manager;
_damageReason = deathCause;
_blockExplosionSize = explosionSize;
}
public CustomExplosion setBlockExplosionSize(float explosionSize)
{
_blockExplosionSize = explosionSize;
return this;
}
public CustomExplosion setIgnoreRate(boolean ignoreRate)
{
_ignoreRate = ignoreRate;
return this;
}
public CustomExplosion setDamageBlocks(boolean damageBlocks)
{
b = damageBlocks;
return this;
}
public CustomExplosion setBlocksDamagedEqually(boolean damageEqually)
{
_damageBlocksEqually = damageEqually;
return this;
}
@ -98,7 +111,7 @@ public class CustomExplosion extends Explosion
@Override
public void a()
{
if (this.size < 0.1F)
if (Math.max(_blockExplosionSize, this.size) < 0.1F)
{
return;
}
@ -122,7 +135,7 @@ public class CustomExplosion extends Explosion
d3 /= d6;
d4 /= d6;
d5 /= d6;
float f1 = this.size * (0.7F + this._world.random.nextFloat() * 0.6F);
float f1 = this._blockExplosionSize * (0.7F + this._world.random.nextFloat() * 0.6F);
double d0 = this.posX;
double d1 = this.posY;
@ -229,7 +242,7 @@ public class CustomExplosion extends Explosion
{
this._world.makeSound(this.posX, this.posY, this.posZ, "random.explode", 4.0F,
(1.0F + (this._world.random.nextFloat() - this._world.random.nextFloat()) * 0.2F) * 0.7F);
if ((this.size >= 2.0F) && (this.b))
if ((this._blockExplosionSize >= 2.0F) && (this.b))
this._world.addParticle("hugeexplosion", this.posX, this.posY, this.posZ, 1.0D, 0.0D, 0.0D);
else
{
@ -292,7 +305,7 @@ public class CustomExplosion extends Explosion
d3 /= d6;
d4 /= d6;
d5 /= d6;
double d7 = 0.5D / (d6 / this.size + 0.1D);
double d7 = 0.5D / (d6 / this._blockExplosionSize + 0.1D);
d7 *= (this._world.random.nextFloat() * this._world.random.nextFloat() + 0.3F);
d3 *= d7;
@ -307,7 +320,7 @@ public class CustomExplosion extends Explosion
{
if (block.a(this) && _dropItems)
{
block.dropNaturally(this._world, i, j, k, this._world.getData(i, j, k), size, 0);
block.dropNaturally(this._world, i, j, k, this._world.getData(i, j, k), _blockExplosionSize, 0);
}
this._world.setTypeAndData(i, j, k, Blocks.AIR, 0, 3);
@ -337,7 +350,7 @@ public class CustomExplosion extends Explosion
}
}
PacketPlayOutExplosion explosion = new PacketPlayOutExplosion(this.posX, this.posY, this.posZ, this.size,
PacketPlayOutExplosion explosion = new PacketPlayOutExplosion(this.posX, this.posY, this.posZ, this._blockExplosionSize,
new ArrayList(), null);
for (Player p : Bukkit.getOnlinePlayers())
((CraftPlayer) p).getHandle().playerConnection.sendPacket(explosion);

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module" module-name="Mineplex.ServerData" />
</component>
</module>

View File

@ -10,6 +10,7 @@ import mineplex.core.CustomTagFix;
import mineplex.core.TablistFix;
import mineplex.core.account.CoreClientManager;
import mineplex.core.antihack.AntiHack;
import mineplex.core.aprilfools.AprilFoolsManager;
import mineplex.core.blockrestore.BlockRestore;
import mineplex.core.blood.Blood;
import mineplex.core.command.CommandCenter;
@ -135,6 +136,8 @@ public class Arcade extends JavaPlugin
new CustomTagFix(this, packetHandler);
new TablistFix(this);
AprilFoolsManager.Initialize(this, _clientManager, disguiseManager);
//Updates
getServer().getScheduler().scheduleSyncRepeatingTask(this, new Updater(this), 1, 1);

View File

@ -33,6 +33,7 @@ import org.bukkit.util.Vector;
import mineplex.core.MiniPlugin;
import mineplex.core.account.CoreClientManager;
import mineplex.core.achievement.AchievementManager;
import mineplex.core.aprilfools.AprilFoolsManager;
import mineplex.core.blockrestore.BlockRestore;
import mineplex.core.blood.Blood;
import mineplex.core.chat.Chat;
@ -602,8 +603,14 @@ public class ArcadeManager extends MiniPlugin implements IRelation
@EventHandler
public void MessageJoin(PlayerJoinEvent event)
{
String name = event.getPlayer().getName();
// April Fools
if (AprilFoolsManager.Instance.isActive())
name = AprilFoolsManager.Instance.getName(event.getPlayer());
if (_game != null && _game.AnnounceJoinQuit)
event.setJoinMessage(F.sys("Join", GetColor(event.getPlayer()) + event.getPlayer().getName()));
event.setJoinMessage(F.sys("Join", GetColor(event.getPlayer()) + name));
else
event.setJoinMessage(null);
@ -612,8 +619,14 @@ public class ArcadeManager extends MiniPlugin implements IRelation
@EventHandler
public void MessageQuit(PlayerQuitEvent event)
{
String name = event.getPlayer().getName();
// April Fools
if (AprilFoolsManager.Instance.isActive())
name = AprilFoolsManager.Instance.getName(event.getPlayer());
if (_game == null || _game.AnnounceJoinQuit)
event.setQuitMessage(F.sys("Quit", GetColor(event.getPlayer()) + event.getPlayer().getName()));
event.setQuitMessage(F.sys("Quit", GetColor(event.getPlayer()) + name));
else
event.setQuitMessage(null);
}

View File

@ -24,7 +24,7 @@ public class BaconBrawl extends SoloGame
new Kit[]
{
new KitPig(manager),
new KitBabyPig(manager),
new KitMamaPig(manager),
new KitSheepPig(manager)
},

View File

@ -1,84 +0,0 @@
package nautilus.game.arcade.game.games.baconbrawl.kits;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Pig;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.disguise.disguises.DisguiseChicken;
import mineplex.core.disguise.disguises.DisguisePig;
import mineplex.core.itemstack.ItemStackFactory;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.perks.PerkBaconBlast;
import nautilus.game.arcade.kit.perks.PerkSpeed;
public class KitBabyPig extends Kit
{
public KitBabyPig(ArcadeManager manager)
{
super(manager, "Bebe Piggles", KitAvailability.Gem,
new String[]
{
"Tiny pig runs so fast!"
},
new Perk[]
{
new PerkBaconBlast(),
new PerkSpeed(1),
},
EntityType.PIG,
new ItemStack(Material.PORK));
}
@Override
public void GiveItems(Player player)
{
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE));
//Disguise
DisguisePig disguise = new DisguisePig(player);
disguise.setName(C.cYellow + player.getName());
disguise.setCustomNameVisible(true);
disguise.setBaby();
Manager.GetDisguise().disguise(disguise);
}
@Override
public Entity SpawnEntity(Location loc)
{
EntityType type = _entityType;
if (type == EntityType.PLAYER)
type = EntityType.ZOMBIE;
LivingEntity entity = (LivingEntity) Manager.GetCreature().SpawnEntity(loc, type);
entity.setRemoveWhenFarAway(false);
entity.setCustomName(GetAvailability().GetColor() + GetName() + " Kit");
entity.setCustomNameVisible(true);
entity.getEquipment().setItemInHand(_itemInHand);
if (type == EntityType.PIG)
{
Pig sheep = (Pig)entity;
sheep.setBaby();
}
UtilEnt.Vegetate(entity);
SpawnCustom(entity);
return entity;
}
}

View File

@ -0,0 +1,92 @@
package nautilus.game.arcade.game.games.baconbrawl.kits;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Pig;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.disguise.disguises.DisguisePig;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.perks.PerkBaconBlast;
import nautilus.game.arcade.kit.perks.PerkSpeed;
import net.minecraft.server.v1_7_R4.PacketPlayOutEntityDestroy;
public class KitMamaPig extends Kit
{
public KitMamaPig(ArcadeManager manager)
{
super(manager, "Mama Piggles", KitAvailability.Gem,
new String[]
{
"Maba & Baby Piggles fight together!"
},
new Perk[]
{
new PerkBaconBlast(),
new PerkSpeed(1),
},
EntityType.PIG,
new ItemStack(Material.PORK));
}
@Override
public void GiveItems(final Player player)
{
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE));
//Disguise
DisguisePig disguise = new DisguisePig(player);
disguise.setName(C.cYellow + player.getName());
disguise.setCustomNameVisible(false);
Manager.GetDisguise().disguise(disguise);
Manager.GetGame().CreatureAllowOverride = true;
final Pig pig = player.getWorld().spawn(player.getEyeLocation(), Pig.class);
pig.setBaby();
pig.setAgeLock(true);
pig.setCustomName(C.cYellow + player.getName());
pig.setCustomNameVisible(true);
Manager.GetGame().CreatureAllowOverride = false;
player.setPassenger(pig);
Bukkit.getScheduler().runTaskLater(Manager.getPlugin(), new Runnable()
{
@Override
public void run()
{
UtilPlayer.sendPacket(player, new PacketPlayOutEntityDestroy(new int[] { pig.getEntityId() }));
}
}, 2);
}
@EventHandler
public void damageTransfer(CustomDamageEvent event)
{
if (event.IsCancelled())
return;
if (!(event.GetDamageeEntity() instanceof Pig))
return;
Pig pig = (Pig)event.GetDamageeEntity();
if (pig.getVehicle() == null || !(pig.getPassenger() instanceof LivingEntity))
return;
event.setDamagee((LivingEntity)pig.getVehicle());
}
}

View File

@ -1,5 +1,6 @@
package nautilus.game.arcade.game.games.champions;
import mineplex.core.aprilfools.AprilFoolsManager;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer;
import mineplex.minecraft.game.core.combat.DeathMessageType;
@ -65,7 +66,7 @@ public class ChampionsDominate extends Domination
EloStart = 1000;
this.DisableKillCommand = false;
registerStatTrackers(
new KillReasonStatTracker(this, "Backstab", "Assassination", false),
new ElectrocutionStatTracker(this),

View File

@ -6,6 +6,7 @@ import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityShootBowEvent;
import org.bukkit.event.inventory.InventoryType;
import mineplex.core.aprilfools.AprilFoolsManager;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer;
import mineplex.minecraft.game.core.combat.DeathMessageType;
@ -63,7 +64,7 @@ public class ChampionsTDM extends TeamDeathmatch
InventoryOpenChest = true;
this.DisableKillCommand = false;
registerStatTrackers(
new WinWithoutLosingTeammateStatTracker(this, "FlawlessVictory"),
new KillAllOpposingStatTracker(this),

View File

@ -84,6 +84,7 @@ public class BlockForm extends Form
// Player > Chicken
DisguiseChicken disguise = new DisguiseChicken(Player);
disguise.setBaby();
disguise.setInvisible(true);
disguise.setSoundDisguise(new DisguiseCat(Player));
Host.Manager.GetDisguise().disguise(disguise);

View File

@ -80,6 +80,7 @@ import mineplex.core.common.util.UtilTime;
import mineplex.core.common.util.UtilWorld;
import mineplex.core.disguise.disguises.DisguisePlayer;
import mineplex.core.itemstack.ItemBuilder;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.loot.*;
import mineplex.core.packethandler.IPacketHandler;
import mineplex.core.packethandler.PacketInfo;
@ -242,10 +243,6 @@ public class SurvivalGames extends SoloGame
PlaySoundGameStart = false;
PrepareTime = 15000;
// Blocks
BlockBreakAllow.add(Material.TNT.getId()); // TNT
BlockPlaceAllow.add(Material.TNT.getId());
BlockBreakAllow.add(Material.WEB.getId()); // Web
BlockPlaceAllow.add(Material.WEB.getId());
@ -1104,6 +1101,9 @@ public class SurvivalGames extends SoloGame
event.setCancelled(true);
}
return;
case WOOD:
event.setCancelled(true);
return;
default:
break;
@ -1904,6 +1904,8 @@ public class SurvivalGames extends SoloGame
_baseLoot.registerLoot(new RandomItem(Material.FLINT, 30, 1, 2));
_baseLoot.registerLoot(new RandomItem(Material.FEATHER, 30, 1, 2));
_baseLoot.registerLoot(new RandomItem(Material.GOLD_INGOT, 20));
_baseLoot.registerLoot(new RandomItem(ItemStackFactory.Instance.CreateStack(Material.TNT, (byte)0, 1, F.item("Throwing TNT")), 15));
_spawnLoot.registerLoot(new RandomItem(Material.MUSHROOM_SOUP, 15));
_spawnLoot.cloneLoot(_baseLoot);

View File

@ -85,6 +85,12 @@ public class PerkBomberHG extends Perk
UtilPlayer.message(event.getPlayer(), F.main(GetName(), "You cannot drop " + F.item("Throwing TNT") + "."));
}
@EventHandler
public void FletchInvClick(InventoryClickEvent event)
{
UtilInv.DisallowMovementOf(event, "Throwing TNT", Material.TNT, (byte) 0, true);
}
@EventHandler
public void TNTDeathRemove(PlayerDeathEvent event)
{

View File

@ -2,6 +2,7 @@ package nautilus.game.arcade.managers;
import java.util.Iterator;
import mineplex.core.aprilfools.AprilFoolsManager;
import mineplex.core.common.Rank;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
@ -46,6 +47,11 @@ public class GameChatManager implements Listener
return;
Player sender = event.getPlayer();
String senderName = sender.getName();
// April Fools
if (AprilFoolsManager.Instance.isActive())
senderName = AprilFoolsManager.Instance.getName(sender);
//Dead Prefix
String dead = "";
@ -100,7 +106,7 @@ public class GameChatManager implements Listener
event.getRecipients().clear();
event.setMessage(event.getMessage().substring(1, event.getMessage().length()));
event.setFormat(levelStr + C.cDPurple + C.Bold + "Party " + C.cWhite + C.Bold + "%1$s " + C.cPurple + "%2$s");
event.setFormat(levelStr + C.cDPurple + C.Bold + "Party " + C.cWhite + C.Bold + senderName + " " + C.cPurple + "%2$s");
event.getRecipients().addAll(party.GetPlayersOnline());
@ -109,7 +115,7 @@ public class GameChatManager implements Listener
}
//Base Format
event.setFormat(dead + levelStr + rankStr + Manager.GetColor(sender) + "%1$s " + ChatColor.WHITE + "%2$s");
event.setFormat(dead + levelStr + rankStr + Manager.GetColor(sender) + senderName + " " + ChatColor.WHITE + "%2$s");
//Public/Private (Not If Player Dead)
if (Manager.GetGame() != null && Manager.GetGame().GetState() == GameState.Live)
@ -125,13 +131,13 @@ public class GameChatManager implements Listener
if (event.getMessage().charAt(0) == '@')
{
event.setMessage(event.getMessage().substring(1, event.getMessage().length()));
event.setFormat(C.cWhite + C.Bold + "Team" + " " + dead + levelStr + rankStr + team.GetColor() + "%1$s " + C.cWhite + "%2$s");
event.setFormat(C.cWhite + C.Bold + "Team" + " " + dead + levelStr + rankStr + team.GetColor() + senderName + " " + C.cWhite + "%2$s");
}
//All Chat
else
{
globalMessage = true;
event.setFormat(dead + levelStr + rankStr + team.GetColor() + "%1$s " + C.cWhite + "%2$s");
event.setFormat(dead + levelStr + rankStr + team.GetColor() + senderName + " " + C.cWhite + "%2$s");
}
}

View File

@ -30,7 +30,7 @@ import org.bukkit.event.player.PlayerPickupItemEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.util.Vector;
public class HalloweenManager implements Listener
public class HolidayManager implements Listener
{
ArcadeManager Manager;
@ -40,7 +40,7 @@ public class HalloweenManager implements Listener
public long _lastSpawn = System.currentTimeMillis();
public HalloweenManager(ArcadeManager manager)
public HolidayManager(ArcadeManager manager)
{
Manager = manager;
@ -61,29 +61,29 @@ public class HalloweenManager implements Listener
if (event.getType() == UpdateType.TICK)
return;
Iterator<Block> pumpkinIterator = _active.iterator();
Iterator<Block> blockIterator = _active.iterator();
while (pumpkinIterator.hasNext())
while (blockIterator.hasNext())
{
Block pumpkin = pumpkinIterator.next();
Block block = blockIterator.next();
if (pumpkin.getType() != Material.PUMPKIN && pumpkin.getType() != Material.JACK_O_LANTERN)
if (block.getType() != Material.PUMPKIN && block.getType() != Material.JACK_O_LANTERN)
{
pumpkinBreak(pumpkin);
pumpkinIterator.remove();
pumpkinBreak(block);
blockIterator.remove();
continue;
}
UtilParticle.PlayParticle(ParticleType.FLAME, pumpkin.getLocation().add(0.5, 0.5, 0.5), 0, 0, 0, 0.06f, 4);
UtilParticle.PlayParticle(ParticleType.FLAME, block.getLocation().add(0.5, 0.5, 0.5), 0, 0, 0, 0.06f, 4);
if (Math.random() > 0.90)
{
if (pumpkin.getType() == Material.PUMPKIN)
if (block.getType() == Material.PUMPKIN)
{
pumpkin.setType(Material.JACK_O_LANTERN);
block.setType(Material.JACK_O_LANTERN);
}
else
{
pumpkin.setType(Material.PUMPKIN);
block.setType(Material.PUMPKIN);
}
}
}