diff --git a/main.py b/main.py index 7411d17..2d6f253 100644 --- a/main.py +++ b/main.py @@ -98,10 +98,12 @@ shared["load_modules"] = [ "punishments", # a simple replacement for the buggy essentials /vanish "vanish", - # ip-tracking utility - "iptracker", + # ip-tracking utility - disabled as of instability + #"iptracker", #server signs for everyone - "serversigns" + "serversigns", + # tabnames module to make players names colored on their chars and sort tab after ranks + "tabnames" ] shared["modules"] = {} for module in shared["load_modules"]: diff --git a/tabnames.py b/tabnames.py new file mode 100755 index 0000000..c0848c0 --- /dev/null +++ b/tabnames.py @@ -0,0 +1,31 @@ +import org.bukkit as bukkit +from helpers import * +from org.bukkit import * + +tabnames_version = "v1.0.0" + +############################################################## +# # +# This module automatically puts people in the corresponding # +# scoreboard team so that their name is colored properly and # +# tab will be nicely sorted. # +# # +############################################################## + +ranks = ["visitor", "member", "builder", "trusted", "modintraining", "mod", "admin", "breaker"] +prefixes = {"admin":"a", "mod":"b", "modintraining":"c", "trusted":"d", "builder":"e", "member":"f","visitor":"g"} + +@hook.event("player.PlayerJoinEvent", "low") +def on_player_join(event): + scoreboard_team = prefix(get_Rank(event.getPlayer())) + bukkit.Bukkit.getServer().dispatchCommand(bukkit.Bukkit.getServer().getConsoleSender(), + "scoreboard teams join " + scoreboard_team + " " + event.getPlayer().getName()) + +def get_Rank(player): + for i in range(0, len(ranks) - 1): + if not player.hasPermission("group." + ranks[i]): + break + return ranks[i-1] + +def prefix(rank): + return prefixes.get(rank) + "_" + rank