-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Bugfix] - removing a status now functions - the console can now change status messages from players changes: - revamped the whole StatusCommand.java for a better understanding of the code and efficiency added: - maxlenght commands to set a maxiumum character lenght for the Status (colorcodes are excluded) - added permissions for said command (only admin) - added a config.yml for saving purposes of the maxium set lenght (default is 15) - added StatusTabCompleter.java for Tab completion in the chat windows when using /status commands Tested-by: Me on a localserver PS: hopefullly this works PPS: working on multi version support Took 3 hours 20 minutes
- Loading branch information
Showing
8 changed files
with
254 additions
and
130 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
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/de/tubyoub/statusplugin/StatusTabCompleter.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 de.tubyoub.statusplugin; | ||
|
||
import org.bukkit.command.Command; | ||
import org.bukkit.command.CommandSender; | ||
import org.bukkit.command.TabCompleter; | ||
import org.bukkit.entity.Player; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
import java.util.stream.Collectors; | ||
import org.bukkit.Bukkit; | ||
|
||
public class StatusTabCompleter implements TabCompleter { | ||
@Override | ||
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) { | ||
List<String> suggestions = new ArrayList<>(); | ||
|
||
if (args.length == 1) { | ||
suggestions.add("help"); | ||
suggestions.add("remove"); | ||
suggestions.add("setmaxlength"); | ||
suggestions.add("resetmaxlength"); | ||
suggestions.add("info"); | ||
suggestions.add("reload"); | ||
} else if (args.length == 2) { | ||
if (args[0].equalsIgnoreCase("remove")) { | ||
suggestions.addAll(Bukkit.getOnlinePlayers().stream().map(Player::getName).collect(Collectors.toList())); | ||
} else if (args[0].equalsIgnoreCase("setmaxlength")) { | ||
suggestions.add("10"); | ||
suggestions.add("20"); | ||
suggestions.add("30"); | ||
} else if (args[0].equalsIgnoreCase("help")) { | ||
suggestions.add("colorcodes"); | ||
} | ||
} | ||
return suggestions; | ||
} | ||
} |
Oops, something went wrong.