Beispiel #1
0
def onCommandSave(sender, args):
    if len(args) != 1:
        return False

    dispatchCommand(sender, ''.join(["/schematic save mcedit ", sender.getName(), "/", args[0]]))

    return True
Beispiel #2
0
def OnCommandSchems(sender, args):
    Name = sender.getName()

    if len(args) == 2 and args[0] in ("load", "save"):
        dispatchCommand(
            sender,
            '/schematic ' + args[0] + ' ' + Name + '/' + args[1].split('/')[0])

        return True

    elif len(args) == 1 and args[0] == "list":
        try:
            UserSchems = os.listdir('/var/www/schems/files/' + Name)
        except:
            SendError(sender, "Could not read the schematic directory.")
            return True

        sender.sendMessage('List of your schematics:')

        for item in UserSchems:
            sender.sendMessage(item)

        return True

    return False
Beispiel #3
0
def onCommandFixLag(sender, args):
    dispatchCommand(sender, "rem items -1")
    dispatchCommand(sender, "rem arrows -1")
    dispatchCommand(sender, "rem boats -1")
    dispatchCommand(sender, "rem paintings -1")
    dispatchCommand(sender, "rem xp -1")

    bukkit.Bukkit.dispatchCommand(sender, "butcher -f")

    sudo("save-all")

    sender.sendMessage("You fixed teh lags!")
    return True
	def Unclaim(self, x, y, uuid, name):
		plot = self.plots[(x, y)]

		if plot.status in (PlotStatus.CLAIMED, PlotStatus.RESERVED):
			if str(plot.ownerid) == str(uuid):
				del self.plots[(x, y)]

				owner = self.players[str(uuid)]
				owner.remPlots += 1

			else:
				raise OwnerError(self.players[str(plot.ownerid)].Name)
		else:
			raise UnclaimedError()
		
		loc = getPlayer(name).getLocation()
		plotX, plotY = self.GetPlotCoords(loc.getBlockX(), loc.getBlockZ())
		id = str(plotX) + ',' + str(plotY)
		dispatchCommand(getConsoleSender(), '/region removeowner ' + id + ' ' + name)
Beispiel #5
0
def OnCommandExecBook(sender, args):
    if not sender.hasPermission("ore.execbook"):
        SendError(sender, "No permission!")
        return

    item = sender.getItemInHand()

    if item.getTypeId() not in (386, 387):
        SendError(sender, 'You must have a book')
        return True

    meta = item.getItemMeta()

    pages = []

    for page in meta.getPages():
        pages.append(page)

    program = '\n'.join(pages)

    for i in xrange(len(args)):
        program = program.replace('#a' + str(i), args[i])

    program = program.replace("#a", ' '.join(args))
    program = program.replace("#m", sender.getName())
    program = program.replace("#p", "ping &b")

    cmds = program.split('\n')

    if len(cmds) > 3 and not sender.hasPermission("ore.execbook.admin"):
        SendError(sender, "Cannot execute more than three commands")
        return True

    for cmd in cmds:
        if cmd in ("execbook", ""):
            continue

        dispatchCommand(sender, cmd)

    SendInfo(sender, "Exectued %d commands!" % len(cmds))

    return True
Beispiel #6
0
def OnCommandExecBook(sender, args):
	if not sender.hasPermission("ore.execbook"):
		SendError(sender, "No permission!")
		return

	item = sender.getItemInHand()

	if item.getTypeId() not in (386, 387):
		SendError(sender, 'You must have a book')
		return True

	meta = item.getItemMeta()

	pages = []

	for page in meta.getPages():
		pages.append(page)

	program = '\n'.join(pages)

	for i in xrange(len(args)):
		program = program.replace('#a' + str(i), args[i])

	program = program.replace("#a", ' '.join(args))
	program = program.replace("#m", sender.getName())
	program = program.replace("#p", "ping &b")

	cmds = program.split('\n')

	if len(cmds) > 3 and not sender.hasPermission("ore.execbook.admin"):
		SendError(sender, "Cannot execute more than three commands")
		return True

	for cmd in cmds:
		if cmd in ("execbook", ""):
			continue

		dispatchCommand(sender, cmd)

	SendInfo(sender, "Exectued %d commands!" % len(cmds))

	return True
	def Claim(self, x, y, uuid, name, reason=""):
		plot = self.plots[(x, y)]

                owner = self.players[str(uuid)]
                self.players[str(uuid)].Name = name

		if owner.remPlots == 0:
			raise CannotClaimMoreError() 

                if "ownerid" in plot:
                        plot.Claim(self.players[str(plot.ownerid)].Name, uuid, reason)
                else:
                        plot.Claim(self.players[str(uuid)].Name, uuid, reason)

                owner.remPlots -= 1

		loc = getPlayer(name).getLocation()
		plotX, plotY = self.GetPlotCoords(loc.getBlockX(), loc.getBlockZ())
		id = str(plotX) + ',' + str(plotY)
		dispatchCommand(getConsoleSender(), '/region addowner ' + id + ' ' + name)
Beispiel #8
0
def OnCommandSchems(sender, args):
	Name = sender.getName()

	if len(args) == 2 and args[0] in ("load", "save"):
		dispatchCommand(sender, '/schematic ' + args[0] + ' ' + Name + '/' + args[1].split('/')[0])
	
		return True

	elif len(args) == 1 and args[0] == "list":
		try:
			UserSchems = os.listdir('/var/www/schems/files/' + Name)
		except:
			SendError(sender, "Could not read the schematic directory.")
			return True

		sender.sendMessage('List of your schematics:')

		for item in UserSchems:
			sender.sendMessage(item)

		return True

	return False
Beispiel #9
0
def OnCommandPass(sender, args):
    dispatchCommand(sender, 'dbp set ' + ' '.join(args))
    return True
Beispiel #10
0
def OnCommandPass(sender, args):
	dispatchCommand(sender, 'dbp set ' + ' '.join(args))
	return True
Beispiel #11
0
def onCommandSkilldown(sender, args):
    dispatchCommand(sender, "pex demote " + args[0])

    return True
Beispiel #12
0
def onCommandSkillup(sender, args):
    dispatchCommand(sender, "pex promote " + args[0])

    return True
Beispiel #13
0
def onCommandNight(sender, args):
    dispatchCommand(sender, "ptime @midnight")
    return True
Beispiel #14
0
def onCommandDay(sender, args):
    dispatchCommand(sender, "ptime @noon")
    return True
	def RemAllowed(self, allower, allowed):
		loc = allower.getLocation()
		plotX, plotY = self.GetPlotCoords(loc.getBlockX(), loc.getBlockZ())
		id = str(plotX) + ',' + str(plotY)
		return dispatchCommand(allower, '/region removemember ' + id + ' ' + str(allowed))