From 9ce1dbf5924a168df647bab5f89d67fdb1e5219b Mon Sep 17 00:00:00 2001 From: Tastybento Date: Wed, 24 Jan 2018 20:49:08 -0800 Subject: [PATCH] Added team kick and leave commands. Need full testing. --- locales/en-US.yml | 6 + .../us/tastybento/bskyblock/Settings.java | 1746 +++++++++-------- .../island/teams/IslandTeamKickCommand.java | 72 +- .../island/teams/IslandTeamLeaveCommand.java | 35 +- .../teams/IslandTeamSetownerCommand.java | 7 +- .../database/managers/PlayersManager.java | 2 +- 6 files changed, 1029 insertions(+), 839 deletions(-) diff --git a/locales/en-US.yml b/locales/en-US.yml index 4a557e378..3bcd12169 100644 --- a/locales/en-US.yml +++ b/locales/en-US.yml @@ -14,6 +14,7 @@ general: unlimited: "Unlimited" success: "&aSuccess!" errors: + command-cancelled: "&cCommand cancelled" no-permission: "&cYou don't have permission to execute this command." use-in-game: "&cThis command is only available in game." no-team: "&cYou do not have a team!" @@ -21,6 +22,7 @@ general: already-have-island: "&cYou already have an island!" no-safe-location: "&cNo safe location found on island!" not-leader: "&cYou are not the leader of your island!" + not-in-team: "&cThat player is not in your team!" offline-player: "&cThat player is offline or doesn't exist." unknown-player: "&cUnknown player!" general: "&cThat command is not ready yet - contact admin" @@ -98,9 +100,13 @@ commands: description: "cancel the pending invite to join your island" leave: description: "leave your island" + type-again: "&cEnter the leave command again to confirm" + left-your-island: "&c[player] left your island" kick: description: "remove a member from your island" parameters: "" + type-again: "&cEnter the kick command again to confirm" + leader-kicked: "&cThe leader kicked you from the island!" promote: description: "promote a player on your island to another rank" parameters: "" diff --git a/src/main/java/us/tastybento/bskyblock/Settings.java b/src/main/java/us/tastybento/bskyblock/Settings.java index 241975252..e23a038d6 100644 --- a/src/main/java/us/tastybento/bskyblock/Settings.java +++ b/src/main/java/us/tastybento/bskyblock/Settings.java @@ -141,7 +141,12 @@ public class Settings implements ISettings { // Reset private int resetLimit; - private int resetWait; + @ConfigEntry(path = "island.require-confirmation.reset") + private boolean resetConfirmation; + + @ConfigEntry(path = "island.require-confirmation.reset-wait") + private long resetWait; + private boolean leaversLoseReset; private boolean kickedKeepInventory; @@ -227,773 +232,25 @@ public class Settings implements ISettings { private String uniqueId = "config"; - /** - * @return the uniqueId - */ - public String getUniqueId() { - return uniqueId; - } - /** - * @param uniqueId the uniqueId to set - */ - public void setUniqueId(String uniqueId) { - this.uniqueId = uniqueId; - } - /** - * @return the checkUpdates - */ - public boolean isCheckUpdates() { - return checkUpdates; - } - /** - * @param checkUpdates the checkUpdates to set - */ - public void setCheckUpdates(boolean checkUpdates) { - this.checkUpdates = checkUpdates; - } - /** - * @return the defaultLanguage - */ - public String getDefaultLanguage() { - return defaultLanguage; - } - /** - * @param defaultLanguage the defaultLanguage to set - */ - public void setDefaultLanguage(String defaultLanguage) { - this.defaultLanguage = defaultLanguage; - } - /** - * @return the useEconomy - */ - public boolean isUseEconomy() { - return useEconomy; - } - /** - * @param useEconomy the useEconomy to set - */ - public void setUseEconomy(boolean useEconomy) { - this.useEconomy = useEconomy; - } - /** - * @return the purgeMaxIslandLevel - */ - public int getPurgeMaxIslandLevel() { - return purgeMaxIslandLevel; - } - /** - * @param purgeMaxIslandLevel the purgeMaxIslandLevel to set - */ - public void setPurgeMaxIslandLevel(int purgeMaxIslandLevel) { - this.purgeMaxIslandLevel = purgeMaxIslandLevel; - } - /** - * @return the purgeRemoveUserData - */ - public boolean isPurgeRemoveUserData() { - return purgeRemoveUserData; - } - /** - * @param purgeRemoveUserData the purgeRemoveUserData to set - */ - public void setPurgeRemoveUserData(boolean purgeRemoveUserData) { - this.purgeRemoveUserData = purgeRemoveUserData; - } - /** - * @return the databaseType - */ - public DatabaseType getDatabaseType() { - return databaseType; - } - /** - * @param databaseType the databaseType to set - */ - public void setDatabaseType(DatabaseType databaseType) { - this.databaseType = databaseType; - } - /** - * @return the dbHost - */ - public String getDbHost() { - return dbHost; - } - /** - * @param dbHost the dbHost to set - */ - public void setDbHost(String dbHost) { - this.dbHost = dbHost; - } - /** - * @return the dbPort - */ - public int getDbPort() { - return dbPort; - } - /** - * @param dbPort the dbPort to set - */ - public void setDbPort(int dbPort) { - this.dbPort = dbPort; - } - /** - * @return the dbName - */ - public String getDbName() { - return dbName; - } - /** - * @param dbName the dbName to set - */ - public void setDbName(String dbName) { - this.dbName = dbName; - } - /** - * @return the dbUsername - */ - public String getDbUsername() { - return dbUsername; - } - /** - * @param dbUsername the dbUsername to set - */ - public void setDbUsername(String dbUsername) { - this.dbUsername = dbUsername; - } - /** - * @return the dbPassword - */ - public String getDbPassword() { - return dbPassword; - } - /** - * @param dbPassword the dbPassword to set - */ - public void setDbPassword(String dbPassword) { - this.dbPassword = dbPassword; - } - /** - * @return the databaseBackupPeriod - */ - public int getDatabaseBackupPeriod() { - return databaseBackupPeriod; - } - /** - * @param databaseBackupPeriod the databaseBackupPeriod to set - */ - public void setDatabaseBackupPeriod(int databaseBackupPeriod) { - this.databaseBackupPeriod = databaseBackupPeriod; - } - /** - * @return the allowAutoActivator - */ - public boolean isAllowAutoActivator() { - return allowAutoActivator; - } - /** - * @param allowAutoActivator the allowAutoActivator to set - */ - public void setAllowAutoActivator(boolean allowAutoActivator) { - this.allowAutoActivator = allowAutoActivator; - } - /** - * @return the allowObsidianScooping - */ - public boolean isAllowObsidianScooping() { - return allowObsidianScooping; - } - /** - * @param allowObsidianScooping the allowObsidianScooping to set - */ - public void setAllowObsidianScooping(boolean allowObsidianScooping) { - this.allowObsidianScooping = allowObsidianScooping; - } - /** - * @return the worldName - */ - public String getWorldName() { - return worldName; - } - /** - * @param worldName the worldName to set - */ - public void setWorldName(String worldName) { - this.worldName = worldName; - } - /** - * @return the islandDistance - */ - public int getIslandDistance() { - return islandDistance; - } - /** - * @param islandDistance the islandDistance to set - */ - public void setIslandDistance(int islandDistance) { - this.islandDistance = islandDistance; - } - /** - * @return the islandProtectionRange - */ - public int getIslandProtectionRange() { - return islandProtectionRange; - } - /** - * @param islandProtectionRange the islandProtectionRange to set - */ - public void setIslandProtectionRange(int islandProtectionRange) { - this.islandProtectionRange = islandProtectionRange; - } - /** - * @return the islandStartX - */ - public int getIslandStartX() { - return islandStartX; - } - /** - * @param islandStartX the islandStartX to set - */ - public void setIslandStartX(int islandStartX) { - this.islandStartX = islandStartX; - } - /** - * @return the islandStartZ - */ - public int getIslandStartZ() { - return islandStartZ; - } - /** - * @param islandStartZ the islandStartZ to set - */ - public void setIslandStartZ(int islandStartZ) { - this.islandStartZ = islandStartZ; - } - /** - * @return the islandXOffset - */ - public int getIslandXOffset() { - return islandXOffset; - } - /** - * @param islandXOffset the islandXOffset to set - */ - public void setIslandXOffset(int islandXOffset) { - this.islandXOffset = islandXOffset; - } - /** - * @return the islandZOffset - */ - public int getIslandZOffset() { - return islandZOffset; - } - /** - * @param islandZOffset the islandZOffset to set - */ - public void setIslandZOffset(int islandZOffset) { - this.islandZOffset = islandZOffset; - } - /** - * @return the seaHeight - */ - public int getSeaHeight() { - return seaHeight; - } - /** - * @param seaHeight the seaHeight to set - */ - public void setSeaHeight(int seaHeight) { - this.seaHeight = seaHeight; - } - /** - * @return the islandHeight - */ - public int getIslandHeight() { - return islandHeight; - } - /** - * @param islandHeight the islandHeight to set - */ - public void setIslandHeight(int islandHeight) { - this.islandHeight = islandHeight; - } - /** - * @return the maxIslands - */ - public int getMaxIslands() { - return maxIslands; - } - /** - * @param maxIslands the maxIslands to set - */ - public void setMaxIslands(int maxIslands) { - this.maxIslands = maxIslands; - } - /** - * @return the netherGenerate - */ - public boolean isNetherGenerate() { - return netherGenerate; - } - /** - * @param netherGenerate the netherGenerate to set - */ - public void setNetherGenerate(boolean netherGenerate) { - this.netherGenerate = netherGenerate; - } - /** - * @return the netherIslands - */ - public boolean isNetherIslands() { - return netherIslands; - } - /** - * @param netherIslands the netherIslands to set - */ - public void setNetherIslands(boolean netherIslands) { - this.netherIslands = netherIslands; - } - /** - * @return the netherTrees - */ - public boolean isNetherTrees() { - return netherTrees; - } - /** - * @param netherTrees the netherTrees to set - */ - public void setNetherTrees(boolean netherTrees) { - this.netherTrees = netherTrees; - } - /** - * @return the netherRoof - */ - public boolean isNetherRoof() { - return netherRoof; - } - /** - * @param netherRoof the netherRoof to set - */ - public void setNetherRoof(boolean netherRoof) { - this.netherRoof = netherRoof; - } - /** - * @return the netherSpawnRadius - */ - public int getNetherSpawnRadius() { - return netherSpawnRadius; - } - /** - * @param netherSpawnRadius the netherSpawnRadius to set - */ - public void setNetherSpawnRadius(int netherSpawnRadius) { - this.netherSpawnRadius = netherSpawnRadius; - } - /** - * @return the endGenerate - */ - public boolean isEndGenerate() { - return endGenerate; - } - /** - * @param endGenerate the endGenerate to set - */ - public void setEndGenerate(boolean endGenerate) { - this.endGenerate = endGenerate; - } - /** - * @return the endIslands - */ - public boolean isEndIslands() { - return endIslands; - } - /** - * @param endIslands the endIslands to set - */ - public void setEndIslands(boolean endIslands) { - this.endIslands = endIslands; - } - /** - * @return the entityLimits - */ - public HashMap getEntityLimits() { - return entityLimits; - } - /** - * @param entityLimits the entityLimits to set - */ - public void setEntityLimits(HashMap entityLimits) { - this.entityLimits = entityLimits; - } - /** - * @return the tileEntityLimits - */ - public HashMap getTileEntityLimits() { - return tileEntityLimits; - } - /** - * @param tileEntityLimits the tileEntityLimits to set - */ - public void setTileEntityLimits(HashMap tileEntityLimits) { - this.tileEntityLimits = tileEntityLimits; - } - /** - * @return the maxTeamSize - */ - public int getMaxTeamSize() { - return maxTeamSize; - } - /** - * @param maxTeamSize the maxTeamSize to set - */ - public void setMaxTeamSize(int maxTeamSize) { - this.maxTeamSize = maxTeamSize; - } - /** - * @return the maxHomes - */ - public int getMaxHomes() { - return maxHomes; - } - /** - * @param maxHomes the maxHomes to set - */ - public void setMaxHomes(int maxHomes) { - this.maxHomes = maxHomes; - } - /** - * @return the nameMinLength - */ - public int getNameMinLength() { - return nameMinLength; - } - /** - * @param nameMinLength the nameMinLength to set - */ - public void setNameMinLength(int nameMinLength) { - this.nameMinLength = nameMinLength; - } - /** - * @return the nameMaxLength - */ - public int getNameMaxLength() { - return nameMaxLength; - } - /** - * @param nameMaxLength the nameMaxLength to set - */ - public void setNameMaxLength(int nameMaxLength) { - this.nameMaxLength = nameMaxLength; - } - /** - * @return the inviteWait - */ - public int getInviteWait() { - return inviteWait; - } - /** - * @param inviteWait the inviteWait to set - */ - public void setInviteWait(int inviteWait) { - this.inviteWait = inviteWait; - } - /** - * @return the resetLimit - */ - public int getResetLimit() { - return resetLimit; - } - /** - * @param resetLimit the resetLimit to set - */ - public void setResetLimit(int resetLimit) { - this.resetLimit = resetLimit; - } - /** - * @return the resetWait - */ - public int getResetWait() { - return resetWait; - } - /** - * @param resetWait the resetWait to set - */ - public void setResetWait(int resetWait) { - this.resetWait = resetWait; - } - /** - * @return the leaversLoseReset - */ - public boolean isLeaversLoseReset() { - return leaversLoseReset; - } - /** - * @param leaversLoseReset the leaversLoseReset to set - */ - public void setLeaversLoseReset(boolean leaversLoseReset) { - this.leaversLoseReset = leaversLoseReset; - } - /** - * @return the kickedKeepInventory - */ - public boolean isKickedKeepInventory() { - return kickedKeepInventory; - } - /** - * @param kickedKeepInventory the kickedKeepInventory to set - */ - public void setKickedKeepInventory(boolean kickedKeepInventory) { - this.kickedKeepInventory = kickedKeepInventory; - } - /** - * @return the removeMobsOnLogin - */ - public boolean isRemoveMobsOnLogin() { - return removeMobsOnLogin; - } - /** - * @param removeMobsOnLogin the removeMobsOnLogin to set - */ - public void setRemoveMobsOnLogin(boolean removeMobsOnLogin) { - this.removeMobsOnLogin = removeMobsOnLogin; - } - /** - * @return the removeMobsOnIsland - */ - public boolean isRemoveMobsOnIsland() { - return removeMobsOnIsland; - } - /** - * @param removeMobsOnIsland the removeMobsOnIsland to set - */ - public void setRemoveMobsOnIsland(boolean removeMobsOnIsland) { - this.removeMobsOnIsland = removeMobsOnIsland; - } - /** - * @return the removeMobsWhitelist - */ - public List getRemoveMobsWhitelist() { - return removeMobsWhitelist; - } - /** - * @param removeMobsWhitelist the removeMobsWhitelist to set - */ - public void setRemoveMobsWhitelist(List removeMobsWhitelist) { - this.removeMobsWhitelist = removeMobsWhitelist; - } - /** - * @return the makeIslandIfNone - */ - public boolean isMakeIslandIfNone() { - return makeIslandIfNone; - } - /** - * @param makeIslandIfNone the makeIslandIfNone to set - */ - public void setMakeIslandIfNone(boolean makeIslandIfNone) { - this.makeIslandIfNone = makeIslandIfNone; - } - /** - * @return the immediateTeleportOnIsland - */ - public boolean isImmediateTeleportOnIsland() { - return immediateTeleportOnIsland; - } - /** - * @param immediateTeleportOnIsland the immediateTeleportOnIsland to set - */ - public void setImmediateTeleportOnIsland(boolean immediateTeleportOnIsland) { - this.immediateTeleportOnIsland = immediateTeleportOnIsland; - } - /** - * @return the respawnOnIsland - */ - public boolean isRespawnOnIsland() { - return respawnOnIsland; - } - /** - * @param respawnOnIsland the respawnOnIsland to set - */ - public void setRespawnOnIsland(boolean respawnOnIsland) { - this.respawnOnIsland = respawnOnIsland; - } - /** - * @return the deathsMax - */ - public int getDeathsMax() { - return deathsMax; - } - /** - * @param deathsMax the deathsMax to set - */ - public void setDeathsMax(int deathsMax) { - this.deathsMax = deathsMax; - } - /** - * @return the deathsSumTeam - */ - public boolean isDeathsSumTeam() { - return deathsSumTeam; - } - /** - * @param deathsSumTeam the deathsSumTeam to set - */ - public void setDeathsSumTeam(boolean deathsSumTeam) { - this.deathsSumTeam = deathsSumTeam; - } - /** - * @return the allowPistonPush - */ - public boolean isAllowPistonPush() { - return allowPistonPush; - } - /** - * @param allowPistonPush the allowPistonPush to set - */ - public void setAllowPistonPush(boolean allowPistonPush) { - this.allowPistonPush = allowPistonPush; - } - /** - * @return the restrictFlyingMobs - */ - public boolean isRestrictFlyingMobs() { - return restrictFlyingMobs; - } - /** - * @param restrictFlyingMobs the restrictFlyingMobs to set - */ - public void setRestrictFlyingMobs(boolean restrictFlyingMobs) { - this.restrictFlyingMobs = restrictFlyingMobs; - } - /** - * @return the togglePvPCooldown - */ - public int getTogglePvPCooldown() { - return togglePvPCooldown; - } - /** - * @param togglePvPCooldown the togglePvPCooldown to set - */ - public void setTogglePvPCooldown(int togglePvPCooldown) { - this.togglePvPCooldown = togglePvPCooldown; - } - /** - * @return the defaultFlags - */ - public HashMap getDefaultFlags() { - return defaultFlags; - } - /** - * @param defaultFlags the defaultFlags to set - */ - public void setDefaultFlags(HashMap defaultFlags) { - this.defaultFlags = defaultFlags; - } - /** - * @return the allowEndermanGriefing - */ - public boolean isAllowEndermanGriefing() { - return allowEndermanGriefing; - } - /** - * @param allowEndermanGriefing the allowEndermanGriefing to set - */ - public void setAllowEndermanGriefing(boolean allowEndermanGriefing) { - this.allowEndermanGriefing = allowEndermanGriefing; - } - /** - * @return the endermanDeathDrop - */ - public boolean isEndermanDeathDrop() { - return endermanDeathDrop; - } - /** - * @param endermanDeathDrop the endermanDeathDrop to set - */ - public void setEndermanDeathDrop(boolean endermanDeathDrop) { - this.endermanDeathDrop = endermanDeathDrop; - } - /** - * @return the allowTNTDamage - */ - public boolean isAllowTNTDamage() { - return allowTNTDamage; - } - /** - * @param allowTNTDamage the allowTNTDamage to set - */ - public void setAllowTNTDamage(boolean allowTNTDamage) { - this.allowTNTDamage = allowTNTDamage; - } - /** - * @return the allowChestDamage - */ - public boolean isAllowChestDamage() { - return allowChestDamage; - } - /** - * @param allowChestDamage the allowChestDamage to set - */ - public void setAllowChestDamage(boolean allowChestDamage) { - this.allowChestDamage = allowChestDamage; - } - /** - * @return the allowCreeperDamage - */ - public boolean isAllowCreeperDamage() { - return allowCreeperDamage; - } - /** - * @param allowCreeperDamage the allowCreeperDamage to set - */ - public void setAllowCreeperDamage(boolean allowCreeperDamage) { - this.allowCreeperDamage = allowCreeperDamage; - } - /** - * @return the allowCreeperGriefing - */ - public boolean isAllowCreeperGriefing() { - return allowCreeperGriefing; - } - /** - * @param allowCreeperGriefing the allowCreeperGriefing to set - */ - public void setAllowCreeperGriefing(boolean allowCreeperGriefing) { - this.allowCreeperGriefing = allowCreeperGriefing; - } - /** - * @return the allowMobDamageToItemFrames - */ - public boolean isAllowMobDamageToItemFrames() { - return allowMobDamageToItemFrames; - } - /** - * @param allowMobDamageToItemFrames the allowMobDamageToItemFrames to set - */ - public void setAllowMobDamageToItemFrames(boolean allowMobDamageToItemFrames) { - this.allowMobDamageToItemFrames = allowMobDamageToItemFrames; - } - /** - * @return the acidDamageOp - */ - public boolean isAcidDamageOp() { - return acidDamageOp; - } - /** - * @param acidDamageOp the acidDamageOp to set - */ - public void setAcidDamageOp(boolean acidDamageOp) { - this.acidDamageOp = acidDamageOp; - } - /** - * @return the acidDamageChickens - */ - public boolean isAcidDamageChickens() { - return acidDamageChickens; - } - /** - * @param acidDamageChickens the acidDamageChickens to set - */ - public void setAcidDamageChickens(boolean acidDamageChickens) { - this.acidDamageChickens = acidDamageChickens; + // Timeout for team kick and leave commands + @ConfigEntry(path = "island.require-confirmation.kick") + private boolean kickConfirmation; + + @ConfigEntry(path = "island.require-confirmation.kick-wait") + private long kickWait; + + @ConfigEntry(path = "island.require-confirmation.leave") + private boolean leaveConfirmation; + + @ConfigEntry(path = "island.require-confirmation.leave-wait") + private long leaveWait; + + + /** + * @return the acidDamage + */ + public int getAcidDamage() { + return acidDamage; } /** * @return the acidDestroyItemTime @@ -1002,22 +259,10 @@ public class Settings implements ISettings { return acidDestroyItemTime; } /** - * @param acidDestroyItemTime the acidDestroyItemTime to set + * @return the acidEffects */ - public void setAcidDestroyItemTime(int acidDestroyItemTime) { - this.acidDestroyItemTime = acidDestroyItemTime; - } - /** - * @return the acidDamage - */ - public int getAcidDamage() { - return acidDamage; - } - /** - * @param acidDamage the acidDamage to set - */ - public void setAcidDamage(int acidDamage) { - this.acidDamage = acidDamage; + public List getAcidEffects() { + return acidEffects; } /** * @return the acidRainDamage @@ -1026,22 +271,10 @@ public class Settings implements ISettings { return acidRainDamage; } /** - * @param acidRainDamage the acidRainDamage to set + * @return the chestItems */ - public void setAcidRainDamage(int acidRainDamage) { - this.acidRainDamage = acidRainDamage; - } - /** - * @return the acidEffects - */ - public List getAcidEffects() { - return acidEffects; - } - /** - * @param acidEffects the acidEffects to set - */ - public void setAcidEffects(List acidEffects) { - this.acidEffects = acidEffects; + public List getChestItems() { + return chestItems; } /** * @return the companionNames @@ -1049,24 +282,6 @@ public class Settings implements ISettings { public List getCompanionNames() { return companionNames; } - /** - * @param companionNames the companionNames to set - */ - public void setCompanionNames(List companionNames) { - this.companionNames = companionNames; - } - /** - * @return the chestItems - */ - public List getChestItems() { - return chestItems; - } - /** - * @param chestItems the chestItems to set - */ - public void setChestItems(List chestItems) { - this.chestItems = chestItems; - } /** * @return the companionType */ @@ -1074,22 +289,135 @@ public class Settings implements ISettings { return companionType; } /** - * @param companionType the companionType to set + * @return the databaseBackupPeriod */ - public void setCompanionType(EntityType companionType) { - this.companionType = companionType; + public int getDatabaseBackupPeriod() { + return databaseBackupPeriod; } /** - * @return the useOwnGenerator + * @return the databaseType */ - public boolean isUseOwnGenerator() { - return useOwnGenerator; + public DatabaseType getDatabaseType() { + return databaseType; } /** - * @param useOwnGenerator the useOwnGenerator to set + * @return the dbHost */ - public void setUseOwnGenerator(boolean useOwnGenerator) { - this.useOwnGenerator = useOwnGenerator; + public String getDbHost() { + return dbHost; + } + /** + * @return the dbName + */ + public String getDbName() { + return dbName; + } + /** + * @return the dbPassword + */ + public String getDbPassword() { + return dbPassword; + } + /** + * @return the dbPort + */ + public int getDbPort() { + return dbPort; + } + /** + * @return the dbUsername + */ + public String getDbUsername() { + return dbUsername; + } + /** + * @return the deathsMax + */ + public int getDeathsMax() { + return deathsMax; + } + /** + * @return the defaultFlags + */ + public HashMap getDefaultFlags() { + return defaultFlags; + } + /** + * @return the defaultLanguage + */ + public String getDefaultLanguage() { + return defaultLanguage; + } + /** + * @return the entityLimits + */ + public HashMap getEntityLimits() { + return entityLimits; + } + @Override + public Settings getInstance() { + // TODO Auto-generated method stub + return this; + } + /** + * @return the inviteWait + */ + public int getInviteWait() { + return inviteWait; + } + /** + * @return the islandDistance + */ + public int getIslandDistance() { + return islandDistance; + } + /** + * @return the islandHeight + */ + public int getIslandHeight() { + return islandHeight; + } + /** + * @return the islandProtectionRange + */ + public int getIslandProtectionRange() { + return islandProtectionRange; + } + /** + * @return the islandStartX + */ + public int getIslandStartX() { + return islandStartX; + } + /** + * @return the islandStartZ + */ + public int getIslandStartZ() { + return islandStartZ; + } + /** + * @return the islandXOffset + */ + public int getIslandXOffset() { + return islandXOffset; + } + /** + * @return the islandZOffset + */ + public int getIslandZOffset() { + return islandZOffset; + } + /** + * @return the kickWait + */ + public long getKickWait() { + return kickWait; + } + /** + * @return the leaveWait + */ + public long getLeaveWait() { + return leaveWait; } /** * @return the limitedBlocks @@ -1098,10 +426,286 @@ public class Settings implements ISettings { return limitedBlocks; } /** - * @param limitedBlocks the limitedBlocks to set + * @return the maxHomes */ - public void setLimitedBlocks(HashMap limitedBlocks) { - this.limitedBlocks = limitedBlocks; + public int getMaxHomes() { + return maxHomes; + } + /** + * @return the maxIslands + */ + public int getMaxIslands() { + return maxIslands; + } + /** + * @return the maxTeamSize + */ + public int getMaxTeamSize() { + return maxTeamSize; + } + /** + * @return the nameMaxLength + */ + public int getNameMaxLength() { + return nameMaxLength; + } + /** + * @return the nameMinLength + */ + public int getNameMinLength() { + return nameMinLength; + } + /** + * @return the netherSpawnRadius + */ + public int getNetherSpawnRadius() { + return netherSpawnRadius; + } + /** + * @return the purgeMaxIslandLevel + */ + public int getPurgeMaxIslandLevel() { + return purgeMaxIslandLevel; + } + /** + * @return the removeMobsWhitelist + */ + public List getRemoveMobsWhitelist() { + return removeMobsWhitelist; + } + /** + * @return the resetLimit + */ + public int getResetLimit() { + return resetLimit; + } + /** + * @return the resetWait + */ + public long getResetWait() { + return resetWait; + } + /** + * @return the seaHeight + */ + public int getSeaHeight() { + return seaHeight; + } + /** + * @return the tileEntityLimits + */ + public HashMap getTileEntityLimits() { + return tileEntityLimits; + } + /** + * @return the togglePvPCooldown + */ + public int getTogglePvPCooldown() { + return togglePvPCooldown; + } + /** + * @return the uniqueId + */ + public String getUniqueId() { + return uniqueId; + } + /** + * @return the worldName + */ + public String getWorldName() { + return worldName; + } + /** + * @return the acidDamageChickens + */ + public boolean isAcidDamageChickens() { + return acidDamageChickens; + } + /** + * @return the acidDamageOp + */ + public boolean isAcidDamageOp() { + return acidDamageOp; + } + /** + * @return the allowAutoActivator + */ + public boolean isAllowAutoActivator() { + return allowAutoActivator; + } + /** + * @return the allowChestDamage + */ + public boolean isAllowChestDamage() { + return allowChestDamage; + } + /** + * @return the allowCreeperDamage + */ + public boolean isAllowCreeperDamage() { + return allowCreeperDamage; + } + /** + * @return the allowCreeperGriefing + */ + public boolean isAllowCreeperGriefing() { + return allowCreeperGriefing; + } + /** + * @return the allowEndermanGriefing + */ + public boolean isAllowEndermanGriefing() { + return allowEndermanGriefing; + } + /** + * @return the allowMobDamageToItemFrames + */ + public boolean isAllowMobDamageToItemFrames() { + return allowMobDamageToItemFrames; + } + /** + * @return the allowObsidianScooping + */ + public boolean isAllowObsidianScooping() { + return allowObsidianScooping; + } + /** + * @return the allowPistonPush + */ + public boolean isAllowPistonPush() { + return allowPistonPush; + } + /** + * @return the allowTNTDamage + */ + public boolean isAllowTNTDamage() { + return allowTNTDamage; + } + /** + * @return the checkUpdates + */ + public boolean isCheckUpdates() { + return checkUpdates; + } + /** + * @return the deathsSumTeam + */ + public boolean isDeathsSumTeam() { + return deathsSumTeam; + } + /** + * @return the endermanDeathDrop + */ + public boolean isEndermanDeathDrop() { + return endermanDeathDrop; + } + /** + * @return the endGenerate + */ + public boolean isEndGenerate() { + return endGenerate; + } + /** + * @return the endIslands + */ + public boolean isEndIslands() { + return endIslands; + } + /** + * @return the immediateTeleportOnIsland + */ + public boolean isImmediateTeleportOnIsland() { + return immediateTeleportOnIsland; + } + /** + * @return the kickConfirmation + */ + public boolean isKickConfirmation() { + return kickConfirmation; + } + /** + * @return the kickedKeepInventory + */ + public boolean isKickedKeepInventory() { + return kickedKeepInventory; + } + /** + * @return the leaveConfirmation + */ + public boolean isLeaveConfirmation() { + return leaveConfirmation; + } + /** + * @return the leaversLoseReset + */ + public boolean isLeaversLoseReset() { + return leaversLoseReset; + } + /** + * @return the makeIslandIfNone + */ + public boolean isMakeIslandIfNone() { + return makeIslandIfNone; + } + /** + * @return the netherGenerate + */ + public boolean isNetherGenerate() { + return netherGenerate; + } + /** + * @return the netherIslands + */ + public boolean isNetherIslands() { + return netherIslands; + } + /** + * @return the netherRoof + */ + public boolean isNetherRoof() { + return netherRoof; + } + /** + * @return the netherTrees + */ + public boolean isNetherTrees() { + return netherTrees; + } + /** + * @return the purgeRemoveUserData + */ + public boolean isPurgeRemoveUserData() { + return purgeRemoveUserData; + } + /** + * @return the removeMobsOnIsland + */ + public boolean isRemoveMobsOnIsland() { + return removeMobsOnIsland; + } + /** + * @return the removeMobsOnLogin + */ + public boolean isRemoveMobsOnLogin() { + return removeMobsOnLogin; + } + /** + * @return the resetConfirmation + */ + public boolean isResetConfirmation() { + return resetConfirmation; + } + /** + * @return the respawnOnIsland + */ + public boolean isRespawnOnIsland() { + return respawnOnIsland; + } + /** + * @return the restrictFlyingMobs + */ + public boolean isRestrictFlyingMobs() { + return restrictFlyingMobs; } /** * @return the teamJoinDeathReset @@ -1109,17 +713,493 @@ public class Settings implements ISettings { public boolean isTeamJoinDeathReset() { return teamJoinDeathReset; } + /** + * @return the useEconomy + */ + public boolean isUseEconomy() { + return useEconomy; + } + /** + * @return the useOwnGenerator + */ + public boolean isUseOwnGenerator() { + return useOwnGenerator; + } + /** + * @param acidDamage the acidDamage to set + */ + public void setAcidDamage(int acidDamage) { + this.acidDamage = acidDamage; + } + /** + * @param acidDamageChickens the acidDamageChickens to set + */ + public void setAcidDamageChickens(boolean acidDamageChickens) { + this.acidDamageChickens = acidDamageChickens; + } + /** + * @param acidDamageOp the acidDamageOp to set + */ + public void setAcidDamageOp(boolean acidDamageOp) { + this.acidDamageOp = acidDamageOp; + } + /** + * @param acidDestroyItemTime the acidDestroyItemTime to set + */ + public void setAcidDestroyItemTime(int acidDestroyItemTime) { + this.acidDestroyItemTime = acidDestroyItemTime; + } + /** + * @param acidEffects the acidEffects to set + */ + public void setAcidEffects(List acidEffects) { + this.acidEffects = acidEffects; + } + /** + * @param acidRainDamage the acidRainDamage to set + */ + public void setAcidRainDamage(int acidRainDamage) { + this.acidRainDamage = acidRainDamage; + } + /** + * @param allowAutoActivator the allowAutoActivator to set + */ + public void setAllowAutoActivator(boolean allowAutoActivator) { + this.allowAutoActivator = allowAutoActivator; + } + /** + * @param allowChestDamage the allowChestDamage to set + */ + public void setAllowChestDamage(boolean allowChestDamage) { + this.allowChestDamage = allowChestDamage; + } + /** + * @param allowCreeperDamage the allowCreeperDamage to set + */ + public void setAllowCreeperDamage(boolean allowCreeperDamage) { + this.allowCreeperDamage = allowCreeperDamage; + } + /** + * @param allowCreeperGriefing the allowCreeperGriefing to set + */ + public void setAllowCreeperGriefing(boolean allowCreeperGriefing) { + this.allowCreeperGriefing = allowCreeperGriefing; + } + /** + * @param allowEndermanGriefing the allowEndermanGriefing to set + */ + public void setAllowEndermanGriefing(boolean allowEndermanGriefing) { + this.allowEndermanGriefing = allowEndermanGriefing; + } + /** + * @param allowMobDamageToItemFrames the allowMobDamageToItemFrames to set + */ + public void setAllowMobDamageToItemFrames(boolean allowMobDamageToItemFrames) { + this.allowMobDamageToItemFrames = allowMobDamageToItemFrames; + } + /** + * @param allowObsidianScooping the allowObsidianScooping to set + */ + public void setAllowObsidianScooping(boolean allowObsidianScooping) { + this.allowObsidianScooping = allowObsidianScooping; + } + /** + * @param allowPistonPush the allowPistonPush to set + */ + public void setAllowPistonPush(boolean allowPistonPush) { + this.allowPistonPush = allowPistonPush; + } + /** + * @param allowTNTDamage the allowTNTDamage to set + */ + public void setAllowTNTDamage(boolean allowTNTDamage) { + this.allowTNTDamage = allowTNTDamage; + } + /** + * @param checkUpdates the checkUpdates to set + */ + public void setCheckUpdates(boolean checkUpdates) { + this.checkUpdates = checkUpdates; + } + /** + * @param chestItems the chestItems to set + */ + public void setChestItems(List chestItems) { + this.chestItems = chestItems; + } + /** + * @param companionNames the companionNames to set + */ + public void setCompanionNames(List companionNames) { + this.companionNames = companionNames; + } + /** + * @param companionType the companionType to set + */ + public void setCompanionType(EntityType companionType) { + this.companionType = companionType; + } + /** + * @param databaseBackupPeriod the databaseBackupPeriod to set + */ + public void setDatabaseBackupPeriod(int databaseBackupPeriod) { + this.databaseBackupPeriod = databaseBackupPeriod; + } + /** + * @param databaseType the databaseType to set + */ + public void setDatabaseType(DatabaseType databaseType) { + this.databaseType = databaseType; + } + /** + * @param dbHost the dbHost to set + */ + public void setDbHost(String dbHost) { + this.dbHost = dbHost; + } + /** + * @param dbName the dbName to set + */ + public void setDbName(String dbName) { + this.dbName = dbName; + } + /** + * @param dbPassword the dbPassword to set + */ + public void setDbPassword(String dbPassword) { + this.dbPassword = dbPassword; + } + /** + * @param dbPort the dbPort to set + */ + public void setDbPort(int dbPort) { + this.dbPort = dbPort; + } + /** + * @param dbUsername the dbUsername to set + */ + public void setDbUsername(String dbUsername) { + this.dbUsername = dbUsername; + } + /** + * @param deathsMax the deathsMax to set + */ + public void setDeathsMax(int deathsMax) { + this.deathsMax = deathsMax; + } + /** + * @param deathsSumTeam the deathsSumTeam to set + */ + public void setDeathsSumTeam(boolean deathsSumTeam) { + this.deathsSumTeam = deathsSumTeam; + } + /** + * @param defaultFlags the defaultFlags to set + */ + public void setDefaultFlags(HashMap defaultFlags) { + this.defaultFlags = defaultFlags; + } + /** + * @param defaultLanguage the defaultLanguage to set + */ + public void setDefaultLanguage(String defaultLanguage) { + this.defaultLanguage = defaultLanguage; + } + /** + * @param endermanDeathDrop the endermanDeathDrop to set + */ + public void setEndermanDeathDrop(boolean endermanDeathDrop) { + this.endermanDeathDrop = endermanDeathDrop; + } + /** + * @param endGenerate the endGenerate to set + */ + public void setEndGenerate(boolean endGenerate) { + this.endGenerate = endGenerate; + } + /** + * @param endIslands the endIslands to set + */ + public void setEndIslands(boolean endIslands) { + this.endIslands = endIslands; + } + /** + * @param entityLimits the entityLimits to set + */ + public void setEntityLimits(HashMap entityLimits) { + this.entityLimits = entityLimits; + } + /** + * @param immediateTeleportOnIsland the immediateTeleportOnIsland to set + */ + public void setImmediateTeleportOnIsland(boolean immediateTeleportOnIsland) { + this.immediateTeleportOnIsland = immediateTeleportOnIsland; + } + /** + * @param inviteWait the inviteWait to set + */ + public void setInviteWait(int inviteWait) { + this.inviteWait = inviteWait; + } + /** + * @param islandDistance the islandDistance to set + */ + public void setIslandDistance(int islandDistance) { + this.islandDistance = islandDistance; + } + /** + * @param islandHeight the islandHeight to set + */ + public void setIslandHeight(int islandHeight) { + this.islandHeight = islandHeight; + } + /** + * @param islandProtectionRange the islandProtectionRange to set + */ + public void setIslandProtectionRange(int islandProtectionRange) { + this.islandProtectionRange = islandProtectionRange; + } + /** + * @param islandStartX the islandStartX to set + */ + public void setIslandStartX(int islandStartX) { + this.islandStartX = islandStartX; + } + /** + * @param islandStartZ the islandStartZ to set + */ + public void setIslandStartZ(int islandStartZ) { + this.islandStartZ = islandStartZ; + } + /** + * @param islandXOffset the islandXOffset to set + */ + public void setIslandXOffset(int islandXOffset) { + this.islandXOffset = islandXOffset; + } + /** + * @param islandZOffset the islandZOffset to set + */ + public void setIslandZOffset(int islandZOffset) { + this.islandZOffset = islandZOffset; + } + /** + * @param kickConfirmation the kickConfirmation to set + */ + public void setKickConfirmation(boolean kickConfirmation) { + this.kickConfirmation = kickConfirmation; + } + /** + * @param kickedKeepInventory the kickedKeepInventory to set + */ + public void setKickedKeepInventory(boolean kickedKeepInventory) { + this.kickedKeepInventory = kickedKeepInventory; + } + /** + * @param kickWait the kickWait to set + */ + public void setKickWait(long kickWait) { + this.kickWait = kickWait; + } + /** + * @param leaveConfirmation the leaveConfirmation to set + */ + public void setLeaveConfirmation(boolean leaveConfirmation) { + this.leaveConfirmation = leaveConfirmation; + } + /** + * @param leaversLoseReset the leaversLoseReset to set + */ + public void setLeaversLoseReset(boolean leaversLoseReset) { + this.leaversLoseReset = leaversLoseReset; + } + /** + * @param leaveWait the leaveWait to set + */ + public void setLeaveWait(long leaveWait) { + this.leaveWait = leaveWait; + } + /** + * @param limitedBlocks the limitedBlocks to set + */ + public void setLimitedBlocks(HashMap limitedBlocks) { + this.limitedBlocks = limitedBlocks; + } + /** + * @param makeIslandIfNone the makeIslandIfNone to set + */ + public void setMakeIslandIfNone(boolean makeIslandIfNone) { + this.makeIslandIfNone = makeIslandIfNone; + } + /** + * @param maxHomes the maxHomes to set + */ + public void setMaxHomes(int maxHomes) { + this.maxHomes = maxHomes; + } + /** + * @param maxIslands the maxIslands to set + */ + public void setMaxIslands(int maxIslands) { + this.maxIslands = maxIslands; + } + /** + * @param maxTeamSize the maxTeamSize to set + */ + public void setMaxTeamSize(int maxTeamSize) { + this.maxTeamSize = maxTeamSize; + } + /** + * @param nameMaxLength the nameMaxLength to set + */ + public void setNameMaxLength(int nameMaxLength) { + this.nameMaxLength = nameMaxLength; + } + /** + * @param nameMinLength the nameMinLength to set + */ + public void setNameMinLength(int nameMinLength) { + this.nameMinLength = nameMinLength; + } + /** + * @param netherGenerate the netherGenerate to set + */ + public void setNetherGenerate(boolean netherGenerate) { + this.netherGenerate = netherGenerate; + } + /** + * @param netherIslands the netherIslands to set + */ + public void setNetherIslands(boolean netherIslands) { + this.netherIslands = netherIslands; + } + /** + * @param netherRoof the netherRoof to set + */ + public void setNetherRoof(boolean netherRoof) { + this.netherRoof = netherRoof; + } + /** + * @param netherSpawnRadius the netherSpawnRadius to set + */ + public void setNetherSpawnRadius(int netherSpawnRadius) { + this.netherSpawnRadius = netherSpawnRadius; + } + /** + * @param netherTrees the netherTrees to set + */ + public void setNetherTrees(boolean netherTrees) { + this.netherTrees = netherTrees; + } + /** + * @param purgeMaxIslandLevel the purgeMaxIslandLevel to set + */ + public void setPurgeMaxIslandLevel(int purgeMaxIslandLevel) { + this.purgeMaxIslandLevel = purgeMaxIslandLevel; + } + /** + * @param purgeRemoveUserData the purgeRemoveUserData to set + */ + public void setPurgeRemoveUserData(boolean purgeRemoveUserData) { + this.purgeRemoveUserData = purgeRemoveUserData; + } + /** + * @param removeMobsOnIsland the removeMobsOnIsland to set + */ + public void setRemoveMobsOnIsland(boolean removeMobsOnIsland) { + this.removeMobsOnIsland = removeMobsOnIsland; + } + /** + * @param removeMobsOnLogin the removeMobsOnLogin to set + */ + public void setRemoveMobsOnLogin(boolean removeMobsOnLogin) { + this.removeMobsOnLogin = removeMobsOnLogin; + } + /** + * @param removeMobsWhitelist the removeMobsWhitelist to set + */ + public void setRemoveMobsWhitelist(List removeMobsWhitelist) { + this.removeMobsWhitelist = removeMobsWhitelist; + } + + /** + * @param resetConfirmation the resetConfirmation to set + */ + public void setResetConfirmation(boolean resetConfirmation) { + this.resetConfirmation = resetConfirmation; + } + /** + * @param resetLimit the resetLimit to set + */ + public void setResetLimit(int resetLimit) { + this.resetLimit = resetLimit; + } + /** + * @param resetWait the resetWait to set + */ + public void setResetWait(long resetWait) { + this.resetWait = resetWait; + } + /** + * @param respawnOnIsland the respawnOnIsland to set + */ + public void setRespawnOnIsland(boolean respawnOnIsland) { + this.respawnOnIsland = respawnOnIsland; + } + /** + * @param restrictFlyingMobs the restrictFlyingMobs to set + */ + public void setRestrictFlyingMobs(boolean restrictFlyingMobs) { + this.restrictFlyingMobs = restrictFlyingMobs; + } + /** + * @param seaHeight the seaHeight to set + */ + public void setSeaHeight(int seaHeight) { + this.seaHeight = seaHeight; + } /** * @param teamJoinDeathReset the teamJoinDeathReset to set */ public void setTeamJoinDeathReset(boolean teamJoinDeathReset) { this.teamJoinDeathReset = teamJoinDeathReset; } - - @Override - public Settings getInstance() { - // TODO Auto-generated method stub - return this; + /** + * @param tileEntityLimits the tileEntityLimits to set + */ + public void setTileEntityLimits(HashMap tileEntityLimits) { + this.tileEntityLimits = tileEntityLimits; } + /** + * @param togglePvPCooldown the togglePvPCooldown to set + */ + public void setTogglePvPCooldown(int togglePvPCooldown) { + this.togglePvPCooldown = togglePvPCooldown; + } + /** + * @param uniqueId the uniqueId to set + */ + public void setUniqueId(String uniqueId) { + this.uniqueId = uniqueId; + } + /** + * @param useEconomy the useEconomy to set + */ + public void setUseEconomy(boolean useEconomy) { + this.useEconomy = useEconomy; + } + /** + * @param useOwnGenerator the useOwnGenerator to set + */ + public void setUseOwnGenerator(boolean useOwnGenerator) { + this.useOwnGenerator = useOwnGenerator; + } + /** + * @param worldName the worldName to set + */ + public void setWorldName(String worldName) { + this.worldName = worldName; + } + } \ No newline at end of file diff --git a/src/main/java/us/tastybento/bskyblock/commands/island/teams/IslandTeamKickCommand.java b/src/main/java/us/tastybento/bskyblock/commands/island/teams/IslandTeamKickCommand.java index e7ba06941..f3316846f 100644 --- a/src/main/java/us/tastybento/bskyblock/commands/island/teams/IslandTeamKickCommand.java +++ b/src/main/java/us/tastybento/bskyblock/commands/island/teams/IslandTeamKickCommand.java @@ -1,6 +1,76 @@ package us.tastybento.bskyblock.commands.island.teams; -public class IslandTeamKickCommand { +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import java.util.UUID; + +import org.bukkit.scheduler.BukkitRunnable; + +import us.tastybento.bskyblock.Constants; +import us.tastybento.bskyblock.api.commands.User; + +public class IslandTeamKickCommand extends AbstractIslandTeamCommand { + + Set kickSet; + + public IslandTeamKickCommand(IslandTeamCommand islandTeamCommand) { + super(islandTeamCommand, "kick"); + } + + @Override + public void setup() { + this.setPermission(Constants.PERMPREFIX + "island.team"); + this.setOnlyPlayer(true); + this.setParameters("commands.island.team.kick.parameters"); + this.setDescription("commands.island.team.kick.description"); + kickSet = new HashSet<>(); + } + + @Override + public boolean execute(User user, List args) { + if (!getPlayers().inTeam(user.getUniqueId())) { + user.sendMessage("general.errors.no-team"); + return true; + } + if (!getIslands().getTeamLeader(user.getUniqueId()).equals(user.getUniqueId())) { + user.sendMessage("general.errors.not-leader"); + return true; + } + // If args are not right, show help + if (args.size() != 1) { + this.getSubCommand("help").get().execute(user, new ArrayList<>()); + return true; + } + // Get target + UUID targetUUID = getPlayers().getUUID(args.get(0)); + if (targetUUID == null) { + user.sendMessage("general.errors.unknown-player"); + return true; + } + if (!getIslands().getMembers(user.getUniqueId()).contains(targetUUID)) { + user.sendMessage("general.errors.not-in-team"); + return true; + } + if (!getSettings().isKickConfirmation() || kickSet.contains(targetUUID)) { + kickSet.remove(targetUUID); + User.getInstance(targetUUID).sendMessage("commands.island.team.kick.leader-kicked"); + getIslands().removePlayer(targetUUID); + user.sendMessage("general.success"); + } else { + user.sendMessage("commands.island.team.kick.type-again"); + kickSet.add(targetUUID); + new BukkitRunnable() { + + @Override + public void run() { + kickSet.remove(targetUUID); + user.sendMessage("general.errors.command-cancelled"); + }}.runTaskLater(getPlugin(), getSettings().getKickWait()); + } + return true; + } } \ No newline at end of file diff --git a/src/main/java/us/tastybento/bskyblock/commands/island/teams/IslandTeamLeaveCommand.java b/src/main/java/us/tastybento/bskyblock/commands/island/teams/IslandTeamLeaveCommand.java index a8f5ddaee..77865800c 100644 --- a/src/main/java/us/tastybento/bskyblock/commands/island/teams/IslandTeamLeaveCommand.java +++ b/src/main/java/us/tastybento/bskyblock/commands/island/teams/IslandTeamLeaveCommand.java @@ -1,11 +1,18 @@ package us.tastybento.bskyblock.commands.island.teams; +import java.util.HashSet; import java.util.List; +import java.util.Set; +import java.util.UUID; + +import org.bukkit.scheduler.BukkitRunnable; import us.tastybento.bskyblock.Constants; import us.tastybento.bskyblock.api.commands.User; public class IslandTeamLeaveCommand extends AbstractIslandTeamCommand { + + Set leaveSet; public IslandTeamLeaveCommand(IslandTeamCommand islandTeamCommand) { super(islandTeamCommand, "leave"); @@ -16,13 +23,35 @@ public class IslandTeamLeaveCommand extends AbstractIslandTeamCommand { this.setPermission(Constants.PERMPREFIX + "island.team"); this.setOnlyPlayer(true); this.setDescription("commands.island.team.leave.description"); - + leaveSet = new HashSet<>(); } @Override public boolean execute(User user, List args) { - // TODO Auto-generated method stub - return false; + if (!getPlayers().inTeam(user.getUniqueId())) { + user.sendMessage("general.errors.no-team"); + return true; + } + if (!getSettings().isKickConfirmation() || leaveSet.contains(user.getUniqueId())) { + leaveSet.remove(user.getUniqueId()); + UUID leaderUUID = getIslands().getTeamLeader(user.getUniqueId()); + if (leaderUUID != null) { + User.getInstance(leaderUUID).sendMessage("commands.island.team.leave.left-your-island", "[player]", user.getName()); + } + getIslands().removePlayer(user.getUniqueId()); + user.sendMessage("general.success"); + } else { + user.sendMessage("commands.island.team.leave.type-again"); + leaveSet.add(user.getUniqueId()); + new BukkitRunnable() { + + @Override + public void run() { + leaveSet.remove(user.getUniqueId()); + user.sendMessage("general.errors.command-cancelled"); + }}.runTaskLater(getPlugin(), getSettings().getKickWait()); + } + return true; } } \ No newline at end of file diff --git a/src/main/java/us/tastybento/bskyblock/commands/island/teams/IslandTeamSetownerCommand.java b/src/main/java/us/tastybento/bskyblock/commands/island/teams/IslandTeamSetownerCommand.java index 17ab8d8c3..3a5ebc9ce 100644 --- a/src/main/java/us/tastybento/bskyblock/commands/island/teams/IslandTeamSetownerCommand.java +++ b/src/main/java/us/tastybento/bskyblock/commands/island/teams/IslandTeamSetownerCommand.java @@ -39,7 +39,12 @@ public class IslandTeamSetownerCommand extends AbstractIslandTeamCommand { if (!(inTeam && teamLeaderUUID.equals(playerUUID))) { return true; } - getPlugin().getLogger().info("DEBUG: arg[0] = " + args.get(0)); + // If args are not right, show help + if (args.size() != 1) { + this.getSubCommand("help").get().execute(user, new ArrayList<>()); + return true; + } + //getPlugin().getLogger().info("DEBUG: arg[0] = " + args.get(0)); UUID targetUUID = getPlayers().getUUID(args.get(0)); if (targetUUID == null) { user.sendMessage("general.errors.unknown-player"); diff --git a/src/main/java/us/tastybento/bskyblock/database/managers/PlayersManager.java b/src/main/java/us/tastybento/bskyblock/database/managers/PlayersManager.java index 216266bec..adf85eb16 100644 --- a/src/main/java/us/tastybento/bskyblock/database/managers/PlayersManager.java +++ b/src/main/java/us/tastybento/bskyblock/database/managers/PlayersManager.java @@ -236,7 +236,7 @@ public class PlayersManager{ * @param playerUUID * @return true if player in a team */ - public boolean inTeam(final UUID playerUUID) { + public boolean inTeam(UUID playerUUID) { addPlayer(playerUUID); return plugin.getIslands().getMembers(playerUUID).size() > 1; }