Adding tabnames, updating main #32
162
main.py
Normal file → Executable file
162
main.py
Normal file → Executable file
@ -1,47 +1,115 @@
|
|||||||
__plugin_name__ = "RedstonerUtils"
|
__plugin_name__ = "RedstonerUtils"
|
||||||
__plugin_version__ = "3.0"
|
__plugin_version__ = "3.0"
|
||||||
__plugin_mainclass__ = "foobar"
|
__plugin_mainclass__ = "foobar"
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
from traceback import format_exc as print_traceback
|
from traceback import format_exc as print_traceback
|
||||||
|
|
||||||
# damn pythonloader changed the PATH
|
main_version = "1.0.1"
|
||||||
sys.path += ['', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-linux2', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages', '/usr/lib/pymodules/python2.7', '/usr/lib/pyshared/python2.7']
|
|
||||||
|
# damn pythonloader changed the PATH
|
||||||
try:
|
sys.path += ['', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-linux2', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages', '/usr/lib/pymodules/python2.7', '/usr/lib/pyshared/python2.7']
|
||||||
# Library that adds a bunch of re-usable methods which are used in nearly all other modules
|
|
||||||
from helpers import *
|
try:
|
||||||
#from wrapper import *
|
# Library that adds a bunch of re-usable methods which are used in nearly all other modules
|
||||||
except:
|
from helpers import *
|
||||||
error("[RedstonerUtils] ERROR: Failed to import Wrapper:")
|
except:
|
||||||
error(print_traceback())
|
print("[RedstonerUtils] ERROR: Failed to import helpers:")
|
||||||
|
print(print_traceback())
|
||||||
@hook.enable
|
|
||||||
def on_enable():
|
|
||||||
info("RedstonerUtils enabled!")
|
|
||||||
|
@hook.enable
|
||||||
|
def on_enable():
|
||||||
@hook.disable
|
info("RedstonerUtils enabled!")
|
||||||
def on_disable():
|
|
||||||
#shared["modules"]["reports"].stop_reporting()
|
|
||||||
info("RedstonerUtils disabled!")
|
@hook.disable
|
||||||
|
def on_disable():
|
||||||
|
shared["modules"]["reports"].stop_reporting()
|
||||||
info("Loading RedstonerUtils...")
|
info("RedstonerUtils disabled!")
|
||||||
|
|
||||||
|
|
||||||
|
info("Loading RedstonerUtils...")
|
||||||
# Import all modules, in this order
|
|
||||||
shared["load_modules"] = [
|
# Import all modules, in this order
|
||||||
"test",
|
shared["load_modules"] = [
|
||||||
# "login",
|
# Collection of tiny utilities
|
||||||
]
|
"misc",
|
||||||
|
# Adds chat for staff using /ac <text or ,<text>
|
||||||
shared["modules"] = {}
|
"adminchat",
|
||||||
for module in shared["load_modules"]:
|
# Adds /badge, allows to give players achievements
|
||||||
try:
|
"badges",
|
||||||
shared["modules"][module] = __import__(module)
|
# Adds a few block placement corrections/mods
|
||||||
info("Module %s loaded." % module)
|
"blockplacemods",
|
||||||
except:
|
# Adds /calc, toggles automatic solving of Math expressions in chat
|
||||||
error("Failed to import module %s:" % module)
|
"calc",
|
||||||
error(print_traceback())
|
# Plugin to locate laggy chunks. /lc <n> lists chunks with more than n entities
|
||||||
|
"lagchunks",
|
||||||
|
# Adds /report and /rp, Stores reports with time and location
|
||||||
|
"reports",
|
||||||
|
# Adds group-chat with /chatgroup and /cgt to toggle normal chat into group mode
|
||||||
|
"chatgroups",
|
||||||
|
# Adds /token, reads and writes from the database to generate pronouncable (and thus memorable) registration-tokens for the website
|
||||||
|
"webtoken",
|
||||||
|
# Adds /lol, broadcasts random funyy messages. A bit like the splash text in the menu
|
||||||
|
"saylol",
|
||||||
|
# Adds /signalstrength, lets you request a signal strength and an amount of items will be inserted into target container to meet that strength.
|
||||||
|
"signalstrength",
|
||||||
|
# Shows the owner of a skull when right-clicked
|
||||||
|
"skullclick",
|
||||||
|
# Adds /listen, highlights chat and plays a sound when your name was mentioned
|
||||||
|
"mentio",
|
||||||
|
# Adds /cycler, swaps the hotbar with inventory when player changes slot from right->left or left->right
|
||||||
|
"cycle",
|
||||||
|
# Adds /getmotd & /setmotd to update the motd on the fly (no reboot)
|
||||||
|
"motd",
|
||||||
|
# AnswerBot. Hides stupid questions from chat and tells the sender about /faq or the like
|
||||||
|
"abot",
|
||||||
|
# Adds '/forcefield', creates forcefield for players who want it.
|
||||||
|
"forcefield",
|
||||||
|
# Adds /damnspam, creates timeout for buttons/levers to mitigate button spam.
|
||||||
|
"damnspam",
|
||||||
|
# Adds /check, useful to lookup details about a player
|
||||||
|
"check",
|
||||||
|
# Adds /an, a command you can use to share thoughts/plans/news
|
||||||
|
"adminnotes",
|
||||||
|
# Adds busy status to players
|
||||||
|
"imbusy",
|
||||||
|
# Adds /imout, displays fake leave/join messages
|
||||||
|
"imout",
|
||||||
|
#adds snowbrawl minigame
|
||||||
|
"snowbrawl",
|
||||||
|
# Adds /tm [player] for a messages to be sent to this player via /msg
|
||||||
|
"pmtoggle",
|
||||||
|
# Replacement for LoginSecurity
|
||||||
|
"loginsecurity",
|
||||||
|
# Centralized Player class
|
||||||
|
"player",
|
||||||
|
# Servercontrol extension for telnet access to logs/AC
|
||||||
|
#"servercontrol",
|
||||||
|
# Script helper plugin
|
||||||
|
"scriptutils",
|
||||||
|
# Per-player notes
|
||||||
|
"tag",
|
||||||
|
# vanish toggle module - temporary fix
|
||||||
|
#"vanishfix",
|
||||||
|
# obisidian mining punishment plugin
|
||||||
|
"punishments",
|
||||||
|
# a simple replacement for the buggy essentials /vanish
|
||||||
|
"vanish",
|
||||||
|
# ip-tracking utility - Disabled because not stable
|
||||||
|
#"iptracker",
|
||||||
|
#alias
|
||||||
|
"chatalias",
|
||||||
|
#tabnames
|
||||||
|
"tabnames"
|
||||||
|
]
|
||||||
|
shared["modules"] = {}
|
||||||
|
for module in shared["load_modules"]:
|
||||||
|
try:
|
||||||
|
shared["modules"][module] = __import__(module)
|
||||||
|
info("Module %s loaded." % module)
|
||||||
|
except:
|
||||||
|
error("Failed to import module %s:" % module)
|
||||||
|
error(print_traceback())
|
||||||
|
35
tabnames.py
Executable file
35
tabnames.py
Executable file
@ -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
|
Reference in New Issue
Block a user