From f03f34777b1d0ddc95c2ddb17e6eddfd832a8332 Mon Sep 17 00:00:00 2001 From: BuildTools Date: Sun, 14 Feb 2016 22:24:11 +0100 Subject: [PATCH 1/3] Added tabnames module, disabled iptracker due to instability --- main.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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"]: -- 2.45.2 From 70f2001e7b24bf35202d5d255c3a3f7398c708af Mon Sep 17 00:00:00 2001 From: BuildTools Date: Sun, 14 Feb 2016 22:25:02 +0100 Subject: [PATCH 2/3] initial commit, adding the tabnames module --- tabnames.py | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100755 tabnames.py diff --git a/tabnames.py b/tabnames.py new file mode 100755 index 0000000..049098c --- /dev/null +++ b/tabnames.py @@ -0,0 +1,35 @@ +import mysqlhack +import org.bukkit as bukkit +import json +from java.util import UUID as UUID +from helpers import * +from org.bukkit import * +from traceback import format_exc as trace +from iptracker_secrets 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 -- 2.45.2 From 91afa684cd09cd4638ee74733a5cb60b2e4a247f Mon Sep 17 00:00:00 2001 From: BuildTools Date: Sun, 14 Feb 2016 22:33:44 +0100 Subject: [PATCH 3/3] removed unnessecary imports, code cleanup --- tabnames.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/tabnames.py b/tabnames.py index 049098c..c0848c0 100755 --- a/tabnames.py +++ b/tabnames.py @@ -1,11 +1,6 @@ -import mysqlhack import org.bukkit as bukkit -import json -from java.util import UUID as UUID from helpers import * from org.bukkit import * -from traceback import format_exc as trace -from iptracker_secrets import * tabnames_version = "v1.0.0" @@ -23,7 +18,8 @@ prefixes = {"admin":"a", "mod":"b", "modintraining":"c", "trusted":"d", "builder @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()) + 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): -- 2.45.2