Merge branch 'clans/alpha' of http://184.154.0.242:7990/scm/min/mineplex into clans/alpha

This commit is contained in:
phobia 2016-01-30 19:24:42 +11:00
commit 4612550ba5
13 changed files with 92 additions and 82 deletions

View File

@ -38,7 +38,7 @@ public class LobbyBalancer implements Listener, Runnable
loadLobbyServers();
_plugin.getProxy().getPluginManager().registerListener(_plugin, this);
_plugin.getProxy().getScheduler().schedule(_plugin, this, 250L, 250L, TimeUnit.MILLISECONDS);
_plugin.getProxy().getScheduler().schedule(_plugin, this, 2L, 2L, TimeUnit.SECONDS);
}
@EventHandler

View File

@ -36,7 +36,7 @@ public class PlayerCount implements Listener, Runnable
_region = !new File("eu.dat").exists() ? Region.US : Region.EU;
_plugin = plugin;
_plugin.getProxy().getScheduler().schedule(_plugin, this, 500L, 500L, TimeUnit.MILLISECONDS);
_plugin.getProxy().getScheduler().schedule(_plugin, this, 4L, 4L, TimeUnit.SECONDS);
_plugin.getProxy().getPluginManager().registerListener(_plugin, this);
_listenerInfo = _plugin.getProxy().getConfigurationAdapter().getListeners().iterator().next();

View File

@ -23,14 +23,14 @@ public enum Rank
MAPLEAD("MapLead", ChatColor.BLUE, "Map Leaders are leaders of the Mineplex Build Team. \nThey oversee the creation of new maps and manage Builders."),
MAPDEV("Builder", ChatColor.BLUE, "Builders are members of the Mineplex Build Team. \nThey create many of the maps used across Mineplex."),
MEDIA("Media", ChatColor.BLUE, "The Media rank is given to talented artists who are\n endorsed to create content for Mineplex."),
EVENT("Event", ChatColor.WHITE, "A member of the official Mineplex Events team!"),
//Media
YOUTUBE("YouTube", ChatColor.RED, "A YouTuber who creates content for \nor related to Mineplex."),
YOUTUBE_SMALL("YT", ChatColor.DARK_PURPLE, "A YouTuber who creates content for \nor related to Mineplex. \n\nThey have fewer subscribers than full YouTubers."),
TWITCH("Twitch", ChatColor.DARK_PURPLE, "A Twitch streamer who often features \nMineplex in their streams."),
//Player
TITAN("Titan", ChatColor.RED, true, "Ancient myths spoke of a gigantic being \nwith immense power... \n\nPurchase Titan at www.mineplex.com/shop"),
LEGEND("Legend", ChatColor.GREEN, true, "Mineplex's third premium rank. \n\nPurchase Legend at www.mineplex.com/shop"),
@ -41,9 +41,9 @@ public enum Rank
private ChatColor _color;
private boolean _donor;
private String _description;
public String Name;
Rank(String name, ChatColor color, String description)
{
_color = color;
@ -51,7 +51,7 @@ public enum Rank
_donor = false;
_description = description;
}
Rank(String name, ChatColor color, boolean donor, String description)
{
_color = color;
@ -59,7 +59,7 @@ public enum Rank
_donor = donor;
_description = description;
}
public String getDescription()
{
return _description;
@ -72,18 +72,18 @@ public enum Rank
return Name;
}
public boolean has(Rank rank)
{
return has(null, rank, false);
}
public boolean has(Player player, Rank rank, boolean inform)
public boolean has(Player player, Rank rank, boolean inform)
{
return has(player, rank, null, inform);
}
public boolean has(Player player, Rank rank, Rank[] specific, boolean inform)
public boolean has(Player player, Rank rank, Rank[] specific, boolean inform)
{
//Specific Rank
if (specific != null)
@ -94,43 +94,43 @@ public enum Rank
{
return true;
}
}
}
}
//
if (compareTo(rank) <= 0)
return true;
if (inform)
{
UtilPlayer.message(player, C.mHead + "Permissions> " +
C.mBody + "This requires Permission Rank [" +
UtilPlayer.message(player, C.mHead + "Permissions> " +
C.mBody + "This requires Permission Rank [" +
C.mHead + rank.Name.toUpperCase() +
C.mBody + "].");
}
return false;
}
public String getTag(boolean bold, boolean uppercase)
{
if (Name.equalsIgnoreCase("ALL"))
return "";
String name = Name;
if (uppercase)
name = Name.toUpperCase();
if (bold) return _color + C.Bold + name;
else return _color + name;
}
public ChatColor getColor()
{
return _color;
}
public boolean isDonor()
public boolean isDonor()
{
return _donor;
}

View File

@ -44,7 +44,7 @@ public class FacebookButton implements GuiItem
{
_player.closeInventory();
new JsonMessage(C.cAquaB + "Click here to claim Facebook Prize!").click(ClickEvent.OPEN_URL, "https://www.facebook.com/MineplexGames/").sendToPlayer(_player);
new JsonMessage(C.cAquaB + "Click here to claim Facebook Prize!").click(ClickEvent.OPEN_URL, "https://www.facebook.com/MineplexGames/app/185301094822359/").sendToPlayer(_player);
}
private boolean isAvailable()
@ -64,14 +64,14 @@ public class FacebookButton implements GuiItem
bonus.setAncientChests(10);
bonus.addLore(lore);
lore.add(" ");
lore.add(C.cGreen + "Click to like us on Facebook!");
return ItemStackFactory.Instance.CreateStack(Material.WATER_BUCKET, (byte) 0, 1, C.cGreen + C.Bold + "Like on Facebook", lore);
lore.add(C.cGreen + "Click to visit us on Facebook!");
return ItemStackFactory.Instance.CreateStack(Material.WATER_BUCKET, (byte) 0, 1, C.cGreen + C.Bold + "Visit us on Facebook", lore);
}
else
{
lore.add(" ");
lore.add(C.cWhite + "You have already claimed the Facebook reward!");
return ItemStackFactory.Instance.CreateStack(Material.REDSTONE_BLOCK, (byte) 0, 1, ChatColor.RED + C.Bold + "Like on Facebook", lore);
return ItemStackFactory.Instance.CreateStack(Material.REDSTONE_BLOCK, (byte) 0, 1, ChatColor.RED + C.Bold + "Visit us on Facebook", lore);
}
}
}

View File

@ -232,26 +232,15 @@ public class Chat extends MiniPlugin
}
}
@EventHandler(priority = EventPriority.NORMAL)
@EventHandler(priority = EventPriority.LOWEST)
public void filterChat(AsyncPlayerChatEvent event)
{
// Dirty hack
if (getPlugin().getName().contains("Clans"))
return;
if (event.isCancelled())
return;
if (event.isAsynchronous())
{
String filteredMessage = getFilteredMessage(event.getPlayer(), event.getMessage());
for (Player onlinePlayer : event.getRecipients())
{
onlinePlayer.sendMessage(String.format(event.getFormat(), event.getPlayer().getDisplayName(), filteredMessage));
}
event.setCancelled(true);
event.setMessage(getFilteredMessage(event.getPlayer(), event.getMessage()));
}
}
@ -300,7 +289,7 @@ public class Chat extends MiniPlugin
}
}
@EventHandler(priority = EventPriority.NORMAL)
@EventHandler(priority = EventPriority.LOW)
public void HandleChat(AsyncPlayerChatEvent event)
{
if (event.isCancelled())

View File

@ -7,6 +7,7 @@ import mineplex.core.common.Rank;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.facebook.FacebookManager;
import mineplex.core.recharge.Recharge;
public class FacebookCommand extends CommandBase<FacebookManager>
{
@ -25,6 +26,11 @@ public class FacebookCommand extends CommandBase<FacebookManager>
return;
}
if (!Recharge.Instance.use(caller, "Facebook Command", 10000, true, false, false))
{
return;
}
Plugin.tryCode(caller, args[0]);
}
}

View File

@ -64,7 +64,7 @@ public class PlayerCountManager extends MiniPlugin
@EventHandler
public void refresh(UpdateEvent event)
{
if (event.getType() != UpdateType.SLOW)
if (event.getType() != UpdateType.SEC_08)
return;
runAsync(this::updatePlayerCount);

View File

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

View File

@ -638,20 +638,20 @@ public class HubManager extends MiniClientPlugin<HubClient>
}
else
{
// TextComponent rankComponent = new TextComponent(rankStr);
// TextComponent playerNameText = new TextComponent(ChatColor.YELLOW + playerName);
// TextComponent component = new TextComponent();
//
// rankComponent.setHoverEvent(new HoverEvent(Action.SHOW_TEXT, new ComponentBuilder(rank.getColor() + rank.getTag(true, true) + ChatColor.WHITE + ":\n" + rank.getDescription()).create()));
//
// component.setText(levelStr);
// component.addExtra(rankComponent);
// component.addExtra(playerNameText);
// component.addExtra(" " + ChatColor.WHITE + event.getMessage());
TextComponent rankComponent = new TextComponent(rankStr);
TextComponent playerNameText = new TextComponent(ChatColor.YELLOW + playerName);
TextComponent component = new TextComponent();
JsonMessage jsonMessage = new JsonMessage(levelStr)
.extra(JSONObject.escape(rankStr)).hover("show_text", rank.getColor() + rank.getTag(true, true) + ChatColor.WHITE + "\n" + rank.getDescription())
.add(JSONObject.escape(C.cYellow + playerName + " " + ChatColor.WHITE + event.getMessage()));
rankComponent.setHoverEvent(new HoverEvent(Action.SHOW_TEXT, new ComponentBuilder(rank.getColor() + rank.getTag(true, true) + ChatColor.WHITE + "\n" + rank.getDescription()).create()));
component.setText(levelStr);
component.addExtra(rankComponent);
component.addExtra(playerNameText);
component.addExtra(" " + ChatColor.WHITE + event.getMessage());
// JsonMessage jsonMessage = new JsonMessage(levelStr)
// .extra(JSONObject.escape(rankStr)).hover("show_text", rank.getColor() + rank.getTag(true, true) + ChatColor.WHITE + "\n" + rank.getDescription())
// .add(JSONObject.escape(C.cYellow + playerName + " " + ChatColor.WHITE + event.getMessage()));
for (Player other : UtilServer.getPlayers())
{
@ -664,8 +664,7 @@ public class HubManager extends MiniClientPlugin<HubClient>
// event.setMessage(event.getMessage());
// event.setFormat(levelStr + rankStr + C.cYellow + playerName + " " + C.cWhite + "%2$s");
if(!event.isCancelled())
jsonMessage.sendToPlayer(other);
other.spigot().sendMessage(component);
}
event.setCancelled(true);
}

View File

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

View File

@ -15,26 +15,7 @@ import mineplex.core.donation.DonationManager;
import mineplex.core.itemstack.ItemBuilder;
import mineplex.core.shop.page.ShopPageBase;
import mineplex.hub.server.ServerManager;
import mineplex.hub.server.ui.button.SelectBETAButton;
import mineplex.hub.server.ui.button.SelectBHButton;
import mineplex.hub.server.ui.button.SelectBLDButton;
import mineplex.hub.server.ui.button.SelectBRButton;
import mineplex.hub.server.ui.button.SelectCLANSButton;
import mineplex.hub.server.ui.button.SelectCSButton;
import mineplex.hub.server.ui.button.SelectCTFButton;
import mineplex.hub.server.ui.button.SelectDMTButton;
import mineplex.hub.server.ui.button.SelectDOMButton;
import mineplex.hub.server.ui.button.SelectFEATButton;
import mineplex.hub.server.ui.button.SelectMINButton;
import mineplex.hub.server.ui.button.SelectMSButton;
import mineplex.hub.server.ui.button.SelectPLAYERButton;
import mineplex.hub.server.ui.button.SelectSGButton;
import mineplex.hub.server.ui.button.SelectSKYButton;
import mineplex.hub.server.ui.button.SelectSSMButton;
import mineplex.hub.server.ui.button.SelectTDMButton;
import mineplex.hub.server.ui.button.SelectTWButton;
import mineplex.hub.server.ui.button.SelectUHCButton;
import mineplex.hub.server.ui.button.SelectWIZButton;
import mineplex.hub.server.ui.button.*;
public class ServerGameMenu extends ShopPageBase<ServerManager, QuickShop>
{
@ -80,7 +61,7 @@ public class ServerGameMenu extends ShopPageBase<ServerManager, QuickShop>
C.Reset + "The least correct builder is eliminated.",
C.Reset + "",
C.Reset + "Join " + ChatColor.GREEN + getPlugin().getGroupTagPlayerCount("SB") + C.Reset + " other players!",
}).setHideInfo(true).build(), new SelectTWButton(this));
}).setHideInfo(true).build(), new SelectSBButton(this));
/*
addButton(6, new ItemBuilder(Material.IRON_SWORD).setTitle(C.cYellowB + "Gladiators" + C.cGray + " Bracketted Deathmatch").addLore(new String[]
@ -95,7 +76,7 @@ public class ServerGameMenu extends ShopPageBase<ServerManager, QuickShop>
}).setHideInfo(true).build(), new SelectFEATButton(this, "Gladiators"));
*/
addButton(6, new ItemBuilder(Material.LAVA_BUCKET).setTitle(C.cYellowB + "Micro Battles" + C.cGray + " 4 Team Deathmatch").addLore(new String[]
addButton(6, new ItemBuilder(Material.LAVA_BUCKET).setTitle(C.cYellowB + "Micro Battle" + C.cGray + " 4 Team Deathmatch").addLore(new String[]
{
(_extraValue ? C.cAquaB : C.cWhiteB) + "FEATURED ARCADE GAME",
C.Reset + "",
@ -104,7 +85,7 @@ public class ServerGameMenu extends ShopPageBase<ServerManager, QuickShop>
C.Reset + "You decide",
C.Reset + "",
C.Reset + "Join " + C.cGreen + getPlugin().getGroupTagPlayerCount("MB") + C.Reset + " other players!"
}).setHideInfo(true).build(), new SelectFEATButton(this, "Gladiators"));
}).setHideInfo(true).build(), new SelectFEATButton(this, "Micro Battle"));
addButton(9, new ItemBuilder(Material.IRON_PICKAXE).setTitle(C.cYellowB + "The Bridges " + C.cGray + "4 Team Survival").addLore(new String[]
{
@ -636,6 +617,11 @@ public class ServerGameMenu extends ShopPageBase<ServerManager, QuickShop>
getPlugin().getSurvivalGamesShop().attemptShopOpen(player);
}
public void OpenSB(Player player)
{
getPlugin().getSpeedBuildersShop().attemptShopOpen(player);
}
public void openDMT(Player player)
{
getPlugin().getDrawMyThingShop().attemptShopOpen(player);

View File

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

View File

@ -96,6 +96,7 @@ public class GameHostManager implements Listener
ultraGames.add(GameType.Lobbers);
ultraGames.add(GameType.Evolution);
ultraGames.add(GameType.MonsterMaze);
ultraGames.add(GameType.Gladiators);
//Hero Games
heroGames.add(GameType.ChampionsDominate);
@ -114,6 +115,7 @@ public class GameHostManager implements Listener
legendGames.add(GameType.UHC);
legendGames.add(GameType.MineStrike);
legendGames.add(GameType.Skywars);
legendGames.add(GameType.SpeedBuilders);
// Team variants - Currently being remade.
/*
legendGames.add(GameType.DragonEscapeTeams);