Merge remote-tracking branch 'refs/remotes/origin/develop' into feature/gem-hunters-persistence

This commit is contained in:
Sam 2017-04-02 12:48:35 +01:00
commit bc1050e387
53 changed files with 1126 additions and 274 deletions

View File

@ -72,6 +72,11 @@ public enum Rank
return _description;
}
public void setName(String name)
{
Name = name;
}
public String getRawTag()
{
if (Name.equalsIgnoreCase("ALL"))

View File

@ -71,6 +71,23 @@ public class ShapeWings extends ShapeGrid implements CosmeticShape
"00000$$0000000$$00000"
};
public static final String[] BEE_WING_PATTERN = new String[]
{
"00$$$000$$$00",
"0$###$0$###$0",
"$$$$$$$$$$$$$",
"$#####$#####$",
"$$$$$$$$$$$$$",
"0$#########$0",
"00$$$$$$$$$00",
"0$#########$0",
"$$$$$$$$$$$$$",
"$#####$#####$",
"$$$$$$$$$$$$$",
"0$###$0$###$0",
"00$$$000$$$00"
};
public static final String[] SMALL_BUTTERFLY_WING_PATTERN = new String[]
{
"0$$00000000$$0",

View File

@ -312,38 +312,19 @@ public class UtilEnt
public static void removeGoalSelectors(Entity entity)
{
try
if (((CraftEntity)entity).getHandle() instanceof EntityInsentient)
{
if (_goalSelector == null)
{
_goalSelector = EntityInsentient.class.getDeclaredField("goalSelector");
_goalSelector.setAccessible(true);
}
if (((CraftEntity)entity).getHandle() instanceof EntityInsentient)
{
EntityInsentient creature = (EntityInsentient)((CraftEntity)entity).getHandle();
PathfinderGoalSelector goalSelector = new PathfinderGoalSelector(((CraftWorld)entity.getWorld()).getHandle().methodProfiler);
_goalSelector.set(creature, goalSelector);
}
}
catch (IllegalArgumentException e)
EntityInsentient creature = (EntityInsentient)((CraftEntity)entity).getHandle();
creature.goalSelector = new PathfinderGoalSelector(((CraftWorld)entity.getWorld()).getHandle().methodProfiler);
}
}
public static void removeTargetSelectors(Entity entity)
{
if (((CraftEntity)entity).getHandle() instanceof EntityInsentient)
{
e.printStackTrace();
}
catch (IllegalAccessException e)
{
e.printStackTrace();
}
catch (NoSuchFieldException e)
{
e.printStackTrace();
}
catch (SecurityException e)
{
e.printStackTrace();
EntityInsentient creature = (EntityInsentient)((CraftEntity)entity).getHandle();
creature.targetSelector = new PathfinderGoalSelector(((CraftWorld)entity.getWorld()).getHandle().methodProfiler);
}
}

View File

@ -449,7 +449,7 @@ public enum Achievement
CHAMPIONS_SPECIAL_WIN("Champion of Champions", 3000,
new String[]{"Champions CTF.SpecialWin"},
new String[]{"Win the game with 5 more captures than the other team"},
new String[]{"Win the game with 5 more flag captures than the other team"},
new int[]{1},
AchievementCategory.CHAMPIONS),

View File

@ -112,7 +112,7 @@ public enum AchievementCategory
DRAW_MY_THING("Draw My Thing", null,
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.GEMS_EARNED },
Material.BOOK_AND_QUILL, 0, GameCategory.CLASSICS, "Extra Tools Kit", false, GameDisplay.Draw.getGameId()),
Material.BOOK_AND_QUILL, 0, GameCategory.CLASSICS, "None", false, GameDisplay.Draw.getGameId()),
CHAMPIONS("Champions", new String[] {"Champions Domination", "Champions TDM", "Champions CTF"},
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED, new StatDisplay("Flags Captured", "Captures") },

View File

@ -1,203 +1,254 @@
package mineplex.core.aprilfools;
import java.util.Calendar;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import com.google.common.collect.ImmutableMap;
import mineplex.core.MiniPlugin;
import mineplex.core.aprilfools.command.PirateSongCommand;
import mineplex.core.common.Rank;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTextMiddle;
import mineplex.core.twofactor.TwoFactorAuth;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
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;
import java.util.Map;
public class AprilFoolsManager extends MiniPlugin
{
public static AprilFoolsManager Instance;
/**
* Manually can be toggled to enable or disable the April Fools activities.
*/
private static final boolean ENABLED = true;
private static final Map<String, String> CHAT_REPLACEMENTS = ImmutableMap.<String, String>builder()
.put("you", "ye")
.put("yes", "aye")
.put("hello", "ahoy")
.put("hey", "ahoy")
.put("hi", "ahoy")
.put("friend", "matey")
.put("friends", "mateys")
.put("chest", "booty")
.put("chests", "booty")
.put("treasure", "booty")
.put("shards", "riches")
.put("sword", "cutlass")
.put("my", "me")
.put("gold", "dubloon")
.put("dog", "seadog")
.put("die", "walk the plank")
.put("kill", "keelhaul")
.put("boat", "ship")
.put("drink", "grog")
.put("water", "grog")
.put("dirt", "flith")
.put("flag", "jolly roger")
.put("am", "be")
.put("are", "be")
.put("your", "yer")
.put("girl", "lass")
.put("woman", "lass")
.put("hell", "davy jones' locker")
.put("nether", "davy jones' locker")
.put("of", "o'")
.put("reward", "bounty")
.put("prize", "bounty")
.put("shoot", "fire in the hole")
.put("clumsy", "landlubber")
.put("clean", "swab")
.put("look", "avast ye")
.put("omg", "shiver my timbers")
.put("wood", "timber")
.put("trash", "poop deck")
.put("noob", "shark bait")
.put("hack", "scurvy")
.put("hacks", "scurvy")
.put("hax", "scurvy")
.put("haks", "scurvy")
.put("hacker", "scurvy")
.put("owner", "captain")
.put("leader", "captain")
.put("lt", "captain")
.put("dev", "firstmate")
.put("developer", "firstmate")
.put("admin", "firstmate")
.build();
private static final Map<Rank, String> RANK_REPLACEMENTS = ImmutableMap.<Rank, String>builder()
.put(Rank.ETERNAL, "Captain")
.put(Rank.TITAN, "FirstMate")
.put(Rank.LEGEND, "Boatswain")
.put(Rank.HERO, "Gunner")
.put(Rank.ULTRA, "Parrot")
.build();
private static AprilFoolsManager _instance;
private final AprilFoolsRepository _repository;
private final TwoFactorAuth _twoFA;
private boolean _enabled;
private DisguiseManager _disguiseManager;
private CoreClientManager _clientManager;
protected AprilFoolsManager(JavaPlugin plugin, CoreClientManager clientManager, DisguiseManager disguiseManager)
private boolean _enabledTitle;
public AprilFoolsManager()
{
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);
super("April Fools");
_instance = this;
_repository = new AprilFoolsRepository();
_twoFA = require(TwoFactorAuth.class);
setEnabled(true);
_enabledTitle = UtilServer.isHubServer() || UtilServer.isTestServer();
if (_enabled)
{
for (Map.Entry<Rank, String> entry : RANK_REPLACEMENTS.entrySet())
{
entry.getKey().setName(entry.getValue());
}
}
}
@EventHandler
public void updateEnabled(UpdateEvent event)
@Override
public void addCommands()
{
if (event.getType() != UpdateType.SLOW)
return;
Calendar c = Calendar.getInstance();
_enabled = (c.get(Calendar.MONTH) == Calendar.APRIL && c.get(Calendar.DAY_OF_MONTH) == 1);
addCommand(new PirateSongCommand(this));
}
@EventHandler(priority = EventPriority.LOW)
public void chatAdd(AsyncPlayerChatEvent event)
@EventHandler(priority = EventPriority.LOWEST)
public void chat(AsyncPlayerChatEvent event)
{
if (!_enabled)
return;
String[] words = event.getMessage().split(" ");
String out = "";
for (String word : words)
if (!_enabled || _twoFA.isAuthenticating(event.getPlayer()))
{
//Prefix
if (Math.random() > 0.85)
return;
}
String message = event.getMessage();
String pirateMessage = "";
for (String word : message.split(" "))
{
String wordLower = word.toLowerCase();
wordLower = wordLower.replaceAll("[^a-zA-Z0-9]", "");
if (CHAT_REPLACEMENTS.containsKey(wordLower))
{
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 += " ";
String pirateWord = CHAT_REPLACEMENTS.get(wordLower);
char[] chars = pirateWord.toCharArray();
if (Character.isUpperCase(word.charAt(0)))
{
chars[0] = Character.toUpperCase(chars[0]);
}
pirateWord = String.valueOf(chars);
pirateMessage += pirateWord + " ";
}
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)
{
//Moo
if (Math.random() > 0.8)
if (wordLower.length() > 1 && wordLower.charAt(wordLower.length() - 1) == 'g')
{
if (_disguiseManager.getDisguise(player) instanceof DisguiseCow)
{
player.getWorld().playSound(player.getLocation(), Sound.COW_IDLE, (float)Math.random() + 0.5f, (float)Math.random() + 0.5f);
}
int g = word.lastIndexOf('g');
char[] chars = word.toCharArray();
chars[g] = '\'';
word = String.valueOf(chars);
}
continue;
pirateMessage += word + " ";
}
}
double random = Math.random();
if (random > 0.85)
{
pirateMessage += "matey!";
}
else if (random > 0.7)
{
String ar = "ar";
for (int i = 0; i < 10; i++)
{
if (Math.random() > 0.75)
{
break;
}
ar += "r";
}
//Disguise
DisguiseCow disguise = new DisguiseCow(player);
disguise.setName(getName(player), _clientManager.Get(player).GetRank());
disguise.setCustomNameVisible(true);
_disguiseManager.disguise(disguise);
pirateMessage += "a" + ar + "gh";
}
else if (random > 0.55)
{
pirateMessage += "scallywag";
}
event.setMessage(pirateMessage.trim());
}
public boolean isActive()
@EventHandler
public void updateRandomMessage(UpdateEvent event)
{
if (!_enabled || !_enabledTitle || event.getType() != UpdateType.SLOW)
{
return;
}
String message = null;
double random = Math.random();
if (random > 0.99)
{
message = "Aye Aye Captain!";
}
else if (random > 0.98)
{
message = "Arggggggh";
}
else if (random > 0.97)
{
message = "Mateyy!";
}
else if (random > 0.96)
{
message = "Shiver me timbers!";
}
if (message == null)
{
return;
}
UtilTextMiddle.display("", message, 10, 40, 10);
}
public AprilFoolsRepository getRepository()
{
return _repository;
}
public void setEnabled(boolean enabled)
{
_enabled = ENABLED && enabled;
}
public boolean isEnabled()
{
return _enabled;
}
public String getName(Player player)
public static AprilFoolsManager getInstance()
{
//Name
int index = 0;
boolean hitVowel = false;
for (int i=0 ; i<player.getName().length()-2 && i<5 ; i++)
if (_instance == null)
{
//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;
_instance = new AprilFoolsManager();
}
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)
{
Calendar c = Calendar.getInstance();
_enabled = b && (c.get(Calendar.MONTH) == Calendar.APRIL && c.get(Calendar.DAY_OF_MONTH) == 1);
return _instance;
}
}

View File

@ -0,0 +1,48 @@
package mineplex.core.aprilfools;
import mineplex.core.account.CoreClient;
import mineplex.serverdata.database.DBPool;
import mineplex.serverdata.database.RepositoryBase;
import mineplex.serverdata.database.column.ColumnInt;
import mineplex.serverdata.database.column.ColumnVarChar;
import java.util.ArrayList;
import java.util.List;
import java.util.function.Consumer;
public class AprilFoolsRepository extends RepositoryBase
{
private static final String GET_TREASURE = "SELECT * FROM aprilFoolsTreasure WHERE accountId=?;";
private static final String INSERT_TREASURE = "INSERT INTO aprilFoolsTreasure VALUES (?,?);";
public AprilFoolsRepository()
{
super(DBPool.getAccount());
}
public void getTreasure(Consumer<List<Integer>> response, CoreClient client)
{
executeQuery(GET_TREASURE, resultSet ->
{
List<Integer> found = new ArrayList<>();
while (resultSet.next())
{
found.add(resultSet.getInt("treasureId"));
}
response.accept(found);
}, new ColumnInt("accountId", client.getAccountId()));
}
public void saveTreasure(CoreClient client, int treasureId)
{
int accountId = client.getAccountId();
executeInsert(INSERT_TREASURE, null,
new ColumnInt("accountId", accountId),
new ColumnInt("treasureId", treasureId)
);
}
}

View File

@ -0,0 +1,48 @@
package mineplex.core.aprilfools.command;
import mineplex.core.aprilfools.AprilFoolsManager;
import mineplex.core.command.CommandBase;
import mineplex.core.common.Rank;
import mineplex.core.common.util.UtilTextMiddle;
import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitRunnable;
public class PirateSongCommand extends CommandBase<AprilFoolsManager>
{
private static final String[] PIRATE_SONG = {
"Are you ready kids?",
"Aye aye captain!",
"I can't hear you!",
"AYE AYE CAPTAIN!",
"OOOOOOOOOOOOH",
"Who lives in a pineapple under the sea?",
"Spongebob Squarepants!"
};
public PirateSongCommand(AprilFoolsManager plugin)
{
super(plugin, Rank.ADMIN, "piratesong");
}
@Override
public void Execute(Player caller, String[] args)
{
Plugin.runSyncTimer(new BukkitRunnable()
{
int index = 0;
@Override
public void run()
{
if (index == PIRATE_SONG.length)
{
cancel();
return;
}
UtilTextMiddle.display("", PIRATE_SONG[index++], 10, 60, 10);
}
}, 20, 100);
}
}

View File

@ -190,6 +190,7 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
{
_youtubers.add(Pair.create("Sigils", "https://www.youtube.com/user/SigilsPlaysGames?sub_confirmation=1"));
_youtubers.add(Pair.create("SallyGreenGamer", "https://www.youtube.com/channel/UCt8eypdLUND5CBvgXzEZrxw?sub_confirmation=1"));
_youtubers.add(Pair.create("RustyDawgT", "https://www.youtube.com/user/RustyDawgT?sub_confirmation=1"));
}
_youtubers.add(Pair.create("SamitoD", "https://www.youtube.com/user/SamitoD?sub_confirmation=1"));
@ -248,6 +249,7 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
{
_youtubers.add(Pair.create("Sigils", "https://www.youtube.com/user/SigilsPlaysGames?sub_confirmation=1"));
_youtubers.add(Pair.create("SallyGreenGamer", "https://www.youtube.com/channel/UCt8eypdLUND5CBvgXzEZrxw?sub_confirmation=1"));
_youtubers.add(Pair.create("RustyDawgT", "https://www.youtube.com/user/RustyDawgT?sub_confirmation=1"));
}
_youtubers.add(Pair.create("SamitoD", "https://www.youtube.com/user/SamitoD?sub_confirmation=1"));

View File

@ -205,22 +205,6 @@ public class Chat extends MiniPlugin
return true;
}
@EventHandler
public void removeChat(AsyncPlayerChatEvent event)
{
if (event.isCancelled())
return;
if (event.isAsynchronous())
{
for (Iterator<Player> playerIterator = event.getRecipients().iterator(); playerIterator.hasNext();)
{
if (!_preferences.get(playerIterator.next()).isActive(Preference.SHOW_CHAT))
playerIterator.remove();
}
}
}
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onSignChange(SignChangeEvent event)
{
@ -369,7 +353,7 @@ public class Chat extends MiniPlugin
msgContainsHack(event.getMessage()))
{
UtilPlayer.message(sender, F.main("Chat",
"Accusing players of cheating in-game is against the rules."
"Accusing players of cheating in-game is against the rules. "
+ "If you think someone is cheating, please gather evidence and report it at "
+ F.link("www.mineplex.com/reports")));
event.setCancelled(true);
@ -403,6 +387,11 @@ public class Chat extends MiniPlugin
return;
}
}
if (event.isAsynchronous())
{
event.getRecipients().removeIf(player -> !_preferences.get(player).isActive(Preference.SHOW_CHAT));
}
}
private boolean msgContainsHack(String msg)

View File

@ -5,6 +5,8 @@ import org.bukkit.entity.Player;
import mineplex.core.chat.Chat;
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.common.util.UtilServer;
public class BroadcastCommand extends CommandBase<Chat>
@ -17,6 +19,12 @@ public class BroadcastCommand extends CommandBase<Chat>
@Override
public void Execute(Player caller, String[] args)
{
if (args.length == 0)
{
UtilPlayer.message(caller, F.main("Broadcast", "What are you broadcasting?"));
return;
}
String announcement = "";
for (String arg : args)

View File

@ -19,6 +19,10 @@ public class DisguiseCommand extends CommandBase<PlayerDisguiseManager> implemen
{
if (args == null || args.length == 0)
{
Plugin.runAsync(() ->
{
new PlayerDisguiseNotification(Plugin.getRealName(caller), caller.getUniqueId(), caller.getName()).publish();
});
Plugin.undisguise(caller);
return;
}
@ -28,6 +32,11 @@ public class DisguiseCommand extends CommandBase<PlayerDisguiseManager> implemen
return;
}
Plugin.runAsync(() ->
{
new PlayerDisguiseNotification(Plugin.getRealName(caller), caller.getUniqueId(), args[0], args.length > 1 ? args[1] : args[0]).publish();
});
Plugin.disguise(caller, args[0], args.length > 1 ? args[1] : args[0]);
}
}

View File

@ -331,6 +331,12 @@ public class PlayerDisguiseManager extends MiniPlugin implements IPacketHandler
}
}
public String getRealName(Player caller)
{
CoreClient coreClient = _clients.Get(caller);
return coreClient == null ? caller.getName() : coreClient.getName();
}
public void undisguise(Player caller)
{
if (!isDisguised(caller))

View File

@ -0,0 +1,57 @@
package mineplex.core.disguise.playerdisguise;
import java.util.UUID;
import mineplex.serverdata.commands.ServerCommand;
public class PlayerDisguiseNotification extends ServerCommand
{
private String _realPlayerName;
private UUID _playerUUID;
private boolean _disguising;
private String _disguisedName;
private String _disguisedSkin;
public PlayerDisguiseNotification(String realPlayerName, UUID playerUUID, String disguisedName, String disguisedSkin)
{
_realPlayerName = realPlayerName;
_playerUUID = playerUUID;
_disguising = true;
_disguisedName = disguisedName;
_disguisedSkin = disguisedSkin;
}
public PlayerDisguiseNotification(String realPlayerName, UUID playerUUID, String disguisedName)
{
_realPlayerName = realPlayerName;
_playerUUID = playerUUID;
_disguising = false;
_disguisedName = disguisedName;
_disguisedSkin = null;
}
public String getRealPlayerName()
{
return _realPlayerName;
}
public UUID getPlayerUUID()
{
return _playerUUID;
}
public boolean isDisguising()
{
return _disguising;
}
public String getDisguisedName()
{
return _disguisedName;
}
public String getDisguisedSkin()
{
return _disguisedSkin;
}
}

View File

@ -165,6 +165,7 @@ import mineplex.core.gadget.gadgets.particle.ParticleFairy;
import mineplex.core.gadget.gadgets.particle.ParticleFireRings;
import mineplex.core.gadget.gadgets.particle.ParticleLegend;
import mineplex.core.gadget.gadgets.particle.ParticleWingsAngel;
import mineplex.core.gadget.gadgets.particle.ParticleWingsBee;
import mineplex.core.gadget.gadgets.particle.ParticleWingsDemons;
import mineplex.core.gadget.gadgets.particle.ParticleWingsInfernal;
import mineplex.core.gadget.gadgets.particle.ParticleWingsLove;
@ -360,6 +361,8 @@ public class GadgetManager extends MiniPlugin
addGadget(new ItemBow(this));
addGadget(new ItemLovePotion(this));
addGadget(new ItemFlowerGift(this));
// NEXT MONTH'S PPC
//addGadget(new ItemBubbleBlaster(this));
// Costume
addGadget(new OutfitRaveSuitHelmet(this));
@ -447,6 +450,7 @@ public class GadgetManager extends MiniPlugin
addGadget(new ParticleFreedom(this));
addGadget(new ParticleChristmasTree(this));
addGadget(new ParticleWingsLove(this));
addGadget(new ParticleWingsBee(this));
// Arrow Trails
addGadget(new ArrowTrailFrostLord(this));

View File

@ -86,7 +86,7 @@ public class GameModifierMineStrikeSkin extends GameModifierGadget
@Override
public void enableCustom(Player player, boolean message)
{
Manager.getGameModifiers(getGameType()).stream().filter(getWeaponFilter(_weapon)).forEach(g -> g.disable(player));
Manager.getGameModifiers(getGameType()).stream().filter(getWeaponFilter(_weapon).and(weapon -> weapon != this)).forEach(g -> g.disable(player));
super.enableCustom(player, message);
}

View File

@ -0,0 +1,121 @@
package mineplex.core.gadget.gadgets.item;
import java.awt.Color;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import org.bukkit.Material;
import org.bukkit.entity.ArmorStand;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.util.Vector;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.LineFormat;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilGear;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilText;
import mineplex.core.common.util.particles.ColoredParticle;
import mineplex.core.common.util.particles.DustSpellColor;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.gadgets.Ammo;
import mineplex.core.gadget.types.ItemGadget;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
public class ItemBubbleBlaster extends ItemGadget
{
private Map<ArmorStand, Player> _armorStands = new HashMap<>();
public ItemBubbleBlaster(GadgetManager manager)
{
super(manager, "Bubble Blaster", UtilText.splitLinesToArray(new String[]{C.cGray + "Placeholder"}, LineFormat.LORE),
-14, Material.DIAMOND_BARDING, (byte) 0, 5000, new Ammo("Bubble", "Bubble", Material.DIAMOND_BARDING, (byte) 0, new String[]{C.cGray + "Placeholder"}, -5, 1));
}
@Override
public void disableCustom(Player player, boolean message)
{
super.disableCustom(player, message);
}
@Override
public void ActivateCustom(Player player)
{
}
@Override
@EventHandler
public void Activate(PlayerInteractEvent event)
{
if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK)
return;
if (UtilBlock.usable(event.getClickedBlock()))
return;
if (!UtilGear.isMat(event.getPlayer().getItemInHand(), this.getDisplayMaterial()))
return;
Player player = event.getPlayer();
if (!isActive(player))
return;
event.setCancelled(true);
player.getInventory().setItem(Manager.getActiveItemSlot(), ItemStackFactory.Instance.CreateStack(getDisplayMaterial(), getDisplayData(), 1, F.item(Manager.getInventoryManager().Get(player).getItemCount(getName()) + " " + getName())));
// TODO CHANGE COLOR IF RAINBOW
// TODO COOLDOWN AFTER MAX OF 5 SECONDS HOLDING
// TODO LAUNCH MULTIPLE WHILE HOLDING
ArmorStand armorStand = player.getWorld().spawn(player.getLocation().add(0, 1, 0), ArmorStand.class);
armorStand.setItemInHand(new ItemStack(Material.STAINED_GLASS, 1, (byte) UtilMath.random.nextInt(15)));
armorStand.setSmall(true);
armorStand.setVisible(false);
_armorStands.put(armorStand, player);
double x = UtilMath.random(0.5, 1) - 1.25, z = UtilMath.random(0.5, 1) - 1.25;
double sub = UtilMath.random(0.5, 1);
if (sub > 0.75)
UtilAction.velocity(armorStand, player.getLocation().getDirection().add(new Vector(x, 0, z)), 0.25, false, 0, 0.5, 1, false);
else
UtilAction.velocity(armorStand, player.getLocation().getDirection().subtract(new Vector(x, 0, z)), 0.25, false, 0, 0.5, 1, false);
}
@EventHandler
public void updateArmorStand(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
Iterator<Map.Entry<ArmorStand, Player>> iterator = _armorStands.entrySet().iterator();
while (iterator.hasNext())
{
Map.Entry<ArmorStand, Player> entry = iterator.next();
ArmorStand armorStand = entry.getKey();
Player player = entry.getValue();
if (armorStand.getTicksLived() >= 20)
{
ColoredParticle coloredParticle = new ColoredParticle(UtilParticle.ParticleType.RED_DUST, new DustSpellColor(Color.WHITE), armorStand.getLocation());
coloredParticle.display();
armorStand.remove();
iterator.remove();
}
}
}
}

View File

@ -4,6 +4,8 @@ import java.util.List;
import java.util.Map;
import java.util.Random;
import net.minecraft.server.v1_8_R3.PacketPlayInUseEntity;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.entity.Item;
@ -32,12 +34,14 @@ import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.gadgets.morph.managers.UtilMorph;
import mineplex.core.gadget.types.MorphGadget;
import mineplex.core.itemstack.ItemBuilder;
import mineplex.core.packethandler.IPacketHandler;
import mineplex.core.packethandler.PacketInfo;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.visibility.VisibilityManager;
public class MorphPumpkinKing extends MorphGadget
public class MorphPumpkinKing extends MorphGadget implements IPacketHandler
{
private static final int CROWN_POINTS = 12;
@ -57,6 +61,7 @@ public class MorphPumpkinKing extends MorphGadget
-1,
Material.PUMPKIN, (byte)0);
manager.getPacketManager().addPacketHandler(this, true, PacketPlayInUseEntity.class);
}
@Override
@ -123,7 +128,20 @@ public class MorphPumpkinKing extends MorphGadget
_bombs.removeIf(bomb -> bomb.update());
}
}
@Override
public void handle(PacketInfo packetInfo)
{
if (packetInfo.getPacket() instanceof PacketPlayInUseEntity)
{
PacketPlayInUseEntity packetPlayInUseEntity = (PacketPlayInUseEntity) packetInfo.getPacket();
if (packetPlayInUseEntity.action == PacketPlayInUseEntity.EnumEntityUseAction.ATTACK)
for (JackOBomb bomb : _bombs)
if (bomb._ent.getEntityId() == packetPlayInUseEntity.a)
packetInfo.setCancelled(true);
}
}
private class JackOBomb
{
private Player _user;
@ -151,6 +169,12 @@ public class MorphPumpkinKing extends MorphGadget
{
return true;
}
if (!_user.isOnline())
{
Manager.getDisguiseManager().undisguise(_disguise);
_ent.remove();
_done = true;
}
if (System.currentTimeMillis() >= _detonation)
{
UtilParticle.PlayParticleToAll(ParticleType.HUGE_EXPLOSION, _ent.getLocation(), null, 0, 1, ViewDist.NORMAL);

View File

@ -63,6 +63,12 @@ public class MorphSquid extends MorphGadget implements IThrown
{
removeArmor(player);
UtilMorph.undisguise(player, Manager.getDisguiseManager());
if (player.getInventory().getBoots() != null && player.getInventory().getBoots().getType() == Material.DIAMOND_BOOTS)
{
player.getInventory().setBoots(new ItemStack(Material.AIR));
player.removePotionEffect(PotionEffectType.SPEED);
}
}
@EventHandler

View File

@ -0,0 +1,55 @@
package mineplex.core.gadget.gadgets.particle;
import java.awt.Color;
import java.time.Month;
import java.time.YearMonth;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.util.Vector;
import mineplex.core.common.shape.ShapeWings;
import mineplex.core.common.util.C;
import mineplex.core.common.util.LineFormat;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilText;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.types.ParticleGadget;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
public class ParticleWingsBee extends ParticleGadget
{
private ShapeWings _wingsBlack = new ShapeWings(UtilParticle.ParticleType.RED_DUST.particleName, new Vector(1, 1, 1), 1, 0, '$', ShapeWings.DEFAULT_ROTATION, ShapeWings.BEE_WING_PATTERN);
private ShapeWings _wingsYellow = new ShapeWings(UtilParticle.ParticleType.RED_DUST.particleName, new Vector(1, 1, 1), 1, 0, '#', ShapeWings.DEFAULT_ROTATION, ShapeWings.BEE_WING_PATTERN);
public ParticleWingsBee(GadgetManager manager)
{
super(manager, "Bumblebee's Wings",
UtilText.splitLineToArray(C.cGray + "Float like a butterfly and sting like a bee with these new spring wings!", LineFormat.LORE),
-14, Material.WOOL, (byte) 4, YearMonth.of(2017, Month.APRIL));
}
@Override
public void playParticle(Player player, UpdateEvent event)
{
Location loc = player.getLocation().add(0, 1, 0).add(player.getLocation().getDirection().multiply(-0.4));
if (Manager.isMoving(player))
{
if (event.getType() == UpdateType.TICK)
{
_wingsBlack.displayColoredParticle(loc, Color.BLACK);
_wingsYellow.displayColoredParticle(loc, Color.YELLOW);
}
return;
}
if (event.getType() == UpdateType.FAST)
{
_wingsBlack.displayColored(loc, Color.BLACK);
_wingsYellow.displayColored(loc, Color.YELLOW);
}
}
}

View File

@ -26,6 +26,7 @@ public abstract class MorphGadget extends Gadget
public void applyArmor(Player player, boolean message)
{
Manager.removeGadgetType(player, GadgetType.MORPH, this);
Manager.removeGadgetType(player, GadgetType.COSTUME);
_active.add(player);

View File

@ -1,5 +1,7 @@
package mineplex.core.gadget.types;
import java.time.YearMonth;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
@ -28,7 +30,12 @@ public abstract class ParticleGadget extends Gadget
public ParticleGadget(GadgetManager manager, String name, String[] desc, int cost, Material mat, byte data, String...altNames)
{
super(manager, GadgetType.PARTICLE, name, desc, cost, mat, data, 1, altNames);
}
}
public ParticleGadget(GadgetManager manager, String name, String[] desc, int cost, Material mat, byte data, YearMonth yearMonth, String...altNames)
{
super(manager, GadgetType.PARTICLE, name, desc, cost, mat, data, yearMonth, 1, altNames);
}
@Override
public void enableCustom(Player player, boolean message)

View File

@ -11,6 +11,8 @@ import org.bukkit.entity.Chicken;
import org.bukkit.entity.EnderDragon;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import org.bukkit.util.Vector;
import mineplex.core.common.util.UtilAlg;
@ -29,7 +31,7 @@ public class DragonData extends MountData
public float Pitch = 0;
public Vector Velocity = new Vector(0,0,0);
public Entity Chicken;
public Chicken Chicken;
public DragonData(DragonMount dragonMount, Player rider)
{
@ -50,6 +52,7 @@ public class DragonData extends MountData
rider.getWorld().playSound(rider.getLocation(), Sound.ENDERDRAGON_GROWL, 20f, 1f);
Chicken = rider.getWorld().spawn(rider.getLocation(), Chicken.class);
Chicken.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, 99999999, 1));
Dragon.setPassenger(Chicken);
Chicken.setPassenger(getOwner());

View File

@ -50,6 +50,8 @@ public class MountSlime extends Mount<SingleEntityMountData<Slime>>
mount.getEntity().setCustomName(player.getName() + "'s " + getName());
UtilEnt.removeTargetSelectors(mount.getEntity());
//Inform
UtilPlayer.message(player, F.main("Mount", "You spawned " + F.elem(getName()) + "."));

View File

@ -4,6 +4,12 @@ import java.sql.Connection;
import java.sql.SQLException;
import java.util.*;
import com.mojang.authlib.GameProfile;
import mineplex.core.aprilfools.AprilFoolsManager;
import mineplex.core.common.skin.SkinData;
import mineplex.core.disguise.DisguiseManager;
import mineplex.core.disguise.disguises.DisguisePlayer;
import mineplex.core.utils.UtilGameProfile;
import org.bukkit.*;
import org.bukkit.configuration.InvalidConfigurationException;
import org.bukkit.configuration.file.YamlConfiguration;
@ -84,6 +90,8 @@ public class NpcManager extends MiniPlugin
final Map<UUID, Npc> _npcMap = new HashMap<>();
private final Set<UUID> _npcDeletingPlayers = new HashSet<>();
private final DisguiseManager _disguise;
public NpcManager(JavaPlugin plugin, Creature creature)
{
super("NpcManager", plugin);
@ -100,6 +108,8 @@ public class NpcManager extends MiniPlugin
_plugin.getServer().getPluginManager().registerEvents(this, _plugin);
_disguise = require(DisguiseManager.class);
try
{
loadNpcs();
@ -295,15 +305,17 @@ public class NpcManager extends MiniPlugin
public Entity spawnNpc(Npc npc)
{
LivingEntity entity = (LivingEntity) _creature.SpawnEntity(npc.getLocation(), EntityType.valueOf(npc.getDatabaseRecord().getEntityType()));
String name = null;
if (npc.getDatabaseRecord().getName() == null)
{
entity.setCustomNameVisible(false);
entity.setCustomName(ChatColor.RESET.toString());
name = entity.getCustomName();
}
else
{
String name = npc.getDatabaseRecord().getName();
name = npc.getDatabaseRecord().getName();
for (ChatColor color : ChatColor.values())
name = name.replace("(" + color.name().toLowerCase() + ")", color.toString());
name = ChatColor.translateAlternateColorCodes('&', name);

View File

@ -10,6 +10,7 @@ import java.util.UUID;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.GameMode;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
@ -195,6 +196,11 @@ public class Portal extends MiniPlugin
*/
public void sendPlayer(final Player player, String serverName)
{
if (player.getGameMode() == GameMode.SPECTATOR)
{
player.setSpectatorTarget(null);
}
ByteArrayOutputStream b = new ByteArrayOutputStream();
DataOutputStream out = new DataOutputStream(b);

View File

@ -36,6 +36,7 @@ public class PowerPlayClubRewards
.put(YearMonth.of(2017, Month.JANUARY), new UnknownSalesPackageItem("Over Easy Morph"))
.put(YearMonth.of(2017, Month.FEBRUARY), new PetItem(PetType.TRUE_LOVE_PET))
.put(YearMonth.of(2017, Month.MARCH), new UnknownSalesPackageItem("Gold Pot Morph"))
.put(YearMonth.of(2017, Month.APRIL), new UnknownSalesPackageItem("Bumblebee's Wings"))
.build();
public interface PowerPlayClubItem

View File

@ -38,6 +38,7 @@ import org.bukkit.Sound;
import org.bukkit.craftbukkit.v1_8_R3.CraftWorld;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
import org.bukkit.craftbukkit.v1_8_R3.inventory.CraftItemStack;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
@ -750,6 +751,13 @@ public class Titles extends MiniDbClientPlugin<TitleData> implements IPacketHand
if (packetInfo.getPacket() instanceof PacketPlayOutNamedEntitySpawn)
{
PacketPlayOutNamedEntitySpawn packet = (PacketPlayOutNamedEntitySpawn) packetInfo.getPacket();
Entity entity = UtilEnt.getEntityById(packet.a);
if (!(entity instanceof Player))
{
return;
}
Player owner = (Player) UtilEnt.getEntityById(packet.a);
if (_gadgetManager.getActive(owner, GadgetType.MORPH) == null)
{

View File

@ -7,6 +7,7 @@ import java.util.List;
import java.util.Map;
import java.util.function.Consumer;
import mineplex.core.titles.tracks.award.AprilFools2017Track;
import net.md_5.bungee.api.ChatColor;
import org.bukkit.Bukkit;
@ -80,6 +81,7 @@ public class TrackManager extends MiniPlugin
// Awarded tracks
registerTrack(new Bridges2017Track());
registerTrack(new AprilFools2017Track());
// Custom tracks
// registerTrack(track("lenny", "Lenny", "( ͡° ͜ʖ ͡°)"));

View File

@ -0,0 +1,30 @@
package mineplex.core.titles.tracks.award;
import mineplex.core.titles.tracks.ItemizedTrack;
import mineplex.core.titles.tracks.TrackFormat;
import mineplex.core.titles.tracks.TrackTier;
import net.md_5.bungee.api.ChatColor;
public class AprilFools2017Track extends ItemizedTrack
{
public AprilFools2017Track()
{
super(
"aprilfools-2017",
ChatColor.LIGHT_PURPLE,
"Fools 2017",
"2017 April Fools Treasure Hunt",
"This track is awarded to players who found all the chests in the 2017 April Fools Event",
true);
special();
getRequirements()
.addTier(new TrackTier(
"2017 April Fools",
null,
this::owns,
new TrackFormat(ChatColor.LIGHT_PURPLE, ChatColor.DARK_PURPLE)
)); }
}

View File

@ -320,7 +320,7 @@ public class TreasureLocation implements Listener
Location centerLocation = treasure.getCenterBlock().getLocation().add(0.5, 0.5, 0.5);
if (event.getTo().distanceSquared(centerLocation) > 9)
{
Location newTo = event.getFrom();
Location newTo = centerLocation.clone();
newTo.setPitch(event.getTo().getPitch());
newTo.setYaw(event.getTo().getYaw());
event.setTo(newTo);
@ -340,8 +340,13 @@ public class TreasureLocation implements Listener
double fromDistanceFromCenter = centerLocation.distanceSquared(fromLocation);
if (toDistanceFromCenter < fromDistanceFromCenter)
{
Location spawnLocation = new Location(player.getWorld(), 0, 64, 0);
UtilAction.velocity(player, UtilAlg.getTrajectory(player.getLocation(), spawnLocation).multiply(-1), 1.5, true, 0.8, 0, 1.0, true);
Entity target = player;
while (target.getVehicle() != null)
{
target = target.getVehicle();
}
Location spawnLocation = new Location(target.getWorld(), 0, 64, 0);
UtilAction.velocity(target, UtilAlg.getTrajectory(target.getLocation(), spawnLocation).multiply(-1), 1.5, true, 0.8, 0, 1.0, true);
}
}
}

View File

@ -1,5 +1,6 @@
package mineplex.game.clans;
import mineplex.core.aprilfools.AprilFoolsManager;
import net.minecraft.server.v1_8_R3.MinecraftServer;
import org.bukkit.Bukkit;
@ -265,6 +266,8 @@ public class Clans extends JavaPlugin
require(TwoFactorAuth.class);
AprilFoolsManager.getInstance();
// Disable spigot item merging
for (World world : getServer().getWorlds())
{

View File

@ -166,7 +166,7 @@ public class ClansHub extends JavaPlugin
new ResourcePackManager(this, portal);
new GlobalPacketManager(this, clientManager, serverStatusManager, inventoryManager, donationManager, petManager, statsManager, hubManager.getBonusManager().getRewardManager());
AprilFoolsManager.Initialize(this, clientManager, disguiseManager);
AprilFoolsManager.getInstance();
new EternalGiveawayManager(this, clientManager, serverStatusManager);

View File

@ -2,6 +2,7 @@ package mineplex.hub;
import static mineplex.core.Managers.require;
import mineplex.hub.modules.AprilFoolsTreasureHunt;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.entity.Player;
@ -117,7 +118,8 @@ public class Hub extends JavaPlugin implements IRelation
// new ProfileCacheManager(this);
ItemStackFactory.Initialize(this, false);
Recharge.Initialize(this);
VisibilityManager.Initialize(this); Give.Initialize(this);
VisibilityManager.Initialize(this);
Give.Initialize(this);
Punish punish = new Punish(this, clientManager);
BlockRestore blockRestore = require(BlockRestore.class);
DonationManager donationManager = require(DonationManager.class);
@ -132,9 +134,9 @@ public class Hub extends JavaPlugin implements IRelation
DisguiseManager disguiseManager = require(DisguiseManager.class);
IncognitoManager incognito = new IncognitoManager(this, clientManager, packetHandler);
PreferencesManager preferenceManager = new PreferencesManager(this, incognito, clientManager);
incognito.setPreferencesManager(preferenceManager);
preferenceManager.GiveItem = true;
Creature creature = new Creature(this);
NpcManager npcManager = new NpcManager(this, creature);
@ -145,7 +147,7 @@ public class Hub extends JavaPlugin implements IRelation
//new TournamentManager(this, clientManager, donationManager);
ProjectileManager throwManager = new ProjectileManager(this);
//Main Modules
new TitanGiveawayManager(this, clientManager, serverStatusManager);
@ -159,9 +161,9 @@ public class Hub extends JavaPlugin implements IRelation
guardianManager.registerGuardian(new AntiHackGuardian(new Location(Bukkit.getWorld("world"), 0, 100, 0), 50, -50, 105, 95, 50, -50));
}
IgnoreManager ignoreManager = new IgnoreManager(this, clientManager, preferenceManager, portal);
IgnoreManager ignoreManager = new IgnoreManager(this, clientManager, preferenceManager, portal);
FriendManager friendManager = new FriendManager(this, clientManager, preferenceManager, portal);
FriendManager friendManager = new FriendManager(this, clientManager, preferenceManager, portal);
StatsManager statsManager = new StatsManager(this, clientManager);
EloManager eloManager = new EloManager(this, clientManager);
@ -199,17 +201,14 @@ public class Hub extends JavaPlugin implements IRelation
new SnapshotPlugin(this, snapshotManager, clientManager);
new ReportPlugin(this, reportManager);
AprilFoolsManager.Initialize(this, clientManager, disguiseManager);
new EternalGiveawayManager(this, clientManager, serverStatusManager);
CombatManager combatManager = new CombatManager(this);
DamageManager damage = new DamageManager(this, combatManager, npcManager, disguiseManager, conditionManager);
conditionManager.setDamageManager(damage);
Fire fire = new Fire(this, conditionManager, damage);
Teleport teleport = new Teleport(this, clientManager);
Energy energy = new Energy(this);
@ -218,14 +217,14 @@ public class Hub extends JavaPlugin implements IRelation
ItemFactory itemFactory = new ItemFactory(this, blockRestore, conditionManager, damage, energy, fire, throwManager);
SkillFactory skillManager = new SkillFactory(this, damage, this, combatManager, conditionManager, throwManager, disguiseManager, blockRestore, fire, new Movement(this), teleport, energy);
ClassManager classManager = new ClassManager(this, clientManager, donationManager, hubManager.GetGadget(), skillManager, itemFactory);
ClassShopManager shopManager = new ClassShopManager(this, classManager, skillManager, itemFactory, achievementManager, clientManager);
new ClassCombatShop(shopManager, clientManager, donationManager, false, "Brute", classManager.GetClass("Brute"), true);
new ClassCombatShop(shopManager, clientManager, donationManager, false, "Mage", classManager.GetClass("Mage"), true);
new ClassCombatShop(shopManager, clientManager, donationManager, false, "Ranger", classManager.GetClass("Ranger"), true);
new ClassCombatShop(shopManager, clientManager, donationManager, false, "Knight", classManager.GetClass("Knight"), true);
new ClassCombatShop(shopManager, clientManager, donationManager, false, "Assassin", classManager.GetClass("Assassin"), true);
ClassShopManager shopManager = new ClassShopManager(this, classManager, skillManager, itemFactory, achievementManager, clientManager);
new ClassCombatShop(shopManager, clientManager, donationManager, false, "Brute", classManager.GetClass("Brute"), true);
new ClassCombatShop(shopManager, clientManager, donationManager, false, "Mage", classManager.GetClass("Mage"), true);
new ClassCombatShop(shopManager, clientManager, donationManager, false, "Ranger", classManager.GetClass("Ranger"), true);
new ClassCombatShop(shopManager, clientManager, donationManager, false, "Knight", classManager.GetClass("Knight"), true);
new ClassCombatShop(shopManager, clientManager, donationManager, false, "Assassin", classManager.GetClass("Assassin"), true);
//Updates
getServer().getScheduler().scheduleSyncRepeatingTask(this, new Updater(this), 1, 1);
@ -238,6 +237,11 @@ public class Hub extends JavaPlugin implements IRelation
require(TwoFactorAuth.class);
require(TeamspeakManager.class);
new WebsiteLinkManager(this, clientManager);
if (AprilFoolsManager.getInstance().isEnabled())
{
require(AprilFoolsTreasureHunt.class);
}
}
@Override

View File

@ -610,11 +610,6 @@ public class HubManager extends MiniClientPlugin<HubClient> implements IChatMess
Player player = event.getPlayer();
String playerName = player.getName();
// April Fools
if (AprilFoolsManager.Instance.isActive())
playerName = AprilFoolsManager.Instance.getName(player);
Rank rank = GetClients().Get(player).getRealOrDisguisedRank();
//Level Prefix

View File

@ -0,0 +1,284 @@
package mineplex.hub.modules;
import mineplex.core.MiniPlugin;
import mineplex.core.ReflectivelyCreateMiniPlugin;
import mineplex.core.account.CoreClientManager;
import mineplex.core.aprilfools.AprilFoolsManager;
import mineplex.core.common.currency.GlobalCurrency;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilMath;
import mineplex.core.donation.DonationManager;
import mineplex.core.inventory.InventoryManager;
import mineplex.core.titles.tracks.Track;
import mineplex.core.titles.tracks.TrackManager;
import mineplex.core.titles.tracks.award.AprilFools2017Track;
import org.bukkit.*;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.block.Skull;
import org.bukkit.entity.ArmorStand;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import java.util.*;
@ReflectivelyCreateMiniPlugin
public class AprilFoolsTreasureHunt extends MiniPlugin
{
private static final int SHARD_REWARD = 500;
private static final String ITEM_REWARD = "Omega Chest";
private static final int[][] TREASURE = {
{
0, 72, -10
},
{
-56, 71, -42
},
{
171, 69, -67
},
{
287, 71, -197
},
{
306, 123, -182
},
{
99, 68, -143
},
{
122, 70, -27
},
{
106, 86, 54
},
{
48, 71, 71
},
{
54, 64, 112
},
{
45, 117, 113
},
{
77, 93, 210
},
{
-13, 65, 128
},
{
-22, 65, 110
},
{
-115, 67, 54
},
{
-91, 56, 46
},
{
-14, 29, -10
},
{
13, 39, 36
},
{
99, 48, 49
},
{
-101, 70, 196
},
{
29, 111, 39
},
{
36, 60, -19
},
{
-65, 70, -111
},
{
-88, 55, -77
},
{
-4, 73, -37
},
{
120, 68, -20
},
{
119, 79, 9
},
{
213, 64, -111
},
{
228, 63, -155
},
{
34, 84, -5
}
};
private static final BlockFace[] BLOCK_FACES = {
BlockFace.NORTH,
BlockFace.EAST,
BlockFace.SOUTH,
BlockFace.WEST,
BlockFace.NORTH_EAST,
BlockFace.SOUTH_EAST,
BlockFace.SOUTH_WEST,
BlockFace.NORTH_WEST
};
private final AprilFoolsManager _aprilFools;
private final CoreClientManager _client;
private final DonationManager _donation;
private final InventoryManager _inventory;
private final TrackManager _track;
private final Map<UUID, List<Integer>> _foundTreasure;
private final List<Location> _treasure;
private boolean _set;
private AprilFoolsTreasureHunt()
{
super("Treasure Hunt");
_aprilFools = require(AprilFoolsManager.class);
_client = require(CoreClientManager.class);
_donation = require(DonationManager.class);
_inventory = require(InventoryManager.class);
_track = require(TrackManager.class);
_foundTreasure = new HashMap<>();
_treasure = new ArrayList<>(TREASURE.length);
}
@EventHandler
public void playerJoin(PlayerJoinEvent event)
{
UUID key = event.getPlayer().getUniqueId();
_foundTreasure.put(key, new ArrayList<>(TREASURE.length));
runAsync(() -> _aprilFools.getRepository().getTreasure(data -> _foundTreasure.put(key, data), _client.Get(key)));
if (!_set)
{
_set = true;
World world = Bukkit.getWorld("world");
for (int[] cords : TREASURE)
{
Location location = new Location(world, cords[0], cords[1], cords[2]);
Block block = location.getBlock();
block.setType(Material.SKULL);
block.setData((byte) 1);
Skull skull = (Skull) block.getState();
skull.setSkullType(SkullType.PLAYER);
skull.setOwner("Topplemop");
skull.setRotation(BLOCK_FACES[UtilMath.r(BLOCK_FACES.length)]);
skull.update();
_treasure.add(location);
}
Location information = _treasure.get(0).clone();
ArmorStand hologram = information.getWorld().spawn(information.add(.5, .5, .5), ArmorStand.class);
hologram.setSmall(true);
hologram.setGravity(false);
hologram.setVisible(false);
hologram.setCustomNameVisible(true);
hologram.setCustomName(C.cDPurple + C.Scramble + "ABC " + C.cPurpleB + "April Fools Treasure Hunt" + C.cDPurple + C.Scramble + " ABC");
hologram.setRemoveWhenFarAway(false);
}
}
@EventHandler
public void interactBlock(PlayerInteractEvent event)
{
if (event.getClickedBlock() == null)
{
return;
}
Player player = event.getPlayer();
UUID key = event.getPlayer().getUniqueId();
List<Integer> found = _foundTreasure.get(key);
Location location = event.getClickedBlock().getLocation();
int i = 0;
for (Location treasure : _treasure)
{
if (location.equals(treasure))
{
findChest(player, i);
break;
}
i++;
}
}
private void findChest(Player player, int treasureId)
{
List<Integer> found = _foundTreasure.get(player.getUniqueId());
if (found.contains(treasureId))
{
player.sendMessage(F.main(_moduleName, "You already have found this skull! You have found " + F.count(String.valueOf(found.size())) + "/" + F.count(String.valueOf(_treasure.size())) + "."));
return;
}
found.add(treasureId);
player.playSound(player.getLocation(), Sound.CAT_MEOW, 1, 0.7F);
player.sendMessage(F.main(_moduleName, "Found " + F.count(String.valueOf(found.size())) + "/" + F.count(String.valueOf(_treasure.size()))) + " Treasure Chests +" + F.currency(GlobalCurrency.TREASURE_SHARD, SHARD_REWARD) + ".");
_donation.rewardCurrencyUntilSuccess(GlobalCurrency.TREASURE_SHARD, player, "", SHARD_REWARD);
runAsync(() -> _aprilFools.getRepository().saveTreasure(_client.Get(player.getUniqueId()), treasureId));
if (found.size() == 1)
{
player.sendMessage(F.main(_moduleName, "There are " + F.count("30") + " secret " + F.elem("Pirate Heads") + " to find through the lobby."));
player.sendMessage(F.main(_moduleName, "Each one is worth " + F.currency(GlobalCurrency.TREASURE_SHARD, SHARD_REWARD) + "."));
player.sendMessage(F.main(_moduleName, "If you find all " + F.count("30") + " you will receive an " + C.cAqua + "Omega Chest" + C.mBody + " and an exclusive " + F.elem("Title") + "!"));
}
else if (found.size() == TREASURE.length)
{
player.sendMessage(F.main(_moduleName, "Completed the " + F.name("Mineplex April Fools 2017 Treasure Hunt") + "."));
_inventory.addItemToInventory(data ->
{
if (data)
{
player.sendMessage(F.main(_moduleName, "+1 " + C.cAqua + ITEM_REWARD + C.mBody + "!"));
}
else
{
player.sendMessage(F.main(_moduleName, "Oops, somehow I could not give you the chest, you should inform a staff member!"));
}
}, player, ITEM_REWARD, 1);
Track track = _track.getTrack(AprilFools2017Track.class);
_track.unlockTrack(player, track, result ->
{
switch (result)
{
case UNKNOWN_ERROR:
player.sendMessage(F.main(_moduleName, "Oops, somehow I could not give you the title track, you should inform a staff member!"));
break;
case SUCCESS:
player.sendMessage(F.main(_moduleName, "Unlocked " + track.getColor() + track.getLongName() + C.mBody + " Title!"));
break;
}
});
}
}
}

View File

@ -115,7 +115,7 @@ public class ServerGameMenu extends ShopPageBase<ServerManager, QuickShop>
C.Reset + "",
C.Reset + "One team must steal the other",
C.Reset + "team's flag. Capture it",
C.Reset + "three times to win.",
C.Reset + "five times to win.",
}, new String[] {"CTF"}, "CTF", new SelectCTFButton(this));
add(20, Material.BEACON, C.cYellowB + "Dominate " + C.cGray + "Team Game", new String[]

View File

@ -56,7 +56,7 @@ public class Blink extends SkillActive
"",
"Using again within 5 seconds De-Blinks,",
"returning you to your original location.",
"Can be used while Slowed."
"Cannot be used while Slowed."
});
}

View File

@ -69,7 +69,7 @@ public class Inferno extends SkillActive
}
@Override
public void Skill(Player player, int level)
public void Skill(Player player, int level)
{
_active.add(player);
}

View File

@ -49,7 +49,7 @@ public class RopedArrow extends SkillActive
{
"Prepare a roped arrow;",
"Your next arrow will pull you",
"pull you in after it hits.",
"in after it hits.",
});
}

View File

@ -3,6 +3,7 @@ package nautilus.game.arcade;
import java.io.File;
import java.util.HashMap;
import mineplex.core.aprilfools.AprilFoolsManager;
import net.minecraft.server.v1_8_R3.MinecraftServer;
import org.bukkit.Bukkit;
@ -202,6 +203,8 @@ public class Arcade extends JavaPlugin
require(TwoFactorAuth.class);
new WebsiteLinkManager(this, _clientManager);
AprilFoolsManager.getInstance();
//Updates
getServer().getScheduler().scheduleSyncRepeatingTask(this, new Updater(this), 1, 1);

View File

@ -224,8 +224,8 @@ public class Draw extends SoloGame
);
registerChatStats(
new ChatStatData("TotalGuess", "Total Guess'", true),
new ChatStatData("PureLuck", "Lucky Guess'", true)
new ChatStatData("TotalGuess", "Total Guesses", true),
new ChatStatData("PureLuck", "Lucky Guesses", true)
);
new CompassModule()

View File

@ -14,6 +14,7 @@ import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import org.bukkit.event.player.PlayerInteractEntityEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.inventory.Inventory;
@ -127,11 +128,24 @@ public class HotbarEditor extends MiniPlugin
if (UtilItem.isSimilar(item, _item, UtilItem.ItemAttribute.NAME))
{
event.setCancelled(true);
HotbarInventory.open(event.getPlayer(), this);
}
}
}
@EventHandler
public void onInteract(PlayerInteractEntityEvent event)
{
ItemStack item = event.getPlayer().getItemInHand();
if (UtilItem.isSimilar(item, _item, UtilItem.ItemAttribute.NAME))
{
event.setCancelled(true);
HotbarInventory.open(event.getPlayer(), this);
}
}
public Gladiators getHost()
{
return _host;

View File

@ -5,6 +5,8 @@ import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.EntityRegainHealthEvent;
import mineplex.minecraft.game.classcombat.Skill.event.SkillTriggerEvent;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.events.GameStateChangeEvent;
@ -17,6 +19,7 @@ import nautilus.game.arcade.game.games.champions.kits.KitRanger;
import nautilus.game.arcade.game.games.gladiators.Arena;
import nautilus.game.arcade.game.games.gladiators.ArenaType;
import nautilus.game.arcade.game.games.gladiators.Gladiators;
import nautilus.game.arcade.game.games.gladiators.RoundState;
import nautilus.game.arcade.kit.Kit;
/**
@ -88,5 +91,11 @@ public class ChampionsGladiators extends Gladiators
{
return "Champions Gladiators";
}
@EventHandler
public void skill(SkillTriggerEvent event)
{
if (getRoundState() != RoundState.FIGHTING)
event.SetCancelled(true);
}
}

View File

@ -9,6 +9,8 @@ import org.bukkit.block.BlockFace;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockFromToEvent;
import org.bukkit.event.block.BlockGrowEvent;
import org.bukkit.event.block.BlockPlaceEvent;
import mineplex.core.common.util.MapUtil;
@ -107,12 +109,24 @@ public class Micro extends TeamGame
{
Block block = WorldData.World.getBlockAt(x, y, z);
if (block.getType() == Material.AIR || block.isLiquid())
if (block.getType() == Material.AIR)
continue;
_blocks.add(block);
}
}
@EventHandler
public void preventGrow(BlockGrowEvent event)
{
event.setCancelled(true);
}
@EventHandler
public void preventFlow(BlockFromToEvent event)
{
event.setCancelled(true);
}
@EventHandler
public void BlockPlace(BlockPlaceEvent event)

View File

@ -559,7 +559,7 @@ public class Gun extends StrikeItem
C.cYellow + C.Bold + "Damage per Bullet: " + ChatColor.RESET + UtilMath.trim(1, getDamage()),
C.cYellow + C.Bold + "Armor Penetration: " + ChatColor.RESET + (int)(_gunStats.getArmorPen()*100) + "%",
C.cYellow + C.Bold + "Damage Dropoff: " + ChatColor.RESET + (int)(_gunStats.getDropoff()*1000d) + "% per 10 Blocks",
C.cYellow + C.Bold + "Recoil per Shot: " + ChatColor.RESET + _gunStats.getConeIncreaseRate(),
C.cYellow + C.Bold + "Recoil per Shot: " + ChatColor.RESET + UtilMath.trim(2, _gunStats.getConeIncreaseRate()),
C.cYellow + C.Bold + "Recoil Recovery: " + ChatColor.RESET + _gunStats.getConeReduceRate() + " per Second",
};
}

View File

@ -65,7 +65,7 @@ public class SoloSuperSmash extends SuperSmash
{
super(manager, kits, type, new String[]
{
"Each player has 3 respawns",
"Each player has 4 respawns",
"Attack to restore hunger!",
"Last player alive wins!"
});

View File

@ -1986,7 +1986,7 @@ public abstract class SurvivalGames extends Game
@EventHandler
public void craftedItems(CraftItemEvent event)
{
if (UtilItem.isWeapon(event.getCurrentItem()) || UtilItem.isArmor(event.getCurrentItem()))
if (UtilItem.isWeapon(event.getCurrentItem()) || UtilItem.isArmor(event.getCurrentItem()) || event.getCurrentItem().getType() == Material.FISHING_ROD)
{
UtilItem.makeUnbreakable(event.getCurrentItem());
}

View File

@ -380,7 +380,7 @@ public class TurfForts extends TeamGame
while (block.getTypeId() == 0 && block.getY() > 0)
block = block.getRelative(BlockFace.DOWN);
if (block.getData() != team.GetColorData())
if ((block.getType() != Material.STAINED_CLAY && block.getType() != Material.WOOL) || block.getData() != team.GetColorData())
{
UtilPlayer.message(event.getPlayer(), F.main("Game", "You can only build above " + F.elem(team.GetColor() + team.GetName()) + "."));
event.setCancelled(true);

View File

@ -1,6 +1,7 @@
package nautilus.game.arcade.gui.privateServer.page;
import java.util.ArrayList;
import java.util.List;
import mineplex.core.common.util.C;
import mineplex.core.game.GameCategory;
@ -89,16 +90,24 @@ public class SetGamePage extends BasePage
private void addGameButton(int slot, final GameType type)
{
String infoString = ChatColor.RESET + C.cGray + "Make this next Game Type";
String space = "§1";
String left = ChatColor.YELLOW + "Left-Click " + C.cGray + "for a §fRandom Map§7.";
String right = ChatColor.YELLOW + "Right-Click " + C.cGray + "to §fChoose Map§7.";
String[] normLore = new String[]{infoString, space, left, right};
List<String> lore = new ArrayList<>();
lore.add(ChatColor.RESET + C.cGray + "Make this next Game Type");
lore.add("§1");
if (type == GameType.UHC || type == GameType.UHCSolo || type == GameType.UHCSoloSpeed || type == GameType.UHCTeamsSpeed)
{
lore.add(ChatColor.YELLOW + "Left-Click " + C.cGray + "to select");
}
else
{
lore.add(ChatColor.YELLOW + "Left-Click " + C.cGray + "for a §fRandom Map§7.");
lore.add(ChatColor.YELLOW + "Right-Click " + C.cGray + "to §fChoose Map§7.");
}
if (_manager.hasWarning().contains(type))
{
normLore = new String[]{infoString, space, left, right, "§2", "§c§lWARNING: §fThis game was rejected!"};
lore.add("§2");
lore.add("§c§lWARNING: §fThis game was rejected!");
}
ShopItem shopItem = new ShopItem(type.GetMaterial(), type.GetMaterialData(), type.GetName(), normLore, 1, false, false);
ShopItem shopItem = new ShopItem(type.GetMaterial(), type.GetMaterialData(), type.GetName(), lore.toArray(new String[lore.size()]), 1, false, false);
addButton(slot, shopItem, new IButton()
{
@Override

View File

@ -117,7 +117,7 @@ public class GameHostManager implements Listener
legendGames.add(GameType.WitherAssault);
legendGames.add(GameType.Wizards);
legendGames.add(GameType.Build);
//legendGames.add(GameType.UHC);
legendGames.add(GameType.UHC);
legendGames.add(GameType.MineStrike);
legendGames.add(GameType.Skywars);
legendGames.add(GameType.SpeedBuilders);
@ -561,16 +561,23 @@ public class GameHostManager implements Listener
@EventHandler
public void whitelistCommand(PlayerCommandPreprocessEvent event)
{
if (_host == null || !event.getPlayer().equals(_host))
if (_host == null)
return;
if (isCommunityServer())
return;
if (!event.getMessage().toLowerCase().startsWith("/whitelist"))
return;
if (!isPrivateServer())
if (!event.getPlayer().equals(_host))
{
event.setCancelled(true);
UtilPlayer.message(event.getPlayer(), F.main("MPS", "You do not have permission to whitelist players. Ask the MPS host"));
return;
}
if (isCommunityServer() || !isPrivateServer())
{
event.setCancelled(true);
return;
}
event.setCancelled(true);

View File

@ -409,6 +409,9 @@ public class NextBestGameManager implements Listener
private void handle(Player player)
{
if (getGame().IsAlive(player))
return;
Party party = _partyManager.getPartyByPlayer(player);
if (party != null)

View File

@ -111,8 +111,7 @@ public class GameChatManager implements Listener
}
else
{
if (rank != Rank.ALL)
rankStr = rank.getTag(true, true) + " " + C.Reset;
rankStr = rank.getTag(true, true) + " " + C.Reset;
}
//Party Chat