Merge remote-tracking branch 'origin/dev'

This commit is contained in:
Dico200
2015-05-08 13:47:23 +02:00
2 changed files with 23 additions and 13 deletions

View File

@@ -1,5 +1,9 @@
from helpers import *
from basecommands import simplecommand
import org.bukkit.event.block.BlockBreakEvent as BlockBreakEvent
import org.bukkit.block.Furnace as Furnace
import org.bukkit.inventory.ItemStack as ItemStack
import org.bukkit.Material as Material
denyslabcorrection = open_json_file("denyslabcorrection", []) #Players that don't want slabs corrected
denyautofill = open_json_file("denyautocauldronfill", [])
@@ -93,11 +97,15 @@ def on_block_place(event):
return
uuid = uid(player)
block = event.getBlockPlaced()
if uuid not in denyslabcorrection and str(block.getType()) in ("WOOD_STEP", "STEP") and block.getData() < 8:
material = str(block.getType())
if uuid not in denyslabcorrection and material in ("WOOD_STEP", "STEP") and block.getData() < 8:
block.setData(block.getData() + 8) # Flip upside down
elif uuid not in denyautofill and str(block.getType()) == "CAULDRON":
elif uuid not in denyautofill and material == "CAULDRON":
block.setData(3) #3 layers of water, 3 signal strength
elif material == "FURNACE":
state = block.getState()
state.getInventory().setSmelting(ItemStack(Material.REDSTONE))
state.update()
@hook.event("player.PlayerInteractEvent", "monitor")
def on_interact(event):
@@ -109,10 +117,8 @@ def on_interact(event):
if event.hasItem() and not str(event.getItem().getType()) == "REDSTONE":
return
block = event.getClickedBlock()
if str(block.getType()) == "CAULDRON" and block.getData() > 0:
block.setData(block.getData() - 1) #Lower water level by one
event2 = BlockBreakEvent(block, player)
server.getPluginManager().callEvent(event2)
data = block.getData()
if not event2.isCancelled() and str(block.getType()) == "CAULDRON":
block.setData(data - 1 if data > 0 else 3)

View File

@@ -11,7 +11,7 @@ from helpers import *
# receive info based on the user's IP. information provided by ipinfo.io
def ip_info(player):
if player.isOnline():
return json.load(urllib2.urlopen("https://ipinfo.io%s/json" % str(player.getAddress().getAddress())))
return json.load(urllib2.urlopen("http://ipinfo.io%s/json" % str(player.getAddress().getAddress())))
else:
return {}
@@ -42,6 +42,11 @@ def get_website_data(player):
return ("http://redstoner.com/users/%s" % results[0][0], results[0][1]) if results else (None, None)
# receive country based on the user's IP
def get_country(data):
return str(data.get("country"))
def get_all_names(player):
uuid = str(uid(player)).replace("-", "")
names = json.load(urllib2.urlopen("https://api.mojang.com/user/profiles/%s/names" % uuid))
@@ -64,8 +69,7 @@ def get_all_data(sender, player):
msg(sender, "&6> Website account: &e%s" % website[0])
msg(sender, "&6> email: &e%s" % website[1])
msg(sender, "&7 -- Data provided by ipinfo.io")
msg(sender, "&6> Country: &e%s" % str(data.get("country")))
msg(sender, "&6> Network: &e%s" % str(data.get("org")))
msg(sender, "&6> Country: &e%s" % get_country(data))
msg(sender, "&7 -- Data provided by Mojang")
msg(sender, "&6> All ingame names used so far: &e%s" % get_all_names(player))
except: