From 003aa082a25794f186485672b4e68d87f4d49992 Mon Sep 17 00:00:00 2001 From: Major- Date: Wed, 6 Nov 2013 23:43:17 +0000 Subject: [PATCH] Format; clean up magic plugin. --- data/plugins/skill-magic/alchemy.rb | 2 +- .../game/command/CreditsCommandListener.java | 8 +- src/org/apollo/game/model/Animation.java | 2 +- .../apollo/net/release/r317/Release317.java | 8 +- .../apollo/net/release/r377/Release377.java | 2 +- src/org/apollo/tools/EquipmentConstants.java | 5 +- src/org/apollo/tools/EquipmentUpdater.java | 78 +++++++++---------- src/org/apollo/tools/NoteUpdater.java | 7 +- 8 files changed, 53 insertions(+), 59 deletions(-) diff --git a/data/plugins/skill-magic/alchemy.rb b/data/plugins/skill-magic/alchemy.rb index abb71208..ff9dc6a3 100644 --- a/data/plugins/skill-magic/alchemy.rb +++ b/data/plugins/skill-magic/alchemy.rb @@ -35,7 +35,7 @@ class AlchemyAction < ItemSpellAction end def illegal_item? - return ILLEGAL_ALC_ITEMS.include? @item.id + return ILLEGAL_ALC_ITEMS.include? @item.id end def execute_action diff --git a/src/org/apollo/game/command/CreditsCommandListener.java b/src/org/apollo/game/command/CreditsCommandListener.java index 95a9d643..8cc61ff8 100644 --- a/src/org/apollo/game/command/CreditsCommandListener.java +++ b/src/org/apollo/game/command/CreditsCommandListener.java @@ -14,7 +14,7 @@ import org.apollo.util.plugin.PluginManager; * @author Graham */ public final class CreditsCommandListener extends CommandListener { - + /* * If you are considering removing this command, please bear in mind that Apollo took several people thousands of * hours to create. We released it to the world for free and it isn't much to ask to leave this command in. It isn't @@ -29,7 +29,7 @@ public final class CreditsCommandListener extends CommandListener { PluginManager mgr = World.getWorld().getPluginManager(); final Set authors = mgr.getAuthors(); - List text = new ArrayList(14 + authors.size()); + List text = new ArrayList(12 + authors.size()); text.add("@dre@Apollo"); text.add("@dre@Introduction"); text.add(""); @@ -38,9 +38,7 @@ public final class CreditsCommandListener extends CommandListener { text.add("information about Apollo, visit the website at:"); text.add("@dbl@https://github.com/apollo-rsps/apollo"); text.add(""); - text.add("Apollo is released under the terms of the ISC"); - text.add("license, details can be found in the root folder of the"); - text.add("Apollo distribution."); + text.add("Apollo is released under the terms of the ISC license."); text.add(""); text.add("@dre@Credits"); text.add(""); diff --git a/src/org/apollo/game/model/Animation.java b/src/org/apollo/game/model/Animation.java index 70221014..a648d93b 100644 --- a/src/org/apollo/game/model/Animation.java +++ b/src/org/apollo/game/model/Animation.java @@ -200,4 +200,4 @@ public final class Animation { return id; } -} +} \ No newline at end of file diff --git a/src/org/apollo/net/release/r317/Release317.java b/src/org/apollo/net/release/r317/Release317.java index 03b135ad..71e764e3 100644 --- a/src/org/apollo/net/release/r317/Release317.java +++ b/src/org/apollo/net/release/r317/Release317.java @@ -26,7 +26,7 @@ import org.apollo.net.meta.PacketMetaDataGroup; import org.apollo.net.release.Release; /** - * An implementation of {@link Release} for the 317 protocol. + * A {@link Release} implementation for the 317 protocol. * * @author Graham */ @@ -112,8 +112,12 @@ public final class Release317 extends Release { register(3, new FocusUpdateEventDecoder()); register(241, new MouseClickEventDecoder()); register(86, new ArrowKeyEventDecoder()); + SpamPacketEventDecoder spamEventDecoder = new SpamPacketEventDecoder(); register(77, spamEventDecoder); + register(165, spamEventDecoder); + register(189, spamEventDecoder); + register(226, spamEventDecoder); register(72, new FirstNpcActionEventDecoder()); register(155, new SecondNpcActionEventDecoder()); @@ -144,4 +148,4 @@ public final class Release317 extends Release { register(DisplayTabInterfaceEvent.class, new DisplayTabInterfaceEventEncoder()); } -} +} \ No newline at end of file diff --git a/src/org/apollo/net/release/r377/Release377.java b/src/org/apollo/net/release/r377/Release377.java index 6c062066..7869c4f4 100644 --- a/src/org/apollo/net/release/r377/Release377.java +++ b/src/org/apollo/net/release/r377/Release377.java @@ -26,7 +26,7 @@ import org.apollo.net.meta.PacketMetaDataGroup; import org.apollo.net.release.Release; /** - * An implementation of {@link Release} for the 377 protocol. + * A {@link Release} implementation for the 377 protocol. * * @author Graham */ diff --git a/src/org/apollo/tools/EquipmentConstants.java b/src/org/apollo/tools/EquipmentConstants.java index b021b4a7..69c0d7a9 100644 --- a/src/org/apollo/tools/EquipmentConstants.java +++ b/src/org/apollo/tools/EquipmentConstants.java @@ -93,10 +93,9 @@ public final class EquipmentConstants { "Tzhaar-ket", "staff", "Staff", "godsword", "c'bow", "Crystal bow", "Dark bow", "Magic butterfly net" }; /** - * Default private construcotr to prevent instantiation. + * Default private constructor to prevent instantiation. */ private EquipmentConstants() { - } -} +} \ No newline at end of file diff --git a/src/org/apollo/tools/EquipmentUpdater.java b/src/org/apollo/tools/EquipmentUpdater.java index 21d2624a..013c6791 100644 --- a/src/org/apollo/tools/EquipmentUpdater.java +++ b/src/org/apollo/tools/EquipmentUpdater.java @@ -20,11 +20,11 @@ public final class EquipmentUpdater { /** * Gets the attack requirement. * - * @param def The item. + * @param definition The item definition. * @return The required level. */ - private static int getAttackRequirement(ItemDefinition def) { - String name = def.getName(); + private static int getAttackRequirement(ItemDefinition definition) { + String name = definition.getName(); if (name == null) { name = "null"; } @@ -229,12 +229,12 @@ public final class EquipmentUpdater { /** * Gets the defence requirement. * - * @param def The item. + * @param definition The item definition. * @return The required level. */ - private static int getDefenceRequirement(ItemDefinition def) { - int id = def.getId(); - String name = def.getName(); + private static int getDefenceRequirement(ItemDefinition definition) { + int id = definition.getId(); + String name = definition.getName(); if (name == null) { name = "null"; } @@ -679,11 +679,11 @@ public final class EquipmentUpdater { /** * Gets the magic requirement. * - * @param def The item. + * @param definition The item definition. * @return The required level. */ - private static int getMagicRequirement(ItemDefinition def) { - String name = def.getName(); + private static int getMagicRequirement(ItemDefinition definition) { + String name = definition.getName(); if (name == null) { name = "null"; } @@ -786,12 +786,12 @@ public final class EquipmentUpdater { /** * Gets the ranged requirement. * - * @param def The item. + * @param definition The item. * @return The required level. */ - private static int getRangedRequirement(ItemDefinition def) { - int id = def.getId(); - String name = def.getName(); + private static int getRangedRequirement(ItemDefinition definition) { + int id = definition.getId(); + String name = definition.getName(); if (name == null) { name = "null"; } @@ -981,11 +981,11 @@ public final class EquipmentUpdater { /** * Gets the weapon type. * - * @param def The item. + * @param definition The item. * @return The weapon type, or {@code -1} if it is not a weapon. */ - private static int getWeaponType(ItemDefinition def) { - String name = def.getName(); + private static int getWeaponType(ItemDefinition definition) { + String name = definition.getName(); if (name == null) { name = "null"; } @@ -1050,11 +1050,11 @@ public final class EquipmentUpdater { /** * Checks if the item is a full body item. * - * @param def The item. + * @param definition The item. * @return {@code true} if so, {@code false} otherwise. */ - private static boolean isFullBody(ItemDefinition def) { - String name = def.getName(); + private static boolean isFullBody(ItemDefinition definition) { + String name = definition.getName(); if (name == null) { name = "null"; } @@ -1069,11 +1069,11 @@ public final class EquipmentUpdater { /** * Checks if the item is a full hat item. * - * @param def The item. + * @param definition The item. * @return {@code true} if so, {@code false} otherwise. */ - private static boolean isFullHat(ItemDefinition def) { - String name = def.getName(); + private static boolean isFullHat(ItemDefinition definition) { + String name = definition.getName(); if (name == null) { name = "null"; } @@ -1088,11 +1088,11 @@ public final class EquipmentUpdater { /** * Checks if the item is a full mask item. * - * @param def The item. + * @param definition The item. * @return {@code true} if so, {@code false} otherwise. */ - private static boolean isFullMask(ItemDefinition def) { - String name = def.getName(); + private static boolean isFullMask(ItemDefinition definition) { + String name = definition.getName(); if (name == null) { name = "null"; } @@ -1107,12 +1107,12 @@ public final class EquipmentUpdater { /** * Checks if the item is two handed. * - * @param def The item. + * @param definition The item. * @return {@code true} if so, {@code false} otherwise. */ - private static boolean isTwoHanded(ItemDefinition def) { - int id = def.getId(); - String name = def.getName(); + private static boolean isTwoHanded(ItemDefinition definition) { + int id = definition.getId(); + String name = definition.getName(); if (name == null) { name = "null"; } @@ -1154,9 +1154,8 @@ public final class EquipmentUpdater { return true; } else if (name.equals("Saradomin sword")) { return true; - } else { - return false; } + return false; } /** @@ -1167,9 +1166,7 @@ public final class EquipmentUpdater { */ public static void main(String[] args) throws Exception { if (args.length != 1) { - System.err.println("Usage:"); - System.err.println(" java -cp ... org.apollo.tools.EquipmentUpdater [release]"); - return; + throw new IllegalArgumentException("Usage:\njava -cp ... org.apollo.tools.EquipmentUpdater [release]"); } String release = args[0]; @@ -1179,11 +1176,11 @@ public final class EquipmentUpdater { IndexedFileSystem fs = new IndexedFileSystem(new File("data/fs/" + release), true); try { ItemDefinitionDecoder decoder = new ItemDefinitionDecoder(fs); - ItemDefinition[] defs = decoder.decode(); - ItemDefinition.init(defs); + ItemDefinition[] definitions = decoder.decode(); + ItemDefinition.init(definitions); - os.writeShort(defs.length); - for (int id = 0; id < defs.length; id++) { + os.writeShort(definitions.length); + for (int id = 0; id < definitions.length; id++) { ItemDefinition def = ItemDefinition.lookup(id); int type = getWeaponType(def); os.writeByte(type); @@ -1211,7 +1208,6 @@ public final class EquipmentUpdater { * Default private constructor to prevent instantiation. */ private EquipmentUpdater() { - } -} +} \ No newline at end of file diff --git a/src/org/apollo/tools/NoteUpdater.java b/src/org/apollo/tools/NoteUpdater.java index 8ec83441..95cd4468 100644 --- a/src/org/apollo/tools/NoteUpdater.java +++ b/src/org/apollo/tools/NoteUpdater.java @@ -26,9 +26,7 @@ public final class NoteUpdater { */ public static void main(String[] args) throws Exception { if (args.length != 1) { - System.err.println("Usage:"); - System.err.println(" java -cp ... org.apollo.tools.NoteUpdater [release]"); - return; + throw new IllegalArgumentException("Usage:\njava -cp ... org.apollo.tools.NoteUpdater [release]"); } String release = args[0]; @@ -42,7 +40,6 @@ public final class NoteUpdater { ItemDefinition.init(defs); os.writeShort(defs.length); - Map itemToNote = new HashMap(); for (int id = 0; id < defs.length; id++) { @@ -68,4 +65,4 @@ public final class NoteUpdater { } } -} +} \ No newline at end of file