Format; clean up magic plugin.

This commit is contained in:
Major-
2013-11-06 23:43:17 +00:00
parent 19e609cd6d
commit 003aa082a2
8 changed files with 53 additions and 59 deletions
@@ -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<String> authors = mgr.getAuthors();
List<String> text = new ArrayList<String>(14 + authors.size());
List<String> text = new ArrayList<String>(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("");
+1 -1
View File
@@ -200,4 +200,4 @@ public final class Animation {
return id;
}
}
}
@@ -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());
}
}
}
@@ -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
*/
+2 -3
View File
@@ -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() {
}
}
}
+37 -41
View File
@@ -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() {
}
}
}
+2 -5
View File
@@ -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<Integer, Integer> itemToNote = new HashMap<Integer, Integer>();
for (int id = 0; id < defs.length; id++) {
@@ -68,4 +65,4 @@ public final class NoteUpdater {
}
}
}
}