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(); loadLobbyServers();
_plugin.getProxy().getPluginManager().registerListener(_plugin, this); _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 @EventHandler

View File

@ -36,7 +36,7 @@ public class PlayerCount implements Listener, Runnable
_region = !new File("eu.dat").exists() ? Region.US : Region.EU; _region = !new File("eu.dat").exists() ? Region.US : Region.EU;
_plugin = plugin; _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); _plugin.getProxy().getPluginManager().registerListener(_plugin, this);
_listenerInfo = _plugin.getProxy().getConfigurationAdapter().getListeners().iterator().next(); _listenerInfo = _plugin.getProxy().getConfigurationAdapter().getListeners().iterator().next();

View File

@ -44,7 +44,7 @@ public class FacebookButton implements GuiItem
{ {
_player.closeInventory(); _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() private boolean isAvailable()
@ -64,14 +64,14 @@ public class FacebookButton implements GuiItem
bonus.setAncientChests(10); bonus.setAncientChests(10);
bonus.addLore(lore); bonus.addLore(lore);
lore.add(" "); lore.add(" ");
lore.add(C.cGreen + "Click to like us on Facebook!"); lore.add(C.cGreen + "Click to visit us on Facebook!");
return ItemStackFactory.Instance.CreateStack(Material.WATER_BUCKET, (byte) 0, 1, C.cGreen + C.Bold + "Like on Facebook", lore); return ItemStackFactory.Instance.CreateStack(Material.WATER_BUCKET, (byte) 0, 1, C.cGreen + C.Bold + "Visit us on Facebook", lore);
} }
else else
{ {
lore.add(" "); lore.add(" ");
lore.add(C.cWhite + "You have already claimed the Facebook reward!"); 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) public void filterChat(AsyncPlayerChatEvent event)
{ {
// Dirty hack
if (getPlugin().getName().contains("Clans"))
return;
if (event.isCancelled()) if (event.isCancelled())
return; return;
if (event.isAsynchronous()) if (event.isAsynchronous())
{ {
String filteredMessage = getFilteredMessage(event.getPlayer(), event.getMessage()); event.setMessage(getFilteredMessage(event.getPlayer(), event.getMessage()));
for (Player onlinePlayer : event.getRecipients())
{
onlinePlayer.sendMessage(String.format(event.getFormat(), event.getPlayer().getDisplayName(), filteredMessage));
}
event.setCancelled(true);
} }
} }
@ -300,7 +289,7 @@ public class Chat extends MiniPlugin
} }
} }
@EventHandler(priority = EventPriority.NORMAL) @EventHandler(priority = EventPriority.LOW)
public void HandleChat(AsyncPlayerChatEvent event) public void HandleChat(AsyncPlayerChatEvent event)
{ {
if (event.isCancelled()) 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.F;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.facebook.FacebookManager; import mineplex.core.facebook.FacebookManager;
import mineplex.core.recharge.Recharge;
public class FacebookCommand extends CommandBase<FacebookManager> public class FacebookCommand extends CommandBase<FacebookManager>
{ {
@ -25,6 +26,11 @@ public class FacebookCommand extends CommandBase<FacebookManager>
return; return;
} }
if (!Recharge.Instance.use(caller, "Facebook Command", 10000, true, false, false))
{
return;
}
Plugin.tryCode(caller, args[0]); Plugin.tryCode(caller, args[0]);
} }
} }

View File

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

View File

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

View File

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

View File

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

View File

@ -15,26 +15,7 @@ import mineplex.core.donation.DonationManager;
import mineplex.core.itemstack.ItemBuilder; import mineplex.core.itemstack.ItemBuilder;
import mineplex.core.shop.page.ShopPageBase; import mineplex.core.shop.page.ShopPageBase;
import mineplex.hub.server.ServerManager; import mineplex.hub.server.ServerManager;
import mineplex.hub.server.ui.button.SelectBETAButton; import mineplex.hub.server.ui.button.*;
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;
public class ServerGameMenu extends ShopPageBase<ServerManager, QuickShop> 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 + "The least correct builder is eliminated.",
C.Reset + "", C.Reset + "",
C.Reset + "Join " + ChatColor.GREEN + getPlugin().getGroupTagPlayerCount("SB") + C.Reset + " other players!", 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[] 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")); }).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", (_extraValue ? C.cAquaB : C.cWhiteB) + "FEATURED ARCADE GAME",
C.Reset + "", C.Reset + "",
@ -104,7 +85,7 @@ public class ServerGameMenu extends ShopPageBase<ServerManager, QuickShop>
C.Reset + "You decide", C.Reset + "You decide",
C.Reset + "", C.Reset + "",
C.Reset + "Join " + C.cGreen + getPlugin().getGroupTagPlayerCount("MB") + C.Reset + " other players!" 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[] 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); getPlugin().getSurvivalGamesShop().attemptShopOpen(player);
} }
public void OpenSB(Player player)
{
getPlugin().getSpeedBuildersShop().attemptShopOpen(player);
}
public void openDMT(Player player) public void openDMT(Player player)
{ {
getPlugin().getDrawMyThingShop().attemptShopOpen(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.Lobbers);
ultraGames.add(GameType.Evolution); ultraGames.add(GameType.Evolution);
ultraGames.add(GameType.MonsterMaze); ultraGames.add(GameType.MonsterMaze);
ultraGames.add(GameType.Gladiators);
//Hero Games //Hero Games
heroGames.add(GameType.ChampionsDominate); heroGames.add(GameType.ChampionsDominate);
@ -114,6 +115,7 @@ public class GameHostManager implements Listener
legendGames.add(GameType.UHC); legendGames.add(GameType.UHC);
legendGames.add(GameType.MineStrike); legendGames.add(GameType.MineStrike);
legendGames.add(GameType.Skywars); legendGames.add(GameType.Skywars);
legendGames.add(GameType.SpeedBuilders);
// Team variants - Currently being remade. // Team variants - Currently being remade.
/* /*
legendGames.add(GameType.DragonEscapeTeams); legendGames.add(GameType.DragonEscapeTeams);