Permalink
Browse files

update Permissions API calls to non-deprecated successors

  • Loading branch information...
1 parent ed6f0bb commit 4689ae8d778fcc44458cb1a3872bc88838096af2 @Animosity committed Mar 10, 2011
View
22 com/ensifera/animosity/craftirc/CraftIRC.java
@@ -29,7 +29,6 @@
import org.bukkit.event.Event.Priority;
import org.bukkit.event.Event;
import org.bukkit.plugin.Plugin;
-import org.bukkit.plugin.PluginDescriptionFile;
// import org.bukkit.plugin.PluginLoader;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.util.config.Configuration;
@@ -76,6 +75,7 @@
public void onEnable() {
try {
+
PluginDescriptionFile desc = this.getDescription();
VERSION = desc.getVersion();
server = this.getServer();
@@ -85,7 +85,7 @@ public void onEnable() {
console = (MinecraftServer) cfield.get((CraftServer)getServer());
//Load node lists. Bukkit does it now, hurray!
- if (null == getConfiguration().getKeys("settings")) {
+ if (null == getConfiguration()) {
CraftIRC.log.info(String.format(CraftIRC.NAME + " config.yml could not be found in plugins/CraftIRC/ -- disabling!"));
getServer().getPluginManager().disablePlugin(((Plugin) (this)));
return;
@@ -160,7 +160,7 @@ public void onEnable() {
} else
hold.put(HoldType.BANS, false);
- // Not yet supported: Register custom "admins!" command alias
+ // TODO: Not yet supported: Register custom "admins!" command alias
// this.getCommand("admins!").setAliases(Arrays.asList(this.cAdminsCmd()));
setDebug(cDebug());
@@ -404,12 +404,16 @@ protected void sendMessage(RelayedMessage msg, String tag, String event) {
}
}
- protected void sendRawToBot(int bot, String message) {
- if (this.isDebug()) CraftIRC.log.info(String.format(CraftIRC.NAME + " sendRawToBot(bot=" + bot + ", message=" + message));
+ protected void sendRawToBot(String rawMessage, int bot) {
+ if (this.isDebug()) CraftIRC.log.info(String.format(CraftIRC.NAME + " sendRawToBot(bot=" + bot + ", message=" + rawMessage));
Minebot target = instances.get(bot);
- target.sendRawLineViaQueue(message);
+ target.sendRawLineViaQueue(rawMessage);
}
+ protected void sendMsgToTargetViaBot(String message, String target, int bot) {
+ Minebot target = instances.get(bot);
+ target.sendMessage(target, message);
+ }
/** TODO: MAKE THIS
* @param rawMessage
@@ -770,13 +774,13 @@ protected String colorizeName(String name) {
return name;
}
- protected String getPermPrefix(String pl) {
+ protected String getPermPrefix(String world, String pl) {
if (perms == null)
return "";
- String group = perms.getGroup(pl);
+ String group = perms.getGroup(world, pl);
if (group == null)
return "";
- String result = perms.getGroupPrefix(group);
+ String result = perms.getGroupPrefix(world, group);
if (result == null)
return "";
return colorizeName(result.replaceAll("&([0-9a-f])", "§$1"));
View
8 com/ensifera/animosity/craftirc/RelayedMessage.java
@@ -122,11 +122,11 @@ public String asString(EndPoint realTarget) throws RelayedMessageException {
result = result.replace("%world%", world);
if (source == EndPoint.GAME && this.plugin.hasPerms() && this.plugin.cChanNameColors(trgBot, trgChannel)) {
//if (this.plugin.isDebug()) CraftIRC.log.info(String.format(CraftIRC.NAME + " RelayedMessage: hasPerms="+String.valueOf(this.plugin.hasPerms())+" cChanNameColors()="+String.valueOf(this.plugin.cChanNameColors(trgBot, trgChannel)))+", apply pre/suffixes ");
- result = result.replace("%prefix%", this.plugin.getPermPrefix(sender));
- result = result.replace("%suffix%", this.plugin.getPermSuffix(sender));
+ result = result.replace("%prefix%", this.plugin.getPermPrefix(world, sender));
+ result = result.replace("%suffix%", this.plugin.getPermSuffix(world, sender));
if (!moderator.equals("")) {
- result = result.replace("%modPrefix%", this.plugin.getPermPrefix(moderator));
- result = result.replace("%modSuffix%", this.plugin.getPermSuffix(moderator));
+ result = result.replace("%modPrefix%", this.plugin.getPermPrefix(world, moderator));
+ result = result.replace("%modSuffix%", this.plugin.getPermSuffix(world, moderator));
} else {
result = result.replace("%modPrefix%", "");
result = result.replace("%modSuffix%", "");
View
4 com/ensifera/animosity/craftirc/example/CraftIRCPluginExampleListener.java
@@ -31,13 +31,13 @@ public void onCustomEvent(Event event) {
switch (ircEvent.eventMode) {
case COMMAND:
if (ircEvent.msgData.message.startsWith("example")) {
- this.plugin.sendMessageToTag("This is an example custom CraftIRC command.",
+ this.plugin.sendMessageToTag("This is an example custom CraftIRC command. The pen is %red%rrrrrrr%blue%oyal blue!",
ircEvent.msgData.srcChannelTag);
ircEvent.setHandled(true);
}
case AUTHED_COMMAND:
if (ircEvent.msgData.message.startsWith("authexample")) {
- this.plugin.sendMessageToTag("This is an example custom authenticated CraftIRC command.",
+ this.plugin.sendMessageToTag("This is an example custom %u%authenticated%u% CraftIRC command.",
ircEvent.msgData.srcChannelTag);
ircEvent.setHandled(true);
}

0 comments on commit 4689ae8

Please sign in to comment.