More javadocs

This commit is contained in:
AlexTheCoder 2016-07-26 22:32:46 -04:00
parent d98ca0ab3c
commit 9c700425fd
16 changed files with 220 additions and 29 deletions

View File

@ -56,6 +56,9 @@ import mineplex.minecraft.game.core.damage.DamageManager;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;
/**
* Main class for clans hub
*/
public class ClansHub extends JavaPlugin
{
private String WEB_CONFIG = "webServer";

View File

@ -15,6 +15,9 @@ import mineplex.game.clans.core.repository.tokens.SimpleClanToken;
import org.bukkit.Material;
import org.bukkit.entity.Player;
/**
* GUI page for clans servers
*/
public class ClansServerPage extends ShopPageBase<ClansTransferManager, ClansServerShop>
{
public ClansServerPage(ClansTransferManager plugin, ClansServerShop shop, CoreClientManager clientManager,
@ -136,6 +139,9 @@ public class ClansServerPage extends ShopPageBase<ClansTransferManager, ClansSer
return getPlugin().getServer(serverName);
}
/**
* Refresh all GUI pages and buttons
*/
public void update()
{
getButtonMap().clear();

View File

@ -10,6 +10,9 @@ import mineplex.core.shop.page.ShopPageBase;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
/**
* GUI Shop manager for clans servers
*/
public class ClansServerShop extends ShopBase<ClansTransferManager>
{
public ClansServerShop(ClansTransferManager plugin, CoreClientManager clientManager, DonationManager donationManager)

View File

@ -35,6 +35,9 @@ import org.bukkit.plugin.java.JavaPlugin;
import com.google.common.collect.Lists;
/**
* Server selection controller for clans
*/
public class ClansTransferManager extends MiniDbClientPlugin<SimpleClanToken>
{
private static final long SERVER_RELOAD_INTERVAL = 5000;
@ -58,11 +61,19 @@ public class ClansTransferManager extends MiniDbClientPlugin<SimpleClanToken>
_serverShop = new ClansServerShop(this, client, donation);
}
/**
* Gets the stored party manager
* @return The stored party manager
*/
public PartyManager getPartyManager()
{
return _party;
}
/**
* Gets a list of all loaded servers
* @return A list of all loaded servers
*/
public List<ServerInfo> getServers()
{
List<ServerInfo> servers = Lists.newArrayList();
@ -70,6 +81,11 @@ public class ClansTransferManager extends MiniDbClientPlugin<SimpleClanToken>
return servers;
}
/**
* Gets the loaded ServerInfo with the given name
* @param name The name to check
* @return The loaded ServerInfo, or null if it is not stored
*/
public ServerInfo getServer(String name)
{
for (ServerInfo server : _servers.values())
@ -82,7 +98,10 @@ public class ClansTransferManager extends MiniDbClientPlugin<SimpleClanToken>
return null;
}
/**
* Pulls all the clans servers from redis and loads them. SHOULD BE RUN ASYNC
*/
public void reload()
{
_servers.clear();
@ -96,6 +115,11 @@ public class ClansTransferManager extends MiniDbClientPlugin<SimpleClanToken>
}
}
/**
* Selects a server to send a player to
* @param player The player to send
* @param serverInfo The server to send the player to
*/
public void selectServer(Player player, ServerInfo serverInfo)
{
Party party = _party.getParty(player);

View File

@ -20,6 +20,9 @@ import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerQuitEvent;
/**
* Manager for player forcefields
*/
public class ForcefieldManager extends MiniPlugin
{
public HubManager Manager;
@ -71,7 +74,12 @@ public class ForcefieldManager extends MiniPlugin
}
}
}
/**
* Handles the radius from a command and sets a player's forcefield to it
* @param caller The caller of the command
* @param args The args of the command
*/
public void ForcefieldRadius(Player caller, String[] args)
{
try

View File

@ -31,7 +31,6 @@ import mineplex.core.common.util.UtilWorld;
import mineplex.core.cosmetic.CosmeticManager;
import mineplex.core.customdata.CustomDataManager;
import mineplex.core.disguise.DisguiseManager;
import mineplex.core.disguise.PlayerDisguiseManager;
import mineplex.core.disguise.disguises.DisguiseBase;
import mineplex.core.disguise.disguises.DisguiseWither;
import mineplex.core.donation.DonationManager;
@ -114,6 +113,9 @@ import org.bukkit.scoreboard.DisplaySlot;
import org.bukkit.scoreboard.Objective;
import org.bukkit.scoreboard.Scoreboard;
/**
* Main manager for clans hub
*/
public class HubManager extends MiniPlugin
{
private BlockRestore _blockRestore;
@ -260,7 +262,7 @@ public class HubManager extends MiniPlugin
addCommand(new GadgetToggle(this));
addCommand(new GameModeCommand(this));
}
@EventHandler(priority = EventPriority.HIGHEST)
public void reflectMotd(ServerListPingEvent event)
{
@ -269,7 +271,12 @@ public class HubManager extends MiniPlugin
event.setMotd("Restarting soon");
}
}
/**
* Checks if an entity can be bumped
* @param ent The entity to check
* @return Whether the entity can be bumped
*/
public boolean BumpDisabled(Entity ent)
{
if (ent == null)
@ -333,7 +340,7 @@ public class HubManager extends MiniPlugin
{
public void run()
{
_portal.sendPlayerToServer(event.getPlayer(), "Lobby");
_portal.sendPlayerToServer(event.getPlayer(), "ClansHub");
}
});
@ -654,87 +661,155 @@ public class HubManager extends MiniPlugin
UtilTextBottom.display(C.cGray + "Visit " + F.elem("http://www.mineplex.com/shop") + " for exclusive perks!", player);
});
}
/**
* Gets the loaded BlockRestore manager
* @return The loaded BlockRestore manager
*/
public BlockRestore GetBlockRestore()
{
return _blockRestore;
}
/**
* Gets the loaded CoreClient manager
* @return The loaded CoreClient manager
*/
public CoreClientManager GetClients()
{
return _clientManager;
}
/**
* Gets the loaded Condition manager
* @return The loaded Condition manager
*/
public ConditionManager GetCondition()
{
return _conditionManager;
}
/**
* Gets the loaded Donation manager
* @return The loaded Donation manager
*/
public DonationManager GetDonation()
{
return _donationManager;
}
/**
* Gets the loaded Disguise manager
* @return The loaded Disguise manager
*/
public DisguiseManager GetDisguise()
{
return _disguiseManager;
}
/**
* Gets the loaded Gadget manager
* @return The loaded Gadget manager
*/
public GadgetManager GetGadget()
{
return _gadgetManager;
}
/**
* Gets the loaded Treasure manager
* @return The loaded Treasure manager
*/
public TreasureManager GetTreasure()
{
return _treasureManager;
}
/**
* Gets the loaded Mount manager
* @return The loaded Mount manager
*/
public MountManager GetMount()
{
return _mountManager;
}
/**
* Gets the loaded Preferences manager
* @return The loaded Preferences manager
*/
public PreferencesManager getPreferences()
{
return _preferences;
}
/**
* Gets the lobby's spawn
* @return The lobby's spawn
*/
public Location GetSpawn()
{
return _spawn.clone();
}
/**
* Gets the loaded Pet manager
* @return The loaded Pet manager
*/
public PetManager getPetManager()
{
return _petManager;
}
/**
* Gets the loaded Bonus manager
* @return The loaded Bonus manager
*/
public BonusManager getBonusManager()
{
return _bonusManager;
}
/**
* Gets the loaded Stats manager
* @return The loaded Stats manager
*/
public StatsManager GetStats()
{
return _statsManager;
}
/**
* Gets the loaded HubVisibility manager
* @return The loaded HubVisibility manager
*/
public HubVisibilityManager GetVisibility()
{
return _visibilityManager;
}
/**
* Gets the loaded CustomData manager
* @return The loaded CustomData manager
*/
public CustomDataManager getCustomDataManager()
{
return _customDataManager;
}
/**
* Gets the loaded Punishment manager
* @return The loaded Punishment manager
*/
public Punish getPunishments()
{
return _punishManager;
}
/**
* Gets the loaded Incognito manager
* @return The loaded Incognito manager
*/
public IncognitoManager getIncognitoManager()
{
return _incognito;
@ -748,7 +823,11 @@ public class HubManager extends MiniPlugin
SetPortalDelay(event.getOther());
}
}
/**
* Updates a player's portal delay start to be now
* @param ent The player to set delay for
*/
public void SetPortalDelay(Entity ent)
{
if (ent instanceof Player)
@ -756,7 +835,12 @@ public class HubManager extends MiniPlugin
_portalTime.put(((Player)ent).getName(), System.currentTimeMillis());
}
}
/**
* Checks if a player can portal yet
* @param The player to check
* @return Whether a player can portal yet
*/
public boolean CanPortal(Player player)
{
//Riding
@ -778,12 +862,19 @@ public class HubManager extends MiniPlugin
event.setCancelled(true);
}
}
/**
* Toggles all gadgets on or off via command
* @param caller The player who issued the command
*/
public void ToggleGadget(Player caller)
{
toggleGadget();
}
/**
* Toggles gadget access on or off in this lobby
*/
public void toggleGadget()
{
GetGadget().toggleGadgetEnabled();
@ -791,7 +882,12 @@ public class HubManager extends MiniPlugin
for (Player player : UtilServer.getPlayers())
player.sendMessage(C.cWhite + C.Bold + "Gadgets/Mounts are now " + F.elem(GetGadget().isGadgetEnabled() ? C.cGreen + C.Bold + "Enabled" : C.cRed + C.Bold + "Disabled"));
}
/**
* Sets a player's gamemode via command
* @param caller The issuer of the command
* @param target The player whose gamemode should be set
*/
public void addGameMode(Player caller, Player target)
{
if (!_creativeAdmin.containsKey(caller.getName()))
@ -847,7 +943,11 @@ public class HubManager extends MiniPlugin
UtilPlayer.message(player, F.main("Game Mode", event.getPlayer().getName() + " left the game. Creative Mode: " + F.tf(false)));
}
}
/**
* Gets the loaded PacketHandler
* @return The loaded PacketHandler
*/
public PacketHandler getPacketHandler()
{
return _packetHandler;

View File

@ -14,6 +14,9 @@ import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerQuitEvent;
/**
* Manager for Hub Visibility of players
*/
public class HubVisibilityManager extends MiniPlugin
{
public HubManager Manager;
@ -26,13 +29,21 @@ public class HubVisibilityManager extends MiniPlugin
Manager = manager;
}
/**
* Force sets a player as hidden
* @param player The player to set
*/
public void addHiddenPlayer(Player player)
{
_hiddenPlayers.add(player);
}
/**
* Force unsets a player as hidden
* @param player The player to unset
*/
public void removeHiddenPlayer(Player player)
{
_hiddenPlayers.remove(player);

View File

@ -7,6 +7,9 @@ import mineplex.core.shop.page.ShopPageBase;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
/**
* GUI button to select a server from a display
*/
public class JoinServerButton implements IButton
{
private ShopPageBase<?, ?> _page;
@ -26,6 +29,11 @@ public class JoinServerButton implements IButton
selectServer(player, _serverInfo);
}
/**
* Selects a server to send a player to
* @param player The player to send
* @param serverInfo The server to send the player to
*/
public void selectServer(Player player, ServerInfo serverInfo)
{
if (serverInfo != null)
@ -47,4 +55,4 @@ public class JoinServerButton implements IButton
_page.playDenySound(player);
}
}
}
}

View File

@ -1,11 +1,18 @@
package mineplex.clanshub;
/**
* Data class for loaded servers
*/
public class ServerInfo
{
public String Name;
public int CurrentPlayers = 0;
public int MaxPlayers = 0;
/**
* Checks how many slots are left on this server
* @return The amount of slots that are left on this server
*/
public int getAvailableSlots()
{
return MaxPlayers - CurrentPlayers;

View File

@ -34,6 +34,9 @@ import org.bukkit.event.player.PlayerDropItemEvent;
import org.bukkit.event.player.PlayerPickupItemEvent;
import org.bukkit.event.weather.WeatherChangeEvent;
/**
* Manager for the hub world
*/
public class WorldManager extends MiniPlugin
{
public HubManager Manager;

View File

@ -6,6 +6,9 @@ import mineplex.core.common.Rank;
import org.bukkit.entity.Player;
/**
* Command for controlling forcefield radius
*/
public class ForcefieldRadius extends CommandBase<ForcefieldManager>
{
public ForcefieldRadius(ForcefieldManager plugin)

View File

@ -6,6 +6,9 @@ import mineplex.core.common.Rank;
import org.bukkit.entity.Player;
/**
* Command for toggling gadgets
*/
public class GadgetToggle extends CommandBase<HubManager>
{
public GadgetToggle(HubManager plugin)

View File

@ -9,6 +9,9 @@ import mineplex.core.common.util.UtilPlayer;
import org.bukkit.GameMode;
import org.bukkit.entity.Player;
/**
* Command for setting gamemode
*/
public class GameModeCommand extends CommandBase<HubManager>
{
public GameModeCommand(HubManager plugin)

View File

@ -10,6 +10,9 @@ import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import org.bukkit.inventory.ItemStack;
/**
* Button to open preferences menu
*/
public class ButtonPrefs implements GuiItem
{
private GUIProfile _profile;

View File

@ -12,6 +12,9 @@ import org.bukkit.event.inventory.ClickType;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.SkullMeta;
/**
* Button to open stats menu
*/
public class ButtonStats implements GuiItem
{
private GUIProfile _profile;

View File

@ -9,6 +9,9 @@ import mineplex.core.preferences.PreferencesManager;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
/**
* Profile GUI
*/
public class GUIProfile extends SimpleGui
{
private PreferencesManager _preferencesManager;