I'm coding bukkit plugins for Minecraft servers in jython, using PyPluginLoader. I've events and everything else which works, but I want to make toggle command, which will toggle blockspawn mode on, but if you enter it again, it shuts it off. Here's the code, error below:
from java.io import File
import org.bukkit as bukkit
server = bukkit.Bukkit.getServer()
log = server.getLogger()
Material = bukkit.Material
from org.bukkit.event import player
from org.bukkit.entity import EntityType
import org.bukkit.permissions
from org.bukkit.plugin.java import JavaPlugin
from org.bukkit import Server
from org.bukkit import plugin
from java.util import Date, HashSet, HashMap
z = HashMap
@hook.command("blockspawn", usage="/<command>",
desc="Toggles blockspawning mode on/off")
def onbrix(sender, command, label):
if z.containsKey(player):
z.remove(player.getName())
sender.sendMessage("Blockspawning OFF")
else:
z.put(player.getName())
sender.sendMessage("Blockspawning ON")
ERROR:
Caused by: Traceback (most recent call last):
File "<iostream>", line 23, in onbrix
TypeError: containsKey(): expected 2 args; got 1