Switched plugin to bsb to avoid confusion with other plugins.

This commit is contained in:
Tastybento 2017-12-24 10:35:36 -08:00
parent f5464347c6
commit 97722b56d5
10 changed files with 39 additions and 39 deletions

View File

@ -46,7 +46,7 @@ public abstract class CompositeCommand extends Command implements PluginIdentifi
* The permission required to execute this command * The permission required to execute this command
*/ */
private String permission = ""; private String permission = "";
public BSkyBlock plugin = BSkyBlock.getPlugin(); public BSkyBlock bsb = BSkyBlock.getPlugin();
/** /**
* Map of sub commands * Map of sub commands
@ -179,7 +179,7 @@ public abstract class CompositeCommand extends Command implements PluginIdentifi
* @return IslandsManager * @return IslandsManager
*/ */
protected IslandsManager getIslands() { protected IslandsManager getIslands() {
return plugin.getIslands(); return bsb.getIslands();
} }
/** /**
@ -196,7 +196,7 @@ public abstract class CompositeCommand extends Command implements PluginIdentifi
* @return set of UUIDs of all team members * @return set of UUIDs of all team members
*/ */
protected Set<UUID> getMembers(User user) { protected Set<UUID> getMembers(User user) {
return plugin.getIslands().getMembers(user.getUniqueId()); return bsb.getIslands().getMembers(user.getUniqueId());
} }
/** /**
@ -216,12 +216,12 @@ public abstract class CompositeCommand extends Command implements PluginIdentifi
* @return PlayersManager * @return PlayersManager
*/ */
protected PlayersManager getPlayers() { protected PlayersManager getPlayers() {
return plugin.getPlayers(); return bsb.getPlayers();
} }
@Override @Override
public BSkyBlock getPlugin() { public BSkyBlock getPlugin() {
return plugin; return bsb;
} }
/** /**
@ -251,7 +251,7 @@ public abstract class CompositeCommand extends Command implements PluginIdentifi
* @return UUID of player's team leader * @return UUID of player's team leader
*/ */
protected UUID getTeamLeader(User user) { protected UUID getTeamLeader(User user) {
return plugin.getIslands().getTeamLeader(user.getUniqueId()); return bsb.getIslands().getTeamLeader(user.getUniqueId());
} }
@Override @Override
@ -306,7 +306,7 @@ public abstract class CompositeCommand extends Command implements PluginIdentifi
* @return true if player is in a team * @return true if player is in a team
*/ */
protected boolean inTeam(User user) { protected boolean inTeam(User user) {
return plugin.getPlayers().inTeam(user.getUniqueId()); return bsb.getPlayers().inTeam(user.getUniqueId());
} }
/** /**

View File

@ -44,7 +44,7 @@ public class IslandCommand extends CompositeCommand {
@Override @Override
public boolean execute(User user, List<String> args) { public boolean execute(User user, List<String> args) {
user.sendLegacyMessage("You successfully did /is !"); user.sendLegacyMessage("You successfully did /is !");
if (!plugin.getIslands().hasIsland(user.getUniqueId())) { if (!bsb.getIslands().hasIsland(user.getUniqueId())) {
return this.getSubCommand("create").execute(user, args); return this.getSubCommand("create").execute(user, args);
} }
// Currently, just go home // Currently, just go home

View File

@ -55,7 +55,7 @@ public class IslandCreateCommand extends CompositeCommand {
.reason(Reason.CREATE) .reason(Reason.CREATE)
.build(); .build();
} catch (IOException e) { } catch (IOException e) {
plugin.getLogger().severe("Could not create island for player."); bsb.getLogger().severe("Could not create island for player.");
user.sendMessage("commands.island.create.unable-create-island"); user.sendMessage("commands.island.create.unable-create-island");
e.printStackTrace(); e.printStackTrace();
} }

View File

@ -34,7 +34,7 @@ public class IslandResetCommand extends CompositeCommand {
user.sendMessage("general.errors.not-leader"); user.sendMessage("general.errors.not-leader");
return false; return false;
} }
if (plugin.getPlayers().inTeam(user.getUniqueId())) { if (bsb.getPlayers().inTeam(user.getUniqueId())) {
user.sendMessage("commands.island.reset.must-remove-members"); user.sendMessage("commands.island.reset.must-remove-members");
return true; return true;
} }
@ -43,14 +43,14 @@ public class IslandResetCommand extends CompositeCommand {
// Get the player's old island // Get the player's old island
Island oldIsland = getIslands().getIsland(player.getUniqueId()); Island oldIsland = getIslands().getIsland(player.getUniqueId());
if (DEBUG) if (DEBUG)
plugin.getLogger().info("DEBUG: old island is at " + oldIsland.getCenter().getBlockX() + "," + oldIsland.getCenter().getBlockZ()); bsb.getLogger().info("DEBUG: old island is at " + oldIsland.getCenter().getBlockX() + "," + oldIsland.getCenter().getBlockZ());
// Remove them from this island (it still exists and will be deleted later) // Remove them from this island (it still exists and will be deleted later)
getIslands().removePlayer(player.getUniqueId()); getIslands().removePlayer(player.getUniqueId());
if (DEBUG) if (DEBUG)
plugin.getLogger().info("DEBUG: old island's owner is " + oldIsland.getOwner()); bsb.getLogger().info("DEBUG: old island's owner is " + oldIsland.getOwner());
// Create new island and then delete the old one // Create new island and then delete the old one
if (DEBUG) if (DEBUG)
plugin.getLogger().info("DEBUG: making new island "); bsb.getLogger().info("DEBUG: making new island ");
try { try {
NewIsland.builder() NewIsland.builder()
.player(player) .player(player)
@ -58,7 +58,7 @@ public class IslandResetCommand extends CompositeCommand {
.oldIsland(oldIsland) .oldIsland(oldIsland)
.build(); .build();
} catch (IOException e) { } catch (IOException e) {
plugin.getLogger().severe("Could not create island for player."); bsb.getLogger().severe("Could not create island for player.");
user.sendMessage("commands.island.create.unable-create-island"); user.sendMessage("commands.island.create.unable-create-island");
e.printStackTrace(); e.printStackTrace();
} }

View File

@ -21,17 +21,17 @@ public class IslandSethomeCommand extends CompositeCommand {
public boolean execute(User user, List<String> args) { public boolean execute(User user, List<String> args) {
UUID playerUUID = user.getUniqueId(); UUID playerUUID = user.getUniqueId();
// Check island // Check island
if (plugin.getIslands().getIsland(user.getUniqueId()) == null) { if (bsb.getIslands().getIsland(user.getUniqueId()) == null) {
user.sendMessage("general.errors.no-island"); user.sendMessage("general.errors.no-island");
return true; return true;
} }
if (!plugin.getIslands().playerIsOnIsland(user.getPlayer())) { if (!bsb.getIslands().playerIsOnIsland(user.getPlayer())) {
user.sendMessage("commands.island.sethome.must-be-on-your-island"); user.sendMessage("commands.island.sethome.must-be-on-your-island");
return true; return true;
} }
if (args.isEmpty()) { if (args.isEmpty()) {
// island sethome // island sethome
plugin.getPlayers().setHomeLocation(playerUUID, user.getLocation()); bsb.getPlayers().setHomeLocation(playerUUID, user.getLocation());
user.sendMessage("commands.island.sethome.home-set"); user.sendMessage("commands.island.sethome.home-set");
} else { } else {
// Dynamic home sizes with permissions // Dynamic home sizes with permissions
@ -44,7 +44,7 @@ public class IslandSethomeCommand extends CompositeCommand {
if (number < 1 || number > maxHomes) { if (number < 1 || number > maxHomes) {
user.sendMessage("commands.island.sethome.num-homes", "[max]", String.valueOf(maxHomes)); user.sendMessage("commands.island.sethome.num-homes", "[max]", String.valueOf(maxHomes));
} else { } else {
plugin.getPlayers().setHomeLocation(playerUUID, user.getLocation(), number); bsb.getPlayers().setHomeLocation(playerUUID, user.getLocation(), number);
user.sendMessage("commands.island.sethome.home-set"); user.sendMessage("commands.island.sethome.home-set");
} }
} catch (Exception e) { } catch (Exception e) {

View File

@ -37,7 +37,7 @@ public class IslandTeamCommand extends AbstractIslandTeamCommand {
public boolean execute(User user, List<String> args) { public boolean execute(User user, List<String> args) {
UUID playerUUID = user.getUniqueId(); UUID playerUUID = user.getUniqueId();
if (DEBUG) if (DEBUG)
plugin.getLogger().info("DEBUG: executing team command for " + playerUUID); bsb.getLogger().info("DEBUG: executing team command for " + playerUUID);
// Fire event so add-ons can run commands, etc. // Fire event so add-ons can run commands, etc.
IslandBaseEvent event = TeamEvent.builder() IslandBaseEvent event = TeamEvent.builder()
.island(getIslands() .island(getIslands()
@ -45,7 +45,7 @@ public class IslandTeamCommand extends AbstractIslandTeamCommand {
.reason(TeamReason.INFO) .reason(TeamReason.INFO)
.involvedPlayer(playerUUID) .involvedPlayer(playerUUID)
.build(); .build();
plugin.getServer().getPluginManager().callEvent(event); bsb.getServer().getPluginManager().callEvent(event);
if (event.isCancelled()) return true; if (event.isCancelled()) return true;
UUID teamLeaderUUID = getTeamLeader(user); UUID teamLeaderUUID = getTeamLeader(user);
Set<UUID> teamMembers = getMembers(user); Set<UUID> teamMembers = getMembers(user);
@ -61,7 +61,7 @@ public class IslandTeamCommand extends AbstractIslandTeamCommand {
String[] spl = perms.getPermission().split(Settings.PERMPREFIX + "team.maxsize."); String[] spl = perms.getPermission().split(Settings.PERMPREFIX + "team.maxsize.");
if (spl.length > 1) { if (spl.length > 1) {
if (!NumberUtils.isDigits(spl[1])) { if (!NumberUtils.isDigits(spl[1])) {
plugin.getLogger().severe("Player " + user.getName() + " has permission: " + perms.getPermission() + " <-- the last part MUST be a number! Ignoring..."); bsb.getLogger().severe("Player " + user.getName() + " has permission: " + perms.getPermission() + " <-- the last part MUST be a number! Ignoring...");
} else { } else {
maxSize = Math.max(maxSize, Integer.valueOf(spl[1])); maxSize = Math.max(maxSize, Integer.valueOf(spl[1]));
} }

View File

@ -49,7 +49,7 @@ public class IslandTeamInviteAcceptCommand extends AbstractIslandTeamCommand {
return true; return true;
} }
if (DEBUG) if (DEBUG)
plugin.getLogger().info("DEBUG: Invite is valid"); bsb.getLogger().info("DEBUG: Invite is valid");
// Fire event so add-ons can run commands, etc. // Fire event so add-ons can run commands, etc.
IslandBaseEvent event = TeamEvent.builder() IslandBaseEvent event = TeamEvent.builder()
.island(getIslands() .island(getIslands()
@ -57,11 +57,11 @@ public class IslandTeamInviteAcceptCommand extends AbstractIslandTeamCommand {
.reason(TeamReason.JOIN) .reason(TeamReason.JOIN)
.involvedPlayer(playerUUID) .involvedPlayer(playerUUID)
.build(); .build();
plugin.getServer().getPluginManager().callEvent(event); bsb.getServer().getPluginManager().callEvent(event);
if (event.isCancelled()) return true; if (event.isCancelled()) return true;
// Remove the invite // Remove the invite
if (DEBUG) if (DEBUG)
plugin.getLogger().info("DEBUG: Removing player from invite list"); bsb.getLogger().info("DEBUG: Removing player from invite list");
inviteList.remove(playerUUID); inviteList.remove(playerUUID);
// Put player into Spectator mode // Put player into Spectator mode
user.setGameMode(GameMode.SPECTATOR); user.setGameMode(GameMode.SPECTATOR);
@ -98,7 +98,7 @@ public class IslandTeamInviteAcceptCommand extends AbstractIslandTeamCommand {
} }
getIslands().save(false); getIslands().save(false);
if (DEBUG) if (DEBUG)
plugin.getLogger().info("DEBUG: After save " + getIslands().getIsland(prospectiveTeamLeaderUUID).getMembers().toString()); bsb.getLogger().info("DEBUG: After save " + getIslands().getIsland(prospectiveTeamLeaderUUID).getMembers().toString());
return true; return true;
} }

View File

@ -47,7 +47,7 @@ public class IslandTeamInviteCommand extends AbstractIslandTeamCommand {
if (args.isEmpty() || args.size() > 1) { if (args.isEmpty() || args.size() > 1) {
// Invite label with no name, i.e., /island invite - tells the player who has invited them so far // Invite label with no name, i.e., /island invite - tells the player who has invited them so far
if (inviteList.containsKey(playerUUID)) { if (inviteList.containsKey(playerUUID)) {
OfflinePlayer inviter = plugin.getServer().getOfflinePlayer(inviteList.get(playerUUID)); OfflinePlayer inviter = bsb.getServer().getOfflinePlayer(inviteList.get(playerUUID));
user.sendMessage("invite.nameHasInvitedYou", "[name]", inviter.getName()); user.sendMessage("invite.nameHasInvitedYou", "[name]", inviter.getName());
} else { } else {
user.sendMessage("help.island.invite"); user.sendMessage("help.island.invite");
@ -96,7 +96,7 @@ public class IslandTeamInviteCommand extends AbstractIslandTeamCommand {
String[] spl = perms.getPermission().split(Settings.PERMPREFIX + "team.maxsize."); String[] spl = perms.getPermission().split(Settings.PERMPREFIX + "team.maxsize.");
if (spl.length > 1) { if (spl.length > 1) {
if (!NumberUtils.isDigits(spl[1])) { if (!NumberUtils.isDigits(spl[1])) {
plugin.getLogger().severe("Player " + user.getName() + " has permission: " + perms.getPermission() + " <-- the last part MUST be a number! Ignoring..."); bsb.getLogger().severe("Player " + user.getName() + " has permission: " + perms.getPermission() + " <-- the last part MUST be a number! Ignoring...");
} else { } else {
maxSize = Math.max(maxSize, Integer.valueOf(spl[1])); maxSize = Math.max(maxSize, Integer.valueOf(spl[1]));
} }
@ -119,7 +119,7 @@ public class IslandTeamInviteCommand extends AbstractIslandTeamCommand {
.reason(TeamReason.INVITE) .reason(TeamReason.INVITE)
.involvedPlayer(invitedPlayerUUID) .involvedPlayer(invitedPlayerUUID)
.build(); .build();
plugin.getServer().getPluginManager().callEvent(event); bsb.getServer().getPluginManager().callEvent(event);
if (event.isCancelled()) return true; if (event.isCancelled()) return true;
// Put the invited player (key) onto the list with inviter (value) // Put the invited player (key) onto the list with inviter (value)
// If someone else has invited a player, then this invite will overwrite the previous invite! // If someone else has invited a player, then this invite will overwrite the previous invite!

View File

@ -30,7 +30,7 @@ public class IslandTeamInviteRejectCommand extends AbstractIslandTeamCommand {
.reason(TeamReason.REJECT) .reason(TeamReason.REJECT)
.involvedPlayer(playerUUID) .involvedPlayer(playerUUID)
.build(); .build();
plugin.getServer().getPluginManager().callEvent(event); bsb.getServer().getPluginManager().callEvent(event);
if (event.isCancelled()) return true; if (event.isCancelled()) return true;
// Remove this player from the global invite list // Remove this player from the global invite list

View File

@ -30,12 +30,12 @@ public class IslandTeamSetownerCommand extends AbstractIslandTeamCommand {
public boolean execute(User user, List<String> args) { public boolean execute(User user, List<String> args) {
UUID playerUUID = user.getUniqueId(); UUID playerUUID = user.getUniqueId();
// Can use if in a team // Can use if in a team
boolean inTeam = plugin.getPlayers().inTeam(playerUUID); boolean inTeam = bsb.getPlayers().inTeam(playerUUID);
UUID teamLeaderUUID = plugin.getIslands().getTeamLeader(playerUUID); UUID teamLeaderUUID = bsb.getIslands().getTeamLeader(playerUUID);
if (!(inTeam && teamLeaderUUID.equals(playerUUID))) { if (!(inTeam && teamLeaderUUID.equals(playerUUID))) {
return true; return true;
} }
plugin.getLogger().info("DEBUG: arg[0] = " + args.get(0)); bsb.getLogger().info("DEBUG: arg[0] = " + args.get(0));
UUID targetUUID = getPlayers().getUUID(args.get(0)); UUID targetUUID = getPlayers().getUUID(args.get(0));
if (targetUUID == null) { if (targetUUID == null) {
user.sendMessage("general.errors.unknown-player"); user.sendMessage("general.errors.unknown-player");
@ -53,7 +53,7 @@ public class IslandTeamSetownerCommand extends AbstractIslandTeamCommand {
user.sendMessage("commands.island.team.setowner.errors.cant-transfer-to-yourself"); user.sendMessage("commands.island.team.setowner.errors.cant-transfer-to-yourself");
return true; return true;
} }
if (!plugin.getIslands().getMembers(playerUUID).contains(targetUUID)) { if (!bsb.getIslands().getMembers(playerUUID).contains(targetUUID)) {
user.sendMessage("commands.island.team.setowner.errors.target-is-not-member"); user.sendMessage("commands.island.team.setowner.errors.target-is-not-member");
return true; return true;
} }
@ -64,7 +64,7 @@ public class IslandTeamSetownerCommand extends AbstractIslandTeamCommand {
.reason(TeamReason.MAKELEADER) .reason(TeamReason.MAKELEADER)
.involvedPlayer(targetUUID) .involvedPlayer(targetUUID)
.build(); .build();
plugin.getServer().getPluginManager().callEvent(event); bsb.getServer().getPluginManager().callEvent(event);
if (event.isCancelled()) return true; if (event.isCancelled()) return true;
// target is the new leader // target is the new leader
@ -81,7 +81,7 @@ public class IslandTeamSetownerCommand extends AbstractIslandTeamCommand {
// Check for zero protection range // Check for zero protection range
Island islandByOwner = getIslands().getIsland(targetUUID); Island islandByOwner = getIslands().getIsland(targetUUID);
if (islandByOwner.getProtectionRange() == 0) { if (islandByOwner.getProtectionRange() == 0) {
plugin.getLogger().warning("Player " + user.getName() + "'s island had a protection range of 0. Setting to default " + range); bsb.getLogger().warning("Player " + user.getName() + "'s island had a protection range of 0. Setting to default " + range);
islandByOwner.setProtectionRange(range); islandByOwner.setProtectionRange(range);
} }
for (PermissionAttachmentInfo perms : target.getEffectivePermissions()) { for (PermissionAttachmentInfo perms : target.getEffectivePermissions()) {
@ -93,7 +93,7 @@ public class IslandTeamSetownerCommand extends AbstractIslandTeamCommand {
String[] spl = perms.getPermission().split(Settings.PERMPREFIX + "island.range."); String[] spl = perms.getPermission().split(Settings.PERMPREFIX + "island.range.");
if (spl.length > 1) { if (spl.length > 1) {
if (!NumberUtils.isDigits(spl[1])) { if (!NumberUtils.isDigits(spl[1])) {
plugin.getLogger().severe("Player " + user.getName() + " has permission: " + perms.getPermission() + " <-- the last part MUST be a number! Ignoring..."); bsb.getLogger().severe("Player " + user.getName() + " has permission: " + perms.getPermission() + " <-- the last part MUST be a number! Ignoring...");
} else { } else {
hasARangePerm = true; hasARangePerm = true;
@ -115,7 +115,7 @@ public class IslandTeamSetownerCommand extends AbstractIslandTeamCommand {
if (range != islandByOwner.getProtectionRange()) { if (range != islandByOwner.getProtectionRange()) {
user.sendMessage("commands.admin.setrange.range-updated", "[number]", String.valueOf(range)); user.sendMessage("commands.admin.setrange.range-updated", "[number]", String.valueOf(range));
target.sendMessage("commands.admin.setrange.range-updated", "[number]", String.valueOf(range)); target.sendMessage("commands.admin.setrange.range-updated", "[number]", String.valueOf(range));
plugin.getLogger().info( bsb.getLogger().info(
"Makeleader: Island protection range changed from " + islandByOwner.getProtectionRange() + " to " "Makeleader: Island protection range changed from " + islandByOwner.getProtectionRange() + " to "
+ range + " for " + user.getName() + " due to permission."); + range + " for " + user.getName() + " due to permission.");
} }
@ -130,8 +130,8 @@ public class IslandTeamSetownerCommand extends AbstractIslandTeamCommand {
public Optional<List<String>> tabComplete(final User user, final String alias, final LinkedList<String> args) { public Optional<List<String>> tabComplete(final User user, final String alias, final LinkedList<String> args) {
List<String> options = new ArrayList<>(); List<String> options = new ArrayList<>();
String lastArg = (!args.isEmpty() ? args.getLast() : ""); String lastArg = (!args.isEmpty() ? args.getLast() : "");
for (UUID member : plugin.getIslands().getMembers(user.getUniqueId())) { for (UUID member : bsb.getIslands().getMembers(user.getUniqueId())) {
options.add(plugin.getServer().getOfflinePlayer(member).getName()); options.add(bsb.getServer().getOfflinePlayer(member).getName());
} }
return Optional.of(Util.tabLimit(options, lastArg)); return Optional.of(Util.tabLimit(options, lastArg));
} }