Exemplo n.º 1
0
 private void setBiome(CommandSender sender, IslandInfo islandInfo, String biome) {
   if (uSkyBlock.getInstance().setBiome(islandInfo.getIslandLocation(), biome)) {
     islandInfo.setBiome(biome);
     sender.sendMessage(
         tr("\u00a7eChanged biome of {0}s island to {1}.", islandInfo.getLeader(), biome));
   } else {
     islandInfo.setBiome("OCEAN");
     sender.sendMessage(
         tr("\u00a7eChanged biome of {0}s island to OCEAN.", islandInfo.getLeader()));
   }
   sender.sendMessage(tr("\u00a7aYou may need to go to spawn, or relog, to see the changes."));
 }
Exemplo n.º 2
0
 private void protectIsland(CommandSender sender, IslandInfo islandInfo) {
   if (WorldGuardHandler.protectIsland(plugin, sender, islandInfo)) {
     sender.sendMessage(
         tr(
             "\u00a7e{0}s island at {1} has been protected",
             islandInfo.getLeader(), islandInfo.getName()));
   } else {
     sender.sendMessage(
         tr(
             "\u00a74{0}s island at {1} was already protected",
             islandInfo.getLeader(), islandInfo.getName()));
   }
 }
Exemplo n.º 3
0
 private void setBiome(
     CommandSender sender, PlayerInfo playerInfo, IslandInfo islandInfo, String biome) {
   if (playerInfo == null || !playerInfo.getHasIsland()) {
     sender.sendMessage(tr("\u00a74That player has no island."));
     return;
   }
   if (uSkyBlock.getInstance().setBiome(playerInfo.getIslandLocation(), biome)) {
     islandInfo.setBiome(biome);
     sender.sendMessage(
         tr("\u00a7e{0} has had their biome changed to {1}.", playerInfo.getPlayerName(), biome));
   } else {
     islandInfo.setBiome("OCEAN");
     sender.sendMessage(
         tr("\u00a7e{0} has had their biome changed to OCEAN.", playerInfo.getPlayerName()));
   }
   sender.sendMessage(tr("\u00a7aYou may need to go to spawn, or relog, to see the changes."));
 }
Exemplo n.º 4
0
 private void removePlayerFromIsland(
     CommandSender sender, PlayerInfo playerInfo, IslandInfo islandInfo) {
   if (playerInfo == null) {
     sender.sendMessage(tr("\u00a74No valid player-name supplied."));
     return;
   }
   sender.sendMessage(tr("Removing {0} from island", playerInfo.getPlayerName()));
   islandInfo.removeMember(playerInfo);
   playerInfo.save();
 }
Exemplo n.º 5
0
 @Override
 public boolean execute(
     CommandSender sender, String alias, Map<String, Object> data, String... args) {
   if (args.length == 2) {
     String island = args[0];
     String playerName = args[1];
     PlayerInfo islandPlayer = plugin.getPlayerInfo(island);
     PlayerInfo playerInfo = plugin.getPlayerInfo(playerName);
     if (islandPlayer == null || !islandPlayer.getHasIsland()) {
       sender.sendMessage(tr("\u00a74Player {0} has no island to transfer!", island));
       return false;
     }
     IslandInfo islandInfo = plugin.getIslandInfo(islandPlayer);
     if (islandInfo == null) {
       sender.sendMessage(tr("\u00a74Player {0} has no island to transfer!", island));
       return false;
     }
     if (playerInfo != null && playerInfo.getHasIsland()) {
       sender.sendMessage(
           tr(
               "\u00a7ePlayer \u00a7d{0}\u00a7e already has an island.\u00a7eUse \u00a7d/usb island remove <name>\u00a7e to remove him first.",
               playerName));
       return false;
     }
     playerInfo.setJoinParty(islandInfo.getIslandLocation());
     Location homeLocation = islandPlayer.getHomeLocation();
     islandInfo.removeMember(islandPlayer); // Remove leader
     islandInfo.setupPartyLeader(playerInfo.getPlayerName()); // Promote member
     playerInfo.setHomeLocation(homeLocation);
     islandPlayer.save();
     playerInfo.save();
     WorldGuardHandler.updateRegion(sender, islandInfo);
     islandInfo.sendMessageToIslandGroup(
         tr("\u00a7bLeadership transferred by {0}\u00a7b to {1}", sender.getName(), playerName));
     return true;
   }
   return false;
 }
Exemplo n.º 6
0
 @Override
 protected boolean doExecute(
     final String alias,
     final Player player,
     final PlayerInfo pi,
     final IslandInfo island,
     Map<String, Object> data,
     String... args) {
   if (args.length == 0) {
     player.sendMessage(tr("\u00a7eThe following players are trusted on your island:"));
     player.sendMessage(tr("\u00a74{0}", island.getTrustees()));
     player.sendMessage(tr("\u00a7eThe following leaders trusts you:"));
     player.sendMessage(tr("\u00a74{0}", getLeaderNames(pi)));
     player.sendMessage(
         tr("\u00a7eTo trust/untrust from your island, use /island trust <player>"));
     return true;
   } else if (args.length == 1) {
     final String name = args[0];
     if (island.getMembers().contains(name)) {
       player.sendMessage(tr("\u00a74Members are already trusted!"));
       return true;
     }
     OfflinePlayer offlinePlayer = Bukkit.getOfflinePlayer(name);
     if (offlinePlayer == null) {
       player.sendMessage(tr("\u00a74Unknown player {0}", name));
       return true;
     }
     if (alias.equals("trust")) {
       island.trust(name);
       if (offlinePlayer.isOnline()) {
         offlinePlayer
             .getPlayer()
             .sendMessage(
                 tr(
                     "\u00a7eYou are now trusted on \u00a74{0}'s \u00a7eisland.",
                     pi.getDisplayName()));
       }
       island.sendMessageToIslandGroup(
           true, marktr("\u00a7a{0} trusted {1} on the island"), player.getName(), name);
     } else {
       island.untrust(name);
       if (offlinePlayer.isOnline()) {
         offlinePlayer
             .getPlayer()
             .sendMessage(
                 tr(
                     "\u00a7eYou are no longer trusted on \u00a74{0}'s \u00a7eisland.",
                     pi.getDisplayName()));
       }
       island.sendMessageToIslandGroup(
           true, marktr("\u00a7c{0} revoked trust in {1} on the island"), player.getName(), name);
     }
     WorldGuardHandler.updateRegion(player, island);
     return true;
   }
   return false;
 }
Exemplo n.º 7
0
 @Override
 protected boolean doExecute(
     String alias,
     Player player,
     PlayerInfo pi,
     IslandInfo island,
     Map<String, Object> data,
     String... args) {
   if (args.length == 0) {
     player.sendMessage(
         tr("\u00a7eThe following players are banned from warping to your island:"));
     player.sendMessage(tr("\u00a74{0}", island.getBans()));
     player.sendMessage(tr("\u00a7eTo ban/unban from your island, use /island ban <player>"));
     return true;
   } else if (args.length == 1) {
     String name = args[0];
     if (island.getMembers().contains(name)) {
       player.sendMessage(tr("\u00a74You can't ban members. Remove them first!"));
       return true;
     }
     if (!island.hasPerm(player, "canKickOthers")) {
       player.sendMessage(tr("\u00a74You do not have permission to kick/ban players."));
       return true;
     }
     if (!island.isBanned(name)) {
       OfflinePlayer offlinePlayer = Bukkit.getOfflinePlayer(name);
       if (offlinePlayer == null) {
         player.sendMessage(tr("\u00a7eUnable to ban unknown player {0}", name));
         return true;
       }
       if (offlinePlayer.isOnline()
           && hasPermission(offlinePlayer.getPlayer(), "usb.exempt.ban")) {
         offlinePlayer
             .getPlayer()
             .sendMessage(tr("\u00a74{0} tried to ban you from their island!", player.getName()));
         player.sendMessage(tr("\u00a74{0} is exempt from being banned.", name));
         return true;
       }
       island.banPlayer(offlinePlayer.getUniqueId());
       player.sendMessage(
           tr("\u00a7eYou have banned \u00a74{0}\u00a7e from warping to your island.", name));
       if (offlinePlayer != null && offlinePlayer.isOnline()) {
         offlinePlayer
             .getPlayer()
             .sendMessage(
                 tr(
                     "\u00a7eYou have been \u00a7cBANNED\u00a7e from {0}\u00a7e''s island.",
                     player.getDisplayName()));
         if (plugin.locationIsOnIsland(player, offlinePlayer.getPlayer().getLocation())) {
           plugin.spawnTeleport(offlinePlayer.getPlayer(), true);
         }
       }
     } else {
       OfflinePlayer offlinePlayer = Bukkit.getOfflinePlayer(name);
       if (offlinePlayer == null) {
         player.sendMessage(tr("\u00a7eUnable to ban unknown player {0}", name));
         return true;
       }
       island.unbanPlayer(offlinePlayer.getUniqueId());
       player.sendMessage(
           tr("\u00a7eYou have unbanned \u00a7a{0}\u00a7e from warping to your island.", name));
       if (offlinePlayer != null && offlinePlayer.isOnline()) {
         offlinePlayer
             .getPlayer()
             .sendMessage(
                 tr(
                     "\u00a7eYou have been \u00a7aUNBANNED\u00a7e from {0}\u00a7e''s island.",
                     player.getDisplayName()));
       }
     }
     WorldGuardHandler.updateRegion(island);
     return true;
   }
   return false;
 }