more code cleanup
This commit is contained in:
@@ -6,7 +6,7 @@ Redstoner's custom plugins, written in python.
|
||||
# Installation / Set-up
|
||||
|
||||
1-line-install-script for bash:
|
||||
`wget -O install.sh "http://pastie.org/pastes/9310905/download?key=6byp4mrqmiui8yqeo3s6yw"; md5sum --check <<<"3499671c0832e561bc9c7d476d2167cb install.sh" && sh install.sh`
|
||||
`wget -O install.sh "http://pastie.org/pastes/9310905/download?key = 6byp4mrqmiui8yqeo3s6yw"; md5sum --check <<<"3499671c0832e561bc9c7d476d2167cb install.sh" && sh install.sh`
|
||||
|
||||
Detailed description:
|
||||
|
||||
@@ -14,7 +14,7 @@ Detailed description:
|
||||
0. Download [the latest spigot](http://ci.md-5.net/job/Spigot/lastStableBuild/artifact/Spigot-Server/target/spigot.jar)
|
||||
0. Run it once inside redstoner, then shut it down again
|
||||
0. Create a new directory (inside redstoner) called 'lib'
|
||||
0. Download [jython](http://search.maven.org/remotecontent?filepath=org/python/jython-standalone/2.7-b2/jython-standalone-2.7-b2.jar) and save it as 'jython.jar' inside lib
|
||||
0. Download [jython](http://search.maven.org/remotecontent?filepath = org/python/jython-standalone/2.7-b2/jython-standalone-2.7-b2.jar) and save it as 'jython.jar' inside lib
|
||||
0. Download [mysql-connector](https://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-java-5.1.30.zip), extract 'mysql-connector-java-X.X.XX-bin.jar
|
||||
' and save it as 'mysql-connector.jar' inside lib
|
||||
0. Download [PyPluginLoader](http://gserv.me/static/PyPluginLoader-0.3.5.jar) (we're using [this fork](https://github.com/gdude2002/Python-Plugin-Loader)) into the plugins directory
|
||||
|
||||
4
abot.py
4
abot.py
@@ -23,9 +23,9 @@ def list_answers(sender):
|
||||
msg(sender, "&e{")
|
||||
msg(sender, " &eregex:")
|
||||
for regex in answer["regex"]:
|
||||
msg(sender, " " + regex.pattern, basecolor="a", usecolor=False)
|
||||
msg(sender, " " + regex.pattern, basecolor="a", usecolor = False)
|
||||
msg(sender, " &epermission:")
|
||||
msg(sender, " " + str(answer["hide-perm"]), basecolor="a", usecolor=False)
|
||||
msg(sender, " " + str(answer["hide-perm"]), basecolor="a", usecolor = False)
|
||||
msg(sender, " &emessage:")
|
||||
msg(sender, " " + "\n ".join(answer["message"].split("\n")))
|
||||
msg(sender, "&e}")
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#pylint: disable=F0401
|
||||
#pylint: disable = F0401
|
||||
from helpers import *
|
||||
|
||||
ac_permission = "utils.ac"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#pylint: disable=F0401
|
||||
#pylint: disable = F0401
|
||||
from helpers import *
|
||||
from java.util.UUID import fromString as juuid
|
||||
import json
|
||||
@@ -67,7 +67,7 @@ def on_cgt_command(sender, args):
|
||||
return True
|
||||
|
||||
|
||||
def groupchat(sender, message, ann=False):
|
||||
def groupchat(sender, message, ann = False):
|
||||
#try:
|
||||
group = groups.get(str(sender.getUniqueId()))
|
||||
if group == None:
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#pylint: disable=F0401
|
||||
#pylint: disable = F0401
|
||||
from helpers import *
|
||||
from time import time as now
|
||||
import org.bukkit.event.block.BlockBreakEvent as BlockBreakEvent
|
||||
|
||||
@@ -3,10 +3,9 @@ from java.util.UUID import fromString as java_uuid
|
||||
|
||||
forcefield_permissions = ["utils.forcefield", "utils.forcefield.ignore"]
|
||||
forcefield_prefix = "&8[&aFF&8]"
|
||||
fd = 4 # forcefield distance
|
||||
|
||||
forcefield_toggle = []
|
||||
forcefield_whitelist = {}
|
||||
fd = 4 # forcefield distance
|
||||
|
||||
|
||||
@hook.command("forcefield")
|
||||
@@ -77,7 +76,7 @@ def whitelist_list(sender, sender_id):
|
||||
if not sender_id in forcefield_whitelist or len(forcefield_whitelist[sender_id]) == 0:
|
||||
msg(sender, "&c Your whitelist has no entries.")
|
||||
else:
|
||||
c=0
|
||||
c = 0
|
||||
for uid in forcefield_whitelist[sender_id]:
|
||||
c+=1
|
||||
msg(sender, "&a %s. &f%s" % (c, server.getPlayer(java_uuid(uid)).getDisplayName()))
|
||||
@@ -157,7 +156,7 @@ def set_velocity_away(player, entity): #Moves entity away from player
|
||||
|
||||
@hook.event("player.PlayerQuitEvent")
|
||||
def on_quit(event):
|
||||
try:
|
||||
forcefield_toggle.remove(str(event.getPlayer().getUniqueId()))
|
||||
except:
|
||||
pass
|
||||
player = event.getPlayer()
|
||||
uid = str(player.getUniqueId())
|
||||
if uid in forcefield_toggle:
|
||||
forcefield_toggle.remove(uid)
|
||||
@@ -1,4 +1,4 @@
|
||||
#pylint: disable=F0401
|
||||
#pylint: disable = F0401
|
||||
from re import sub
|
||||
import org.bukkit as bukkit
|
||||
import org.bukkit.Location as Location
|
||||
@@ -54,7 +54,7 @@ def safetp(player, world, x, y, z, yaw = 0, pitch = 0):
|
||||
safetp(player, world, x, y+1, z, yaw, pitch)
|
||||
|
||||
|
||||
def plugin_header(sender=None, name="Redstoner Utils"):
|
||||
def plugin_header(sender = None, name="Redstoner Utils"):
|
||||
"""
|
||||
sends the recipient a "Plugin Header", in the format of:
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#pylint: disable=F0401
|
||||
#pylint: disable = F0401
|
||||
import org.bukkit as bukkit
|
||||
from helpers import *
|
||||
|
||||
@@ -21,7 +21,7 @@ def scan_chunks(amount):
|
||||
ents = chunk.getEntities()
|
||||
# [0]world [1]X [2]Y [3]Z [4]amount
|
||||
chunks.append([chunk.getWorld(), int(ents[-1].getLocation().getX()), int(ents[0].getLocation().getY()), int(ents[0].getLocation().getZ()), len(ents)])
|
||||
chunks.sort(key=lambda entry: entry[4], reverse=True)
|
||||
chunks.sort(key = lambda entry: entry[4], reverse = True)
|
||||
lagchunks = chunks
|
||||
except Exception, e:
|
||||
error(e)
|
||||
|
||||
4
misc.py
4
misc.py
@@ -1,4 +1,4 @@
|
||||
#pylint: disable=F0401
|
||||
#pylint: disable = F0401
|
||||
from helpers import *
|
||||
from time import time as now
|
||||
import thread
|
||||
@@ -100,7 +100,7 @@ def on_player_entity_interact(event):
|
||||
def on_pluginversions_command(sender, args):
|
||||
plugin_header(sender, "Plugin versions")
|
||||
plugins = list(server.getPluginManager().getPlugins())
|
||||
plugins.sort(key=lambda pl: pl.getDescription().getName())
|
||||
plugins.sort(key = lambda pl: pl.getDescription().getName())
|
||||
msg(sender, "&3Listing all " + str(len(plugins)) + " plugins and their version:")
|
||||
for plugin in plugins:
|
||||
msg(sender, "&6" + plugin.getDescription().getName() + "&r: &e" + plugin.getDescription().getVersion())
|
||||
|
||||
4
motd.py
4
motd.py
@@ -1,4 +1,4 @@
|
||||
#pylint: disable=F0401
|
||||
#pylint: disable = F0401
|
||||
from helpers import *
|
||||
|
||||
motd = server.getMotd()
|
||||
@@ -7,7 +7,7 @@ motd = server.getMotd()
|
||||
@hook.command("getmotd")
|
||||
def on_getmotd_command(sender, args):
|
||||
plugin_header(sender, "MOTD")
|
||||
msg(sender, motd, usecolor=False)
|
||||
msg(sender, motd, usecolor = False)
|
||||
|
||||
|
||||
@hook.command("setmotd")
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#pylint: disable=F0401
|
||||
#pylint: disable = F0401
|
||||
import java.lang.reflect.Method
|
||||
import java.io.File
|
||||
import java.net.URL
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#pylint: disable=F0401
|
||||
#pylint: disable = F0401
|
||||
import org.bukkit as bukkit
|
||||
from helpers import msg
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#pylint: disable=F0401
|
||||
#pylint: disable = F0401
|
||||
import org.bukkit.event.block.BlockPlaceEvent as BlockPlaceEvent
|
||||
import org.bukkit.event.block.BlockBreakEvent as BlockBreakEvent
|
||||
import org.bukkit.event.player.PlayerInteractEvent as PlayerInteractEvent
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#pylint: disable=F0401
|
||||
import mysqlhack #pylint: disable=unused-import
|
||||
#pylint: disable = F0401
|
||||
import mysqlhack #pylint: disable = unused-import
|
||||
import thread
|
||||
from re import match
|
||||
from com.ziclix.python.sql import zxJDBC
|
||||
@@ -17,7 +17,7 @@ from random import randrange
|
||||
# string "email", null: false
|
||||
|
||||
|
||||
def mysql_query(query, args, fetch=True):
|
||||
def mysql_query(query, args, fetch = True):
|
||||
conn = zxJDBC.connect(mysql_database, mysql_user, mysql_pass, "com.mysql.jdbc.Driver")
|
||||
curs = conn.cursor()
|
||||
curs.execute(query, args)
|
||||
|
||||
Reference in New Issue
Block a user