Merge branch 'dev' of https://github.com/RedstonerServer/redstoner-utils into dev
This commit is contained in:
12
adminchat.py
12
adminchat.py
@@ -50,12 +50,12 @@ def get_key(uuid):
|
|||||||
key = ac_keys.get(uuid)
|
key = ac_keys.get(uuid)
|
||||||
return key if key != None else ac_defaultkey
|
return key if key != None else ac_defaultkey
|
||||||
|
|
||||||
@simplecommand("adminchatkey",
|
@simplecommand("adminchatkey",
|
||||||
aliases = ["ackey"],
|
aliases = ["ackey"],
|
||||||
senderLimit = 0,
|
senderLimit = 0,
|
||||||
helpNoargs = True,
|
helpNoargs = True,
|
||||||
helpSubcmd = True,
|
helpSubcmd = True,
|
||||||
description = "Sets a key character for adminchat",
|
description = "Sets a key character for adminchat",
|
||||||
usage = "<key>")
|
usage = "<key>")
|
||||||
def adminchatkey_command(sender, command, label, args):
|
def adminchatkey_command(sender, command, label, args):
|
||||||
key = " ".join(args)
|
key = " ".join(args)
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ def adminnotes_command(sender, command, label, args):
|
|||||||
show_an_help(sender)
|
show_an_help(sender)
|
||||||
return
|
return
|
||||||
if not args[1].isdigit():
|
if not args[1].isdigit():
|
||||||
msg(sender, "&cThe ID has to be numeric (check /an if you're unsure)")
|
msg(sender, "&cThe ID has to be numeric (check /an if you're unsure)")
|
||||||
return
|
return
|
||||||
note_id = int(args[1])-1
|
note_id = int(args[1])-1
|
||||||
if note_id >= len(notes):
|
if note_id >= len(notes):
|
||||||
|
|||||||
@@ -20,13 +20,13 @@ def helpMsg(sender, cmd, description, usage, aliases, permission):
|
|||||||
|
|
||||||
|
|
||||||
def simplecommand(cmd,
|
def simplecommand(cmd,
|
||||||
aliases = [],
|
aliases = [],
|
||||||
usage = "[args...]",
|
usage = "[args...]",
|
||||||
description = None,
|
description = None,
|
||||||
senderLimit = -1,
|
senderLimit = -1,
|
||||||
amin = 0,
|
amin = 0,
|
||||||
amax = -1,
|
amax = -1,
|
||||||
helpNoargs = False,
|
helpNoargs = False,
|
||||||
helpSubcmd = False):
|
helpSubcmd = False):
|
||||||
cmd = cmd.lower()
|
cmd = cmd.lower()
|
||||||
permission = "utils." + cmd
|
permission = "utils." + cmd
|
||||||
@@ -107,4 +107,4 @@ class Validate():
|
|||||||
if not checkargs(sender, args, amin, amax):
|
if not checkargs(sender, args, amin, amax):
|
||||||
raise CommandException("")
|
raise CommandException("")
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ settingInformation = dict( #[setting type, identifying description, detailed des
|
|||||||
)
|
)
|
||||||
|
|
||||||
defaults = {
|
defaults = {
|
||||||
0: list,
|
0: list,
|
||||||
1: dict,
|
1: dict,
|
||||||
2: list
|
2: list
|
||||||
}
|
}
|
||||||
@@ -87,8 +87,8 @@ def getSettingDetails(arg):
|
|||||||
raise CommandException(" &cThat setting could not be found.\n For command help, use &o/toggle &cor &o/set")
|
raise CommandException(" &cThat setting could not be found.\n For command help, use &o/toggle &cor &o/set")
|
||||||
|
|
||||||
@simplecommand("toggle",
|
@simplecommand("toggle",
|
||||||
aliases = ["setting", "set", "config"],
|
aliases = ["setting", "set", "config"],
|
||||||
usage = "<setting> [value|info]",
|
usage = "<setting> [value|info]",
|
||||||
description = "Toggles or sets your preferences for our redstone \nutilities. The following settings are available:\n" + ", ".join([x for x in settingInformation]),
|
description = "Toggles or sets your preferences for our redstone \nutilities. The following settings are available:\n" + ", ".join([x for x in settingInformation]),
|
||||||
senderLimit = 0,
|
senderLimit = 0,
|
||||||
helpNoargs = True,
|
helpNoargs = True,
|
||||||
@@ -144,13 +144,13 @@ def toggle_command(sender, command, label, args):
|
|||||||
if arg2 == "details":
|
if arg2 == "details":
|
||||||
return " &aSetting %s:\n &9%s \n&6Accepted arguments: [<slot>|clear|details]" % (setting, details[2])
|
return " &aSetting %s:\n &9%s \n&6Accepted arguments: [<slot>|clear|details]" % (setting, details[2])
|
||||||
|
|
||||||
slot = int(arg2) if arg2.isdigit() else 0
|
slot = int(arg2) if arg2.isdigit() else 0
|
||||||
if not (0 <= slot <= details[4]):
|
if not (0 <= slot <= details[4]):
|
||||||
return " &cSlot number must be more than or equal to 0 and less than or equal to %s!" % details[4]
|
return " &cSlot number must be more than or equal to 0 and less than or equal to %s!" % details[4]
|
||||||
|
|
||||||
item = fromStack(player.getItemInHand())
|
item = fromStack(player.getItemInHand())
|
||||||
if item[0] == 0 or item[1] <= 0:
|
if item[0] == 0 or item[1] <= 0:
|
||||||
if enabled:
|
if enabled:
|
||||||
items = values[uuid]
|
items = values[uuid]
|
||||||
if slot in items:
|
if slot in items:
|
||||||
del items[slot]
|
del items[slot]
|
||||||
@@ -197,16 +197,16 @@ def on_block_place(event):
|
|||||||
material = block.getType()
|
material = block.getType()
|
||||||
|
|
||||||
|
|
||||||
if (material in (Material.WOOD_STEP, Material.STEP)
|
if (material in (Material.WOOD_STEP, Material.STEP)
|
||||||
and isEnabled("slab", uuid)
|
and isEnabled("slab", uuid)
|
||||||
and player.hasPermission("utils.toggle.slab")
|
and player.hasPermission("utils.toggle.slab")
|
||||||
and block.getData() < 8
|
and block.getData() < 8
|
||||||
):
|
):
|
||||||
block.setData(block.getData() + 8) # Flip upside down
|
block.setData(block.getData() + 8) # Flip upside down
|
||||||
|
|
||||||
|
|
||||||
elif (material == Material.CAULDRON
|
elif (material == Material.CAULDRON
|
||||||
and isEnabled("cauldron", uuid)
|
and isEnabled("cauldron", uuid)
|
||||||
and player.hasPermission("utils.toggle.cauldron")
|
and player.hasPermission("utils.toggle.cauldron")
|
||||||
):
|
):
|
||||||
block.setData(3) #3 layers of water, 3 signal strength
|
block.setData(3) #3 layers of water, 3 signal strength
|
||||||
@@ -214,7 +214,7 @@ def on_block_place(event):
|
|||||||
|
|
||||||
elif ((material == Material.FURNACE and player.hasPermission("utils.toggle.furnace"))
|
elif ((material == Material.FURNACE and player.hasPermission("utils.toggle.furnace"))
|
||||||
or (material == Material.DROPPER and player.hasPermission("utils.toggle.dropper"))
|
or (material == Material.DROPPER and player.hasPermission("utils.toggle.dropper"))
|
||||||
or (material == Material.HOPPER and player.hasPermission("utils.toggle.hopper"))
|
or (material == Material.HOPPER and player.hasPermission("utils.toggle.hopper"))
|
||||||
):
|
):
|
||||||
stacks = get(str(material).lower()).get(uuid)
|
stacks = get(str(material).lower()).get(uuid)
|
||||||
if stacks != None: # Enabled
|
if stacks != None: # Enabled
|
||||||
@@ -227,7 +227,7 @@ def on_block_place(event):
|
|||||||
"""
|
"""
|
||||||
elif (material == Material.REDSTONE_TORCH_ON
|
elif (material == Material.REDSTONE_TORCH_ON
|
||||||
and event.getBlockAgainst().getType() == Material.REDSTONE_BLOCK
|
and event.getBlockAgainst().getType() == Material.REDSTONE_BLOCK
|
||||||
and isEnabled("torch", uuid)
|
and isEnabled("torch", uuid)
|
||||||
and player.hasPermission("utils.toggle.torch")
|
and player.hasPermission("utils.toggle.torch")
|
||||||
):
|
):
|
||||||
torches_to_break.append(block)
|
torches_to_break.append(block)
|
||||||
@@ -244,8 +244,8 @@ def on_block_place(event):
|
|||||||
@hook.event("player.PlayerInteractEvent", "monitor")
|
@hook.event("player.PlayerInteractEvent", "monitor")
|
||||||
def on_interact(event):
|
def on_interact(event):
|
||||||
player = event.getPlayer()
|
player = event.getPlayer()
|
||||||
if (isEnabled("cauldron", uid(player))
|
if (isEnabled("cauldron", uid(player))
|
||||||
and player.hasPermission("utils.toggle.cauldron")
|
and player.hasPermission("utils.toggle.cauldron")
|
||||||
and is_creative(player)
|
and is_creative(player)
|
||||||
and event.getAction() == Action.RIGHT_CLICK_BLOCK
|
and event.getAction() == Action.RIGHT_CLICK_BLOCK
|
||||||
and (not event.hasItem() or event.getItem().getType() == Material.REDSTONE)
|
and (not event.hasItem() or event.getItem().getType() == Material.REDSTONE)
|
||||||
@@ -269,7 +269,7 @@ def stop_breaking_torches():
|
|||||||
class torch_breaker(Runnable):
|
class torch_breaker(Runnable):
|
||||||
|
|
||||||
def run():
|
def run():
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if break_torches:
|
if break_torches:
|
||||||
for i in range(len(torches_to_break)):
|
for i in range(len(torches_to_break)):
|
||||||
|
|||||||
@@ -97,12 +97,12 @@ def on_chat(event):
|
|||||||
groupchat(sender, msge)
|
groupchat(sender, msge)
|
||||||
event.setCancelled(True)
|
event.setCancelled(True)
|
||||||
|
|
||||||
@simplecommand("chatgroupkey",
|
@simplecommand("chatgroupkey",
|
||||||
aliases = ["cgkey"],
|
aliases = ["cgkey"],
|
||||||
senderLimit = 0,
|
senderLimit = 0,
|
||||||
helpNoargs = True,
|
helpNoargs = True,
|
||||||
helpSubcmd = True,
|
helpSubcmd = True,
|
||||||
description = "Sets a key character for chatting to your chatgroup",
|
description = "Sets a key character for chatting to your chatgroup",
|
||||||
usage = "<key>")
|
usage = "<key>")
|
||||||
def chatgroupkey_command(sender, command, label, args):
|
def chatgroupkey_command(sender, command, label, args):
|
||||||
key = " ".join(args)
|
key = " ".join(args)
|
||||||
|
|||||||
@@ -126,7 +126,7 @@ def runas(player, cmd):
|
|||||||
player.chat("/" + cmd)
|
player.chat("/" + cmd)
|
||||||
else:
|
else:
|
||||||
server.dispatchCommand(player, cmd)
|
server.dispatchCommand(player, cmd)
|
||||||
|
|
||||||
|
|
||||||
def is_player(obj):
|
def is_player(obj):
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -34,10 +34,10 @@ def matches_thread(password, user):
|
|||||||
|
|
||||||
|
|
||||||
@simplecommand("cgpass",
|
@simplecommand("cgpass",
|
||||||
usage = "<password> <new password>",
|
usage = "<password> <new password>",
|
||||||
description = "Changes your password",
|
description = "Changes your password",
|
||||||
senderLimit = 0,
|
senderLimit = 0,
|
||||||
helpNoargs = True)
|
helpNoargs = True)
|
||||||
def change_pass_command(sender, command, label, args):
|
def change_pass_command(sender, command, label, args):
|
||||||
if sender.getName() in logging_in:
|
if sender.getName() in logging_in:
|
||||||
return "&cYou are not logged in"
|
return "&cYou are not logged in"
|
||||||
@@ -52,9 +52,9 @@ def change_pass_command(sender, command, label, args):
|
|||||||
return "&cYou are not registered"
|
return "&cYou are not registered"
|
||||||
|
|
||||||
@simplecommand("login",
|
@simplecommand("login",
|
||||||
usage = "<password>",
|
usage = "<password>",
|
||||||
description = "Logs you in if <password> matches your password.",
|
description = "Logs you in if <password> matches your password.",
|
||||||
senderLimit = 0,
|
senderLimit = 0,
|
||||||
helpNoargs = True)
|
helpNoargs = True)
|
||||||
def login_command(sender, command, label, args):
|
def login_command(sender, command, label, args):
|
||||||
password = args[0]
|
password = args[0]
|
||||||
@@ -195,7 +195,7 @@ def kick_thread():
|
|||||||
if name in logging_in:
|
if name in logging_in:
|
||||||
del logging_in[name]
|
del logging_in[name]
|
||||||
break
|
break
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
thread = threading.Thread(target = kick_thread)
|
thread = threading.Thread(target = kick_thread)
|
||||||
|
|||||||
4
main.py
4
main.py
@@ -38,8 +38,8 @@ shared["load_modules"] = [
|
|||||||
"adminchat",
|
"adminchat",
|
||||||
# Adds /badge, allows to give players achievements
|
# Adds /badge, allows to give players achievements
|
||||||
"badges",
|
"badges",
|
||||||
# Adds a few block placement corrections/mods
|
# Adds a few block placement corrections/mods
|
||||||
"blockplacemods",
|
"blockplacemods",
|
||||||
# Adds /calc, toggles automatic solving of Math expressions in chat
|
# Adds /calc, toggles automatic solving of Math expressions in chat
|
||||||
"calc",
|
"calc",
|
||||||
# Plugin to locate laggy chunks. /lc <n> lists chunks with more than n entities
|
# Plugin to locate laggy chunks. /lc <n> lists chunks with more than n entities
|
||||||
|
|||||||
2
misc.py
2
misc.py
@@ -138,7 +138,7 @@ def on_sudo_command(sender, command, label, args):
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
@simplecommand("me",
|
@simplecommand("me",
|
||||||
usage = "[message..]",
|
usage = "[message..]",
|
||||||
description = "Sends a message in third person",
|
description = "Sends a message in third person",
|
||||||
helpNoargs = True)
|
helpNoargs = True)
|
||||||
|
|||||||
20
player.py
20
player.py
@@ -4,24 +4,24 @@ players = []
|
|||||||
|
|
||||||
class py_player:
|
class py_player:
|
||||||
|
|
||||||
def __init__(player):
|
def __init__(player):
|
||||||
self.player = player
|
self.player = player
|
||||||
|
|
||||||
#Properties TODO
|
#Properties TODO
|
||||||
#Example:
|
#Example:
|
||||||
self.logging_in = False
|
self.logging_in = False
|
||||||
|
|
||||||
def get_py_player(player):
|
def get_py_player(player):
|
||||||
py_player = players[players.index(player)]
|
py_player = players[players.index(player)]
|
||||||
return py_player
|
return py_player
|
||||||
|
|
||||||
|
|
||||||
@hook.event("player.PlayerJoinEvent","highest")
|
@hook.event("player.PlayerJoinEvent","highest")
|
||||||
def on_join(event):
|
def on_join(event):
|
||||||
player = py_player(event.getPlayer())
|
player = py_player(event.getPlayer())
|
||||||
players.append(player)
|
players.append(player)
|
||||||
|
|
||||||
|
|
||||||
@hook.event("player.PlayerQuitEvent","highest")
|
@hook.event("player.PlayerQuitEvent","highest")
|
||||||
def on_leave(event):
|
def on_leave(event):
|
||||||
players.remove(get_py_player(event.getPlayer()))
|
players.remove(get_py_player(event.getPlayer()))
|
||||||
|
|||||||
41
setup.sh
41
setup.sh
@@ -3,6 +3,15 @@
|
|||||||
# exit on failure
|
# exit on failure
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
for cmd in curl java unzip git pip; do
|
||||||
|
if ! which -s "$cmd"; then
|
||||||
|
tput setf 4 >&2
|
||||||
|
echo "Error: please install '$cmd' to proceed" >&2
|
||||||
|
tput sgr0 >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
echo -e "> This will only set up Spigot and all the plugins, configuration files are still up to you to manage"
|
echo -e "> This will only set up Spigot and all the plugins, configuration files are still up to you to manage"
|
||||||
echo -e "> Press enter to coninue"
|
echo -e "> Press enter to coninue"
|
||||||
read
|
read
|
||||||
@@ -33,19 +42,19 @@ curl --progress-bar -Lo "essentials.jar" "https://github.com/RedstonerServer/Ess
|
|||||||
echo ">> Downloading essentialschat.jar ..."
|
echo ">> Downloading essentialschat.jar ..."
|
||||||
curl --progress-bar -Lo "essentialschat.jar" "https://hub.spigotmc.org/jenkins/job/Spigot-Essentials/lastSuccessfulBuild/artifact/EssentialsChat/target/EssentialsChat-2.x-SNAPSHOT.jar"
|
curl --progress-bar -Lo "essentialschat.jar" "https://hub.spigotmc.org/jenkins/job/Spigot-Essentials/lastSuccessfulBuild/artifact/EssentialsChat/target/EssentialsChat-2.x-SNAPSHOT.jar"
|
||||||
echo ">> Downloading imageonmap.jar ..."
|
echo ">> Downloading imageonmap.jar ..."
|
||||||
curl --progress-bar -Lo "imageonmap.jar" "https://dev.bukkit.org/media/files/772/680/imageonmap.jar"
|
curl --progress-bar -Lo "imageonmap.jar." "https://dev.bukkit.org/media/files/772/680/imageonmap.jar"
|
||||||
echo ">> Downloading logblock.jar ..."
|
echo ">> Downloading logblock.jar ..."
|
||||||
curl --progress-bar -Lo "logblock.jar" "https://dev.bukkit.org/media/files/757/963/LogBlock.jar"
|
curl --progress-bar -Lo "logblock.jar." "https://dev.bukkit.org/media/files/757/963/LogBlock.jar"
|
||||||
echo ">> Downloading logblockquestioner.zip ..."
|
echo ">> Downloading logblockquestioner.zip ..."
|
||||||
curl --progress-bar -Lo "logblockquestioner.zip" "https://cloud.github.com/downloads/DiddiZ/LogBlockQuestioner/LogBlockQuestioner%20v0.03.zip"
|
curl --progress-bar -Lo "logblockquestioner.zip" "https://cloud.github.com/downloads/DiddiZ/LogBlockQuestioner/LogBlockQuestioner%20v0.03.zip"
|
||||||
echo ">> Downloading multiverse-core.jar ..."
|
echo ">> Downloading multiverse-core.jar ..."
|
||||||
curl --progress-bar -Lo "multiverse-core.jar" "https://dev.bukkit.org/media/files/588/781/Multiverse-Core-2.4.jar"
|
curl --progress-bar -Lo "multiverse-core.jar" "https://dev.bukkit.org/media/files/588/781/Multiverse-Core-2.4.jar"
|
||||||
echo ">> Downloading multiverse-portals.jar ..."
|
echo ">> Downloading multiverse-portals.jar ..."
|
||||||
curl --progress-bar -Lo "multiverse-portals.jar" "https://dev.bukkit.org/media/files/588/790/Multiverse-Portals-2.4.jar"
|
curl --progress-bar -Lo "multiverse-portals.jar." "https://dev.bukkit.org/media/files/588/790/Multiverse-Portals-2.4.jar"
|
||||||
echo ">> Downloading multiverse-netherportals.jar ..."
|
echo ">> Downloading multiverse-netherportals.jar ..."
|
||||||
curl --progress-bar -Lo "multiverse-netherportals.jar" "https://dev.bukkit.org/media/files/589/64/Multiverse-NetherPortals-2.4.jar"
|
curl --progress-bar -Lo "multiverse-netherportals.jar." "https://dev.bukkit.org/media/files/589/64/Multiverse-NetherPortals-2.4.jar"
|
||||||
echo ">> Downloading multiverse-inventories.jar ..."
|
echo ">> Downloading multiverse-inventories.jar ..."
|
||||||
curl --progress-bar -Lo "multiverse-inventories.jar" "https://dev.bukkit.org/media/files/663/303/Multiverse-Inventories-2.5.jar"
|
curl --progress-bar -Lo "multiverse-inventories.jar." "https://dev.bukkit.org/media/files/663/303/Multiverse-Inventories-2.5.jar"
|
||||||
echo ">> Downloading permissionsex.jar ..."
|
echo ">> Downloading permissionsex.jar ..."
|
||||||
curl --progress-bar -Lo "permissionsex.jar" "https://dev.bukkit.org/media/files/882/992/PermissionsEx-1.23.3.jar"
|
curl --progress-bar -Lo "permissionsex.jar" "https://dev.bukkit.org/media/files/882/992/PermissionsEx-1.23.3.jar"
|
||||||
echo ">> Downloading plotme.jar ..."
|
echo ">> Downloading plotme.jar ..."
|
||||||
@@ -53,15 +62,15 @@ curl --progress-bar -Lo "plotme.jar" "http://ci.worldcretornica.com/job/PlotMe-C
|
|||||||
echo ">> Downloading plotme-defaultgenerator.jar ..."
|
echo ">> Downloading plotme-defaultgenerator.jar ..."
|
||||||
curl --progress-bar -Lo "plotme-defaultgenerator.jar" "http://ci.worldcretornica.com/job/PlotMe-DefaultGenerator/83/artifact/target/PlotMe-DefaultGenerator.jar"
|
curl --progress-bar -Lo "plotme-defaultgenerator.jar" "http://ci.worldcretornica.com/job/PlotMe-DefaultGenerator/83/artifact/target/PlotMe-DefaultGenerator.jar"
|
||||||
echo ">> Downloading serversigns.jar ..."
|
echo ">> Downloading serversigns.jar ..."
|
||||||
curl --progress-bar -Lo "serversigns.jar" "https://dev.bukkit.org/media/files/876/381/ServerSigns.jar"
|
curl --progress-bar -Lo "serversigns.jar." "https://dev.bukkit.org/media/files/876/381/ServerSigns.jar"
|
||||||
echo ">> Downloading redstoneclockdetector.jar ..."
|
echo ">> Downloading redstoneclockdetector.jar ..."
|
||||||
curl --progress-bar -Lo "redstoneclockdetector.jar" "https://dev.bukkit.org/media/files/577/253/RedstoneClockDetector.jar"
|
curl --progress-bar -Lo "redstoneclockdetector.jar." "https://dev.bukkit.org/media/files/577/253/RedstoneClockDetector.jar"
|
||||||
echo ">> Downloading vault.jar ..."
|
echo ">> Downloading vault.jar ..."
|
||||||
curl --progress-bar -Lo "vault.jar" "https://dev.bukkit.org/media/files/837/976/Vault.jar"
|
curl --progress-bar -Lo "vault.jar" "https://dev.bukkit.org/media/files/837/976/Vault.jar"
|
||||||
echo ">> Downloading worldborder.jar ..."
|
echo ">> Downloading worldborder.jar ..."
|
||||||
curl --progress-bar -Lo "worldborder.jar" "https://dev.bukkit.org/media/files/883/629/WorldBorder.jar"
|
curl --progress-bar -Lo "worldborder.jar." "https://dev.bukkit.org/media/files/883/629/WorldBorder.jar"
|
||||||
echo ">> Downloading worldguard.jar ..."
|
echo ">> Downloading worldguard.jar ..."
|
||||||
curl --progress-bar -Lo "worldguard.jar" "https://github.com/RedstonerServer/WorldGuard/releases/download/6.0.0-redstoner/worldguard-6.0.0-REDSTONER.jar"
|
curl --progress-bar -Lo "worldguard.jar." "https://github.com/RedstonerServer/WorldGuard/releases/download/6.0.0-redstoner/worldguard-6.0.0-REDSTONER.jar"
|
||||||
echo ">> Downloading worldedit.jar ..."
|
echo ">> Downloading worldedit.jar ..."
|
||||||
curl --progress-bar -Lo "worldedit.jar" "https://dev.bukkit.org/media/files/880/435/worldedit-bukkit-6.1.jar"
|
curl --progress-bar -Lo "worldedit.jar" "https://dev.bukkit.org/media/files/880/435/worldedit-bukkit-6.1.jar"
|
||||||
echo ">> Downloading pythonpluginloader.jar ..."
|
echo ">> Downloading pythonpluginloader.jar ..."
|
||||||
@@ -70,13 +79,23 @@ curl --progress-bar -Lo "pythonpluginloader.jar" "https://bamboo.gserv.me/browse
|
|||||||
echo -e "\n> Unpacking LogBlockQuestioner"
|
echo -e "\n> Unpacking LogBlockQuestioner"
|
||||||
unzip -q "logblockquestioner.zip" "LogBlockQuestioner.jar"
|
unzip -q "logblockquestioner.zip" "LogBlockQuestioner.jar"
|
||||||
rm "logblockquestioner.zip"
|
rm "logblockquestioner.zip"
|
||||||
mv -v "LogBlockQuestioner.jar" "logblockquestioner.jar"
|
mv -v "LogBlockQuestioner.jar" "logblockquestioner.jar."
|
||||||
|
|
||||||
echo -e "\n> Pulling redstoner-utils ..."
|
echo -e "\n> Pulling redstoner-utils ..."
|
||||||
git clone -q "git@github.com:RedstonerServer/redstoner-utils.git" "redstoner-utils.py.dir" > /dev/null
|
git clone -q "git@github.com:RedstonerServer/redstoner-utils.git" "redstoner-utils.py.dir" > /dev/null
|
||||||
|
|
||||||
|
echo -e "\n> Installing dependencies"
|
||||||
|
pip install passlib
|
||||||
|
|
||||||
echo -e "\n> All plugins downloaded"
|
echo -e "\n> All plugins downloaded"
|
||||||
cd ".."
|
|
||||||
|
cd "redstoner-utils.py.dir"
|
||||||
|
echo -e "\n> Duplicating sample files"
|
||||||
|
for file in ls ./*.example; do
|
||||||
|
cp -v "$file" "$(echo "$file" | rev | cut -d "." -f 2- | rev)"
|
||||||
|
done
|
||||||
|
|
||||||
|
cd "../.."
|
||||||
|
|
||||||
mkdir -v "lib"
|
mkdir -v "lib"
|
||||||
cd "lib"
|
cd "lib"
|
||||||
|
|||||||
42
snowbrawl.py
42
snowbrawl.py
@@ -49,7 +49,7 @@ class Arena(object):
|
|||||||
self.match_goal = None # amount of deaths or time until the match ends (depends on arena_type)
|
self.match_goal = None # amount of deaths or time until the match ends (depends on arena_type)
|
||||||
self.arena_type = None # arena type (death or time)
|
self.arena_type = None # arena type (death or time)
|
||||||
self.explosion_damage = None
|
self.explosion_damage = None
|
||||||
|
|
||||||
self.player_stats = {}
|
self.player_stats = {}
|
||||||
self.players = Queue()
|
self.players = Queue()
|
||||||
self.spawn_location = []
|
self.spawn_location = []
|
||||||
@@ -60,7 +60,7 @@ class Arena(object):
|
|||||||
self.corner1 = None # The corner1 given by the player (really bad for 3D position compare)
|
self.corner1 = None # The corner1 given by the player (really bad for 3D position compare)
|
||||||
self.corner2 = None # The corner2 given by the player (really bad for 3D position compare)
|
self.corner2 = None # The corner2 given by the player (really bad for 3D position compare)
|
||||||
self.tpp = None # The top, positive x, positive z corner
|
self.tpp = None # The top, positive x, positive z corner
|
||||||
self.bnn = None # The bottom, negative x, negative z corner
|
self.bnn = None # The bottom, negative x, negative z corner
|
||||||
|
|
||||||
#set corners of arena
|
#set corners of arena
|
||||||
def set_corner(self, sender, type):
|
def set_corner(self, sender, type):
|
||||||
@@ -75,21 +75,21 @@ class Arena(object):
|
|||||||
#Compares the corner1 and corner2 locations and figures out tpp and bnn so that we dont have to do it everytime we run in_arena()
|
#Compares the corner1 and corner2 locations and figures out tpp and bnn so that we dont have to do it everytime we run in_arena()
|
||||||
def update_corner_points(self):
|
def update_corner_points(self):
|
||||||
self.tpp = None
|
self.tpp = None
|
||||||
self.bnn = None
|
self.bnn = None
|
||||||
if self.corner1 == None or self.corner2 == None:
|
if self.corner1 == None or self.corner2 == None:
|
||||||
return
|
return
|
||||||
corn1 = self.corner1.get_location()
|
corn1 = self.corner1.get_location()
|
||||||
corn2 = self.corner2.get_location()
|
corn2 = self.corner2.get_location()
|
||||||
if not corn1.getWorld().getName() == corn2.getWorld().getName():
|
if not corn1.getWorld().getName() == corn2.getWorld().getName():
|
||||||
return
|
return
|
||||||
|
|
||||||
top = corn1.y if corn1.y > corn2.y else corn2.y
|
top = corn1.y if corn1.y > corn2.y else corn2.y
|
||||||
bottom = corn1.y if corn1.y < corn2.y else corn2.y
|
bottom = corn1.y if corn1.y < corn2.y else corn2.y
|
||||||
pos_x = corn1.x if corn1.x > corn2.x else corn2.x
|
pos_x = corn1.x if corn1.x > corn2.x else corn2.x
|
||||||
pos_z = corn1.z if corn1.z > corn2.z else corn2.z
|
pos_z = corn1.z if corn1.z > corn2.z else corn2.z
|
||||||
neg_x = corn1.x if corn1.x < corn2.x else corn2.x
|
neg_x = corn1.x if corn1.x < corn2.x else corn2.x
|
||||||
neg_z = corn1.z if corn1.z < corn2.z else corn2.z
|
neg_z = corn1.z if corn1.z < corn2.z else corn2.z
|
||||||
|
|
||||||
self.tpp = Coords(corn1.getWorld(), pos_x, top, pos_z, 0, 0)
|
self.tpp = Coords(corn1.getWorld(), pos_x, top, pos_z, 0, 0)
|
||||||
self.bnn = Coords(corn2.getWorld(), neg_x, bottom, neg_z, 0, 0)
|
self.bnn = Coords(corn2.getWorld(), neg_x, bottom, neg_z, 0, 0)
|
||||||
|
|
||||||
@@ -118,9 +118,9 @@ class Arena(object):
|
|||||||
self.start_match()
|
self.start_match()
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
#remove a player from the queue
|
#remove a player from the queue
|
||||||
def remove_player(self, player):
|
def remove_player(self, player):
|
||||||
if self.queue.contains(player):
|
if self.queue.contains(player):
|
||||||
self.queue.remove(player)
|
self.queue.remove(player)
|
||||||
return True
|
return True
|
||||||
@@ -132,7 +132,7 @@ class Arena(object):
|
|||||||
return False
|
return False
|
||||||
loc_tpp = self.tpp.get_location()
|
loc_tpp = self.tpp.get_location()
|
||||||
loc_bnn = self.bnn.get_location()
|
loc_bnn = self.bnn.get_location()
|
||||||
|
|
||||||
if loc.y > loc_tpp.y:
|
if loc.y > loc_tpp.y:
|
||||||
return False
|
return False
|
||||||
if loc.y < loc_bnn.y:
|
if loc.y < loc_bnn.y:
|
||||||
@@ -179,12 +179,12 @@ class Arena(object):
|
|||||||
alist[i] = alist[i+1]
|
alist[i] = alist[i+1]
|
||||||
alist[i+1] = temp
|
alist[i+1] = temp
|
||||||
return alist
|
return alist
|
||||||
|
|
||||||
@make_synchronized #Jython synchronized block
|
@make_synchronized #Jython synchronized block
|
||||||
def end_match(self): #End match, sort the players and print the 3 players with least amount of deaths
|
def end_match(self): #End match, sort the players and print the 3 players with least amount of deaths
|
||||||
|
|
||||||
sorted_list = self.bubbleSort(self.players.read())
|
sorted_list = self.bubbleSort(self.players.read())
|
||||||
|
|
||||||
for player in self.players.read():
|
for player in self.players.read():
|
||||||
if player.isOnline():
|
if player.isOnline():
|
||||||
loc = self.sign_location[0].get_location().get_location()
|
loc = self.sign_location[0].get_location().get_location()
|
||||||
@@ -256,7 +256,7 @@ class Arena(object):
|
|||||||
|
|
||||||
def get_click_signs(self):
|
def get_click_signs(self):
|
||||||
return self.sign_click
|
return self.sign_click
|
||||||
|
|
||||||
#Check if player is in the queue
|
#Check if player is in the queue
|
||||||
def in_queue(self,player):
|
def in_queue(self,player):
|
||||||
if self.queue.contains(player):
|
if self.queue.contains(player):
|
||||||
@@ -307,7 +307,7 @@ class Arena(object):
|
|||||||
sign.get_location().set_location(location)
|
sign.get_location().set_location(location)
|
||||||
break
|
break
|
||||||
|
|
||||||
#Remove location out of location
|
#Remove location out of location
|
||||||
def delete_location(self, name, type):
|
def delete_location(self, name, type):
|
||||||
if type == "spawn":
|
if type == "spawn":
|
||||||
for spawn in self.spawn_location[:]:
|
for spawn in self.spawn_location[:]:
|
||||||
@@ -472,16 +472,16 @@ class Queue(object):
|
|||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.queue = []
|
self.queue = []
|
||||||
|
|
||||||
#Appends to queue
|
#Appends to queue
|
||||||
def put(self,args):
|
def put(self,args):
|
||||||
self.queue.append(args)
|
self.queue.append(args)
|
||||||
|
|
||||||
#Returns the first item in the queue and removes it
|
#Returns the first item in the queue and removes it
|
||||||
def get(self):
|
def get(self):
|
||||||
if len(self.queue) > 0:
|
if len(self.queue) > 0:
|
||||||
return self.queue.pop(0)
|
return self.queue.pop(0)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
@@ -498,7 +498,7 @@ class Queue(object):
|
|||||||
if player in self.queue:
|
if player in self.queue:
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
#Clear the queue
|
#Clear the queue
|
||||||
def clear(self):
|
def clear(self):
|
||||||
self.queue = []
|
self.queue = []
|
||||||
@@ -532,7 +532,7 @@ class timings_runnable(Runnable):
|
|||||||
self.arena = arena
|
self.arena = arena
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
self.arena.end_match()
|
self.arena.end_match()
|
||||||
|
|
||||||
#timings thread to end arenas if their type is time
|
#timings thread to end arenas if their type is time
|
||||||
def timings():
|
def timings():
|
||||||
@@ -545,10 +545,10 @@ def timings():
|
|||||||
if arena.start_time + arena.match_goal < current_time:
|
if arena.start_time + arena.match_goal < current_time:
|
||||||
timing = timings_runnable(arena)
|
timing = timings_runnable(arena)
|
||||||
server.getScheduler().runTask(server.getPluginManager().getPlugin("RedstonerUtils"), timing)
|
server.getScheduler().runTask(server.getPluginManager().getPlugin("RedstonerUtils"), timing)
|
||||||
|
|
||||||
time.sleep(0.1)
|
time.sleep(0.1)
|
||||||
|
|
||||||
|
|
||||||
timingsThread = threading.Thread(target = timings)
|
timingsThread = threading.Thread(target = timings)
|
||||||
timingsThread.daemon = True #Thread dies if main thread dies
|
timingsThread.daemon = True #Thread dies if main thread dies
|
||||||
timingsThread.start()
|
timingsThread.start()
|
||||||
@@ -663,7 +663,7 @@ def on_quit(event):
|
|||||||
|
|
||||||
##############################################################################################
|
##############################################################################################
|
||||||
# Command handling
|
# Command handling
|
||||||
##############################################################################################
|
##############################################################################################
|
||||||
|
|
||||||
|
|
||||||
def create_arena(sender, args):
|
def create_arena(sender, args):
|
||||||
|
|||||||
Reference in New Issue
Block a user