-
Notifications
You must be signed in to change notification settings - Fork 112
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added makeleader - to transfer ownership, and prepared WG regions for…
… UUID
- Loading branch information
Showing
15 changed files
with
186 additions
and
103 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
src/main/java/us/talabrek/ultimateskyblock/command/completion/MemberTabCompleter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package us.talabrek.ultimateskyblock.command.completion; | ||
|
||
import org.bukkit.command.Command; | ||
import org.bukkit.command.CommandSender; | ||
import org.bukkit.command.TabCompleter; | ||
import org.bukkit.entity.Player; | ||
import us.talabrek.ultimateskyblock.island.IslandInfo; | ||
import us.talabrek.ultimateskyblock.player.PlayerInfo; | ||
import us.talabrek.ultimateskyblock.uSkyBlock; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* Only list members of your current party. | ||
*/ | ||
public class MemberTabCompleter implements TabCompleter { | ||
private final uSkyBlock plugin; | ||
|
||
public MemberTabCompleter(uSkyBlock plugin) { | ||
this.plugin = plugin; | ||
} | ||
|
||
@Override | ||
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) { | ||
if (sender instanceof Player) { | ||
PlayerInfo playerInfo = plugin.getPlayerInfo((Player) sender); | ||
if (playerInfo != null && playerInfo.getHasIsland()) { | ||
IslandInfo islandInfo = plugin.getIslandInfo(playerInfo); | ||
if (islandInfo != null) { | ||
String member = args.length > 0 ? args[args.length-1] : ""; | ||
return AbstractTabCompleter.filter(islandInfo.getMembers(), member); | ||
} | ||
} | ||
} | ||
return null; | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
src/main/java/us/talabrek/ultimateskyblock/command/island/AcceptRejectCommand.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
src/main/java/us/talabrek/ultimateskyblock/command/island/MakeLeaderCommand.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package us.talabrek.ultimateskyblock.command.island; | ||
|
||
import org.bukkit.entity.Player; | ||
import us.talabrek.ultimateskyblock.handler.WorldGuardHandler; | ||
import us.talabrek.ultimateskyblock.island.IslandInfo; | ||
import us.talabrek.ultimateskyblock.player.PlayerInfo; | ||
import us.talabrek.ultimateskyblock.uSkyBlock; | ||
|
||
import java.util.Map; | ||
|
||
public class MakeLeaderCommand extends RequireIslandCommand { | ||
public MakeLeaderCommand(uSkyBlock plugin) { | ||
super(plugin, "makeleader|transfer", "usb.island.create", "member", "transfer leadership to another member"); | ||
} | ||
|
||
@Override | ||
protected boolean doExecute(String alias, Player player, PlayerInfo pi, IslandInfo island, Map<String, Object> data, String... args) { | ||
if (args.length == 1) { | ||
String member = args[0]; | ||
if (!island.getMembers().contains(member)) { | ||
player.sendMessage("\u00a74You can only transfer ownership to party-members!"); | ||
return true; | ||
} | ||
if (island.getLeader().equals(member)) { | ||
player.sendMessage(member + "\u00a7e is already leader of your island!"); | ||
return true; | ||
} | ||
island.setupPartyLeader(member); // Promote member | ||
island.setupPartyMember(player.getName()); // Demote leader | ||
WorldGuardHandler.updateRegion(player, island); | ||
island.sendMessageToIslandGroup("\u00a7bLeadership transferred by " + player.getDisplayName() + "\u00a7b to " + member); | ||
return true; | ||
} | ||
return false; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.