Example #1
0
	def __init__(self, name, isServer, srvcolor):
		self.Name = name
		
		self.IsServer = isServer

		self.SrvColor = srvcolor
		self.BraColor = ChatColor.getByChar(hex(int(ChatColor.getChar(srvcolor), 16) ^ 8)[-1])
		self.NamColor = ChatColor.AQUA
		self.MsgColor = ChatColor.WHITE
Example #2
0
	def __init__(self, name, isServer, srvcolor):
		self.Name = name
		
		self.IsServer = isServer

		self.SrvColor = srvcolor
		self.BraColor = ChatColor.getByChar(hex(int(ChatColor.getChar(srvcolor), 16) ^ 8)[-1])
		self.NamColor = ChatColor.AQUA
		self.MsgColor = ChatColor.WHITE
Example #3
0
 def onPlayerChat(self, event):
     pl = event.getPlayer()
     if pl.isOp():
         return
     self.config = self.plugin.getPluginCfg()
     allplayers = list(event.getRecipients())
     if self.config["localChat"] == True:
         if event.getMessage()[0] == "*":
             econ = None
             econProvider = server.getServicesManager().getRegistration(Economy)
             if econProvider:
                 econ = econProvider.getProvider()
             else:
                 pl.sendMessage(ChatColor.translateAlternateColorCodes("&", self.config["noEcoMsg"]))
             if econ:
                 if econ.getBalance(pl.getName()) >= self.config["msgCost"]:
                     econ.withdrawPlayer(pl.getName(), self.config["msgCost"])
                     event.setMessage(event.getMessage()[1:])
                     event.setFormat(ChatColor.translateAlternateColorCodes("&", self.config["globalPrefix"]) + event.getFormat())
                     return
                 else:
                     pl.sendMessage(ChatColor.translateAlternateColorCodes("&", self.config["noMoneyMsg"] % str(self.config["msgCost"])))
                     event.setCancelled(True)
                     return
         if event.getMessage()[0] <> "!":
             for reciver in allplayers:
                 if self.checkRadius(pl.getLocation(), reciver.getLocation()) == False and not reciver.isOp() and not reciver.hasPermission("rcchat.seelocalchat"):
                     event.getRecipients().remove(reciver)
             event.setFormat(ChatColor.translateAlternateColorCodes("&", self.config["localPrefix"]) + event.getFormat())
             return
         else:
             if pl.hasPermission("rcchat.nomsgdelay"):
                 event.setMessage(event.getMessage()[1:])
                 event.setFormat(ChatColor.translateAlternateColorCodes("&",self.config["globalPrefix"]) + event.getFormat())
                 return
             if pl.getName() in self.msgTime:
                 delay = self.config["msgDelay"]
                 for group in self.config["permissionsGroups"]:
                     if pl.hasPermission("rcchat." + group):
                         delay = self.config["permissionsGroups"][group]
                 if time() - self.msgTime[pl.getName()] < delay:
                     pl.sendMessage(ChatColor.translateAlternateColorCodes("&", self.config["noEnoughTime"] % unicode(int(delay - (time() - self.msgTime[pl.getName()])))))
                     event.setCancelled(True)
                     return
                 else:
                     self.msgTime[pl.getName()] = time()
                     event.setMessage(event.getMessage()[1:])
                     event.setFormat(ChatColor.translateAlternateColorCodes("&",self.config["globalPrefix"]) + event.getFormat())
                     return
             else:
                 self.msgTime[pl.getName()] = time()
                 event.setMessage(event.getMessage()[1:])
                 event.setFormat(ChatColor.translateAlternateColorCodes("&",self.config["globalPrefix"]) + event.getFormat())
Example #4
0
	def getPlayerByShortName(self, name):
		players = self.plugin.getServer().getOnlinePlayers()

		lowername = name.lower()
		found = None
		delta = 9001
		for player in players:
			if ChatColor.stripColor(player.getName()).lower().startswith(lowername):
				curdelta = len(player.getName()) - len(lowername)
				if curdelta < delta:
					found = player
					delta = curdelta
				if curdelta == 0:
					break

		return found
Example #5
0
    def cmdSetItemName(self, sender, argv):
        if not self.check_setitem(sender, argv):
            return

        player = sender
        if len(argv) < 1:
            player.sendMessage(
                "%sPlease, enter new name! Usage: setitemname <newname>" %
                ChatColor.GOLD)
            return

        argv = [x for x in argv]
        itemName = ChatColor.translateAlternateColorCodes('&', ' '.join(argv))

        itemStack = player.getItemInHand()
        itemMeta = itemStack.getItemMeta()
        itemMeta.setDisplayName(unicode(ChatColor.RESET) + itemName)
        itemStack.setItemMeta(itemMeta)
        player.sendMessage("%sComplete!" % (ChatColor.GREEN))
Example #6
0
    def cmdSetItemLore(self, sender, argv):
        if not self.check_setitem(sender, argv):
            return

        player = sender
        if len(argv) < 1:
            player.sendMessage(
                "%sPlease, enter new lore! Usage: setitemlore <lore>" %
                ChatColor.GOLD)
            return

        argv = [x for x in argv]
        itemLore = ChatColor.translateAlternateColorCodes(
            '&', ' '.join(argv)).split("\\n")

        itemStack = player.getItemInHand()
        itemMeta = itemStack.getItemMeta()
        lore = [(unicode(ChatColor.RESET) + x) for x in itemLore]
        itemMeta.setLore(lore)
        itemStack.setItemMeta(itemMeta)
        player.sendMessage("%sComplete!" % (ChatColor.GREEN))
Example #7
0
def task():
    for player in Bukkit.getOnlinePlayers():
        player.sendMessage(ChatColor.translateAlternateColorCodes(
            '&', message))
Example #8
0
 def onPlayerChat(self, event):
     pl = event.getPlayer()
     if pl.isOp():
         return
     self.config = self.plugin.getPluginCfg()
     allplayers = list(event.getRecipients())
     if self.config["localChat"] == True:
         if event.getMessage()[0] == "*":
             econ = None
             econProvider = server.getServicesManager().getRegistration(
                 Economy)
             if econProvider:
                 econ = econProvider.getProvider()
             else:
                 pl.sendMessage(
                     ChatColor.translateAlternateColorCodes(
                         "&", self.config["noEcoMsg"]))
             if econ:
                 if econ.getBalance(pl.getName()) >= self.config["msgCost"]:
                     econ.withdrawPlayer(pl.getName(),
                                         self.config["msgCost"])
                     event.setMessage(event.getMessage()[1:])
                     event.setFormat(
                         ChatColor.translateAlternateColorCodes(
                             "&", self.config["globalPrefix"]) +
                         event.getFormat())
                     return
                 else:
                     pl.sendMessage(
                         ChatColor.translateAlternateColorCodes(
                             "&", self.config["noMoneyMsg"] %
                             str(self.config["msgCost"])))
                     event.setCancelled(True)
                     return
         if event.getMessage()[0] <> "!":
             for reciver in allplayers:
                 if self.checkRadius(pl.getLocation(), reciver.getLocation(
                 )) == False and not reciver.isOp(
                 ) and not reciver.hasPermission("rcchat.seelocalchat"):
                     event.getRecipients().remove(reciver)
             event.setFormat(
                 ChatColor.translateAlternateColorCodes(
                     "&", self.config["localPrefix"]) + event.getFormat())
             return
         else:
             if pl.hasPermission("rcchat.nomsgdelay"):
                 event.setMessage(event.getMessage()[1:])
                 event.setFormat(
                     ChatColor.translateAlternateColorCodes(
                         "&", self.config["globalPrefix"]) +
                     event.getFormat())
                 return
             if pl.getName() in self.msgTime:
                 delay = self.config["msgDelay"]
                 for group in self.config["permissionsGroups"]:
                     if pl.hasPermission("rcchat." + group):
                         delay = self.config["permissionsGroups"][group]
                 if time() - self.msgTime[pl.getName()] < delay:
                     pl.sendMessage(
                         ChatColor.translateAlternateColorCodes(
                             "&", self.config["noEnoughTime"] % unicode(
                                 int(delay -
                                     (time() - self.msgTime[pl.getName()])))
                         ))
                     event.setCancelled(True)
                     return
                 else:
                     self.msgTime[pl.getName()] = time()
                     event.setMessage(event.getMessage()[1:])
                     event.setFormat(
                         ChatColor.translateAlternateColorCodes(
                             "&", self.config["globalPrefix"]) +
                         event.getFormat())
                     return
             else:
                 self.msgTime[pl.getName()] = time()
                 event.setMessage(event.getMessage()[1:])
                 event.setFormat(
                     ChatColor.translateAlternateColorCodes(
                         "&", self.config["globalPrefix"]) +
                     event.getFormat())