Merge branch 'develop' of github.com:Mineplex-LLC/Minecraft-PC into update/skyfall

# Conflicts:
#	Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/Island.java
This commit is contained in:
Sarah 2017-04-05 04:21:14 +02:00
commit e4b79a3731
186 changed files with 5063 additions and 612 deletions

View File

@ -16,6 +16,7 @@ import java.util.logging.Logger;
import mineplex.bungee.api.ApiDeleteCall;
import mineplex.bungee.api.ApiGetCall;
import mineplex.bungee.api.ApiPostCall;
import mineplex.bungee.api.HttpCallBase;
import mineplex.bungee.api.token.ARecord;
import mineplex.bungee.api.token.DnsRecord;
import mineplex.bungee.api.token.DomainRecords;
@ -24,8 +25,8 @@ import mineplex.serverdata.data.BungeeServer;
import mineplex.serverdata.data.DataRepository;
import mineplex.serverdata.redis.RedisDataRepository;
import mineplex.serverdata.servers.ConnectionData;
import mineplex.serverdata.servers.ConnectionData.ConnectionType;
import mineplex.serverdata.servers.ServerManager;
import mineplex.serverdata.servers.ConnectionData.ConnectionType;
public class BungeeRotator
{
@ -96,8 +97,7 @@ public class BungeeRotator
_repository = new RedisDataRepository<BungeeServer>(ServerManager.getConnection(true, ServerManager.SERVER_STATUS_LABEL), ServerManager.getConnection(false, ServerManager.SERVER_STATUS_LABEL),
Region.ALL, BungeeServer.class, "bungeeServers");
// Temporarily reassigning to US Redis IP for EU player redirection testing. 10.81.1.156 -> 10.33.53.16
_secondRepository = new RedisDataRepository<BungeeServer>(new ConnectionData("10.33.53.16", 6379, ConnectionType.MASTER, "ServerStatus"), new ConnectionData("10.33.53.16", 6377, ConnectionType.SLAVE, "ServerStatus"),
_secondRepository = new RedisDataRepository<BungeeServer>(new ConnectionData("10.81.1.156", 6379, ConnectionType.MASTER, "ServerStatus"), new ConnectionData("10.81.1.156", 6377, ConnectionType.SLAVE, "ServerStatus"),
Region.ALL, BungeeServer.class, "bungeeServers");
//_ipRepository = new PlayerStatsRepository();
@ -110,7 +110,7 @@ public class BungeeRotator
try
{
List<BungeeServer> bungeeServers = new ArrayList<BungeeServer>(_repository.getElements());
//bungeeServers.addAll(_secondRepository.getElements());
bungeeServers.addAll(_secondRepository.getElements());
Collections.sort(bungeeServers, bungeeSorter);

View File

@ -1,6 +1,7 @@
package mineplex.cache.player;
import java.util.UUID;
import java.util.concurrent.TimeUnit;
import mineplex.serverdata.Region;
import mineplex.serverdata.redis.RedisDataRepository;
@ -32,7 +33,8 @@ public enum PlayerCache
ServerManager.getMasterConnection(),
ServerManager.getSlaveConnection(),
Region.ALL,
"accountid"
"accountid",
(int) TimeUnit.HOURS.toSeconds(6)
);
}

View File

@ -10,58 +10,61 @@ import mineplex.core.common.util.UtilPlayer;
public enum Rank
{
//Staff
LT("Leader", "lt", ChatColor.DARK_RED, "Leaders manage the operation of their respective team \nor projects. They usually operate on affairs within \nthe staff, development, or management team."),
OWNER("Owner", "owner", ChatColor.DARK_RED, "Owners are the founders of Mineplex. \nEach owner manages a different aspect of the \nserver and ensures its efficient operation."),
DEVELOPER("Dev", "dev", ChatColor.DARK_RED, "Developers work behind the scenes to \ncreate new games and features, and fix bugs to \ngive the best experience."),
ADMIN("Admin", "adm", ChatColor.DARK_RED, "An Administrators role is to manage \ntheir respective Senior Moderator team \nand all moderators within it."),
JNR_DEV("Jr.Dev", "jrdev", ChatColor.GOLD, "Junior Developers work behind the scenes to \ncreate new games and features, and fix bugs to \ngive the best experience."),
SUPPORT("Support", "spp", ChatColor.BLUE, "Support agents handle tickets and \nprovide customer service."),
CMOD("C.Mod", "cmod", ChatColor.GOLD, "Clans Moderators are members of the Clans Management Senior Mod team. \nTheir duties include moderation and support within the Clans servers. \n\nFor assistance, contact them using " + F.elem("/a <message>") + "."),
SNR_MODERATOR("Sr.Mod", "srmod", ChatColor.GOLD, "Senior Moderators are members of a special \nSenior Moderator team where they have to fulfill specific tasks. \nJust like Moderators, you can always ask them for help. \n\nFor assistance, contact them using " + F.elem("/a <message>") + "."),
MODERATOR("Mod", "mod", ChatColor.GOLD, "Moderators enforce rules and provide help to \nanyone with questions or concerns. \n\nFor assistance, contact them using " + F.elem("/a <message>") + "."),
HELPER("Trainee", "train", ChatColor.GOLD, "Trainees are moderators-in-training. \nTheir duties include enforcing the rules and \nproviding help to anyone with questions or concerns. \n\nFor assistance, contact them using " + F.elem("/a <message>") + "."),
MAPLEAD("MapLead", "mapl", ChatColor.BLUE, "Map Leaders are leaders of the Mineplex Build Team. \nThey oversee the creation of new maps and manage Builders."),
MAPDEV("Builder", "mapd", ChatColor.BLUE, "Builders are members of the Mineplex Build Team. \nThey create many of the maps used across Mineplex."),
MEDIA("Media", "media", ChatColor.BLUE, "The Media rank is given to talented artists who are\n endorsed to create content for Mineplex."),
LT("Leader", "lt", ChatColor.DARK_RED, "Leaders manage the operation of their respective team \nor projects. They usually operate on affairs within \nthe staff, development, or management team.", 11),
OWNER("Owner", "owner", ChatColor.DARK_RED, "Owners are the founders of Mineplex. \nEach owner manages a different aspect of the \nserver and ensures its efficient operation.", 55),
DEVELOPER("Dev", "dev", ChatColor.DARK_RED, "Developers work behind the scenes to \ncreate new games and features, and fix bugs to \ngive the best experience.", 5),
ADMIN("Admin", "adm", ChatColor.DARK_RED, "An Administrators role is to manage \ntheir respective Senior Moderator team \nand all moderators within it.", 10),
JNR_DEV("Jr.Dev", "jrdev", ChatColor.GOLD, "Junior Developers work behind the scenes to \ncreate new games and features, and fix bugs to \ngive the best experience.", -1),
SUPPORT("Support", "spp", ChatColor.BLUE, "Support agents handle tickets and \nprovide customer service.", 47),
CMOD("C.Mod", "cmod", ChatColor.GOLD, "Clans Moderators are members of the Clans Management Senior Mod team. \nTheir duties include moderation and support within the Clans servers. \n\nFor assistance, contact them using " + F.elem("/a <message>") + ".", 32),
SNR_MODERATOR("Sr.Mod", "srmod", ChatColor.GOLD, "Senior Moderators are members of a special \nSenior Moderator team where they have to fulfill specific tasks. \nJust like Moderators, you can always ask them for help. \n\nFor assistance, contact them using " + F.elem("/a <message>") + ".", 44),
MODERATOR("Mod", "mod", ChatColor.GOLD, "Moderators enforce rules and provide help to \nanyone with questions or concerns. \n\nFor assistance, contact them using " + F.elem("/a <message>") + ".", 32),
HELPER("Trainee", "train", ChatColor.GOLD, "Trainees are moderators-in-training. \nTheir duties include enforcing the rules and \nproviding help to anyone with questions or concerns. \n\nFor assistance, contact them using " + F.elem("/a <message>") + ".", 24),
MAPLEAD("MapLead", "mapl", ChatColor.BLUE, "Map Leaders are leaders of the Mineplex Build Team. \nThey oversee the creation of new maps and manage Builders.", 25),
MAPDEV("Builder", "mapd", ChatColor.BLUE, "Builders are members of the Mineplex Build Team. \nThey create many of the maps used across Mineplex.", 26),
MEDIA("Media", "media", ChatColor.BLUE, "The Media rank is given to talented artists who are\n endorsed to create content for Mineplex.", -1),
EVENT("Event", "evnt", ChatColor.WHITE, "A member of the official Mineplex Events team!"),
EVENT("Event", "evnt", ChatColor.WHITE, "A member of the official Mineplex Events team!", -1),
//Media
YOUTUBE("YouTube", "yt", ChatColor.RED, "A YouTuber who creates content for \nor related to Mineplex."),
YOUTUBE_SMALL("YT", "ytsm", ChatColor.DARK_PURPLE, "A YouTuber who creates content for \nor related to Mineplex. \n\nThey have fewer subscribers than full YouTubers."),
TWITCH("Twitch", "tw", ChatColor.DARK_PURPLE, "A Twitch streamer who often features \nMineplex in their streams."),
YOUTUBE("YouTube", "yt", ChatColor.RED, "A YouTuber who creates content for \nor related to Mineplex.", 22),
YOUTUBE_SMALL("YT", "ytsm", ChatColor.DARK_PURPLE, "A YouTuber who creates content for \nor related to Mineplex. \n\nThey have fewer subscribers than full YouTubers.", 20),
TWITCH("Twitch", "tw", ChatColor.DARK_PURPLE, "A Twitch streamer who often features \nMineplex in their streams.", 21),
//Player
ETERNAL("Eternal", "et", ChatColor.DARK_AQUA, true, "Fantastic and magical, no one \nexcept the time lords truly understand \nthe power of this rank.\n\nThe fifth purchasable rank at Mineplex.com/shop"),
TITAN("Titan", "t", ChatColor.RED, true, "Ancient myths spoke of a gigantic being \nwith immense power... \n\nThe fourth purchasable rank at Mineplex.com/shop"),
LEGEND("Legend", "l", ChatColor.GREEN, true, "Years they have told stories of this rank, \nonly for the legends to be true. \n\nThe third purchasable rank at Mineplex.com/shop"),
HERO("Hero", "h", ChatColor.LIGHT_PURPLE, true, "There are many stories of a \nvaliant Hero who was brave enough to \ntame the most fearsome dragon in the land. \n\nThe second purchasable rank at Mineplex.com/shop"),
ULTRA("Ultra", "u", ChatColor.AQUA, true, "A first step into the stories of the mist. \nOnly those brave enough may enter. \n\nThe first purchasable rank at Mineplex.com/shop"),
ALL("", "", ChatColor.WHITE, null);
ETERNAL("Eternal", "et", ChatColor.DARK_AQUA, true, "Fantastic and magical, no one \nexcept the time lords truly understand \nthe power of this rank.\n\nThe fifth purchasable rank at Mineplex.com/shop", 18),
TITAN("Titan", "t", ChatColor.RED, true, "Ancient myths spoke of a gigantic being \nwith immense power... \n\nThe fourth purchasable rank at Mineplex.com/shop", 15),
LEGEND("Legend", "l", ChatColor.GREEN, true, "Years they have told stories of this rank, \nonly for the legends to be true. \n\nThe third purchasable rank at Mineplex.com/shop", 14),
HERO("Hero", "h", ChatColor.LIGHT_PURPLE, true, "There are many stories of a \nvaliant Hero who was brave enough to \ntame the most fearsome dragon in the land. \n\nThe second purchasable rank at Mineplex.com/shop", 13),
ULTRA("Ultra", "u", ChatColor.AQUA, true, "A first step into the stories of the mist. \nOnly those brave enough may enter. \n\nThe first purchasable rank at Mineplex.com/shop", 12),
ALL("", "", ChatColor.WHITE, null, -1);
private ChatColor _color;
private boolean _donor;
private String _description;
private int _forumId;
public String Name;
public String ScoreboardTag;
Rank(String name, String scoreboardTag, ChatColor color, String description)
Rank(String name, String scoreboardTag, ChatColor color, String description, int forumId)
{
_color = color;
Name = name;
_donor = false;
_description = description;
ScoreboardTag = scoreboardTag;
_forumId = forumId;
}
Rank(String name, String scoreboardTag, ChatColor color, boolean donor, String description)
Rank(String name, String scoreboardTag, ChatColor color, boolean donor, String description, int forumId)
{
_color = color;
Name = name;
_donor = donor;
_description = description;
ScoreboardTag = scoreboardTag;
_forumId = forumId;
}
public String getDescription()
@ -69,6 +72,11 @@ public enum Rank
return _description;
}
public void setName(String name)
{
Name = name;
}
public String getRawTag()
{
if (Name.equalsIgnoreCase("ALL"))
@ -138,4 +146,9 @@ public enum Rank
{
return _donor;
}
public int getForumId()
{
return _forumId;
}
}

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",
@ -111,6 +128,30 @@ public class ShapeWings extends ShapeGrid implements CosmeticShape
"000000$000000"
};
public static final String[] FOUR_LEAF_CLOVER = new String[]
{
"$$$$$$$$###$$$$$$$",
"$$$$$$##***#$$$$$$",
"$$$$##****%#$$$$$$",
"$$$#******%#$###$$",
"$$$#***%#%%##***#$",
"$$$$#**%#%#*****#$",
"$$$####*%%#*%%**#$",
"$##***#*%#**##**##",
"#***%%*###******%#",
"#**%##*%###%%%%%%#",
"#**#**%%#**######$",
"$#****%#*****#$$$$",
"$$#*%%%#******#$$$",
"$$#####**%#****#$$",
"$$$$$##**%#***%#$$",
"$$$$$###****%%%#$$",
"$$$$##$#%%%%%##$$$",
"$$$##$$$#####$$$$$",
"$###$$$$$$$$$$$$$$",
"$##$$$$$$$$$$$$$$$"
};
/**
* Default rotation to give the wings a little tilt when displayed on players for instance

View File

@ -64,6 +64,7 @@ public class SkinData
public final static SkinData TURKEY = new SkinData("eyJ0aW1lc3RhbXAiOjE0NzU3NzM2MTc5MDQsInByb2ZpbGVJZCI6IjlmY2FlZDhiMTRiNTRmN2ZhNjRjYjYwNDBlNzA1MjcyIiwicHJvZmlsZU5hbWUiOiJMQ2FzdHIxIiwic2lnbmF0dXJlUmVxdWlyZWQiOnRydWUsInRleHR1cmVzIjp7IlNLSU4iOnsidXJsIjoiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS8xYzdmYjczMTRkNmY1ZTMzNmVjN2ViNTI1ZGM0ODMzOWNhMjI4ZDk3ODU1MDM3ZDZhNDIwOGZjNzYwNDc1NiJ9fX0=", "eZWi1LOD8ke7MCUAfhspBCnyfCoGM8suFLKtbW6b27CURoRBG3eKIfwLYYeMp3ObjoZ8gCB90s28Qyw5XMzwvvowy9W/b5cYC0OzQ8+GR7tDZoWc28tGqGBM8cmDJIFQgZdceBIIr2lXeAvEJfLbyrus46hPjk8YTiQW2DsBq88BhKIy6Igb1rGqJ1goVERF07b6+/yMdLKCaT8OZFzKLXfo5rY5gr6HLnvsQiNL9aTrl74agXn1GUcP+QVNe7/c9lYmv5vLCBst1YiIPq27NZASZ++Fwyv6+PRlaFZZYtMHVd4UZeYPl7ak1Cdi/1sUcRpkBbJM8AHIrqq0iuXxrLbc6ldQ2cYQKHg9ljIpW/EZanuf6Wgm/LK1JnxXne9GUb/xPzB1EnZ95i8/u9WJa+NixEcfc3pAzDPYncIR8lishFwyBRta6BCG76U3UY2lQr3YD/48AJ49r7+WVU0gOP/h2SDSdAZHEdvkpVJ0w/xA+SevJ7Y7xA5EJ655YMQ0F8f3WUFTf1pFklE5E+fwkMVCWOPw7UMy558IcRSpdWAPPyf8sc7CpDqRk37/vXWRDa+7YBfgskK6B2eXowrzThUOBx+AmDTF3Rv8ZSr1Un0FWGi+GQ5ny7W9dJBMomzyMUbzz9stsCml5XB+6xLP2MD+9lO1bHipKS6qkhtZChE=");
public final static SkinData GINGERBREAD = new SkinData("eyJ0aW1lc3RhbXAiOjE0ODAxOTk5MjM0NTUsInByb2ZpbGVJZCI6IjRjOGQ1NjllZWZlMTRkOGE4YzJmMmM4ODA3ODA3ODRmIiwicHJvZmlsZU5hbWUiOiJHaW5nZXJicmVhZE1hbiIsInNpZ25hdHVyZVJlcXVpcmVkIjp0cnVlLCJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvMzAyM2IxZGQ5MWQyYjM2Y2FkZTU2NjVjM2Y3ODk3ZmNiOGRlMWFlNjE5YTRlOTYxODU2MzdiMTliZGNmZjQ3In19fQ==", "lND5lQCzd5DKdn+ps82zn55hrSDr12bBLFoSbxetOj7MaYAuHCkJPQQOXdcMh3TLLSgxmQzEWkIHSUo760/2Qfd2uDDOTVfZZqiFjiOwDQ7YQjkokqNaC3U9gEq+LBJ+IgEkwaCsluXYMIK0Wvqx1DFa82pg8bSYGczJfTw/1kQsUUTpmao6ChZw3yrHTPow38onD95f9i6yVcnhSpPfM/JTQuL4N6Jdcql6VRJNSvCHJvEgh6R2p0w7DJhEGIzkFaF3lPdBqw+Mm97fBPvznscd4s6gpH07gUl/T+vlyHyRBLm85Pgm70r4MQ+c/nGOQOXzFMNpO8RIot/uhd7t3bvSi6yFzZQm7P9QLCLm/0C84x0sCugjeN/hVA347FWnuRPcya5xPzlpTWAW7pCjheAz0mvnPUMYT6Wp4CJx6bPdePnaiLFSeK8EyQIU9IUQJgXqMA3cOwqMBdh/0r71fTInPdgXsVxabmGbCgIuK3A2hSgxpcZv9412T0NIJYSTi0s2B3dyAaZJrdF5wa1hIr8au63SWFJww3GEEOF5YObEyVvKj2yS40iaHaRrfn1DeALT0eD0oN1zzK66FKbFuDmZmm4Thel9gKt+QcnR2uHlFLEBUogpIXyeC8zca7SOppANloOpO4mBbf22dXBJogenVd425JWaXOHJ6NVqIBw=");
public final static SkinData LOVE_DOCTOR = new SkinData("eyJ0aW1lc3RhbXAiOjE0ODQ0MzM1MjQxMjAsInByb2ZpbGVJZCI6IjlmY2FlZDhiMTRiNTRmN2ZhNjRjYjYwNDBlNzA1MjcyIiwicHJvZmlsZU5hbWUiOiJMQ2FzdHIxIiwic2lnbmF0dXJlUmVxdWlyZWQiOnRydWUsInRleHR1cmVzIjp7IlNLSU4iOnsidXJsIjoiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS9iY2RiZTM2OTM1NGZjMzUxY2RhNGRmY2Y2OWM0MzY3ODcwYjI4ZWE3NDUzYWVjM2IzMjgyM2YyMWMzNTJlNTUifX19", "KD0NsKFlS+9/JpPQdT0Lq2jo942WeHpFevJPR3T9JO/5NVmNprupsWuTgepw14iHoax8/xyP8S4XksYq8hJ30e+gRKXVReqtq4l8JetXJILI7JTL6EHj/Flg4t0O6ASIm3Hr+w86IKrPb0NwHTjHJHvbf0r7k3E/TMLbq0/c7Xgi+JgC0uQd+wIPZhQe92P3O7eGH858X0vsxG0FVzgnEAlHVLmqBCwqxMU5CsBp0JCTVIbtp+JNmveCsfLagP6mi39rUudbueXJQgqLv7H7Zw+ZNINLLaKPNVO6Od8sX3c+CSUQ+Bm9bakYr628k/z0krTdNpLG7OGXWoT3XShW6HXB/z7o7hpuDXJW7HdyvmWv9GVyWLm2USNe7/3Ugs2zWZI1f+t6t+V3EVr3T+nR4zpY/ISdlTsLtV/Daebr0v/V0YlaM0UaASzz16ob3p1cfao7C7BZwKqOBKoSyHpnuLhd70wOtNrhhPDU9dWQBC/l6uojcMJ9lQMsxFmHj4JFqJYl7p/UXnq1vnYBo1P3A//IGl4gL1Hv8U0I14LT77/AMYH57mItgD0/VnE4bvPIFML/4cX7L9qpdLoOAAyfa5P9cAfzhUnVnRRLM016MpGtvY8SfbZ68Of1Xjz/dZ9/fBEcObXPHGX2QNuJRFiWJjRVKjO7ok0qfiVUEmuZr6I=");
public final static SkinData LEPRECHAUN = new SkinData("eyJ0aW1lc3RhbXAiOjE0ODc4NzI5Mjg1ODIsInByb2ZpbGVJZCI6IjlmY2FlZDhiMTRiNTRmN2ZhNjRjYjYwNDBlNzA1MjcyIiwicHJvZmlsZU5hbWUiOiJMQ2FzdHIxIiwic2lnbmF0dXJlUmVxdWlyZWQiOnRydWUsInRleHR1cmVzIjp7IlNLSU4iOnsidXJsIjoiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS80ZTBkZjZhZGNiNzkzMzM5ZjFhOGNkM2E0ZGQ2ZThjNGQ2ZWFjYmU5NWMzZDA5OTI4NDMyMWFiZGI5MTgwOSJ9fX0=", "cyIYHTdzvVBOyYoiJZTvNS8Et5pzqBNxuz6GQspE2lBkW2Bj82JNv5oczsf3oxYAG4zxdb96G8+7UKBmoJdvx0x6UD7Dk0dnKrwpXfOhe+jRxtwMGMsdYCb8URWaoIoeKpxdCmAtjgV6FI8zDy2Yzi+MF4O9e4VqH0tMBoD2/CZScQwNEzc4YXf2M2fglKn9uK2+xrgLV+XS+SNdIn7BRiNlQf96u6N2G0lO+eb09LbIfIgAgfnyLiARccWa+VNo6gwlCFyRMnwOlgqxL5XA5Um4kkx2ZReRRCDFQ4NV5eLBktLd5wpECyOuY7v7S3zLqwbhwG47gS8hnXqmtHG5RW0RUQZEryg638Cw7hwr2k09iStfok8WeZUIJ+fuUWgdArvbtN36a2pCXyFdqzp+E8xzSF4E9SQv0K+1lNj+w4L58dh8pddeKK8m5bpjINj4xZ6nf7reWYQAX/imVNYTXTW8JqYnF+++xViBwmfeeM3PmEg+wyTduh+M25nyhGcqn5l+UyQ9aMzzdNs2aEdx12fOm1sOFXjHrHWeo6ciEm7sY1SDjiJ99VVXuGHCJWBtxq/B+c+vC/Cj8itEYOetwe5NKrgI99pZjG+KiRr4L0n8/NA3Px7SbKUUpHse80pNMjGfFW4pAOyFXJaKHrObWT2iL2AnTe+yfdY4sf/JZT4=");
// Comments this out for now, so it doesn't load the player profile
// A better way to do this would check for the properties when getting the skull or the skin

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);
}
EntityInsentient creature = (EntityInsentient)((CraftEntity)entity).getHandle();
creature.goalSelector = new PathfinderGoalSelector(((CraftWorld)entity.getWorld()).getHandle().methodProfiler);
}
}
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)
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

@ -208,11 +208,6 @@ public class UtilServer
}
}
public static String getWebServerURL()
{
return getPlugin().getConfig().getString(Constants.WEB_CONFIG_KEY);
}
public static BukkitTask runAsync(Runnable runnable)
{
return getPlugin().getServer().getScheduler().runTaskAsynchronously(getPlugin(), runnable);

View File

@ -36,6 +36,7 @@ import mineplex.core.account.command.TestRank;
import mineplex.core.account.command.UpdateRank;
import mineplex.core.account.event.ClientUnloadEvent;
import mineplex.core.account.event.ClientWebResponseEvent;
import mineplex.core.account.event.RankSaveEvent;
import mineplex.core.account.repository.AccountRepository;
import mineplex.core.account.repository.token.ClientToken;
import mineplex.core.common.Rank;
@ -43,6 +44,7 @@ import mineplex.core.common.timing.TimingManager;
import mineplex.core.common.util.Callback;
import mineplex.core.common.util.UUIDFetcher;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTasks;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
@ -552,6 +554,7 @@ public class CoreClientManager extends MiniPlugin
client.SetRank(newRank, false);
}
UtilServer.CallEvent(new RankSaveEvent(uuid, newRank));
}
}, name, uuid, rank, perm);
}
@ -571,6 +574,8 @@ public class CoreClientManager extends MiniPlugin
if (callback != null)
callback.run(newRank);
UtilServer.CallEvent(new RankSaveEvent(uuid, newRank));
}
}, name, uuid, rank, perm);
}

View File

@ -0,0 +1,42 @@
package mineplex.core.account.event;
import java.util.UUID;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
import mineplex.core.common.Rank;
public class RankSaveEvent extends Event
{
private static final HandlerList handlers = new HandlerList();
private UUID _uuid;
private Rank _rank;
public RankSaveEvent(UUID uuid, Rank rank)
{
_uuid = uuid;
_rank = rank;
}
public UUID getUUID()
{
return _uuid;
}
public Rank getRank()
{
return _rank;
}
public HandlerList getHandlers()
{
return handlers;
}
public static HandlerList getHandlerList()
{
return handlers;
}
}

View File

@ -16,6 +16,7 @@ import com.google.gson.reflect.TypeToken;
import mineplex.cache.player.PlayerCache;
import mineplex.core.account.ILoginProcessor;
import mineplex.core.account.event.RankSaveEvent;
import mineplex.core.account.repository.token.LoginToken;
import mineplex.core.account.repository.token.RankUpdateToken;
import mineplex.core.common.Rank;
@ -204,6 +205,8 @@ public class AccountRepository extends MinecraftRepository
{
if (callback != null)
callback.run(response);
UtilServer.CallEvent(new RankSaveEvent(uuid, rank));
});
};

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 = false;
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;
private boolean _enabledTitle;
protected AprilFoolsManager(JavaPlugin plugin, CoreClientManager clientManager, DisguiseManager disguiseManager)
public AprilFoolsManager()
{
super("April Fools", plugin);
super("April Fools");
_disguiseManager = disguiseManager;
_clientManager = clientManager;
_instance = this;
_repository = new AprilFoolsRepository();
_twoFA = require(TwoFactorAuth.class);
setEnabled(true);
_enabledTitle = UtilServer.isHubServer() || UtilServer.isTestServer();
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
public void updateEnabled(UpdateEvent event)
{
if (event.getType() != UpdateType.SLOW)
return;
Calendar c = Calendar.getInstance();
_enabled = (c.get(Calendar.MONTH) == Calendar.APRIL && c.get(Calendar.DAY_OF_MONTH) == 1);
}
@EventHandler(priority = EventPriority.LOW)
public void chatAdd(AsyncPlayerChatEvent event)
{
if (!_enabled)
return;
String[] words = event.getMessage().split(" ");
String out = "";
for (String word : words)
if (_enabled)
{
//Prefix
if (Math.random() > 0.85)
for (Map.Entry<Rank, String> entry : RANK_REPLACEMENTS.entrySet())
{
out += "moo";
for (int i=0 ; i<UtilMath.r(2) ; i++)
out += "o";
out += " " + word + " ";
entry.getKey().setName(entry.getValue());
}
}
}
//Suffix
else if (Math.random() > 0.85)
@Override
public void addCommands()
{
addCommand(new PirateSongCommand(this));
}
@EventHandler(priority = EventPriority.LOWEST)
public void chat(AsyncPlayerChatEvent event)
{
if (!_enabled || _twoFA.isAuthenticating(event.getPlayer()))
{
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 += word + " ";
String pirateWord = CHAT_REPLACEMENTS.get(wordLower);
char[] chars = pirateWord.toCharArray();
out += "moo";
if (Character.isUpperCase(word.charAt(0)))
{
chars[0] = Character.toUpperCase(chars[0]);
}
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 += " ";
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"));
@ -260,7 +262,7 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
}
else
{
if(carlLocation != null)
if (carlLocation != null)
{
_carlNpc.setLocation(carlLocation);
}
@ -405,14 +407,14 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
if (event.getType() != UpdateType.TICK)
return;
_animation.itemClean();
if (_canVote)
return;
if (!_enabled)
return;
_animation.itemClean();
if (!_animationRunning)
return;

View File

@ -48,13 +48,13 @@ public class AnimationCarl extends Animation
for (int i = 50; i < 60; i++)
{
Item gem = _creeper.getWorld().dropItem(_creeper.getLocation().add(0.5, 1.5, 0.5), ItemStackFactory.Instance.CreateStack(Material.EMERALD, (byte) 0, 1, " " + i));
Item coin = _creeper.getWorld().dropItem(_creeper.getLocation().add(0.5, 1.5, 0.5), ItemStackFactory.Instance.CreateStack(Material.DOUBLE_PLANT, (byte) 0, 1, " " + i));
Item shard = _creeper.getWorld().dropItem(_creeper.getLocation().add(0.5, 1.5, 0.5), ItemStackFactory.Instance.CreateStack(Material.PRISMARINE_SHARD, (byte) 0, 1, " " + i));
_items.add(gem);
_items.add(coin);
_items.add(shard);
Vector vel = new Vector(Math.sin(i * 9/5d), 0, Math.cos(i * 9/5d));
UtilAction.velocity(gem, vel, Math.abs(Math.sin(i * 12/3000d)), false, 0, 0.2 + Math.abs(Math.cos(i * 12/3000d))*0.6, 1, false);
UtilAction.velocity(coin, vel, Math.abs(Math.sin(UtilMath.r(i) * 30/3000d)), false, 0, 0.2 + Math.abs(Math.cos(UtilMath.r(i) * 30/3000d))*0.6, 1, false);
UtilAction.velocity(shard, vel, Math.abs(Math.sin(UtilMath.r(i) * 30/3000d)), false, 0, 0.2 + Math.abs(Math.cos(UtilMath.r(i) * 30/3000d))*0.6, 1, false);
}
}
@ -62,11 +62,11 @@ public class AnimationCarl extends Animation
{
for (int i = 50; i < 60; i++)
{
Item coin = _creeper.getWorld().dropItem(_creeper.getLocation().add(0.5, 1.5, 0.5), ItemStackFactory.Instance.CreateStack(Material.DOUBLE_PLANT, (byte) 0, 1, " " + i));
_items.add(coin);
Item shard = _creeper.getWorld().dropItem(_creeper.getLocation().add(0.5, 1.5, 0.5), ItemStackFactory.Instance.CreateStack(Material.PRISMARINE_SHARD, (byte) 0, 1, " " + i));
_items.add(shard);
Vector vel = new Vector(Math.sin(UtilMath.r(i) * 7/5d), 0, Math.cos(UtilMath.r(i) * 7/5d));
UtilAction.velocity(coin, vel, Math.abs(Math.sin(UtilMath.r(i) * 7/3000d)), false, 0, 0.2 + Math.abs(Math.cos(UtilMath.r(i) * 7/3000d))*0.6, 1, false);
UtilAction.velocity(shard, vel, Math.abs(Math.sin(UtilMath.r(i) * 7/3000d)), false, 0, 0.2 + Math.abs(Math.cos(UtilMath.r(i) * 7/3000d))*0.6, 1, false);
}
}

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

@ -135,12 +135,12 @@ public abstract class CommandBase<PluginType extends MiniPlugin> implements ICom
return matches;
}
protected List<String> tabCompletePlayerNames(CommandSender sender, String commandLabel, String[] args)
protected List<String> tabCompletePlayerNames(CommandSender sender, String[] args)
{
return tabCompletePlayerNames(sender, commandLabel, args, t -> true);
return tabCompletePlayerNames(sender, args, t -> true);
}
protected List<String> tabCompletePlayerNames(CommandSender sender, String commandLabel, String[] args, Predicate<Player> filter)
protected List<String> tabCompletePlayerNames(CommandSender sender, String[] args, Predicate<Player> filter)
{
if (sender instanceof Player)
{

View File

@ -1,23 +1,26 @@
package mineplex.core.cosmetic.ui.page;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.currency.GlobalCurrency;
import mineplex.core.common.util.C;
import mineplex.core.cosmetic.CosmeticManager;
import mineplex.core.cosmetic.ui.CosmeticShop;
import mineplex.core.donation.DonationManager;
import mineplex.core.gadget.gadgets.outfit.freezesuit.OutfitFreezeSuit;
import mineplex.core.gadget.gadgets.outfit.ravesuit.OutfitRaveSuit;
import mineplex.core.gadget.gadgets.outfit.spacesuit.OutfitSpaceSuit;
import mineplex.core.gadget.gadgets.outfit.stpatricks.OutfitStPatricksSuit;
import mineplex.core.gadget.types.Gadget;
import mineplex.core.gadget.types.GadgetType;
import mineplex.core.gadget.types.ItemGadget;
import mineplex.core.gadget.types.OutfitGadget;
import mineplex.core.shop.item.IButton;
import mineplex.core.shop.item.ShopItem;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
/**
* Created by shaun on 14-09-15.
@ -42,11 +45,13 @@ public class CostumePage extends GadgetPage
OutfitGadget outfitGadget = ((OutfitGadget) gadget);
int offset = 0;
int offset;
if (gadget instanceof OutfitRaveSuit) offset = 0;
else if (gadget instanceof OutfitSpaceSuit) offset = 1;
else offset = 2;
else if (gadget instanceof OutfitFreezeSuit) offset = 2;
else if (gadget instanceof OutfitStPatricksSuit) offset = 3;
else offset = 4;
slot = offset + 1 + 18; //1 buffer to left, 18 = 2 lines down

View File

@ -175,6 +175,11 @@ public class GadgetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
itemLore.add(C.cBlack);
itemLore.add(C.cBlue + "Found in Love Chests");
}
else if (gadget.getCost(GlobalCurrency.TREASURE_SHARD) == -18)
{
itemLore.add(C.cBlack);
itemLore.add(C.cBlue + "Found in St Patrick's Chests");
}
//Rank Unlocks
else if (gadget.getCost(GlobalCurrency.TREASURE_SHARD) == -10)

View File

@ -113,6 +113,11 @@ public class MountPage extends ShopPageBase<CosmeticManager, CosmeticShop>
itemLore.add(C.cBlack);
itemLore.add(C.cBlue + "Found in Thankful Treasure");
}
else if (mount.getCost(GlobalCurrency.TREASURE_SHARD) == -18)
{
itemLore.add(C.cBlack);
itemLore.add(C.cBlue + "Found in St Patrick's Chests");
}
else if (mount.getCost(GlobalCurrency.TREASURE_SHARD) == -14)
{
itemLore.add(C.cBlack);

View File

@ -22,6 +22,8 @@ import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.currency.GlobalCurrency;
@ -111,6 +113,11 @@ public class PetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
itemLore.add(C.cBlack);
itemLore.add(C.cBlue + "Found in Haunted Chests");
}
else if (pet.getPrice() == -18)
{
itemLore.add(C.cBlack);
itemLore.add(C.cBlue + "Found in St Patrick's Chests");
}
else if (pet.getPrice() == -14)
{
itemLore.add(C.cBlack);
@ -165,9 +172,13 @@ public class PetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
itemLore.add(C.cBlack);
itemLore.add(C.cGreen + "Click to Disable");
addButton(slot, new ShopItem(pet.getMaterial(), pet.getData(),
pet.getName() + " (" + C.cWhite + petName + C.cGreen + ")",
itemLore.toArray(new String[itemLore.size()]), 1, false, false), new DeactivatePetButton(this, getPlugin().getPetManager()));
ItemStack item = pet.getDisplayItem();
ItemMeta itemMeta = item.getItemMeta();
itemMeta.setDisplayName(C.cGreen + C.Bold + pet.getName() + C.cGreen + " (" + C.cWhite + petName + C.cGreen + ")");
itemMeta.setLore(itemLore);
item.setItemMeta(itemMeta);
addButton(slot, new ShopItem(item, false, false).hideInfo(), new DeactivatePetButton(this, getPlugin().getPetManager()));
addGlow(slot);
}
@ -175,29 +186,14 @@ public class PetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
{
itemLore.add(C.cBlack);
itemLore.add(C.cGreen + "Click to Enable");
/*
ItemStack petItem = ItemStackFactory.Instance.CreateStack(pet.getMaterial(), pet.getData(), 1,
pet.getName() + " (" + C.cWhite + petName + C.cGreen + ")", itemLore);
IButton iButton = new ActivatePetButton(pet, this);
ItemStack item = pet.getDisplayItem();
ItemMeta itemMeta = item.getItemMeta();
itemMeta.setDisplayName(C.cGreen + C.Bold + pet.getName() + C.cGreen + " (" + C.cWhite + petName + C.cGreen + ")");
itemMeta.setLore(itemLore);
item.setItemMeta(itemMeta);
if (pet.equals(PetType.SHULKER))
{
petItem = UtilItem.getVersionSpecificItem(_player, UtilPlayer.PlayerVersion._1_9, petItem);
if (petItem.getType().equals(Material.BARRIER))
{
iButton = null;
}
else
{
// Does not set the item stack yet
//petItem.setType(Material.getMaterial(201));
}
}*/
addButton(slot, new ShopItem(pet.getMaterial(), pet.getData(),
pet.getName() + " (" + C.cWhite + petName + C.cGreen + ")",
itemLore.toArray(new String[itemLore.size()]), 1, false, false), new ActivatePetButton(pet, this));
addButton(slot, new ShopItem(item, false, false).hideInfo(), new ActivatePetButton(pet, this));
//addButton(slot, new ShopItem(petItem, false, false), iButton);
}
}

View File

@ -7,6 +7,7 @@ import java.util.function.Consumer;
import org.bukkit.scheduler.BukkitTask;
import mineplex.core.common.Constants;
import mineplex.core.common.util.UtilServer;
import mineplex.core.server.remotecall.JsonWebCall;
import mineplex.core.thread.ThreadPool;
@ -17,7 +18,7 @@ import mineplex.serverdata.database.DatabaseRunnable;
@Deprecated
public class BasicMSSQLProvider implements MSSQLProvider
{
private final String _webAddress = UtilServer.getWebServerURL();
private final String _webAddress = Constants.WEB_ADDRESS;
// Queue for failed processes
private final Object QUEUE_LOCK = new Object();

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))
@ -462,99 +468,92 @@ public class PlayerDisguiseManager extends MiniPlugin implements IPacketHandler
if (!requestedUsername.equalsIgnoreCase(caller.getName()))
{
Rank otherRank = Rank.ALL;
CoreClient other = new CoreClient(requestedUsername, requestedProfile.getId());
try
getClientManager().getOrLoadClient(requestedUsername, other ->
{
getClientManager().LoadClient(other, requestedProfile.getId(), caller.getAddress().getAddress().getHostAddress());
otherRank = other.GetRank();
}
catch (NullPointerException exception)
{
other = null;
}
Rank otherRank = other != null ? other.GetRank() : Rank.ALL;
if (otherRank.has(Rank.TWITCH))
{
UtilPlayer.message(caller, F.main("Disguise", "You can't disguise as staff, YouTubers or Twitchers!"));
return;
}
if (other != null)
{
PunishClient pclient = getPunishManager().GetClient(requestedUsername);
if (pclient != null && (pclient.IsBanned() || pclient.IsMuted()))
if (otherRank.has(Rank.TWITCH))
{
UtilPlayer.message(caller, F.main("Disguise", "You can't disguise as players who are banned/muted!"));
UtilPlayer.message(caller, F.main("Disguise", "You can't disguise as staff, YouTubers or Twitchers!"));
return;
}
}
callerClient.disguise(requestedUsername, requestedProfile.getId(), otherRank);
_mapping.put(callerClient.getDisguisedAs().toLowerCase(), callerClient.getName());
System.out.println("=================");
System.out.println("Disguising " + caller.getName() + " as:");
System.out.println(requestedProfile.getName() + " id " + requestedProfile.getId());
System.out.println("Properties:");
for (Map.Entry<String, Property> p : requestedProfile.getProperties().entries())
{
System.out.println("\t" + p.getKey() + " " + p.getValue().getName());
System.out.println("\t" + p.getValue().getValue());
System.out.println("\t" + p.getValue().getSignature());
}
System.out.println("=================");
DisguisePlayer disguisePlayer = new DisguisePlayer(caller, requestedProfile);
disguisePlayer.showInTabList(true, 0);
allow(caller);
getDisguiseManager().disguise(disguisePlayer, () ->
{
GameProfile callerProfile = ((CraftPlayer) caller).getProfile();
require(ScoreboardManager.class).handlePlayerQuit(disguisePlayer.getOriginalProfile().getName());
try
if (other != null)
{
UtilGameProfile.changeName(callerProfile, disguisePlayer.getProfile().getName());
UtilGameProfile.changeId(callerProfile, disguisePlayer.getProfile().getId());
Field playersByName = PlayerList.class.getDeclaredField("playersByName");
playersByName.setAccessible(true);
Map map = (Map) playersByName.get(MinecraftServer.getServer().getPlayerList());
map.remove(disguisePlayer.getOriginalProfile().getName());
map.put(disguisePlayer.getProfile().getName(), disguisePlayer.getEntity());
}
catch (Throwable t)
{
t.printStackTrace();
PunishClient pclient = getPunishManager().GetClient(requestedUsername);
if (pclient != null && (pclient.IsBanned() || pclient.IsMuted()))
{
UtilPlayer.message(caller, F.main("Disguise", "You can't disguise as players who are banned/muted!"));
return;
}
}
require(ScoreboardManager.class).handlePlayerJoin(disguisePlayer.getName());
callerClient.disguise(requestedUsername, requestedProfile.getId(), otherRank);
callerProfile.getProperties().clear();
callerProfile.getProperties().putAll(disguisePlayer.getProfile().getProperties());
_mapping.put(callerClient.getDisguisedAs().toLowerCase(), callerClient.getName());
callerProfile.getProperties().removeAll(ORIGINAL_UUID_KEY);
callerProfile.getProperties().put(ORIGINAL_UUID_KEY, new Property(ORIGINAL_UUID_KEY, caller.getUniqueId().toString()));
System.out.println("=================");
System.out.println("Disguising " + caller.getName() + " as:");
System.out.println(requestedProfile.getName() + " id " + requestedProfile.getId());
System.out.println("Properties:");
for (Map.Entry<String, Property> p : requestedProfile.getProperties().entries())
{
System.out.println("\t" + p.getKey() + " " + p.getValue().getName());
System.out.println("\t" + p.getValue().getValue());
System.out.println("\t" + p.getValue().getSignature());
}
System.out.println("=================");
require(FriendManager.class).updatePlayerStatus(disguisePlayer.getOriginalProfile().getId(), null);
require(FriendManager.class).updatePlayerStatus(disguisePlayer.getProfile().getId(), new PlayerStatus(disguisePlayer.getProfile().getId(), requestedUsername, _serverName));
DisguisePlayer disguisePlayer = new DisguisePlayer(caller, requestedProfile);
disguisePlayer.showInTabList(true, 0);
allow(caller);
getDisguiseManager().disguise(disguisePlayer, () ->
{
GameProfile callerProfile = ((CraftPlayer) caller).getProfile();
getPreferencesManager().handlePlayerJoin(caller, true);
require(ScoreboardManager.class).handlePlayerQuit(disguisePlayer.getOriginalProfile().getName());
_disguises.put(caller.getUniqueId(), disguisePlayer);
try
{
UtilGameProfile.changeName(callerProfile, disguisePlayer.getProfile().getName());
UtilGameProfile.changeId(callerProfile, disguisePlayer.getProfile().getId());
UtilPlayer.message(caller, F.main("Disguise", "Disguise Active: " + ChatColor.RESET + requestedUsername));
Field playersByName = PlayerList.class.getDeclaredField("playersByName");
playersByName.setAccessible(true);
Map map = (Map) playersByName.get(MinecraftServer.getServer().getPlayerList());
map.remove(disguisePlayer.getOriginalProfile().getName());
map.put(disguisePlayer.getProfile().getName(), disguisePlayer.getEntity());
}
catch (Throwable t)
{
t.printStackTrace();
}
UtilServer.CallEvent(new PlayerDisguisedEvent(caller));
require(ScoreboardManager.class).handlePlayerJoin(disguisePlayer.getName());
storeDisguiseData(caller, requestedUsername, requestedProfile);
callerProfile.getProperties().clear();
callerProfile.getProperties().putAll(disguisePlayer.getProfile().getProperties());
_pendingDisguise.remove(requestedUsername.toLowerCase());
callerProfile.getProperties().removeAll(ORIGINAL_UUID_KEY);
callerProfile.getProperties().put(ORIGINAL_UUID_KEY, new Property(ORIGINAL_UUID_KEY, caller.getUniqueId().toString()));
_cannotJoin.remove(requestedUsername.toLowerCase());
require(FriendManager.class).updatePlayerStatus(disguisePlayer.getOriginalProfile().getId(), null);
require(FriendManager.class).updatePlayerStatus(disguisePlayer.getProfile().getId(), new PlayerStatus(disguisePlayer.getProfile().getId(), requestedUsername, _serverName));
getPreferencesManager().handlePlayerJoin(caller, true);
_disguises.put(caller.getUniqueId(), disguisePlayer);
UtilPlayer.message(caller, F.main("Disguise", "Disguise Active: " + ChatColor.RESET + requestedUsername));
UtilServer.CallEvent(new PlayerDisguisedEvent(caller));
storeDisguiseData(caller, requestedUsername, requestedProfile);
_pendingDisguise.remove(requestedUsername.toLowerCase());
_cannotJoin.remove(requestedUsername.toLowerCase());
});
});
}
else

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

@ -47,6 +47,6 @@ public class AddFriend extends CommandBase<FriendManager>
@Override
public List<String> onTabComplete(CommandSender sender, String commandLabel, String[] args)
{
return tabCompletePlayerNames(sender, commandLabel, args);
return tabCompletePlayerNames(sender, args);
}
}

View File

@ -2,8 +2,10 @@ package mineplex.core.gadget;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
import java.util.function.Predicate;
@ -28,7 +30,6 @@ import mineplex.core.account.CoreClientManager;
import mineplex.core.achievement.AchievementManager;
import mineplex.core.blockrestore.BlockRestore;
import mineplex.core.common.util.F;
import mineplex.core.common.util.NautHashMap;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer;
@ -153,6 +154,10 @@ import mineplex.core.gadget.gadgets.outfit.spacesuit.OutfitSpaceSuitBoots;
import mineplex.core.gadget.gadgets.outfit.spacesuit.OutfitSpaceSuitChestplate;
import mineplex.core.gadget.gadgets.outfit.spacesuit.OutfitSpaceSuitHelmet;
import mineplex.core.gadget.gadgets.outfit.spacesuit.OutfitSpaceSuitLeggings;
import mineplex.core.gadget.gadgets.outfit.stpatricks.OutfitStPatricksBoots;
import mineplex.core.gadget.gadgets.outfit.stpatricks.OutfitStPatricksChestplate;
import mineplex.core.gadget.gadgets.outfit.stpatricks.OutfitStPatricksHat;
import mineplex.core.gadget.gadgets.outfit.stpatricks.OutfitStPatricksLeggings;
import mineplex.core.gadget.gadgets.outfit.windupsuit.OutfitWindUpSuitBoosterManager;
import mineplex.core.gadget.gadgets.particle.ParticleChristmasTree;
import mineplex.core.gadget.gadgets.particle.ParticleCoalFumes;
@ -160,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;
@ -179,6 +185,7 @@ import mineplex.core.gadget.gadgets.particle.vampire.ParticleBlood;
import mineplex.core.gadget.gadgets.particle.wisdom.ParticleEnchant;
import mineplex.core.gadget.gadgets.taunts.BlowAKissTaunt;
import mineplex.core.gadget.gadgets.taunts.EternalTaunt;
import mineplex.core.gadget.gadgets.taunts.RainbowTaunt;
import mineplex.core.gadget.gadgets.wineffect.WinEffectBabyChicken;
import mineplex.core.gadget.gadgets.wineffect.WinEffectFlames;
import mineplex.core.gadget.gadgets.wineffect.WinEffectHalloween;
@ -206,6 +213,7 @@ import mineplex.core.gadget.set.SetWisdom;
import mineplex.core.gadget.set.suits.SetFreezeSuit;
import mineplex.core.gadget.set.suits.SetRaveSuit;
import mineplex.core.gadget.set.suits.SetSpaceSuit;
import mineplex.core.gadget.set.suits.SetStPatricksSuit;
import mineplex.core.gadget.types.ArrowEffectGadget;
import mineplex.core.gadget.types.BalloonGadget;
import mineplex.core.gadget.types.DeathEffectGadget;
@ -253,10 +261,10 @@ public class GadgetManager extends MiniPlugin
private TreasureManager _treasureManager;
private SoulManager _soulManager;
private NautHashMap<GadgetType, List<Gadget>> _gadgets;
private Map<GadgetType, List<Gadget>> _gadgets;
private final NautHashMap<Player, Long> _lastMove = new NautHashMap<>();
private final NautHashMap<Player, NautHashMap<GadgetType, Gadget>> _playerActiveGadgetMap = new NautHashMap<>();
private final Map<Player, Long> _lastMove = new HashMap<>();
private final Map<Player, Map<GadgetType, Gadget>> _playerActiveGadgetMap = new HashMap<>();
private final HashSet<GadgetSet> _sets = new HashSet<>();
@ -315,8 +323,11 @@ public class GadgetManager extends MiniPlugin
addSet(new SetRaveSuit(this));
addSet(new SetSpaceSuit(this));
addSet(new SetFreezeSuit(this));
addSet(new SetStPatricksSuit(this));
// Hidden in this update
//addSet(new SetWindUpSuit(this));
// Sets
addSet(new SetParty(this));
addSet(new SetCupidsLove(this));
addSet(new SetEmerald(this));
@ -330,7 +341,7 @@ public class GadgetManager extends MiniPlugin
private void createGadgets()
{
_gadgets = new NautHashMap<>();
_gadgets = new HashMap<>();
// Items
addGadget(new ItemEtherealPearl(this));
@ -350,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));
@ -373,6 +386,11 @@ public class GadgetManager extends MiniPlugin
addGadget(new OutfitFreezeSuitLeggings(this));
addGadget(new OutfitFreezeSuitBoots(this));
addGadget(new OutfitStPatricksHat(this));
addGadget(new OutfitStPatricksChestplate(this));
addGadget(new OutfitStPatricksLeggings(this));
addGadget(new OutfitStPatricksBoots(this));
addGadget(new OutfitTeam(this, "Team Helmet", -1, ArmorSlot.HELMET, Material.LEATHER_HELMET, (byte)0));
addGadget(new OutfitTeam(this, "Team Shirt", -1, ArmorSlot.CHEST, Material.LEATHER_CHESTPLATE, (byte)0));
addGadget(new OutfitTeam(this, "Team Pants", -1, ArmorSlot.LEGS, Material.LEATHER_LEGGINGS, (byte)0));
@ -432,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));
@ -561,6 +580,7 @@ public class GadgetManager extends MiniPlugin
// TAUNTS!!!
addGadget(new EternalTaunt(this));
addGadget(new BlowAKissTaunt(this));
addGadget(new RainbowTaunt(this));
// Gem Hunters Mounts
for (MountType mount : MountType.values())
@ -1035,7 +1055,7 @@ public class GadgetManager extends MiniPlugin
public void setActive(Player player, Gadget gadget)
{
if (!_playerActiveGadgetMap.containsKey(player))
_playerActiveGadgetMap.put(player, new NautHashMap<GadgetType, Gadget>());
_playerActiveGadgetMap.put(player, new HashMap<>());
_playerActiveGadgetMap.get(player).put(gadget.getGadgetType(), gadget);
}
@ -1043,7 +1063,7 @@ public class GadgetManager extends MiniPlugin
public Gadget getActive(Player player, GadgetType gadgetType)
{
if (!_playerActiveGadgetMap.containsKey(player))
_playerActiveGadgetMap.put(player, new NautHashMap<GadgetType, Gadget>());
_playerActiveGadgetMap.put(player, new HashMap<>());
return _playerActiveGadgetMap.get(player).get(gadgetType);
}
@ -1051,7 +1071,7 @@ public class GadgetManager extends MiniPlugin
public void removeActive(Player player, Gadget gadget)
{
if (!_playerActiveGadgetMap.containsKey(player))
_playerActiveGadgetMap.put(player, new NautHashMap<GadgetType, Gadget>());
_playerActiveGadgetMap.put(player, new HashMap<>());
_playerActiveGadgetMap.get(player).remove(gadget.getGadgetType());
}

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
@ -124,6 +129,19 @@ public class MorphPumpkinKing extends MorphGadget
}
}
@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

@ -109,7 +109,7 @@ public class OutfitTeam extends OutfitGadget
Player player = event.getPlayer();
if (!event.getMessage().toLowerCase().startsWith("/team"))
if (!event.getMessage().toLowerCase().startsWith("/team "))
return;
event.setCancelled(true);

View File

@ -0,0 +1,15 @@
package mineplex.core.gadget.gadgets.outfit.stpatricks;
import org.bukkit.Material;
import mineplex.core.gadget.GadgetManager;
public class OutfitStPatricksBoots extends OutfitStPatricksSuit
{
public OutfitStPatricksBoots(GadgetManager manager)
{
super(manager, "Leprechaun's Boots", -18, ArmorSlot.BOOTS, Material.LEATHER_BOOTS, (byte) 0, "St Patrick's Boots");
}
}

View File

@ -0,0 +1,15 @@
package mineplex.core.gadget.gadgets.outfit.stpatricks;
import org.bukkit.Material;
import mineplex.core.gadget.GadgetManager;
public class OutfitStPatricksChestplate extends OutfitStPatricksSuit
{
public OutfitStPatricksChestplate(GadgetManager manager)
{
super(manager, "Leprechaun's Chest", -18, ArmorSlot.CHEST, Material.LEATHER_CHESTPLATE, (byte) 0, "St Patrick's Chest");
}
}

View File

@ -0,0 +1,15 @@
package mineplex.core.gadget.gadgets.outfit.stpatricks;
import org.bukkit.Material;
import mineplex.core.gadget.GadgetManager;
public class OutfitStPatricksHat extends OutfitStPatricksSuit
{
public OutfitStPatricksHat(GadgetManager manager)
{
super(manager, "Leprechaun's Hat", -18, ArmorSlot.HELMET, Material.LEATHER_HELMET, (byte) 0, "St Patrick's Hat");
}
}

View File

@ -0,0 +1,15 @@
package mineplex.core.gadget.gadgets.outfit.stpatricks;
import org.bukkit.Material;
import mineplex.core.gadget.GadgetManager;
public class OutfitStPatricksLeggings extends OutfitStPatricksSuit
{
public OutfitStPatricksLeggings(GadgetManager manager)
{
super(manager, "Leprechaun's Pants", -18, ArmorSlot.LEGS, Material.LEATHER_LEGGINGS, (byte) 0, "St Patrick's Pants");
}
}

View File

@ -0,0 +1,117 @@
package mineplex.core.gadget.gadgets.outfit.stpatricks;
import java.util.HashSet;
import java.util.Iterator;
import org.bukkit.Color;
import org.bukkit.Material;
import org.bukkit.entity.Item;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerPickupItemEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.inventory.meta.LeatherArmorMeta;
import org.bukkit.util.Vector;
import mineplex.core.common.util.C;
import mineplex.core.common.util.LineFormat;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilText;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.types.OutfitGadget;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
public class OutfitStPatricksSuit extends OutfitGadget
{
private HashSet<Item> _items = new HashSet<>();
public OutfitStPatricksSuit(GadgetManager manager, String name, int cost, OutfitGadget.ArmorSlot slot, Material mat, byte data, String... altNames)
{
super(manager, name, UtilText.splitLinesToArray(new String[]{C.cGray + "Wherever a Leprechaun goes he leaves behind a trail of gold and a hint of spring."}, LineFormat.LORE), cost, slot, mat, data, altNames);
setColor(Color.fromRGB(0, 153, 0));
ItemStack displayItem = new ItemStack(mat, 1, data);
if (displayItem.getItemMeta() instanceof LeatherArmorMeta)
{
LeatherArmorMeta leatherArmorMeta = (LeatherArmorMeta) displayItem.getItemMeta();
leatherArmorMeta.setColor(Color.fromRGB(0, 153, 0));
displayItem.setItemMeta(leatherArmorMeta);
}
setDisplayItem(displayItem);
}
@Override
public void enableCustom(Player player, boolean message)
{
applyArmor(player, message);
}
@Override
public void disableCustom(Player player, boolean message)
{
removeArmor(player, message);
}
@EventHandler
public void onUpdate(UpdateEvent event)
{
// Prevents event running 4 times
if (getSlot() != ArmorSlot.HELMET)
return;
if (event.getType() == UpdateType.TICK)
cleanItems();
if (event.getType() == UpdateType.FASTER)
{
for (Player player : getActive())
{
if (setActive(player))
{
ItemStack itemStack = new ItemStack(Material.GOLD_INGOT);
ItemMeta itemMeta = itemStack.getItemMeta();
itemMeta.setDisplayName(player.getName() + "DROPPED" + System.currentTimeMillis() + UtilMath.random.nextInt());
itemStack.setItemMeta(itemMeta);
Item gold = player.getWorld().dropItem(player.getLocation().add(0.5, 1.5, 0.5), itemStack);
_items.add(gold);
gold.setVelocity(new Vector((Math.random() - 0.5) * 0.3, Math.random() - 0.4, (Math.random() - 0.5) * 0.3));
}
}
}
}
@EventHandler
public void onItemPickup(PlayerPickupItemEvent event)
{
// Prevents event running 4 times
if (getSlot() != ArmorSlot.HELMET)
return;
if (_items.contains(event.getItem()))
{
event.setCancelled(true);
}
}
private boolean setActive(Player player)
{
return getSet() != null && getSet().isActive(player);
}
public void cleanItems()
{
Iterator<Item> it = _items.iterator();
while (it.hasNext())
{
Item item = it.next();
if (item.getTicksLived() >= 20)
{
item.remove();
it.remove();
}
}
}
}

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

@ -25,7 +25,7 @@ public class BlowAKissTaunt extends TauntGadget
public BlowAKissTaunt(GadgetManager manager)
{
super(manager, "Blow A Kiss", UtilText.splitLinesToArray(new String[]{
C.cWhite + "Type /taunt in game to blow a kiss at your enemies.",
C.cWhite + "Use /taunt in game to blow a kiss at your enemies.",
C.cRed + "Cannot be used while in PvP!"}, LineFormat.LORE),
-17, Material.GLASS, (byte) 0);
setDisplayItem(ItemStackFactory.Instance.createCustomPotion(PotionType.INSTANT_HEAL));

View File

@ -0,0 +1,68 @@
package mineplex.core.gadget.gadgets.taunts;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.util.Vector;
import mineplex.core.common.util.C;
import mineplex.core.common.util.LineFormat;
import mineplex.core.common.util.UtilText;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.types.TauntGadget;
import mineplex.core.particleeffects.EffectLocation;
import mineplex.core.particleeffects.RainbowTauntEffect;
import mineplex.core.recharge.Recharge;
public class RainbowTaunt extends TauntGadget
{
private static final int COOLDOWN = 30000;
private static final int PVP_COOLDOWN = 10000;
public RainbowTaunt(GadgetManager manager)
{
super(manager, "Rainbow Taunt", UtilText.splitLinesToArray(new String[]
{
C.cGray + "At the end of every Rainbow they say there is a pot of Gold.",
"",
C.cWhite + "Use /taunt in game to use this taunt.",
C.cGreen + "Can be used while in PvP!"
},
LineFormat.LORE), -18, Material.WOOL, (byte) 11);
setCanPlayWithPvp(false);
setPvpCooldown(PVP_COOLDOWN);
setShouldPlay(false);
}
@Override
public void onStart(Player player)
{
if (!Recharge.Instance.use(player, getName(), COOLDOWN, true, false, "Cosmetics"))
return;
Vector dir = player.getLocation().getDirection();
Vector sideA = dir.clone().setX(-dir.getZ()).setZ(dir.getX());
Vector sideB = dir.clone().setX(dir.getZ()).setZ(-dir.getX());
Location start = player.getLocation().clone().add(sideA.multiply(4).toLocation(player.getWorld()));
Location end = player.getLocation().clone().add(sideB.multiply(4).toLocation(player.getWorld()));
RainbowTauntEffect rainbowTauntEffect = new RainbowTauntEffect(start, Manager.getPlugin());
rainbowTauntEffect.setTargetLocation(new EffectLocation(end));
rainbowTauntEffect.start();
}
@Override
public void onPlay(Player player)
{
}
@Override
public void onFinish(Player player)
{
}
}

View File

@ -0,0 +1,22 @@
package mineplex.core.gadget.set.suits;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.gadgets.outfit.stpatricks.OutfitStPatricksBoots;
import mineplex.core.gadget.gadgets.outfit.stpatricks.OutfitStPatricksChestplate;
import mineplex.core.gadget.gadgets.outfit.stpatricks.OutfitStPatricksHat;
import mineplex.core.gadget.gadgets.outfit.stpatricks.OutfitStPatricksLeggings;
import mineplex.core.gadget.types.GadgetSet;
public class SetStPatricksSuit extends GadgetSet
{
public SetStPatricksSuit(GadgetManager manager)
{
super(manager, "St Patrick's Suit", "You're so rich that gold falls out of your pocket with every step!",
manager.getGadget(OutfitStPatricksHat.class),
manager.getGadget(OutfitStPatricksChestplate.class),
manager.getGadget(OutfitStPatricksLeggings.class),
manager.getGadget(OutfitStPatricksBoots.class));
}
}

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;
@ -30,6 +32,11 @@ public abstract class ParticleGadget extends Gadget
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

@ -70,6 +70,7 @@ public abstract class TauntGadget extends Gadget
@Override
public void disableCustom(Player player, boolean message)
{
super.disableCustom(player, message);
finish(player);
}

View File

@ -110,6 +110,7 @@ public abstract class WinEffectGadget extends Gadget
}
finally
{
UtilServer.getPlayersCollection().forEach(UtilPlayer::showForAll);
_player = null;
_baseLocation = null;
_team.clear();

View File

@ -35,6 +35,6 @@ public class MessageAdminCommand extends CommandBase<MessageManager>
@Override
public List<String> onTabComplete(CommandSender sender, String commandLabel, String[] args)
{
return tabCompletePlayerNames(sender, commandLabel, args);
return tabCompletePlayerNames(sender, args);
}
}

View File

@ -45,6 +45,6 @@ public class MessageCommand extends CommandBase<MessageManager>
@Override
public List<String> onTabComplete(CommandSender sender, String commandLabel, String[] args)
{
return tabCompletePlayerNames(sender, commandLabel, args);
return tabCompletePlayerNames(sender, args);
}
}

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

@ -35,6 +35,7 @@ import mineplex.core.mount.types.MountMule;
import mineplex.core.mount.types.MountNightmareSteed;
import mineplex.core.mount.types.MountSlime;
import mineplex.core.mount.types.MountSpider;
import mineplex.core.mount.types.MountStPatricksHorse;
import mineplex.core.mount.types.MountTitan;
import mineplex.core.mount.types.MountUndead;
import mineplex.core.mount.types.MountValentinesSheep;
@ -48,7 +49,7 @@ public class MountManager extends MiniPlugin
private DisguiseManager _disguiseManager;
private List<Mount<?>> _types;
private NautHashMap<Player, Mount<?>> _playerActiveMountMap = new NautHashMap<Player, Mount<?>>();
private NautHashMap<Player, Mount<?>> _playerActiveMountMap = new NautHashMap<>();
public MountManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager, BlockRestore blockRestore, DisguiseManager disguiseManager)
{
@ -79,10 +80,10 @@ public class MountManager extends MiniPlugin
_types.add(new MountValentinesSheep(this));
_types.add(new MountFreedomHorse(this));
_types.add(new MountNightmareSteed(this));
// Hidden in this update
_types.add(new MountChicken(this));
_types.add(new MountCake(this));
_types.add(new MountLoveTrain(this));
_types.add(new MountStPatricksHorse(this));
//_types.add(new MountSheep(this));
}

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

@ -0,0 +1,115 @@
package mineplex.core.mount.types;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.bukkit.Material;
import org.bukkit.entity.Horse;
import org.bukkit.entity.Item;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.HorseJumpEvent;
import org.bukkit.event.player.PlayerPickupItemEvent;
import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.C;
import mineplex.core.common.util.LineFormat;
import mineplex.core.common.util.UtilText;
import mineplex.core.mount.HorseMount;
import mineplex.core.mount.MountManager;
import mineplex.core.mount.SingleEntityMountData;
import mineplex.core.particleeffects.RainbowTrailEffect;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
public class MountStPatricksHorse extends HorseMount
{
private HashSet<Item> _items = new HashSet<>();
private Map<SingleEntityMountData<Horse>, RainbowTrailEffect> _trailMap = new HashMap<>();
public MountStPatricksHorse(MountManager manager)
{
super(manager, "Rainbow Horse",
UtilText.splitLinesToArray(new String[]{C.cGray + "You know the cow that jumped over the moon? Total show off."}, LineFormat.LORE),
Material.CAULDRON_ITEM, (byte) 0, -18, Horse.Color.WHITE, Horse.Style.WHITE, Horse.Variant.HORSE, 1, null);
}
@Override
public void enableCustom(Player player)
{
super.enableCustom(player);
SingleEntityMountData<Horse> horseData = getActive().get(player);
horseData.getEntity().getInventory().setArmor(new ItemStack(Material.GOLD_BARDING));
_trailMap.put(horseData, new RainbowTrailEffect(horseData.getEntity(), Manager.getPlugin(), _items));
_trailMap.get(horseData).start();
}
@Override
public void disable(Player player)
{
super.disable(player);
List<SingleEntityMountData<Horse>> toRemove = new ArrayList<>();
for (SingleEntityMountData<Horse> horseData : _trailMap.keySet())
{
if (horseData.getOwner().equals(player))
toRemove.add(horseData);
}
for (SingleEntityMountData<Horse> horseData : toRemove)
{
_trailMap.get(horseData).stop();
_trailMap.remove(horseData);
}
}
@EventHandler
public void horseJump(HorseJumpEvent event)
{
for (SingleEntityMountData<Horse> horseData : _trailMap.keySet())
{
if (horseData.getEntity().equals(event.getEntity()))
{
if (Recharge.Instance.use(horseData.getOwner(), getName(), 2500, false, false, "Cosmetics"))
{
_trailMap.get(horseData).setJumping(true);
}
}
}
}
@EventHandler
public void onItemPickup(PlayerPickupItemEvent event)
{
if (_items.contains(event.getItem()))
{
event.setCancelled(true);
}
}
@EventHandler
public void onUpdate(UpdateEvent event)
{
if (event.getType() == UpdateType.TICK)
cleanItems();
}
public void cleanItems()
{
Iterator<Item> it = _items.iterator();
while (it.hasNext())
{
Item item = it.next();
if (item.getTicksLived() >= 20)
{
item.remove();
it.remove();
}
}
}
}

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

@ -0,0 +1,33 @@
package mineplex.core.particleeffects;
import java.awt.Color;
import org.bukkit.Location;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.util.Vector;
import mineplex.core.common.shape.ShapeWings;
import mineplex.core.common.util.UtilParticle;
public class CloverEffect extends Effect
{
private ShapeWings _cloverBlack = new ShapeWings(UtilParticle.ParticleType.RED_DUST.particleName, new Vector(1, 1, 1), 1, 0, '#', ShapeWings.DEFAULT_ROTATION, ShapeWings.FOUR_LEAF_CLOVER);
private ShapeWings _cloverDarkGreen = new ShapeWings(UtilParticle.ParticleType.RED_DUST.particleName, new Vector(1, 1, 1), 1, 0, '%', ShapeWings.DEFAULT_ROTATION, ShapeWings.FOUR_LEAF_CLOVER);
private ShapeWings _cloverGreen = new ShapeWings(UtilParticle.ParticleType.RED_DUST.particleName, new Vector(1, 1, 1), 1, 0, '*', ShapeWings.DEFAULT_ROTATION, ShapeWings.FOUR_LEAF_CLOVER);
public CloverEffect(JavaPlugin plugin, Location location)
{
super(-1, new EffectLocation(location), plugin, 1);
}
@Override
public void runEffect()
{
Location location = getEffectLocation().getLocation();
_cloverBlack.displayColored(location, Color.BLACK);
_cloverDarkGreen.displayColored(location, new Color(0, 100, 0));
_cloverGreen.displayColored(location, Color.GREEN);
}
}

View File

@ -0,0 +1,63 @@
package mineplex.core.particleeffects;
import java.awt.Color;
import org.bukkit.Location;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.util.Vector;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.particles.ColoredParticle;
import mineplex.core.common.util.particles.DustSpellColor;
public class RainbowTauntEffect extends Effect
{
private static final int PARTICLES = 25;
private static final double HEIGHT = 4;
private static final Color RED = new Color(255, 0, 0);
private static final Color ORANGE = new Color(255, 127, 0);
private static final Color YELLOW = new Color(255, 255, 0);
private static final Color GREEN = new Color(0, 255, 0);
private static final Color BLUE = new Color(0, 0, 255);
private static final Color INDIGO = new Color(75, 0, 130);
private static final Color VIOLET = new Color(143, 0, 255);
public RainbowTauntEffect(Location start, JavaPlugin javaPlugin)
{
super(16, new EffectLocation(start), javaPlugin, 5);
}
@Override
public void runEffect()
{
Location location = getEffectLocation().getFixedLocation();
Location target = getTargetLocation().getFixedLocation();
Color[] colors = new Color[]{VIOLET, INDIGO, BLUE, GREEN, YELLOW, ORANGE, RED};
for (int i = 0; i < 7; i++)
{
line(location.clone().add(0, 0.25 * i, 0), target.clone().add(0, 0.25 * i, 0), colors[i]);
}
}
private void line(Location startLocation, Location targetLocation, Color color)
{
Vector link = targetLocation.toVector().subtract(startLocation.toVector());
float length = (float) link.length();
float pitch = (float) (4 * HEIGHT / Math.pow(length, 2));
for (int i = 0; i < PARTICLES; i++)
{
Vector v = link.clone().normalize().multiply(length * i / PARTICLES);
float x = ((float) i / PARTICLES) * length - length / 2;
float y = (float) (-pitch * Math.pow(x, 2) + HEIGHT);
startLocation.add(v).add(0, y, 0);
ColoredParticle coloredParticle = new ColoredParticle(UtilParticle.ParticleType.RED_DUST,
new DustSpellColor(color), startLocation);
coloredParticle.display();
startLocation.subtract(0, y, 0).subtract(v);
}
}
}

View File

@ -0,0 +1,113 @@
package mineplex.core.particleeffects;
import java.awt.Color;
import java.util.HashSet;
import org.bukkit.Material;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Item;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.util.Vector;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.particles.ColoredParticle;
import mineplex.core.common.util.particles.DustSpellColor;
public class RainbowTrailEffect extends Effect
{
private HashSet<Item> _items;
private long _count, _jumpingTimer = 0;
private boolean _isJumping = false;
private Entity _entity;
private Color _red = new Color(255, 0, 0);
private Color _orange = new Color(255, 127, 0);
private Color _yellow = new Color(255, 255, 0);
private Color _green = new Color(0, 255, 0);
private Color _blue = new Color(0, 0, 255);
private Color _indigo = new Color(75, 0, 130);
private Color _violet = new Color(143, 0, 255);
private Color _color = _red;
public RainbowTrailEffect(Entity entity, JavaPlugin javaPlugin, HashSet<Item> items)
{
super(-1, new EffectLocation(entity), javaPlugin);
_entity = entity;
_items = items;
}
@Override
public void runEffect()
{
if (!_entity.isValid() || _entity.isDead())
{
stop();
return;
}
ColoredParticle coloredParticle = new ColoredParticle(UtilParticle.ParticleType.RED_DUST,
new DustSpellColor(_color), _effectLocation.getLocation().clone().add(0, .5, 0));
for (int i = 0; i < 7; i++)
{
coloredParticle.setLocation(_effectLocation.getLocation().clone().add(0, .5, 0));
coloredParticle.display();
if (_isJumping)
{
coloredParticle.setLocation(_effectLocation.getLocation().clone().add(.25, .5, 0));
coloredParticle.display();
coloredParticle.setLocation(_effectLocation.getLocation().clone().add(0, .5, .25));
coloredParticle.display();
}
}
if (_isJumping)
{
_jumpingTimer++;
if (_jumpingTimer >= 30)
{
setJumping(false);
_jumpingTimer = 0;
}
}
_count++;
if (_count % 5 == 0)
{
if (_color.equals(_red))
_color = _orange;
else if (_color.equals(_orange))
_color = _yellow;
else if (_color.equals(_yellow))
_color = _green;
else if (_color.equals(_green))
_color = _blue;
else if (_color.equals(_blue))
_color = _indigo;
else if (_color.equals(_indigo))
_color = _violet;
else
_color = _red;
}
if (_count == Long.MAX_VALUE - 1)
_count = 0;
}
public void setJumping(boolean jumping)
{
_isJumping = jumping;
if (_isJumping)
{
ItemStack itemStack = new ItemStack(Material.GOLD_INGOT);
ItemMeta itemMeta = itemStack.getItemMeta();
itemMeta.setDisplayName("DROPPED" + System.currentTimeMillis() + UtilMath.random.nextInt());
itemStack.setItemMeta(itemMeta);
Item gold = _entity.getWorld().dropItem(_entity.getLocation().add(0.5, 1.5, 0.5), itemStack);
_items.add(gold);
gold.setVelocity(new Vector((Math.random()-0.5)*0.3, Math.random()-0.4, (Math.random()-0.5)*0.3));
}
}
}

View File

@ -1,6 +1,5 @@
package mineplex.core.party.command.cli;
import java.util.Arrays;
import java.util.List;
import org.bukkit.command.CommandSender;
@ -39,7 +38,7 @@ public class PartyInviteCommand extends CommandBase<PartyManager>
Player player = (Player) sender;
Party party = Plugin.getPartyByPlayer(player);
return tabCompletePlayerNames(sender, commandLabel, args, other -> party == null || !party.isMember(other));
return tabCompletePlayerNames(sender, args, other -> party == null || !party.isMember(other));
}
return null;

View File

@ -50,7 +50,7 @@ public class PartyKickCommand extends CommandBase<PartyManager>
if (party != null && party.isOwner(player))
{
return tabCompletePlayerNames(sender, commandLabel, args, other -> other != player && party.isMember(other));
return tabCompletePlayerNames(sender, args, other -> other != player && party.isMember(other));
}
}

View File

@ -77,7 +77,7 @@ public class PartyTransferOwnerCommand extends CommandBase<PartyManager>
if (party != null && party.isOwner(player))
{
return tabCompletePlayerNames(sender, commandLabel, args, other -> other != player && party.isMember(other));
return tabCompletePlayerNames(sender, args, other -> other != player && party.isMember(other));
}
}

View File

@ -38,7 +38,7 @@ public class PartyGUIInviteCommand extends CommandBase<PartyManager>
Player player = (Player) sender;
Party party = Plugin.getPartyByPlayer(player);
return tabCompletePlayerNames(sender, commandLabel, args, other -> party == null || !party.isMember(other));
return tabCompletePlayerNames(sender, args, other -> party == null || !party.isMember(other));
}
return null;

View File

@ -396,6 +396,20 @@ public class PetManager extends MiniClientPlugin<PetClient>
UtilEnt.silence(villager, true);
_trueLovePets.put(zombie, new TrueLoveData(player, zombie, villager));
}
else if (petType.equals(PetType.LEPRECHAUN))
{
Zombie zombie = (Zombie) pet;
zombie.setBaby(true);
UtilEnt.silence(zombie, true);
zombie.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, Integer.MAX_VALUE, 1, false, false));
zombie.getEquipment().setHelmet(SkinData.LEPRECHAUN.getSkull());
zombie.getEquipment().setChestplate(ItemStackFactory.Instance.createColoredLeatherArmor(1, org.bukkit.Color.fromRGB(0, 153, 0)));
zombie.getEquipment().setLeggings(ItemStackFactory.Instance.createColoredLeatherArmor(2, org.bukkit.Color.fromRGB(0, 153, 0)));
zombie.getEquipment().setBoots(ItemStackFactory.Instance.createColoredLeatherArmor(3, org.bukkit.Color.fromRGB(0, 153, 0)));
}
_activePetOwnerTypes.put(player.getName(), petType);
_activePetOwners.put(player.getName(), pet);

View File

@ -6,7 +6,9 @@ import java.util.Optional;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.inventory.ItemStack;
import mineplex.core.common.skin.SkinData;
import mineplex.core.pet.sales.PetSalesPackage;
public enum PetType
@ -30,7 +32,8 @@ public enum PetType
BLAZE("Grim Reaper", EntityType.BLAZE, -8, "Aww isn't he so cute with his little wings and little scythe?"),
GINGERBREAD_MAN("Gingerbread Man", EntityType.ZOMBIE, -16, "Looks like you can catch him after all."),
CUPID_PET("Cupid", EntityType.ZOMBIE, -17, "Sometimes you need a little extra help finding true Love. Why not have Cupid help you out?", Material.BOW, (byte) 0),
TRUE_LOVE_PET("True Love", EntityType.ZOMBIE, -14, "Sometimes love means chasing the person of your dreams until you catch them.", Material.APPLE, YearMonth.of(2017, Month.FEBRUARY))
TRUE_LOVE_PET("True Love", EntityType.ZOMBIE, -14, "Sometimes love means chasing the person of your dreams until you catch them.", Material.APPLE, YearMonth.of(2017, Month.FEBRUARY)),
LEPRECHAUN("Leprechaun", EntityType.ZOMBIE, -18, "Apparently this little guy lost his Pot of Gold in the war.", SkinData.LEPRECHAUN.getSkull())
// TODO CHECK IF LOBBY IS 1.9+
// Not in this update
//SHULKER("Shulker Pet", EntityType.BAT, 0, "Is it a turtle or an alien? Either way its shot can be really UPLIFTING.")
@ -42,6 +45,7 @@ public enum PetType
private final Material _material;
private final byte _data;
private YearMonth _yearMonth;
private ItemStack _displayItem;
PetType(String name, EntityType entityType, int price)
{
@ -84,6 +88,12 @@ public enum PetType
_yearMonth = yearMonth;
}
PetType(String name, EntityType entityType, int price, String lore, ItemStack displayItem)
{
this(name, entityType, price, lore);
_displayItem = displayItem;
}
public String getName()
{
return _name;
@ -114,6 +124,15 @@ public enum PetType
return _data;
}
public ItemStack getDisplayItem()
{
if (_displayItem == null)
{
return new ItemStack(_material, 1, _data);
}
return _displayItem;
}
public YearMonth getYearMonth()
{
return _yearMonth;

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

@ -0,0 +1,44 @@
package mineplex.core.powerplayclub;
import org.bukkit.entity.Player;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
public class PPCDataRequestEvent extends Event
{
private static final HandlerList handlers = new HandlerList();
private Player _player;
private PowerPlayData _data;
public PPCDataRequestEvent(Player player)
{
_player = player;
_data = null;
}
public Player getPlayer()
{
return _player;
}
public PowerPlayData getData()
{
return _data;
}
public void setData(PowerPlayData data)
{
_data = data;;
}
public HandlerList getHandlers()
{
return handlers;
}
public static HandlerList getHandlerList()
{
return handlers;
}
}

View File

@ -25,6 +25,7 @@ import org.bukkit.plugin.java.JavaPlugin;
import mineplex.core.account.CoreClientManager;
import mineplex.core.account.ILoginProcessor;
import mineplex.core.common.util.UtilServer;
import mineplex.core.donation.DonationManager;
import mineplex.serverdata.database.DBPool;
@ -121,8 +122,16 @@ public class PowerPlayClubRepository implements Listener {
_cachedPlayerData.remove(event.getPlayer().getUniqueId());
}
@EventHandler
public void onDataRequested(PPCDataRequestEvent event)
{
event.setData(getCachedData(event.getPlayer()));
}
public CompletableFuture<Void> addSubscription(int accountId, LocalDate date, String duration)
{
UtilServer.CallEvent(new SubscriptionAddEvent(accountId, duration));
return CompletableFuture.supplyAsync(() ->
{
try (Connection connection = DBPool.getAccount().getConnection())
@ -133,7 +142,8 @@ public class PowerPlayClubRepository implements Listener {
statement.setString(3, duration);
statement.executeUpdate();
} catch (SQLException e)
}
catch (SQLException e)
{
e.printStackTrace();
}

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

@ -0,0 +1,38 @@
package mineplex.core.powerplayclub;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
public class SubscriptionAddEvent extends Event
{
private static final HandlerList handlers = new HandlerList();
private int _accountId;
private String _duration;
public SubscriptionAddEvent(int accountId, String duration)
{
_accountId = accountId;
_duration = duration;
}
public int getAccountId()
{
return _accountId;
}
public String getDuration()
{
return _duration;
}
public HandlerList getHandlers()
{
return handlers;
}
public static HandlerList getHandlerList()
{
return handlers;
}
}

View File

@ -143,6 +143,6 @@ public class PunishCommand extends CommandBase<Punish>
@Override
public List<String> onTabComplete(CommandSender sender, String commandLabel, String[] args)
{
return tabCompletePlayerNames(sender, commandLabel, args);
return tabCompletePlayerNames(sender, args);
}
}

View File

@ -9,6 +9,7 @@ import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import mineplex.core.Managers;
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.Rank;
import mineplex.core.common.util.banner.CountryFlag;
@ -91,6 +92,10 @@ import mineplex.core.gadget.gadgets.outfit.spacesuit.OutfitSpaceSuitBoots;
import mineplex.core.gadget.gadgets.outfit.spacesuit.OutfitSpaceSuitChestplate;
import mineplex.core.gadget.gadgets.outfit.spacesuit.OutfitSpaceSuitHelmet;
import mineplex.core.gadget.gadgets.outfit.spacesuit.OutfitSpaceSuitLeggings;
import mineplex.core.gadget.gadgets.outfit.stpatricks.OutfitStPatricksBoots;
import mineplex.core.gadget.gadgets.outfit.stpatricks.OutfitStPatricksChestplate;
import mineplex.core.gadget.gadgets.outfit.stpatricks.OutfitStPatricksHat;
import mineplex.core.gadget.gadgets.outfit.stpatricks.OutfitStPatricksLeggings;
import mineplex.core.gadget.gadgets.particle.ParticleChristmasTree;
import mineplex.core.gadget.gadgets.particle.ParticleCoalFumes;
import mineplex.core.gadget.gadgets.particle.ParticleFairy;
@ -113,6 +118,7 @@ import mineplex.core.gadget.gadgets.particle.shadow.ParticleFoot;
import mineplex.core.gadget.gadgets.particle.vampire.ParticleBlood;
import mineplex.core.gadget.gadgets.particle.wisdom.ParticleEnchant;
import mineplex.core.gadget.gadgets.taunts.BlowAKissTaunt;
import mineplex.core.gadget.gadgets.taunts.RainbowTaunt;
import mineplex.core.gadget.gadgets.wineffect.WinEffectBabyChicken;
import mineplex.core.gadget.gadgets.wineffect.WinEffectFlames;
import mineplex.core.gadget.gadgets.wineffect.WinEffectHalloween;
@ -140,6 +146,7 @@ import mineplex.core.mount.types.MountMule;
import mineplex.core.mount.types.MountNightmareSteed;
import mineplex.core.mount.types.MountSlime;
import mineplex.core.mount.types.MountSpider;
import mineplex.core.mount.types.MountStPatricksHorse;
import mineplex.core.mount.types.MountUndead;
import mineplex.core.mount.types.MountValentinesSheep;
import mineplex.core.mount.types.MountZombie;
@ -157,9 +164,11 @@ import mineplex.core.reward.rewards.PowerPlayReward;
import mineplex.core.reward.rewards.RankReward;
import mineplex.core.reward.rewards.RuneAmplifierReward;
import mineplex.core.reward.rewards.SpinTicketReward;
import mineplex.core.reward.rewards.TitleReward;
import mineplex.core.reward.rewards.TreasureShardReward;
import mineplex.core.reward.rewards.UnknownPackageReward;
import mineplex.core.stats.StatsManager;
import mineplex.core.titles.tracks.TrackManager;
import mineplex.core.treasure.TreasureType;
public class RewardManager
@ -167,6 +176,7 @@ public class RewardManager
private EnumMap<RewardPool.Type, RewardPool> _rewardPools;
private Random _random;
private final TrackManager _trackManager = Managers.require(TrackManager.class);
private CoreClientManager _clientManager;
private DonationManager _donationManager;
private InventoryManager _inventoryManager;
@ -414,6 +424,37 @@ public class RewardManager
addMineStrikeSkin(Type.MINESTRIKE, MineStrikeSkin.P90_Asiimov, rarity, 100, 1000);
addMineStrikeSkin(Type.MINESTRIKE, MineStrikeSkin.SG553_Pulse, rarity, 100, 1000);
// Titles
addTitle(Type.NORMAL, "shrug", rarity, 10, 500);
addTitle(Type.NORMAL, "tableflip", rarity, 10, 500);
addTitle(Type.NORMAL, "tablerespecter", rarity, 15, 500);
addTitle(Type.NORMAL, "tableflip-disgusted", rarity, 15, 500);
addTitle(Type.NORMAL, "tableflip-enraged", rarity, 15, 500);
addTitle(Type.NORMAL, "tableflip-riot", rarity, 10, 500);
addTitle(Type.NORMAL, "teddy-bear", rarity, 10, 500);
addTitle(Type.NORMAL, "disgust", rarity, 10, 500);
addTitle(Type.NORMAL, "old-man", rarity, 5, 500);
addTitle(Type.NORMAL, "jake", rarity, 5, 500);
addTitle(Type.NORMAL, "finn", rarity, 5, 500);
addTitle(Type.NORMAL, "finn-and-jake", rarity, 5, 500);
addTitle(Type.NORMAL, "boxer", rarity, 5, 500);
addTitle(Type.NORMAL, "zoidberg", rarity, 5, 500);
addTitle(Type.OMEGA, "shrug", rarity, 10, 500);
addTitle(Type.OMEGA, "tableflip", rarity, 10, 500);
addTitle(Type.OMEGA, "tablerespecter", rarity, 15, 500);
addTitle(Type.OMEGA, "tableflip-disgusted", rarity, 15, 500);
addTitle(Type.OMEGA, "tableflip-enraged", rarity, 15, 500);
addTitle(Type.OMEGA, "tableflip-riot", rarity, 10, 500);
addTitle(Type.OMEGA, "teddy-bear", rarity, 10, 500);
addTitle(Type.OMEGA, "disgust", rarity, 10, 500);
addTitle(Type.OMEGA, "old-man", rarity, 5, 500);
addTitle(Type.OMEGA, "jake", rarity, 5, 500);
addTitle(Type.OMEGA, "finn", rarity, 5, 500);
addTitle(Type.OMEGA, "finn-and-jake", rarity, 5, 500);
addTitle(Type.OMEGA, "boxer", rarity, 5, 500);
addTitle(Type.OMEGA, "zoidberg", rarity, 5, 500);
// VALENTINES
//Hats
@ -553,6 +594,11 @@ public class RewardManager
addPetReward(Type.LOVECHEST, PetType.CUPID_PET, rarity, 50, 500);
addGadget(Type.LOVECHEST, getGadget(WinEffectLoveIsABattlefield.class), rarity, 100, 500);
// ST PATRICKS
addGadget(Type.STPATRICKS, getGadget(OutfitStPatricksChestplate.class), rarity, 50);
addGadget(Type.STPATRICKS, getGadget(OutfitStPatricksLeggings.class), rarity, 50);
addGadget(Type.STPATRICKS, getGadget(OutfitStPatricksBoots.class), rarity, 50);
}
public void addLegendary()
@ -624,6 +670,38 @@ public class RewardManager
addMineStrikeSkin(Type.MINESTRIKE, MineStrikeSkin.XM1014_Pig_Gun, rarity, 10, 7500);
addMineStrikeSkin(Type.MINESTRIKE, MineStrikeSkin.M4A4_Enderman, rarity, 10, 7500);
// Titles
addTitle(Type.NORMAL, "ayyye", rarity, 25, 500);
addTitle(Type.NORMAL, "ameno", rarity, 15, 5000);
addTitle(Type.NORMAL, "magician", rarity, 25, 5000);
addTitle(Type.NORMAL, "fireball", rarity, 75, 5000);
addTitle(Type.NORMAL, "magic-missile", rarity, 75, 5000);
addTitle(Type.NORMAL, "pewpewpew", rarity, 75, 5000);
addTitle(Type.NORMAL, "stardust", rarity, 60, 5000);
addTitle(Type.NORMAL, "blow-a-kiss", rarity, 60, 5000);
addTitle(Type.NORMAL, "cool-guy", rarity, 60, 5000);
addTitle(Type.NORMAL, "deal-with-it", rarity, 60, 5000);
addTitle(Type.NORMAL, "party-time", rarity, 55, 5000);
addTitle(Type.NORMAL, "lalala", rarity, 30, 5000);
addTitle(Type.NORMAL, "gotta-go", rarity, 30, 5000);
addTitle(Type.NORMAL, "whaaat", rarity, 30, 5000);
addTitle(Type.OMEGA, "ayyye", rarity, 25, 500);
addTitle(Type.OMEGA, "ameno", rarity, 15, 5000);
addTitle(Type.OMEGA, "magician", rarity, 25, 5000);
addTitle(Type.OMEGA, "fireball", rarity, 75, 5000);
addTitle(Type.OMEGA, "magic-missile", rarity, 75, 5000);
addTitle(Type.OMEGA, "pewpewpew", rarity, 75, 5000);
addTitle(Type.OMEGA, "stardust", rarity, 60, 5000);
addTitle(Type.OMEGA, "blow-a-kiss", rarity, 60, 5000);
addTitle(Type.OMEGA, "cool-guy", rarity, 60, 5000);
addTitle(Type.OMEGA, "deal-with-it", rarity, 60, 5000);
addTitle(Type.OMEGA, "party-time", rarity, 55, 5000);
addTitle(Type.OMEGA, "lalala", rarity, 30, 5000);
addTitle(Type.OMEGA, "gotta-go", rarity, 30, 5000);
addTitle(Type.OMEGA, "whaaat", rarity, 30, 5000);
//WINTER
//Arrow Trails
@ -770,6 +848,14 @@ public class RewardManager
addGadget(Type.LOVECHEST, getGadget(MorphLoveDoctor.class), rarity, 30, 5000);
addGadget(Type.LOVECHEST, getGadget(BlowAKissTaunt.class), rarity, 50, 5000);
addGadget(Type.LOVECHEST, getGadget(ParticleWingsLove.class), rarity, 10, 5000);
// ST PATRICKS
addGadget(Type.STPATRICKS, getGadget(RainbowTaunt.class), rarity, 30);
addGadget(Type.STPATRICKS, getGadget(OutfitStPatricksHat.class), rarity, 15);
addPetReward(Type.STPATRICKS, PetType.LEPRECHAUN, rarity, 30);
addMount(Type.STPATRICKS, getMount(MountStPatricksHorse.class), rarity, 30);
}
public UnknownPackageReward addMount(Type type, Mount<?> mount, RewardRarity rarity, int weight)
@ -855,6 +941,11 @@ public class RewardManager
return addGadget(type, gadget, gadget.getDisplayName() + " (Minestrike Weapon Skin)", rarity, weight, shards);
}
public void addTitle(Type type, String trackName, RewardRarity rarity, int weight, int shards)
{
addReward(type, new TitleReward(_trackManager.getTrackById(trackName), rarity, weight, shards));
}
public UnknownPackageReward addHat(Type type, HatType hatType, RewardRarity rarity, int weight)
{
return addHat(type, hatType, rarity, weight, getShards(rarity));

View File

@ -64,6 +64,7 @@ public class RewardPool
GINGERBREAD(false, 1),
MINESTRIKE(true, 2),
LOVECHEST(false, 1),
STPATRICKS(false, 1),
CARL_SPINNER(true);
private boolean _useDuplicates;

View File

@ -21,6 +21,7 @@ public enum RewardType
MINESTRIKE_CHEST( 0, 2, 16, 0),
LOVE_CHEST( 0, 6, 18, 0),
VALENTINES_GIFT( 0, 7, 20, 20),
ST_PATRICKS( 0, 6, 18, 0),
SPINNER_FILLER( 0.1, 1, 4, 20),
SPINNER_REAL( 0.000001, 0.05, 0.4, 5);

View File

@ -0,0 +1,49 @@
package mineplex.core.reward.rewards;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import mineplex.core.Managers;
import mineplex.core.reward.Reward;
import mineplex.core.reward.RewardData;
import mineplex.core.reward.RewardRarity;
import mineplex.core.reward.RewardType;
import mineplex.core.titles.tracks.Track;
import mineplex.core.titles.tracks.TrackManager;
public class TitleReward extends Reward
{
private final ItemStack ITEM_STACK = new ItemStack(Material.BOOK);
private final TrackManager _trackManager = Managers.require(TrackManager.class);
private final Track _track;
public TitleReward(Track track, RewardRarity rarity, int weight, int shardValue)
{
super(rarity, weight, shardValue);
if (track == null)
{
throw new IllegalStateException();
}
_track = track;
}
@Override
protected RewardData giveRewardCustom(Player player, RewardType rewardType)
{
_trackManager.unlockTrack(player, _track);
return getFakeRewardData(player);
}
@Override
public RewardData getFakeRewardData(Player player)
{
return new RewardData(getRarity().getDarkColor() + "Title", getRarity().getColor() + _track.getLongName(), ITEM_STACK, getRarity());
}
@Override
public boolean canGiveReward(Player player)
{
return !_trackManager.hasTrack(player, _track);
}
}

View File

@ -4,6 +4,8 @@ import mineplex.core.MiniPlugin;
import mineplex.core.account.CoreClientManager;
import mineplex.core.donation.DonationManager;
import mineplex.core.itemstack.ItemBuilder;
import mineplex.core.lifetimes.Lifetime;
import mineplex.core.lifetimes.Lifetimed;
import mineplex.core.shop.ShopBase;
import mineplex.core.shop.item.IButton;
@ -12,7 +14,7 @@ import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import org.bukkit.inventory.ItemStack;
public abstract class ShopPageInventory<PluginType extends MiniPlugin, ShopType extends ShopBase<PluginType>> extends
public abstract class ShopPageInventory<PluginType extends Lifetimed, ShopType extends ShopBase<PluginType>> extends
ShopPageBase
{
private int _page;

View File

@ -0,0 +1,31 @@
package mineplex.core.teamspeak;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
public class TeamspeakClientInfo
{
private Map<Integer, Date> _linkedAccounts = new HashMap<>();
public TeamspeakClientInfo(Map<Integer, Date> linkedAccounts)
{
_linkedAccounts = new HashMap<>(linkedAccounts);
}
public Map<Integer, Date> getLinkedAccounts()
{
return Collections.unmodifiableMap(_linkedAccounts);
}
public void unlink(int account)
{
_linkedAccounts.remove(account);
}
public void link(int id, Date now)
{
_linkedAccounts.put(id, now);
}
}

View File

@ -0,0 +1,373 @@
package mineplex.core.teamspeak;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import net.md_5.bungee.api.ChatColor;
import net.md_5.bungee.api.chat.BaseComponent;
import net.md_5.bungee.api.chat.ClickEvent;
import net.md_5.bungee.api.chat.ComponentBuilder;
import net.md_5.bungee.api.chat.HoverEvent;
import org.apache.commons.lang.StringUtils;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitTask;
import mineplex.core.MiniClientPlugin;
import mineplex.core.ReflectivelyCreateMiniPlugin;
import mineplex.core.account.CoreClient;
import mineplex.core.account.CoreClientManager;
import mineplex.core.account.ILoginProcessor;
import mineplex.core.bonuses.BonusManager;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilTime;
import mineplex.core.teamspeak.commands.TeamspeakCommand;
import mineplex.core.teamspeak.redis.TeamspeakLinkRequest;
import mineplex.core.teamspeak.redis.TeamspeakLinkResponse;
import mineplex.core.teamspeak.redis.TeamspeakUnlinkRequest;
import mineplex.core.teamspeak.redis.TeamspeakUnlinkResponse;
import mineplex.serverdata.commands.ServerCommandManager;
@ReflectivelyCreateMiniPlugin
public class TeamspeakManager extends MiniClientPlugin<TeamspeakClientInfo> implements ILoginProcessor
{
public static final String TEAMSPEAK_CHANNEL_NAME = "Teamspeak Rank Channel";
public static final int MAX_LINKED_ACCOUNTS = 5;
private final CoreClientManager _clientManager = require(CoreClientManager.class);
private final TeamspeakRepository _repository = new TeamspeakRepository();
private final Map<UUID, BukkitTask> _requestMap = new HashMap<>();
private TeamspeakManager()
{
super("TeamSpeak Manager");
ServerCommandManager.getInstance().registerCommandType(TeamspeakLinkResponse.class, response ->
{
BukkitTask task = _requestMap.remove(response.getRequest().getCommandId());
if (task == null)
return;
task.cancel();
Player sender = Bukkit.getPlayer(response.getRequest().getCaller());
if (sender == null)
return;
switch (response.getResponse())
{
case TOKEN_VALID:
Date now = new Date();
Get(sender).link(response.getId(), now);
runAsync(() ->
{
_repository.save(_clientManager.getAccountId(sender), response.getId(), now);
});
UtilPlayer.message(sender, F.main("Teamspeak", "Congrats! You've successfully linked your Teamspeak account!"));
break;
case TOKEN_INVALID:
UtilPlayer.message(sender, F.main("Teamspeak", "Uh oh! That's not the token you were given!"));
break;
}
});
ServerCommandManager.getInstance().registerCommandType(TeamspeakUnlinkResponse.class, response ->
{
BukkitTask task = _requestMap.remove(response.getRequest().getCommandId());
if (task == null)
return;
task.cancel();
Player sender = Bukkit.getPlayer(response.getRequest().getCaller());
if (sender == null)
return;
switch (response.getResponse())
{
case UNLINKED:
Get(sender).unlink(response.getRequest().getId());
runAsync(() ->
{
_repository.delete(_clientManager.getAccountId(sender), response.getRequest().getId());
});
UtilPlayer.message(sender, F.main("Teamspeak", "You've unlinked your Teamspeak account!"));
break;
}
});
_clientManager.addStoredProcedureLoginProcessor(this);
}
@Override
public void processLoginResultSet(String playerName, UUID uuid, int accountId, ResultSet resultSet) throws SQLException
{
Map<Integer, Date> dates = new HashMap<>();
while (resultSet.next())
{
int teamspeakId = resultSet.getInt("teamspeakId");
Date linkDate = resultSet.getDate("linkDate");
dates.put(teamspeakId, linkDate);
}
Set(uuid, new TeamspeakClientInfo(dates));
}
@Override
public String getQuery(int accountId, String uuid, String name)
{
return String.format(TeamspeakRepository.GET_ALL_PLAYER_IDS, accountId);
}
@Override
protected TeamspeakClientInfo addPlayer(UUID uuid)
{
return new TeamspeakClientInfo(Collections.emptyMap());
}
public void link(Player caller, String token)
{
if (_requestMap.containsKey(caller.getUniqueId()))
{
UtilPlayer.message(caller, F.main("Teamspeak", "Please wait until your current request has been processed"));
return;
}
TeamspeakClientInfo info = Get(caller);
if (info.getLinkedAccounts().size() >= MAX_LINKED_ACCOUNTS)
{
UtilPlayer.message(caller, F.main("Teamspeak", "You have too many linked accounts! Please unlink one using /teamspeak unlink"));
return;
}
UtilPlayer.message(caller, F.main("Teamspeak", "Linking your account..."));
TeamspeakLinkRequest linkRequest = new TeamspeakLinkRequest(
caller.getUniqueId(),
token
);
linkRequest.publish();
_requestMap.put(linkRequest.getCommandId(), runSyncLater(() ->
{
if (!caller.isOnline())
return;
UtilPlayer.message(caller, F.main("Teamspeak", "It seems something has gone wrong - your request couldn't be processed"));
_requestMap.remove(linkRequest.getCommandId());
}, 20L * 5));
}
public void unlink(Player caller, String arg)
{
int id;
try
{
id = Integer.parseInt(arg);
}
catch (NumberFormatException ex)
{
UtilPlayer.message(caller, F.main("Teamspeak", F.elem(arg) + " is not a number"));
return;
}
if (_requestMap.containsKey(caller.getUniqueId()))
{
UtilPlayer.message(caller, F.main("Teamspeak", "Please wait until your current request has been processed"));
return;
}
TeamspeakClientInfo info = Get(caller);
if (!info.getLinkedAccounts().containsKey(id))
{
UtilPlayer.message(caller, F.main("Teamspeak", "You have not linked to that account"));
return;
}
UtilPlayer.message(caller, F.main("Teamspeak", "Unlinking your account..."));
TeamspeakUnlinkRequest unlinkRequest = new TeamspeakUnlinkRequest(
caller.getUniqueId(),
id
);
unlinkRequest.publish();
_requestMap.put(unlinkRequest.getCommandId(), runSyncLater(() ->
{
if (!caller.isOnline())
return;
UtilPlayer.message(caller, F.main("Teamspeak", "It seems something has gone wrong - your request couldn't be processed"));
_requestMap.remove(unlinkRequest.getCommandId());
}, 20L * 5));
}
@Override
public void addCommands()
{
addCommand(new TeamspeakCommand(this));
}
public void displayUnlinkPrompt(Player caller, String strPage)
{
TeamspeakClientInfo info = Get(caller);
List<Map.Entry<Integer, Date>> linkedAccounts = new ArrayList<>(info.getLinkedAccounts().entrySet());
if (linkedAccounts.size() == 0)
{
UtilPlayer.message(caller, F.main("Teamspeak", "You have no linked Teamspeak accounts!"));
return;
}
int totalPages = (int) Math.ceil(linkedAccounts.size() / 8.0);
int page;
try
{
page = Integer.parseInt(strPage);
}
catch (NumberFormatException ex)
{
UtilPlayer.message(caller, F.main("Teamspeak", F.elem(strPage) + " is not a number!"));
return;
}
page = page - 1;
if (page < 0)
{
UtilPlayer.message(caller, F.main("Teamspeak", "Page numbers must be greater than zero!"));
return;
}
else if (page >= totalPages)
{
UtilPlayer.message(caller, F.main("Teamspeak", "You only have " + F.elem(totalPages) + " pages of linked accounts, that number is too big!"));
return;
}
String header = "[" +
ChatColor.RESET + C.cWhite + C.Bold + "Teamspeak Accounts (" + (page + 1) + "/" + totalPages + ")" +
ChatColor.RESET + C.cAqua + C.Strike + "]";
int headerChars = ChatColor.stripColor(header).length();
int numEqualsInHeader = (50 - headerChars) / 2;
header = C.cAqua + C.Strike + StringUtils.repeat("=", numEqualsInHeader) + header + StringUtils.repeat("=", numEqualsInHeader);
caller.sendMessage(header);
int start = page * 8;
List<Map.Entry<Integer, Date>> subList = start < linkedAccounts.size() ? linkedAccounts.subList(start, Math.min(linkedAccounts.size(), start + 8)) : Collections.emptyList();
for (Map.Entry<Integer, Date> data : subList)
{
BaseComponent[] hover = new ComponentBuilder("")
.append("ID: ")
.color(ChatColor.YELLOW)
.append(String.valueOf(data.getKey()), ComponentBuilder.FormatRetention.NONE)
.color(ChatColor.WHITE)
.create();
ComponentBuilder builder = new ComponentBuilder("")
.append("Unlink")
.color(ChatColor.RED)
.bold(true)
.event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("Click to unlink this account. All your ranks on Teamspeak will be removed").color(ChatColor.RED).create()))
.event(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, "/teamspeak unlink " + data.getKey()))
.append(" - ", ComponentBuilder.FormatRetention.NONE)
.color(ChatColor.WHITE)
.append("Account linked on " + UtilTime.date(data.getValue().getTime()))
.event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, hover))
.color(ChatColor.GRAY);
caller.spigot().sendMessage(builder.create());
}
int chars = ChatColor.stripColor(header).length();
int numEquals = (chars - 3) / 2;
ComponentBuilder pageSwitch = new ComponentBuilder("")
.append(StringUtils.repeat("=", numEquals) + "[")
.strikethrough(true)
.color(ChatColor.AQUA)
.append(" ", ComponentBuilder.FormatRetention.NONE)
.append("<", ComponentBuilder.FormatRetention.NONE)
.bold(true);
if (page > 0)
{
BaseComponent[] prev = new ComponentBuilder("")
.append("Go to page " + page)
.color(ChatColor.GREEN)
.create();
pageSwitch
.color(ChatColor.GREEN)
.event(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/teamspeak list " + (page)))
.event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, prev));
}
else
{
pageSwitch
.color(ChatColor.GRAY);
}
pageSwitch.append(" ", ComponentBuilder.FormatRetention.NONE)
.append(">", ComponentBuilder.FormatRetention.NONE)
.bold(true);
if (page + 1 < totalPages)
{
BaseComponent[] next = new ComponentBuilder("")
.append("Go to page " + (page + 2))
.color(ChatColor.GREEN)
.create();
pageSwitch
.color(ChatColor.GREEN)
.event(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/teamspeak list " + (page + 2)))
.event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, next));
}
else
{
pageSwitch
.color(ChatColor.GRAY);
}
pageSwitch
.append(" ", ComponentBuilder.FormatRetention.NONE)
.append("]" + StringUtils.repeat("=", numEquals), ComponentBuilder.FormatRetention.NONE)
.strikethrough(true)
.color(ChatColor.AQUA);
caller.spigot().sendMessage(pageSwitch.create());
}
}

View File

@ -0,0 +1,57 @@
package mineplex.core.teamspeak;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.Date;
import mineplex.serverdata.database.DBPool;
import mineplex.serverdata.database.RepositoryBase;
@SuppressWarnings("WeakerAccess")
public class TeamspeakRepository extends RepositoryBase
{
TeamspeakRepository()
{
super(DBPool.getAccount());
}
public static final String GET_ALL_PLAYER_IDS = "SELECT `teamspeakId`, `linkDate` FROM accountTeamspeak WHERE accountId = %s;";
public static final String SAVE_PLAYER_ID = "INSERT INTO accountTeamspeak (accountId, teamspeakId, linkDate) VALUES (?, ?, ?);";
public static final String DELETE_PLAYER_ID = "DELETE FROM accountTeamspeak WHERE accountId = ? AND teamspeakId = ?;";
public void save(int accountId, int id, Date now)
{
try (Connection connection = getConnection())
{
try (PreparedStatement statement = connection.prepareStatement(SAVE_PLAYER_ID))
{
statement.setInt(1, accountId);
statement.setInt(2, id);
statement.setDate(3, new java.sql.Date(now.getTime()));
statement.executeUpdate();
}
}
catch (SQLException ex)
{
ex.printStackTrace();
}
}
public void delete(int accountId, int id)
{
try (Connection connection = getConnection())
{
try (PreparedStatement statement = connection.prepareStatement(DELETE_PLAYER_ID))
{
statement.setInt(1, accountId);
statement.setInt(2, id);
statement.executeUpdate();
}
}
catch (SQLException ex)
{
ex.printStackTrace();
}
}
}

View File

@ -0,0 +1,29 @@
package mineplex.core.teamspeak.commands;
import org.bukkit.entity.Player;
import mineplex.core.command.CommandBase;
import mineplex.core.common.Rank;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.teamspeak.TeamspeakManager;
public class LinkCommand extends CommandBase<TeamspeakManager>
{
public LinkCommand(TeamspeakManager plugin)
{
super(plugin, Rank.ALL, "link");
}
@Override
public void Execute(Player caller, String[] args)
{
if (args.length == 0)
{
UtilPlayer.message(caller, F.main("Teamspeak", "No token specified. Join the " + F.elem(TeamspeakManager.TEAMSPEAK_CHANNEL_NAME) + " on Teamspeak and type " + F.elem("!link") + " to link an account"));
return;
}
Plugin.link(caller, args[0]);
}
}

View File

@ -0,0 +1,23 @@
package mineplex.core.teamspeak.commands;
import org.bukkit.entity.Player;
import mineplex.core.command.CommandBase;
import mineplex.core.common.Rank;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.teamspeak.TeamspeakManager;
public class ListCommand extends CommandBase<TeamspeakManager>
{
public ListCommand(TeamspeakManager plugin)
{
super(plugin, Rank.ALL, "list");
}
@Override
public void Execute(Player caller, String[] args)
{
Plugin.displayUnlinkPrompt(caller, args.length == 0 ? "1" : args[0]);
}
}

View File

@ -0,0 +1,28 @@
package mineplex.core.teamspeak.commands;
import org.bukkit.entity.Player;
import mineplex.core.command.MultiCommandBase;
import mineplex.core.common.Rank;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.teamspeak.TeamspeakManager;
public class TeamspeakCommand extends MultiCommandBase<TeamspeakManager>
{
public TeamspeakCommand(TeamspeakManager plugin)
{
super(plugin, Rank.ALL, "teamspeak", "ts");
AddCommand(new LinkCommand(plugin));
AddCommand(new ListCommand(plugin));
AddCommand(new UnlinkCommand(plugin));
}
@Override
protected void Help(Player caller, String[] args)
{
UtilPlayer.message(caller, F.main("Teamspeak", "To link a new Teamspeak account, run " + F.elem("/teamspeak link")));
UtilPlayer.message(caller, F.main("Teamspeak", "To list all linked Teamspeak accounts, run " + F.elem("/teamspeak list")));
}
}

View File

@ -0,0 +1,29 @@
package mineplex.core.teamspeak.commands;
import org.bukkit.entity.Player;
import mineplex.core.command.CommandBase;
import mineplex.core.common.Rank;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.teamspeak.TeamspeakManager;
public class UnlinkCommand extends CommandBase<TeamspeakManager>
{
public UnlinkCommand(TeamspeakManager plugin)
{
super(plugin, Rank.ALL, "unlink");
}
@Override
public void Execute(Player caller, String[] args)
{
if (args.length == 0)
{
UtilPlayer.message(caller, F.main("Teamspeak", "No account specified!"));
return;
}
Plugin.unlink(caller, args[0]);
}
}

View File

@ -0,0 +1,27 @@
package mineplex.core.teamspeak.redis;
import java.util.UUID;
import mineplex.serverdata.commands.ServerCommand;
public class TeamspeakLinkRequest extends ServerCommand
{
private final UUID _caller;
private final String _token;
public TeamspeakLinkRequest(UUID caller, String token)
{
this._caller = caller;
this._token = token;
}
public UUID getCaller()
{
return _caller;
}
public String getToken()
{
return _token;
}
}

View File

@ -0,0 +1,42 @@
package mineplex.core.teamspeak.redis;
import com.google.gson.annotations.SerializedName;
import mineplex.serverdata.commands.ServerCommand;
public class TeamspeakLinkResponse extends ServerCommand
{
private final Response _response;
private final TeamspeakLinkRequest _request;
private final int _id;
public TeamspeakLinkResponse(Response response, TeamspeakLinkRequest request, int id)
{
_response = response;
_request = request;
_id = id;
}
public Response getResponse()
{
return _response;
}
public TeamspeakLinkRequest getRequest()
{
return _request;
}
public int getId()
{
return _id;
}
public enum Response
{
@SerializedName("token-valid")
TOKEN_VALID,
@SerializedName("token-invalid")
TOKEN_INVALID
}
}

View File

@ -0,0 +1,27 @@
package mineplex.core.teamspeak.redis;
import java.util.UUID;
import mineplex.serverdata.commands.ServerCommand;
public class TeamspeakUnlinkRequest extends ServerCommand
{
private final UUID _caller;
private final int _id;
public TeamspeakUnlinkRequest(UUID caller, int id)
{
this._caller = caller;
this._id = id;
}
public UUID getCaller()
{
return _caller;
}
public int getId()
{
return _id;
}
}

View File

@ -0,0 +1,33 @@
package mineplex.core.teamspeak.redis;
import com.google.gson.annotations.SerializedName;
import mineplex.serverdata.commands.ServerCommand;
public class TeamspeakUnlinkResponse extends ServerCommand
{
private final Response _response;
private final TeamspeakUnlinkRequest _request;
public TeamspeakUnlinkResponse(Response response, TeamspeakUnlinkRequest request)
{
this._response = response;
this._request = request;
}
public Response getResponse()
{
return _response;
}
public TeamspeakUnlinkRequest getRequest()
{
return _request;
}
public enum Response
{
@SerializedName(value = "unlinked")
UNLINKED
}
}

View File

@ -3,6 +3,7 @@ package mineplex.core.titles;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Arrays;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -37,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;
@ -70,6 +72,7 @@ import mineplex.core.itemstack.ItemBuilder;
import mineplex.core.packethandler.IPacketHandler;
import mineplex.core.packethandler.PacketHandler;
import mineplex.core.packethandler.PacketInfo;
import mineplex.core.titles.commands.GiveTrackCommand;
import mineplex.core.titles.commands.TrackCommand;
import mineplex.core.titles.tracks.Track;
import mineplex.core.titles.tracks.TrackFormat;
@ -301,21 +304,7 @@ public class Titles extends MiniDbClientPlugin<TitleData> implements IPacketHand
tracks.removeIf(track -> track.getRequirements().getTier(player) == null && track.hideIfUnowned());
tracks.sort((a, b) ->
{
if (a.hideIfUnowned() && !b.hideIfUnowned())
{
return -1;
}
else if (!a.hideIfUnowned() && b.hideIfUnowned())
{
return 1;
}
else
{
return a.getShortName().compareTo(b.getShortName());
}
});
tracks.sort(Comparator.comparing(Track::getShortName));
String bookTitle = C.cGreen + "Titles";
@ -762,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

@ -0,0 +1,79 @@
package mineplex.core.titles.commands;
import java.util.List;
import java.util.stream.Collectors;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import mineplex.core.command.CommandBase;
import mineplex.core.common.Rank;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.titles.tracks.ItemizedTrack;
import mineplex.core.titles.tracks.Track;
import mineplex.core.titles.tracks.TrackManager;
public class GiveTrackCommand extends CommandBase<TrackManager>
{
public GiveTrackCommand(TrackManager plugin)
{
super(plugin, Rank.ADMIN, "givetrack" );
}
@Override
public void Execute(Player caller, String[] args)
{
if (args.length < 2)
{
UtilPlayer.message(caller, F.help("/givetrack <player> <trackid>", "Give a player an unlockable track", GetRequiredRank()));
return;
}
String player = args[0];
String track = args[1];
Track trackObj = Plugin.getTrackById(track);
if (trackObj == null)
{
UtilPlayer.message(caller, F.main(Plugin.getName(), "That is not a track" ));
return;
}
if (!(trackObj instanceof ItemizedTrack))
{
UtilPlayer.message(caller, F.main(Plugin.getName(), "That is not an unlockable track" ));
return;
}
Plugin.unlockTrack(player, track, result -> {
switch (result)
{
case PLAYER_NOT_FOUND:
UtilPlayer.message(caller, F.main(Plugin.getName(), "That player has never joined Mineplex!"));
break;
case UNKNOWN_ERROR:
UtilPlayer.message(caller, F.main(Plugin.getName(), "Oops. Something has gone wrong while giving " + F.elem(player) + " the track " + F.elem(track) + "!"));
break;
case SUCCESS:
UtilPlayer.message(caller, F.main(Plugin.getName(), "Successfully gave " + F.elem(player) + " the track " + F.elem(track) + "!"));
break;
}
});
}
@Override
public List<String> onTabComplete(CommandSender sender, String commandLabel, String[] args)
{
if (args.length == 1)
{
return tabCompletePlayerNames(sender, args);
}
if (args.length == 2)
{
return getMatches(args[1], Plugin.getAllTracks().stream().filter(track -> track instanceof ItemizedTrack).map(Track::getId).collect(Collectors.toList()));
}
return null;
}
}

View File

@ -1,5 +1,8 @@
package mineplex.core.titles.commands;
import java.util.List;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import mineplex.core.Managers;
@ -10,6 +13,7 @@ import mineplex.core.common.Rank;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.titles.Titles;
import mineplex.core.titles.tracks.ItemizedTrack;
import mineplex.core.titles.tracks.Track;
import mineplex.core.titles.tracks.TrackManager;
@ -52,4 +56,17 @@ public class TrackCommand extends CommandBase<Titles>
}
Plugin.setOrToggleTrackForPlayer(caller, track, args.length > 1);
}
@Override
public List<String> onTabComplete(CommandSender sender, String commandLabel, String[] args)
{
if (args.length == 1)
{
if (sender instanceof Player)
{
return getMatches(args[0], _trackManager.getAllTracks().stream().filter(track -> track.getRequirements().getTier((Player) sender) != null).map(Track::getId));
}
}
return null;
}
}

View File

@ -0,0 +1,35 @@
package mineplex.core.titles.tracks;
import net.md_5.bungee.api.ChatColor;
import org.bukkit.entity.Player;
import mineplex.core.Managers;
import mineplex.core.inventory.InventoryManager;
public class ItemizedTrack extends Track
{
private final InventoryManager _inventoryManager = Managers.require(InventoryManager.class);
public ItemizedTrack(String trackId, String shortName, String description, boolean hideIfUnowned)
{
super(trackId, shortName, description, hideIfUnowned);
special();
}
public ItemizedTrack(String trackId, ChatColor color, String shortName, String longName, String description)
{
super(trackId, color, shortName, longName, description);
special();
}
public ItemizedTrack(String trackId, ChatColor color, String shortName, String longName, String description, boolean hideIfUnowned)
{
super(trackId, color, shortName, longName, description, hideIfUnowned);
special();
}
public boolean owns(Player player) {
return _inventoryManager.Get(player).getItemCount("track." + getId()) > 0;
}
}

View File

@ -50,7 +50,7 @@ public class Track implements Listener
{
// Book limits
Validate.isTrue(shortName.length() <= 16, "Short name cannot be longer than 16 characters");
Validate.isTrue(trackId.length() <= 16, "ID cannot be longer than 16 characters");
Validate.isTrue(trackId.length() <= 32, "ID cannot be longer than 32 characters");
this._id = trackId;
this._shortName = shortName;

View File

@ -5,9 +5,42 @@ import java.util.HashMap;
import java.util.LinkedHashMap;
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;
import org.bukkit.entity.Player;
import mineplex.core.MiniPlugin;
import mineplex.core.ReflectivelyCreateMiniPlugin;
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.util.Callback;
import mineplex.core.inventory.InventoryManager;
import mineplex.core.titles.commands.GiveTrackCommand;
import mineplex.core.titles.tracks.award.Bridges2017Track;
import mineplex.core.titles.tracks.custom.DongerTrack;
import mineplex.core.titles.tracks.custom.EarlyBirdTrack;
import mineplex.core.titles.tracks.custom.HappyGaryTrack;
import mineplex.core.titles.tracks.custom.LeaderTrack;
import mineplex.core.titles.tracks.custom.SnekTrack;
import mineplex.core.titles.tracks.custom.TableFlipTrack;
import mineplex.core.titles.tracks.custom.TrackBuilder;
import mineplex.core.titles.tracks.custom.WizardTrack;
import mineplex.core.titles.tracks.standard.GemCollectorTrack;
import mineplex.core.titles.tracks.standard.HolidayCheerTrack;
import mineplex.core.titles.tracks.standard.LevelerTrack;
import mineplex.core.titles.tracks.standard.LuckyTrack;
import mineplex.core.titles.tracks.standard.MineplexMasteryTrack;
import mineplex.core.titles.tracks.standard.PartyAnimalTrack;
import mineplex.core.titles.tracks.standard.PeacefulTrack;
import mineplex.core.titles.tracks.standard.PerfectionistTrack;
import mineplex.core.titles.tracks.standard.PowerPlayTrack;
import mineplex.core.titles.tracks.standard.SweetToothTrack;
import mineplex.core.titles.tracks.standard.TreasureHunterTrack;
import mineplex.core.titles.tracks.standard.UnluckyTrack;
import mineplex.core.titles.tracks.standard.WarriorTrack;
@ReflectivelyCreateMiniPlugin
public class TrackManager extends MiniPlugin
@ -15,6 +48,9 @@ public class TrackManager extends MiniPlugin
private final Map<Class<? extends Track>, Track> _registeredTracks = new LinkedHashMap<>();
private final Map<String, Track> _trackById = new HashMap<>();
private final InventoryManager _inventoryManager = require(InventoryManager.class);
private final CoreClientManager _coreClientManager = require(CoreClientManager.class);
private TrackManager()
{
super("Track Manager");
@ -42,10 +78,73 @@ public class TrackManager extends MiniPlugin
// registerTrack(new SurvivorTrack());
registerTrack(new LevelerTrack());
registerTrack(new PerfectionistTrack());
// Awarded tracks
registerTrack(new Bridges2017Track());
registerTrack(new AprilFools2017Track());
// Custom tracks
// registerTrack(track("lenny", "Lenny", "( ͡° ͜ʖ ͡°)"));
// registerTrack(track("lenny-disgusted", "Disgusted Lenny", "( ͡ಠ ʖ̯ ͡ಠ)"));
// registerTrack(track("lenny-winking", "Winking Lenny", "( ͡~ ͜ʖ ͡°)"));
registerTrack(track("ayyye", "Ayyye", "(づ ̄ ³ ̄)づ"));
registerTrack(track("ameno", "Ameno", "༼ つ ◕_◕ ༽つ Gib me gems"));
// registerTrack(track("unknown", "Unknown", "(☞゚ヮ゚)☞"));
registerTrack(track("shrug", "Shrug", "¯\\_(ツ)_/¯"));
registerTrack(track("tableflip", "Tableflip", "(╯°□°)╯︵ ┻━┻"));
registerTrack(track("tablerespecter", "Table Respecter", "┬─┬ノ(ಠ_ಠ)"));
registerTrack(track("tableflip-disgusted", "Disgusted Flip", "Disgusted Tableflip", "(╯ಠ_ಠ╯︵ ┳━┳"));
// registerTrack(track("tableflip-donger", "Donger Flip", "ヽ༼ຈل͜ຈ༽ノ︵┻━┻"));
registerTrack(track("tableflip-enraged", "Enraged Flip", "(ノಠдಠ)ノ︵┻━┻"));
registerTrack(track("tableflip-riot", "Rioting Flip", "(┛◉Д◉)┛彡┻━┻"));
registerTrack(track("magician", "Magician", "(ノ◕ヮ◕)ノ*:・゚✧"));
registerTrack(track("teddy-bear", "Teddy Bear", "ʕ•ᴥ•ʔ"));
registerTrack(track("disgust", "Disgust", "ಠ_ಠ"));
registerTrack(track("old-man", "Old Man", "໒( •̀ ╭ ͟ʖ╮ •́ )७"));
registerTrack(track("jake", "Jake", "(❍ᴥ❍ʋ)"));
registerTrack(track("finn", "Finn", "| (• ◡•)|"));
registerTrack(track("finn-and-jake", "Finn 'n Jake", "| (• ◡•)| (❍ᴥ❍ʋ)"));
registerTrack(track("boxer", "Boxer", "(ง'̀-'́)ง"));
registerTrack(track0("zoidberg", "Zoidberg", "Why not?", "(\\/) (°,,°) (\\/)"));
registerTrack(track("crying", "Crying", "(ಥ﹏ಥ)"));
// registerTrack(track("unknown", "Unknown", "(◕‿◕✿)"));
registerTrack(track("fireball", "Fireball", "༼つಠ益ಠ༽つ ─=≡ΣO))"));
registerTrack(track("stardust", "Stardust", "(つ◕౪◕)つ━☆゚.*・。゚"));
registerTrack(track("magic-missile", "Magic Missile", "( °-°)シ ミ★ ミ☆"));
registerTrack(track("blow-a-kiss", "Blowing a Kiss", "♡(´ε` )"));
registerTrack(track("pewpewpew", "PEWPEWPEW", "(☞^o^)☞"));
// registerTrack(track("pewpew", "pew pew", "(☞゚ヮ゚)☞"));
registerTrack(track("cool-guy", "Cool Guy", "(⌐■_■)"));
// registerTrack(track("unknown", "Unknown", "(ง •̀ω•́)ง✧"));
// registerTrack(track("unknown", "Unknown", "(╯⊙ ⊱ ⊙╰ )"));
registerTrack(track("party-time", "Party Time", "♪~ ᕕ(ᐛ)ᕗ"));
registerTrack(track1("whats-a-liter", "What's a Liter?", "also wats a leader"));
registerTrack(animatedTrack("deal-with-it", "Deal With It", "(⌐■_■)", "( •_•);( •_•)>⌐■-■;(⌐■_■);( •_•)>⌐■-■", 5));
registerTrack(animatedTrack("this-guy", "This Guy", "(☞゚ヮ゚)☞", "(☞゚ヮ゚)☞;☜(゚ヮ゚☜)", 5));
registerTrack(animatedTrack("lalala", "La La La", "♪┏(・o・) ┛", "♪┏(・o・) ┛;♪┗ ( ・o・) ┓♪;┏ ( ・o・) ┛♪;┗ (・o・ ) ┓♪;┏(・o・)┛♪", 1));
registerTrack(animatedTrack("gotta-go", "Gotta Go", "┬┴┬┴┤(・_├┬┴┬┴", "┬┴┬┴┤(・_├┬┴┬┴;┬┴┬┴┤ (・├┬┴┬┴;┬┴┬┴┤ (├┬┴┬┴;┬┴┬┴┤ (・├┬┴┬┴", 5));
// registerTrack(animatedTrack("unknown", "Unknown", "o°▽°)o", "o°▽°)o;(o_△_)o;(o°▽°)o", 5));
registerTrack(animatedTrack("rolling-around", "Rolling Around", "(゚‐゚)", "(.-.);(:I );(゚‐゚);( I:)", 4));
// registerTrack(animatedTrack("unknown", "Unknown", "('ω')", "('ω');( ε: );(.ω.);( :3 );('ω');( ε: );(.ω.);( :3 )", 5));
// registerTrack(animatedTrack("whee", "Whee", "(゚ー゚)", "(゚ー゚);( ゚ー);( ゚);(  );(゚ );(ー゚ );(゚ー゚)", 1));
// registerTrack(animatedTrack("lets-spin", "Let's Spin", "I Say, Let's Spin", "(・ω・)", "( ・ω);( ・);( );(・ );(ω・ );(・ω・)", 1));
// registerTrack(animatedTrack("unknown", "Unknown", "(^∀^)", "(^∀^);( ^∀);( ^);(  );(^ );(∀^ );(^∀^)", 5));
registerTrack(animatedTrack("whaaat", "Whaaaaaat?", "(°o°)", "(°o°);(°o。);(。o。);(。o°);(°o°);(°o。);(。o。);(。o°)", 5));
// registerTrack(animatedTrack("spinning", "Spinning", "(゚◇゚)", "(゚◇゚);( ゚◇);( ゚);(  );(゚ );(◇゚ );(゚◇", 5));
// registerTrack(animatedTrack("unknown", "Unknown", "(・∇・)", "(・∇・);( ・∇);( ・);(  );(・ );(∇・ );(・∇・)", 5));
}
@Override
public void addCommands()
{
addCommand(new GiveTrackCommand(this));
}
private void registerTrack(Track track)
{
if (_trackById.containsKey(track.getId()))
throw new IllegalArgumentException("Duplicate id: " + track.getId());
_registeredTracks.put(track.getClass(), track);
_trackById.put(track.getId(), track);
}
@ -62,6 +161,144 @@ public class TrackManager extends MiniPlugin
public final List<Track> getAllTracks()
{
return new ArrayList<>(_registeredTracks.values());
return new ArrayList<>(_trackById.values());
}
public boolean hasTrack(Player player, Track track)
{
return _inventoryManager.Get(player).getItemCount("track." + track.getId()) > 0;
}
public void unlockTrack(Player player, Track track)
{
unlockTrack(player, track, null);
}
public void unlockTrack(Player player, Track track, Consumer<TrackGiveResult> consumer)
{
unlockTrack(player.getName(), track.getId(), consumer);
}
public void unlockTrack(String player, String track, Consumer<TrackGiveResult> consumer)
{
_coreClientManager.getOrLoadClient(player, client ->
{
if (client == null)
{
if (consumer != null)
consumer.accept(TrackGiveResult.PLAYER_NOT_FOUND);
return;
}
runAsync(() ->
{
Callback<Boolean> successCallback = success ->
{
if (success)
{
if (consumer != null)
consumer.accept(TrackGiveResult.SUCCESS);
}
else
{
if (consumer != null)
consumer.accept(TrackGiveResult.UNKNOWN_ERROR);
}
};
Player playerObj = Bukkit.getPlayer(client.getUniqueId());
if (playerObj != null)
{
_inventoryManager.addItemToInventory(successCallback, playerObj, "track." + track, 1);
}
else
{
_inventoryManager.addItemToInventoryForOffline(successCallback, client.getAccountId(), "track." + track, 1);
}
});
});
}
public enum TrackGiveResult
{
PLAYER_NOT_FOUND,
UNKNOWN_ERROR,
SUCCESS
}
// Begin helper methods
private ItemizedTrack animatedTrack(String id, String name, String desc, String frames, int ticks)
{
return TrackBuilder.builder(id)
.withShortName(name)
.withDescription(desc)
.setFrames(frames.split(";"))
.setTicks(ticks)
.withColor(ChatColor.GOLD)
.setHideIfUnowned(true)
.build();
}
private ItemizedTrack animatedTrack(String id, String name, String longName, String desc, String frames, int ticks)
{
return TrackBuilder.builder(id)
.withShortName(name)
.withLongName(longName)
.withDescription(desc)
.setFrames(frames.split(";"))
.setTicks(ticks)
.withColor(ChatColor.GOLD)
.setHideIfUnowned(true)
.build();
}
private ItemizedTrack track(String id, String name, String tierName)
{
return TrackBuilder.builder(id)
.withShortName(name)
.withDescription(tierName)
.setTierName(tierName)
.withColor(ChatColor.GOLD)
.setTierColor(ChatColor.GOLD)
.setHideIfUnowned(true)
.build();
}
private ItemizedTrack track0(String id, String shortName, String desc, String tierName)
{
return TrackBuilder.builder(id)
.withShortName(shortName)
.withDescription(desc)
.setTierName(tierName)
.withColor(ChatColor.GOLD)
.setTierColor(ChatColor.GOLD)
.setHideIfUnowned(true)
.build();
}
private ItemizedTrack track1(String id, String name, String desc)
{
return TrackBuilder.builder(id)
.withShortName(name)
.withDescription(desc)
.setTierName(name)
.withColor(ChatColor.GOLD)
.setTierColor(ChatColor.GOLD)
.setHideIfUnowned(true)
.build();
}
private ItemizedTrack track(String id, String shortName, String longName, String tierName)
{
return TrackBuilder.builder(id)
.withShortName(shortName)
.withLongName(longName)
.withDescription(tierName)
.setTierName(tierName)
.withColor(ChatColor.GOLD)
.setTierColor(ChatColor.GOLD)
.setHideIfUnowned(true)
.build();
}
}

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

@ -0,0 +1,31 @@
package mineplex.core.titles.tracks.award;
import net.md_5.bungee.api.ChatColor;
import mineplex.core.titles.tracks.TrackFormat;
import mineplex.core.titles.tracks.TrackTier;
import mineplex.core.titles.tracks.ItemizedTrack;
public class Bridges2017Track extends ItemizedTrack
{
public Bridges2017Track()
{
super(
"tournament-br-2017",
ChatColor.GOLD,
"BotB 2017",
"2017 Bridges Champion",
"This track is awarded to the winners of the 2017 BotB Tournament",
true);
special();
getRequirements()
.addTier(new TrackTier(
"2017 Bridges Champion",
null,
this::owns,
new TrackFormat(ChatColor.GOLD, ChatColor.GOLD)
));
}
}

View File

@ -1,4 +1,4 @@
package mineplex.core.titles.tracks;
package mineplex.core.titles.tracks.custom;
import java.util.Set;
@ -6,6 +6,10 @@ import net.md_5.bungee.api.ChatColor;
import com.google.common.collect.Sets;
import mineplex.core.titles.tracks.Track;
import mineplex.core.titles.tracks.TrackFormat;
import mineplex.core.titles.tracks.TrackTier;
public class DongerTrack extends Track
{
private static final Set<String> OWNERS = Sets.newHashSet(
@ -13,7 +17,7 @@ public class DongerTrack extends Track
"a20d59d1-cfd8-4116-ac27-45d9c7eb4a97"
);
protected DongerTrack()
public DongerTrack()
{
super("donger", ChatColor.AQUA, "Donger", "Donger", "ヽ༼ຈل͜ຈ༽ノ", true);
special();

View File

@ -1,4 +1,4 @@
package mineplex.core.titles.tracks;
package mineplex.core.titles.tracks.custom;
import java.sql.ResultSet;
import java.sql.SQLException;
@ -15,12 +15,15 @@ import com.google.common.collect.Sets;
import mineplex.core.Managers;
import mineplex.core.account.CoreClientManager;
import mineplex.core.account.ILoginProcessor;
import mineplex.core.titles.tracks.Track;
import mineplex.core.titles.tracks.TrackFormat;
import mineplex.core.titles.tracks.TrackTier;
public class EarlyBirdTrack extends Track
{
private final Set<UUID> _wonEternal = Sets.newConcurrentHashSet();
protected EarlyBirdTrack()
public EarlyBirdTrack()
{
super("early-bird", ChatColor.AQUA, "Early Bird", "Early Bird", "This track is unlocked by receiving the Eternal rank from chickens in the 2016 Thanksgiving Event", true);
special();

View File

@ -1,4 +1,4 @@
package mineplex.core.titles.tracks;
package mineplex.core.titles.tracks.custom;
import java.util.Set;
@ -9,12 +9,15 @@ import com.google.common.collect.Sets;
import mineplex.core.Managers;
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.Rank;
import mineplex.core.titles.tracks.Track;
import mineplex.core.titles.tracks.TrackFormat;
import mineplex.core.titles.tracks.TrackTier;
public class HappyGaryTrack extends Track
{
private final CoreClientManager _coreClientManager = Managers.require(CoreClientManager.class);
protected HappyGaryTrack()
public HappyGaryTrack()
{
super("happygary", ChatColor.GOLD, "Happy Gary", "Happy Gary", "", true);
special();

View File

@ -1,16 +1,19 @@
package mineplex.core.titles.tracks;
package mineplex.core.titles.tracks.custom;
import net.md_5.bungee.api.ChatColor;
import mineplex.core.Managers;
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.Rank;
import mineplex.core.titles.tracks.Track;
import mineplex.core.titles.tracks.TrackFormat;
import mineplex.core.titles.tracks.TrackTier;
public class LeaderTrack extends Track
{
private final CoreClientManager _coreClientManager = Managers.require(CoreClientManager.class);
protected LeaderTrack()
public LeaderTrack()
{
super("leader", ChatColor.DARK_RED, "Leader", "What's a Leader?", "also wat does dev mean", true);
special();

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