コード例 #1
0
 public void unTeach(Player player, String[] args) {
   if (args.length != 2) {
     plugin.PM.warn(player, "Correct Syntax: /unteach <player> <spell>");
   } else {
     if (!plugin.spellManager.isSpell(args[1])) {
       plugin.PM.warn(player, "That spell was not recognized");
       return;
     }
     Player teachTo = Bukkit.getPlayer(args[0]);
     Spell spell = plugin.spellManager.getSpell(args[1]);
     if (teachTo != null) {
       if (spell.playerKnows(teachTo)) {
         spell.unTeach(teachTo);
         plugin.PM.tell(player, teachTo.getName() + " has forgotten " + spell.getName() + ".");
       } else {
         plugin.PM.warn(player, teachTo.getName() + " doesn't know that spell.");
       }
     } else {
       plugin.PM.warn(player, "That player was not found.");
     }
   }
 }
コード例 #2
0
 public void unTeachConsole(String[] args) {
   if (args.length != 2) {
     plugin.PM.log("Correct Syntax: /unteach <player> <spell>", Level.INFO);
   } else {
     if (!plugin.spellManager.isSpell(args[1])) {
       plugin.PM.log("That spell was not recognized", Level.WARNING);
       return;
     }
     Player teachTo = Bukkit.getPlayer(args[0]);
     Spell spell = plugin.spellManager.getSpell(args[1]);
     if (teachTo != null) {
       if (spell.playerKnows(teachTo)) {
         spell.unTeach(teachTo);
         plugin.PM.log(teachTo.getName() + " has forgotten " + spell.getName(), Level.INFO);
       } else {
         plugin.PM.log(teachTo.getName() + " doesn't know " + spell.getName() + ".", Level.INFO);
       }
     } else {
       plugin.PM.log("The player was not found.", Level.INFO);
       return;
     }
   }
 }