def onCommandSchems(sender, args): Name = sender.getName() try: UserSchems = os.listdir('/var/www/schems/files/'+Name) except:return False if len(args) == 2: Sub = args[0] if Sub in ('load','save'): runas(sender,'/schematic '+Sub+' '+Name+'/'+args[1].split('/')[0]) return True elif len(args) == 1: Sub = args[0] if Sub == 'list': sender.sendMessage('List of your schematics:') for item in UserSchems: sender.sendMessage(item) return True sender.sendMessage('/schems list | load <name> | save <name>')
def passset(sender, args): runas(sender,'dbp set '+' '.join(args)) return True
def onCommandBookGet(sender, args): item = sender.getItemInHand() if item.getTypeId() not in (386,387): sender.sendMessage(color("c") + 'You must have a book') return False # YAY for descriptive names -Dot metadata = item.getItemMeta() s = '' for i in metadata.getPages(): s = s+'\n'+i n = 0 while 1: a = '#a'+str(n) if len(args) <= n: break s = s.replace(a, args[n]) n += 1 n = 0 while 1: a = '#r'+str(n) if len(args) <= n: break s = s.replace(a, ' '.join(args[n:])) n += 1 n = 0 while 1: a = '#n'+str(n) if len(args) <= n: break name = getPlayer(args[n]) if name != None: s = s.replace(a, name.getName()) n += 1 s = s.replace('#a', ' '.join(args)) s = s.replace('#p', 'ping &b') s = s.replace('#m', sender.getName()) s = s.split('\n')[1:] n = 0 if len(args) > 0 and '@'+args[0] in s: n = s.index('@'+args[0])+1 no = 0 while True: if n == len(s): break if no == 3 and not sender.hasPermission('xeoperms.give'): break command = s[n] if command[0:2] == '#b': bcast(color("e") + s[n][2:] + color("6") + ' ('+ sender.getName() + ')') elif command.split()[0] != 'e': runas(sender, command) if not n+1 == len(s) and s[n+1][0] == '@': break n += 1 no += 1 sender.sendMessage('Command(s) run!') return True for i in s: if n == 3 and not sender.hasPermission('xeoperms.give'): break if len(i) == 0: break if i[0] == '@': break if i[0:2] == '#b': bcast(color("e") + i[2:] + color("6") + ' ('+sender.getName()+')') elif i.split()[0] != 'e': runas(sender, i) n += 1 sender.sendMessage(color("a") + 'Command(s) run!') return True