def onCommandSpecial(sender, args): if not sender.hasPermission("plotmanager.reserve"): sender.sendMessage("You don't have enough permissions to execute this command") return if len(args) == 2: x = Manager.getPlotX(sender.getLocation().getX()) z = Manager.getPlotZ(sender.getLocation().getZ()) elif len(args) == 4: x = int(args[2]) z = int(args[3]) else: sender.sendMessage("Usage: /plot special [x] [z]") return if Manager.isOutOfRange(x, z): sender.sendMessage(''.join(["Plot ", str(x), ", ", str(z), " is out of range"])) return del args[0] if Manager.special(x, z, ' '.join(args)): sender.sendMessage(''.join(["You successfully reserved plot ", str(x), ", ", str(z)])) else: sender.sendMessage(''.join(["Failed to reserve plot ", str(x), ", ", str(z), ". Make sure that this is a free plot"]))
def onCommandClaim(sender, args): if not sender.hasPermission("plotmanager.claim"): sender.sendMessage("You don't have enough permissions to execute this command") return if len(args) == 1: x = Manager.getPlotX(sender.getLocation().getX()) z = Manager.getPlotZ(sender.getLocation().getZ()) elif len(args) == 3: x = int(args[1]) z = int(args[2]) else: sender.sendMessage("Usage: /plot claim [x] [z]") return if Manager.isOutOfRange(x, z): sender.sendMessage(''.join(["Plot ", str(x), ", ", str(z), " is out of range"])) return if Manager.claim(sender.getName(), x, z): sender.sendMessage(''.join(["You successfully claimed plot ", str(x), ", ", str(z)])) else: sender.sendMessage(''.join(["Failed to unclaim plot ", str(x), ", ", str(z), ". Make sure that this is a free plot and that you are allowed to claim plots"]))
def onCommandInfo(sender, args): if not sender.hasPermission("plotmanager.info"): sender.sendMessage("You don't have enough permissions to execute this command") return if len(args) == 1: x = Manager.getPlotX(sender.getLocation().getX()) z = Manager.getPlotZ(sender.getLocation().getZ()) elif len(args) == 3: x = int(args[1]) z = int(args[2]) else: sender.sendMessage("Usage: /plot info [x] [z]") return if Manager.isOutOfRange(x, z): sender.sendMessage(''.join(["Plot ", str(x), ", ", str(z), " is out of range"])) return plot = Manager.getPlot(x, z) sender.sendMessage(''.join(["--- Plot ", str(x), ", ", str(z), " ---"])) if plot.status == Manager.PlotStatus.FREE: sender.sendMessage("Status: Free") elif plot.status == Manager.PlotStatus.CLAIMED: sender.sendMessage(''.join(["Status: Claimed by ", plot.owner])) sender.sendMessage(''.join(["Claimed at: ", plot.date])) elif plot.status == Manager.PlotStatus.TEMP: sender.sendMessage(''.join(["Status: Temporarily claimed by ", plot.owner])) sender.sendMessage(''.join(["Claimed at: ", plot.date])) elif plot.status == Manager.PlotStatus.RESERVED: sender.sendMessage("Status: Reserved") elif plot.status == Manager.PlotStatus.SPECIAL: sender.sendMessage(''.join(["Status: ", plot.description]))
def onCommandUnclaim(sender, args): if len(args) == 1: x = Manager.getPlotX(sender.getLocation().getX()) z = Manager.getPlotZ(sender.getLocation().getZ()) elif len(args) == 3: x = int(args[1]) z = int(args[2]) else: sender.sendMessage("Usage: /plot unclaim [x] [z]") return if Manager.isOutOfRange(x, z): sender.sendMessage(''.join(["Plot ", str(x), ", ", str(z), " is out of range"])) return if Manager.unclaim(sender.getName(), x, z): sender.sendMessage(''.join(["You successfully unclaimed plot ", str(x), ", ", str(z)])) else: sender.sendMessage(''.join(["Failed to unclaim plot ", str(x), ", ", str(z), ". Make sure that you are the owner of this plot"]))
def onCommandForceUnclaim(sender, args): if not sender.hasPermission("plotmanager.admin"): sender.sendMessage("You don't have enough permissions to execute this command") return if len(args) == 1: x = Manager.getPlotX(sender.getLocation().getX()) z = Manager.getPlotZ(sender.getLocation().getZ()) elif len(args) == 3 and args[1].isdigit() and args[2].isdigit(): x = int(args[1]) z = int(args[2]) else: sender.sendMessage("Usage: /plot forceUnclaim [x] [z]") return if Manager.isOutOfRange(x, z): sender.sendMessage(''.join(["Plot ", str(x), ", ", str(z), " is out of range"])) return Manager.forceUnclaim(x, z) sender.sendMessage(''.join(["Forcefully unclaimed plot ", str(x), ", ", str(z)]))