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
*/
private String permission = "";
public BSkyBlock plugin = BSkyBlock.getPlugin();
public BSkyBlock bsb = BSkyBlock.getPlugin();
/**
* Map of sub commands
@ -179,7 +179,7 @@ public abstract class CompositeCommand extends Command implements PluginIdentifi
* @return IslandsManager
*/
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
*/
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
*/
protected PlayersManager getPlayers() {
return plugin.getPlayers();
return bsb.getPlayers();
}
@Override
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
*/
protected UUID getTeamLeader(User user) {
return plugin.getIslands().getTeamLeader(user.getUniqueId());
return bsb.getIslands().getTeamLeader(user.getUniqueId());
}
@Override
@ -306,7 +306,7 @@ public abstract class CompositeCommand extends Command implements PluginIdentifi
* @return true if player is in a team
*/
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
public boolean execute(User user, List<String> args) {
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);
}
// Currently, just go home

View File

@ -55,7 +55,7 @@ public class IslandCreateCommand extends CompositeCommand {
.reason(Reason.CREATE)
.build();
} 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");
e.printStackTrace();
}

View File

@ -34,7 +34,7 @@ public class IslandResetCommand extends CompositeCommand {
user.sendMessage("general.errors.not-leader");
return false;
}
if (plugin.getPlayers().inTeam(user.getUniqueId())) {
if (bsb.getPlayers().inTeam(user.getUniqueId())) {
user.sendMessage("commands.island.reset.must-remove-members");
return true;
}
@ -43,14 +43,14 @@ public class IslandResetCommand extends CompositeCommand {
// Get the player's old island
Island oldIsland = getIslands().getIsland(player.getUniqueId());
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)
getIslands().removePlayer(player.getUniqueId());
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
if (DEBUG)
plugin.getLogger().info("DEBUG: making new island ");
bsb.getLogger().info("DEBUG: making new island ");
try {
NewIsland.builder()
.player(player)
@ -58,7 +58,7 @@ public class IslandResetCommand extends CompositeCommand {
.oldIsland(oldIsland)
.build();
} 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");
e.printStackTrace();
}

View File

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

View File

@ -37,7 +37,7 @@ public class IslandTeamCommand extends AbstractIslandTeamCommand {
public boolean execute(User user, List<String> args) {
UUID playerUUID = user.getUniqueId();
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.
IslandBaseEvent event = TeamEvent.builder()
.island(getIslands()
@ -45,7 +45,7 @@ public class IslandTeamCommand extends AbstractIslandTeamCommand {
.reason(TeamReason.INFO)
.involvedPlayer(playerUUID)
.build();
plugin.getServer().getPluginManager().callEvent(event);
bsb.getServer().getPluginManager().callEvent(event);
if (event.isCancelled()) return true;
UUID teamLeaderUUID = getTeamLeader(user);
Set<UUID> teamMembers = getMembers(user);
@ -61,7 +61,7 @@ public class IslandTeamCommand extends AbstractIslandTeamCommand {
String[] spl = perms.getPermission().split(Settings.PERMPREFIX + "team.maxsize.");
if (spl.length > 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 {
maxSize = Math.max(maxSize, Integer.valueOf(spl[1]));
}

View File

@ -49,7 +49,7 @@ public class IslandTeamInviteAcceptCommand extends AbstractIslandTeamCommand {
return true;
}
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.
IslandBaseEvent event = TeamEvent.builder()
.island(getIslands()
@ -57,11 +57,11 @@ public class IslandTeamInviteAcceptCommand extends AbstractIslandTeamCommand {
.reason(TeamReason.JOIN)
.involvedPlayer(playerUUID)
.build();
plugin.getServer().getPluginManager().callEvent(event);
bsb.getServer().getPluginManager().callEvent(event);
if (event.isCancelled()) return true;
// Remove the invite
if (DEBUG)
plugin.getLogger().info("DEBUG: Removing player from invite list");
bsb.getLogger().info("DEBUG: Removing player from invite list");
inviteList.remove(playerUUID);
// Put player into Spectator mode
user.setGameMode(GameMode.SPECTATOR);
@ -98,7 +98,7 @@ public class IslandTeamInviteAcceptCommand extends AbstractIslandTeamCommand {
}
getIslands().save(false);
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;
}

View File

@ -47,7 +47,7 @@ public class IslandTeamInviteCommand extends AbstractIslandTeamCommand {
if (args.isEmpty() || args.size() > 1) {
// Invite label with no name, i.e., /island invite - tells the player who has invited them so far
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());
} else {
user.sendMessage("help.island.invite");
@ -96,7 +96,7 @@ public class IslandTeamInviteCommand extends AbstractIslandTeamCommand {
String[] spl = perms.getPermission().split(Settings.PERMPREFIX + "team.maxsize.");
if (spl.length > 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 {
maxSize = Math.max(maxSize, Integer.valueOf(spl[1]));
}
@ -119,7 +119,7 @@ public class IslandTeamInviteCommand extends AbstractIslandTeamCommand {
.reason(TeamReason.INVITE)
.involvedPlayer(invitedPlayerUUID)
.build();
plugin.getServer().getPluginManager().callEvent(event);
bsb.getServer().getPluginManager().callEvent(event);
if (event.isCancelled()) return true;
// 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!

View File

@ -30,7 +30,7 @@ public class IslandTeamInviteRejectCommand extends AbstractIslandTeamCommand {
.reason(TeamReason.REJECT)
.involvedPlayer(playerUUID)
.build();
plugin.getServer().getPluginManager().callEvent(event);
bsb.getServer().getPluginManager().callEvent(event);
if (event.isCancelled()) return true;
// 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) {
UUID playerUUID = user.getUniqueId();
// Can use if in a team
boolean inTeam = plugin.getPlayers().inTeam(playerUUID);
UUID teamLeaderUUID = plugin.getIslands().getTeamLeader(playerUUID);
boolean inTeam = bsb.getPlayers().inTeam(playerUUID);
UUID teamLeaderUUID = bsb.getIslands().getTeamLeader(playerUUID);
if (!(inTeam && teamLeaderUUID.equals(playerUUID))) {
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));
if (targetUUID == null) {
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");
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");
return true;
}
@ -64,7 +64,7 @@ public class IslandTeamSetownerCommand extends AbstractIslandTeamCommand {
.reason(TeamReason.MAKELEADER)
.involvedPlayer(targetUUID)
.build();
plugin.getServer().getPluginManager().callEvent(event);
bsb.getServer().getPluginManager().callEvent(event);
if (event.isCancelled()) return true;
// target is the new leader
@ -81,7 +81,7 @@ public class IslandTeamSetownerCommand extends AbstractIslandTeamCommand {
// Check for zero protection range
Island islandByOwner = getIslands().getIsland(targetUUID);
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);
}
for (PermissionAttachmentInfo perms : target.getEffectivePermissions()) {
@ -93,7 +93,7 @@ public class IslandTeamSetownerCommand extends AbstractIslandTeamCommand {
String[] spl = perms.getPermission().split(Settings.PERMPREFIX + "island.range.");
if (spl.length > 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 {
hasARangePerm = true;
@ -115,7 +115,7 @@ public class IslandTeamSetownerCommand extends AbstractIslandTeamCommand {
if (range != islandByOwner.getProtectionRange()) {
user.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 "
+ 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) {
List<String> options = new ArrayList<>();
String lastArg = (!args.isEmpty() ? args.getLast() : "");
for (UUID member : plugin.getIslands().getMembers(user.getUniqueId())) {
options.add(plugin.getServer().getOfflinePlayer(member).getName());
for (UUID member : bsb.getIslands().getMembers(user.getUniqueId())) {
options.add(bsb.getServer().getOfflinePlayer(member).getName());
}
return Optional.of(Util.tabLimit(options, lastArg));
}