Merge branch 'master' of ssh://184.154.0.242:7999/min/Mineplex
This commit is contained in:
commit
9880e9a3c7
@ -14,6 +14,7 @@ import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.disguise.DisguiseManager;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.gadget.event.GadgetActivateEvent;
|
||||
import mineplex.core.gadget.event.GadgetCollideEntityEvent;
|
||||
import mineplex.core.gadget.gadgets.ItemBatGun;
|
||||
import mineplex.core.gadget.gadgets.ItemCoinBomb;
|
||||
@ -63,6 +64,7 @@ import mineplex.core.gadget.types.OutfitGadget.ArmorSlot;
|
||||
import mineplex.core.gadget.types.ParticleGadget;
|
||||
import mineplex.core.inventory.InventoryManager;
|
||||
import mineplex.core.mount.MountManager;
|
||||
import mineplex.core.mount.event.MountActivateEvent;
|
||||
import mineplex.core.pet.PetManager;
|
||||
import mineplex.core.preferences.PreferencesManager;
|
||||
import mineplex.core.projectile.ProjectileManager;
|
||||
@ -91,6 +93,7 @@ public class GadgetManager extends MiniPlugin
|
||||
private BlockRestore _blockRestore;
|
||||
private ProjectileManager _projectileManager;
|
||||
private AchievementManager _achievementManager;
|
||||
private MountManager _mountManager;
|
||||
|
||||
private NautHashMap<GadgetType, List<Gadget>> _gadgets;
|
||||
|
||||
@ -99,6 +102,7 @@ public class GadgetManager extends MiniPlugin
|
||||
|
||||
private boolean _hideParticles = false;
|
||||
private int _activeItemSlot = 3;
|
||||
private boolean _gadgetsEnabled = true;
|
||||
|
||||
public GadgetManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager, InventoryManager inventoryManager,
|
||||
MountManager mountManager, PetManager petManager, PreferencesManager preferencesManager,
|
||||
@ -115,6 +119,7 @@ public class GadgetManager extends MiniPlugin
|
||||
_blockRestore = blockRestore;
|
||||
_projectileManager = projectileManager;
|
||||
_achievementManager = achievementManager;
|
||||
_mountManager = mountManager;
|
||||
|
||||
CreateGadgets();
|
||||
}
|
||||
@ -491,6 +496,40 @@ public class GadgetManager extends MiniPlugin
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean isGadgetEnabled()
|
||||
{
|
||||
return _gadgetsEnabled;
|
||||
}
|
||||
|
||||
public void toggleGadgetEnabled()
|
||||
{
|
||||
setGadgetEnabled(!_gadgetsEnabled);
|
||||
}
|
||||
|
||||
public void setGadgetEnabled(boolean enabled)
|
||||
{
|
||||
if (_gadgetsEnabled != enabled)
|
||||
{
|
||||
_gadgetsEnabled = enabled;
|
||||
DisableAll();
|
||||
_mountManager.DisableAll();
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void GadgetActivate(GadgetActivateEvent event)
|
||||
{
|
||||
if (!_gadgetsEnabled)
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void MountActivate(MountActivateEvent event)
|
||||
{
|
||||
if (!_gadgetsEnabled)
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void chissMeow(PlayerToggleSneakEvent event)
|
||||
|
@ -19,10 +19,10 @@ public enum GameDisplay
|
||||
DragonEscapeTeams("Dragon Escape Teams", Material.DRAGON_EGG, (byte)0, GameCategory.TEAM_VARIANT, 11),
|
||||
DragonRiders("Dragon Riders", Material.DRAGON_EGG, (byte)0, GameCategory.ARCADE, 12),
|
||||
Dragons("Dragons", Material.ENDER_STONE, (byte)0, GameCategory.ARCADE, 13),
|
||||
DragonsTeams("Dragons Teams", Material.ENDER_STONE, (byte)0, GameCategory.TEAM_VARIANT, 14),
|
||||
DragonsTeams("Dragons Teams", Material.DRAGON_EGG, (byte)0, GameCategory.TEAM_VARIANT, 14),
|
||||
Draw("Draw My Thing", Material.BOOK_AND_QUILL, (byte)0, GameCategory.CLASSICS, 15),
|
||||
Evolution("Evolution", Material.EMERALD, (byte)0, GameCategory.ARCADE, 16),
|
||||
Gravity("Gravity", Material.ENDER_PORTAL, (byte)0, GameCategory.EXTRA, 18),
|
||||
Gravity("Gravity", Material.ENDER_PORTAL_FRAME, (byte)0, GameCategory.EXTRA, 18),
|
||||
Halloween("Halloween Horror", Material.PUMPKIN, (byte)0, GameCategory.CLASSICS, 19),
|
||||
HideSeek("Block Hunt", Material.GRASS, (byte)0, GameCategory.CLASSICS, 20),
|
||||
HoleInTheWall("Hole in the Wall", Material.STAINED_GLASS, (byte) 2, GameCategory.ARCADE, 52),
|
||||
|
@ -10,6 +10,7 @@ import mineplex.core.message.MessageManager;
|
||||
import mineplex.serverdata.commands.AnnouncementCommand;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class AnnounceCommand extends CommandBase<MessageManager>
|
||||
@ -22,13 +23,25 @@ public class AnnounceCommand extends CommandBase<MessageManager>
|
||||
@Override
|
||||
public void Execute(Player caller, String[] args)
|
||||
{
|
||||
if (args == null || args.length == 0)
|
||||
if (args == null || args.length <= 1)
|
||||
{
|
||||
Plugin.Help(caller);
|
||||
}
|
||||
else
|
||||
{
|
||||
new AnnouncementCommand(true, F.combine(args, 0, null, false)).publish();
|
||||
Rank rank = Rank.ALL;
|
||||
|
||||
try
|
||||
{
|
||||
rank = Rank.valueOf(args[0]);
|
||||
}
|
||||
catch (IllegalArgumentException ex)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main(Plugin.getName(), ChatColor.RED + "" + ChatColor.BOLD + "Invalid rank!"));
|
||||
return;
|
||||
}
|
||||
|
||||
new AnnouncementCommand(true, rank.toString(), F.combine(args, 1, null, false)).publish();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,7 @@
|
||||
package mineplex.core.message.redis;
|
||||
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
@ -13,20 +15,41 @@ import org.bukkit.entity.Player;
|
||||
|
||||
public class AnnouncementHandler implements CommandCallback
|
||||
{
|
||||
private CoreClientManager _clientManager;
|
||||
|
||||
public AnnouncementHandler(CoreClientManager clientManager)
|
||||
{
|
||||
_clientManager = clientManager;
|
||||
}
|
||||
|
||||
public void run(ServerCommand command)
|
||||
{
|
||||
if (command instanceof AnnouncementCommand)
|
||||
{
|
||||
AnnouncementCommand announcementCommand = (AnnouncementCommand)command;
|
||||
|
||||
|
||||
Rank rank;
|
||||
try
|
||||
{
|
||||
rank = Rank.valueOf(announcementCommand.getRank());
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
return;
|
||||
}
|
||||
|
||||
String message = announcementCommand.getMessage();
|
||||
|
||||
if (announcementCommand.getDisplayTitle())
|
||||
UtilTextMiddle.display(C.cYellow + "Announcement", message, 10, 120, 10);
|
||||
|
||||
for (Player player : Bukkit.getOnlinePlayers())
|
||||
{
|
||||
UtilPlayer.message(player, F.main("Announcement", C.cAqua + message));
|
||||
if (_clientManager.hasRank(player, rank))
|
||||
{
|
||||
if (announcementCommand.getDisplayTitle())
|
||||
UtilTextMiddle.display(C.cYellow + "Announcement", message, 10, 120, 10, player);
|
||||
|
||||
UtilPlayer.message(player, F.main("Announcement", C.cAqua + message));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -28,14 +28,12 @@ import mineplex.core.disguise.DisguiseManager;
|
||||
import mineplex.core.disguise.disguises.DisguiseSlime;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.gadget.GadgetManager;
|
||||
import mineplex.core.gadget.event.GadgetActivateEvent;
|
||||
import mineplex.core.gadget.event.GadgetCollideEntityEvent;
|
||||
import mineplex.core.giveaway.GiveawayManager;
|
||||
import mineplex.core.hologram.HologramManager;
|
||||
import mineplex.core.inventory.InventoryManager;
|
||||
import mineplex.core.message.PrivateMessageEvent;
|
||||
import mineplex.core.mount.MountManager;
|
||||
import mineplex.core.mount.event.MountActivateEvent;
|
||||
import mineplex.core.notifier.NotificationManager;
|
||||
import mineplex.core.npc.NpcManager;
|
||||
import mineplex.core.packethandler.PacketHandler;
|
||||
@ -161,9 +159,6 @@ public class HubManager extends MiniClientPlugin<HubClient>
|
||||
|
||||
private HashMap<String, ArrayList<String>> _creativeAdmin = new HashMap<String, ArrayList<String>>();
|
||||
|
||||
//Admin
|
||||
private boolean _gadgetsEnabled = true;
|
||||
|
||||
public HubManager(JavaPlugin plugin, BlockRestore blockRestore, CoreClientManager clientManager, DonationManager donationManager, InventoryManager inventoryManager, ConditionManager conditionManager, DisguiseManager disguiseManager, TaskManager taskManager, Portal portal, PartyManager partyManager, PreferencesManager preferences, PetManager petManager, PollManager pollManager, StatsManager statsManager, AchievementManager achievementManager, HologramManager hologramManager, NpcManager npcManager, PersonalServerManager personalServerManager, PacketHandler packetHandler, Punish punish, ServerStatusManager serverStatusManager, GiveawayManager giveawayManager)
|
||||
{
|
||||
super("Hub Manager", plugin);
|
||||
@ -836,12 +831,6 @@ public class HubManager extends MiniClientPlugin<HubClient>
|
||||
event.SetCancelled(true);
|
||||
}
|
||||
|
||||
public boolean IsGadgetEnabled()
|
||||
{
|
||||
return _gadgetsEnabled;
|
||||
}
|
||||
|
||||
|
||||
public NewsManager GetNewsManager()
|
||||
{
|
||||
return _news;
|
||||
@ -858,30 +847,15 @@ public class HubManager extends MiniClientPlugin<HubClient>
|
||||
|
||||
public void ToggleGadget(Player caller)
|
||||
{
|
||||
_gadgetsEnabled = !_gadgetsEnabled;
|
||||
toggleGadget();
|
||||
}
|
||||
|
||||
if (!_gadgetsEnabled)
|
||||
{
|
||||
GetMount().DisableAll();
|
||||
GetGadget().DisableAll();
|
||||
}
|
||||
public void toggleGadget()
|
||||
{
|
||||
GetGadget().toggleGadgetEnabled();
|
||||
|
||||
for (Player player : UtilServer.getPlayers())
|
||||
player.sendMessage(C.cWhite + C.Bold + "Gadgets/Mounts are now " + F.elem(_gadgetsEnabled ? C.cGreen + C.Bold + "Enabled" : C.cRed + C.Bold + "Disabled"));
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void GadgetActivate(GadgetActivateEvent event)
|
||||
{
|
||||
if (!_gadgetsEnabled)
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void MountActivate(MountActivateEvent event)
|
||||
{
|
||||
if (!_gadgetsEnabled)
|
||||
event.setCancelled(true);
|
||||
player.sendMessage(C.cWhite + C.Bold + "Gadgets/Mounts are now " + F.elem(GetGadget().isGadgetEnabled() ? C.cGreen + C.Bold + "Enabled" : C.cRed + C.Bold + "Disabled"));
|
||||
}
|
||||
|
||||
public void addGameMode(Player caller, Player target)
|
||||
|
@ -4,14 +4,17 @@ package mineplex.serverdata.commands;
|
||||
public class AnnouncementCommand extends ServerCommand
|
||||
{
|
||||
private boolean _displayTitle;
|
||||
private String _rank;
|
||||
private String _message;
|
||||
|
||||
public boolean getDisplayTitle() { return _displayTitle; }
|
||||
public String getRank() { return _rank; }
|
||||
public String getMessage() { return _message; }
|
||||
|
||||
public AnnouncementCommand(boolean displayTitle, String message)
|
||||
public AnnouncementCommand(boolean displayTitle, String rank, String message)
|
||||
{
|
||||
_displayTitle = displayTitle;
|
||||
_rank = rank;
|
||||
_message = message;
|
||||
}
|
||||
|
||||
|
@ -24,6 +24,7 @@ import mineplex.core.common.util.UtilAction;
|
||||
import mineplex.core.common.util.UtilGear;
|
||||
import mineplex.core.common.util.UtilInv;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.cosmetic.CosmeticManager;
|
||||
import mineplex.core.creature.Creature;
|
||||
@ -1236,6 +1237,25 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void disableGadget(PlayerJoinEvent event)
|
||||
{
|
||||
updateGadgetEnabled();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void disableGadget(PlayerQuitEvent event)
|
||||
{
|
||||
updateGadgetEnabled();
|
||||
}
|
||||
|
||||
private void updateGadgetEnabled()
|
||||
{
|
||||
// Disables gadgets if player count is greater than 40
|
||||
int playerCount = UtilServer.getPlayers().length;
|
||||
getCosmeticManager().getGadgetManager().setGadgetEnabled(playerCount <= 40);
|
||||
}
|
||||
|
||||
/*public void saveBasicStats(final Game game)
|
||||
{
|
||||
if (!IsTournamentServer())
|
||||
|
Loading…
Reference in New Issue
Block a user