mirror of
https://github.com/2006-Scape/apollo.git
synced 2026-07-07 00:38:46 +00:00
Strict whitespace format, make private fields final that can be immutable
This commit is contained in:
@@ -177,16 +177,15 @@ def on_message(args, proc)
|
|||||||
numbers = [ 'first', 'second', 'third', 'fourth', 'fifth' ]
|
numbers = [ 'first', 'second', 'third', 'fourth', 'fifth' ]
|
||||||
message = args[0]; option = 0
|
message = args[0]; option = 0
|
||||||
|
|
||||||
# TODO
|
numbers.each_index do |index|
|
||||||
# numbers.each_index do |index|
|
number = numbers[index]
|
||||||
# number = numbers[index]
|
|
||||||
#
|
if message.to_s.start_with?(number)
|
||||||
# if message.to_s.start_with?(number)
|
option = index + 1
|
||||||
# option = index + 1
|
message = message[number.length + 1, message.length].to_sym
|
||||||
# message = message[number.length + 1, message.length].to_sym
|
break
|
||||||
# break
|
end
|
||||||
# end
|
end
|
||||||
# end
|
|
||||||
|
|
||||||
|
|
||||||
class_name = message.to_s.camelize.concat('Message')
|
class_name = message.to_s.camelize.concat('Message')
|
||||||
|
|||||||
@@ -68,12 +68,12 @@ public final class IsaacRandom {
|
|||||||
/**
|
/**
|
||||||
* The internal state.
|
* The internal state.
|
||||||
*/
|
*/
|
||||||
private int[] mem;
|
private final int[] mem;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The results given to the user.
|
* The results given to the user.
|
||||||
*/
|
*/
|
||||||
private int[] rsl;
|
private final int[] rsl;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates the random number generator without an initial seed.
|
* Creates the random number generator without an initial seed.
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ public final class ServiceManager {
|
|||||||
/**
|
/**
|
||||||
* The service map.
|
* The service map.
|
||||||
*/
|
*/
|
||||||
private Map<Class<? extends Service>, Service> services = new HashMap<>();
|
private final Map<Class<? extends Service>, Service> services = new HashMap<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates and initializes the {@link ServiceManager}.
|
* Creates and initializes the {@link ServiceManager}.
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ public final class IndexedFileSystem implements Closeable {
|
|||||||
/**
|
/**
|
||||||
* The index files.
|
* The index files.
|
||||||
*/
|
*/
|
||||||
private RandomAccessFile[] indices = new RandomAccessFile[256];
|
private final RandomAccessFile[] indices = new RandomAccessFile[256];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read only flag.
|
* Read only flag.
|
||||||
|
|||||||
@@ -133,7 +133,7 @@ public final class GameObjectDecoder {
|
|||||||
if (block) {
|
if (block) {
|
||||||
for (int dx = 0; dx < definition.getWidth(); dx++) {
|
for (int dx = 0; dx < definition.getWidth(); dx++) {
|
||||||
for (int dy = 0; dy < definition.getLength(); dy++) {
|
for (int dy = 0; dy < definition.getLength(); dy++) {
|
||||||
int localX = (x % Region.SIZE) + dx, localY = (y % Region.SIZE) + dy;
|
int localX = x % Region.SIZE + dx, localY = y % Region.SIZE + dy;
|
||||||
|
|
||||||
if (localX > 7 || localY > 7) {
|
if (localX > 7 || localY > 7) {
|
||||||
int nextLocalX = localX > 7 ? x + localX - 7 : x + localX;
|
int nextLocalX = localX > 7 ? x + localX - 7 : x + localX;
|
||||||
@@ -141,11 +141,13 @@ public final class GameObjectDecoder {
|
|||||||
Position nextPosition = new Position(nextLocalX, nextLocalY);
|
Position nextPosition = new Position(nextLocalX, nextLocalY);
|
||||||
Region next = regions.fromPosition(nextPosition);
|
Region next = regions.fromPosition(nextPosition);
|
||||||
|
|
||||||
int nextX = (nextPosition.getX() % Region.SIZE) + dx, nextY = (nextPosition.getY() % Region.SIZE) + dy;
|
int nextX = nextPosition.getX() % Region.SIZE + dx, nextY = nextPosition.getY() % Region.SIZE + dy;
|
||||||
if (nextX > 7)
|
if (nextX > 7) {
|
||||||
nextX -= 7;
|
nextX -= 7;
|
||||||
if (nextY > 7)
|
}
|
||||||
|
if (nextY > 7) {
|
||||||
nextY -= 7;
|
nextY -= 7;
|
||||||
|
}
|
||||||
|
|
||||||
next.getMatrix(height).block(nextX, nextY);
|
next.getMatrix(height).block(nextX, nextY);
|
||||||
continue;
|
continue;
|
||||||
@@ -181,7 +183,7 @@ public final class GameObjectDecoder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (block) {
|
if (block) {
|
||||||
int localX = (x % Region.SIZE), localY = (y % Region.SIZE);
|
int localX = x % Region.SIZE, localY = y % Region.SIZE;
|
||||||
current.block(localX, localY);
|
current.block(localX, localY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -209,7 +211,7 @@ public final class GameObjectDecoder {
|
|||||||
|
|
||||||
int localY = packed & 0x3F;
|
int localY = packed & 0x3F;
|
||||||
int localX = packed >> 6 & 0x3F;
|
int localX = packed >> 6 & 0x3F;
|
||||||
int height = (packed >> 12) & 0x3;
|
int height = packed >> 12 & 0x3;
|
||||||
|
|
||||||
int attributes = buffer.get() & 0xFF;
|
int attributes = buffer.get() & 0xFF;
|
||||||
int type = attributes >> 2;
|
int type = attributes >> 2;
|
||||||
|
|||||||
@@ -121,17 +121,13 @@ public final class NpcDefinitionDecoder {
|
|||||||
} else if (opcode == 102 || opcode == 103) {
|
} else if (opcode == 102 || opcode == 103) {
|
||||||
buffer.getShort();
|
buffer.getShort();
|
||||||
} else if (opcode == 106) {
|
} else if (opcode == 106) {
|
||||||
@SuppressWarnings("unused")
|
wrap(buffer.getShort());
|
||||||
int morphVariableBitsIndex = wrap(buffer.getShort());
|
wrap(buffer.getShort());
|
||||||
@SuppressWarnings("unused")
|
|
||||||
int morphismCount = wrap(buffer.getShort());
|
|
||||||
|
|
||||||
int count = buffer.get() & 0xFF;
|
int count = buffer.get() & 0xFF;
|
||||||
int[] morphisms = new int[count + 1];
|
int[] morphisms = new int[count + 1];
|
||||||
Arrays.setAll(morphisms, index -> wrap(buffer.getShort()));
|
Arrays.setAll(morphisms, index -> wrap(buffer.getShort()));
|
||||||
} else if (opcode == 107) {
|
} else if (opcode == 107) {
|
||||||
@SuppressWarnings("unused")
|
|
||||||
boolean clickable = false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ public final class MessageHandlerChainSet {
|
|||||||
public <M extends Message> boolean notify(Player player, M message) {
|
public <M extends Message> boolean notify(Player player, M message) {
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
MessageHandlerChain<M> chain = (MessageHandlerChain<M>) chains.get(message.getClass());
|
MessageHandlerChain<M> chain = (MessageHandlerChain<M>) chains.get(message.getClass());
|
||||||
return (chain == null) || chain.notify(player, message);
|
return chain == null || chain.notify(player, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -98,8 +98,7 @@ public final class EquipItemHandler extends MessageHandler<ItemOptionMessage> {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (definition.getSlot() == EquipmentConstants.SHIELD && weapon != null
|
if (definition.getSlot() == EquipmentConstants.SHIELD && weapon != null && EquipmentDefinition.lookup(weapon.getId()).isTwoHanded()) {
|
||||||
&& EquipmentDefinition.lookup(weapon.getId()).isTwoHanded()) {
|
|
||||||
equipment.set(EquipmentConstants.SHIELD, inventory.reset(inventorySlot));
|
equipment.set(EquipmentConstants.SHIELD, inventory.reset(inventorySlot));
|
||||||
inventory.add(equipment.reset(EquipmentConstants.WEAPON));
|
inventory.add(equipment.reset(EquipmentConstants.WEAPON));
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -27,8 +27,7 @@ public final class ItemOnObjectVerificationHandler extends MessageHandler<ItemOn
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handle(Player player, ItemOnObjectMessage message) {
|
public void handle(Player player, ItemOnObjectMessage message) {
|
||||||
if (message.getInterfaceId() != SynchronizationInventoryListener.INVENTORY_ID
|
if (message.getInterfaceId() != SynchronizationInventoryListener.INVENTORY_ID && message.getInterfaceId() != BankConstants.SIDEBAR_INVENTORY_ID) {
|
||||||
&& message.getInterfaceId() != BankConstants.SIDEBAR_INVENTORY_ID) {
|
|
||||||
message.terminate();
|
message.terminate();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ public final class ForwardPrivateChatMessage extends Message {
|
|||||||
*/
|
*/
|
||||||
public ForwardPrivateChatMessage(String username, PrivilegeLevel level, byte[] message) {
|
public ForwardPrivateChatMessage(String username, PrivilegeLevel level, byte[] message) {
|
||||||
this.username = username;
|
this.username = username;
|
||||||
this.privilege = level;
|
privilege = level;
|
||||||
this.message = message;
|
this.message = message;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
package org.apollo.game.message.impl;
|
package org.apollo.game.message.impl;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import org.apollo.game.message.Message;
|
import org.apollo.game.message.Message;
|
||||||
import org.apollo.game.model.Position;
|
import org.apollo.game.model.Position;
|
||||||
import org.apollo.game.model.area.RegionCoordinates;
|
import org.apollo.game.model.area.RegionCoordinates;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A {@link Message} sent to the client that contains multiple
|
* A {@link Message} sent to the client that contains multiple
|
||||||
*
|
*
|
||||||
@@ -37,7 +37,7 @@ public final class GroupedRegionUpdateMessage extends Message {
|
|||||||
*/
|
*/
|
||||||
public GroupedRegionUpdateMessage(Position lastKnownRegion, RegionCoordinates coordinates, List<RegionUpdateMessage> messages) {
|
public GroupedRegionUpdateMessage(Position lastKnownRegion, RegionCoordinates coordinates, List<RegionUpdateMessage> messages) {
|
||||||
this.lastKnownRegion = lastKnownRegion;
|
this.lastKnownRegion = lastKnownRegion;
|
||||||
this.region = new Position(coordinates.getAbsoluteX(), coordinates.getAbsoluteY());
|
region = new Position(coordinates.getAbsoluteX(), coordinates.getAbsoluteY());
|
||||||
this.messages = messages;
|
this.messages = messages;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ public final class ItemOnObjectMessage extends InventoryItemMessage {
|
|||||||
public ItemOnObjectMessage(int interfaceId, int itemId, int itemSlot, int objectId, int x, int y) {
|
public ItemOnObjectMessage(int interfaceId, int itemId, int itemSlot, int objectId, int x, int y) {
|
||||||
super(0, interfaceId, itemId, itemSlot);
|
super(0, interfaceId, itemId, itemSlot);
|
||||||
this.objectId = objectId;
|
this.objectId = objectId;
|
||||||
this.position = new Position(x, y);
|
position = new Position(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -33,8 +33,8 @@ public final class RemoveObjectMessage extends RegionUpdateMessage {
|
|||||||
*/
|
*/
|
||||||
public RemoveObjectMessage(GameObject object, int positionOffset) {
|
public RemoveObjectMessage(GameObject object, int positionOffset) {
|
||||||
this.positionOffset = positionOffset;
|
this.positionOffset = positionOffset;
|
||||||
this.type = object.getType();
|
type = object.getType();
|
||||||
this.orientation = object.getOrientation();
|
orientation = object.getOrientation();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -37,10 +37,10 @@ public final class SendObjectMessage extends RegionUpdateMessage {
|
|||||||
* @param positionOffset The offset of the object's position from the region's central position.
|
* @param positionOffset The offset of the object's position from the region's central position.
|
||||||
*/
|
*/
|
||||||
public SendObjectMessage(GameObject object, int positionOffset) {
|
public SendObjectMessage(GameObject object, int positionOffset) {
|
||||||
this.id = object.getId();
|
id = object.getId();
|
||||||
this.positionOffset = positionOffset;
|
this.positionOffset = positionOffset;
|
||||||
this.type = object.getType();
|
type = object.getType();
|
||||||
this.orientation = object.getOrientation();
|
orientation = object.getOrientation();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ public final class SetPlayerActionMessage extends Message {
|
|||||||
public SetPlayerActionMessage(String text, int slot, boolean primaryInteraction) {
|
public SetPlayerActionMessage(String text, int slot, boolean primaryInteraction) {
|
||||||
this.text = text;
|
this.text = text;
|
||||||
this.slot = slot;
|
this.slot = slot;
|
||||||
this.primaryAction = primaryInteraction;
|
primaryAction = primaryInteraction;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ public final class WalkMessage extends Message {
|
|||||||
/**
|
/**
|
||||||
* The running flag.
|
* The running flag.
|
||||||
*/
|
*/
|
||||||
private boolean run;
|
private final boolean run;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The steps.
|
* The steps.
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ public final class Item {
|
|||||||
Preconditions.checkArgument(amount >= 0, "Amount cannot be negative.");
|
Preconditions.checkArgument(amount >= 0, "Amount cannot be negative.");
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.amount = amount;
|
this.amount = amount;
|
||||||
this.definition = ItemDefinition.lookup(id);
|
definition = ItemDefinition.lookup(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -192,7 +192,7 @@ public final class Position {
|
|||||||
* @return The y coordinate.
|
* @return The y coordinate.
|
||||||
*/
|
*/
|
||||||
public int getY() {
|
public int getY() {
|
||||||
return (packed >> 15) & 0x7FFF;
|
return packed >> 15 & 0x7FFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ public final class World {
|
|||||||
/**
|
/**
|
||||||
* The command dispatcher.
|
* The command dispatcher.
|
||||||
*/
|
*/
|
||||||
private CommandDispatcher commandDispatcher = new CommandDispatcher();
|
private final CommandDispatcher commandDispatcher = new CommandDispatcher();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The EventListenerChainSet for this World.
|
* The EventListenerChainSet for this World.
|
||||||
@@ -208,7 +208,7 @@ public final class World {
|
|||||||
* @throws Exception If any definitions could not be loaded or there was a failure when loading plugins.
|
* @throws Exception If any definitions could not be loaded or there was a failure when loading plugins.
|
||||||
*/
|
*/
|
||||||
public void init(int release, IndexedFileSystem fs, PluginManager manager) throws Exception {
|
public void init(int release, IndexedFileSystem fs, PluginManager manager) throws Exception {
|
||||||
this.releaseNumber = release;
|
releaseNumber = release;
|
||||||
|
|
||||||
ItemDefinitionDecoder itemDecoder = new ItemDefinitionDecoder(fs);
|
ItemDefinitionDecoder itemDecoder = new ItemDefinitionDecoder(fs);
|
||||||
ItemDefinition[] items = itemDecoder.decode();
|
ItemDefinition[] items = itemDecoder.decode();
|
||||||
|
|||||||
@@ -129,7 +129,7 @@ public final class Region {
|
|||||||
Set<Entity> local = entities.computeIfAbsent(position, key -> new HashSet<>(DEFAULT_SET_SIZE));
|
Set<Entity> local = entities.computeIfAbsent(position, key -> new HashSet<>(DEFAULT_SET_SIZE));
|
||||||
local.add(entity);
|
local.add(entity);
|
||||||
|
|
||||||
if ((System.currentTimeMillis() - start) / 1000 > 10 && (entity instanceof GameObject)) {
|
if ((System.currentTimeMillis() - start) / 1000 > 10 && entity instanceof GameObject) {
|
||||||
System.out.println("Adding entity " + entity + " to " + entity.getPosition());
|
System.out.println("Adding entity " + entity + " to " + entity.getPosition());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -169,7 +169,7 @@ public final class Region {
|
|||||||
*/
|
*/
|
||||||
public Set<Entity> getEntities(Position position) {
|
public Set<Entity> getEntities(Position position) {
|
||||||
Set<Entity> set = entities.get(position);
|
Set<Entity> set = entities.get(position);
|
||||||
return (set == null) ? ImmutableSet.of() : ImmutableSet.copyOf(set);
|
return set == null ? ImmutableSet.of() : ImmutableSet.copyOf(set);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -224,7 +224,7 @@ public final class Region {
|
|||||||
* @return The Set of RegionUpdateMessages.
|
* @return The Set of RegionUpdateMessages.
|
||||||
*/
|
*/
|
||||||
public List<RegionUpdateMessage> getUpdates(int height) {
|
public List<RegionUpdateMessage> getUpdates(int height) {
|
||||||
List<RegionUpdateMessage> original = this.updates.get(height);
|
List<RegionUpdateMessage> original = updates.get(height);
|
||||||
List<RegionUpdateMessage> updates = new ArrayList<>(original);
|
List<RegionUpdateMessage> updates = new ArrayList<>(original);
|
||||||
original.clear();
|
original.clear();
|
||||||
|
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ public enum CollisionFlag {
|
|||||||
* @return The array of CollisionFlags.
|
* @return The array of CollisionFlags.
|
||||||
*/
|
*/
|
||||||
public static CollisionFlag[] forType(EntityType type) {
|
public static CollisionFlag[] forType(EntityType type) {
|
||||||
return (type == EntityType.PROJECTILE) ? projectiles() : mobs();
|
return type == EntityType.PROJECTILE ? projectiles() : mobs();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ public abstract class UpdateOperation<E extends Entity> {
|
|||||||
Preconditions.checkArgument(dx >= 0 && dx < Region.SIZE, position + " not in expected Region of " + region + ".");
|
Preconditions.checkArgument(dx >= 0 && dx < Region.SIZE, position + " not in expected Region of " + region + ".");
|
||||||
Preconditions.checkArgument(dy >= 0 && dy < Region.SIZE, position + " not in expected Region of " + region + ".");
|
Preconditions.checkArgument(dy >= 0 && dy < Region.SIZE, position + " not in expected Region of " + region + ".");
|
||||||
|
|
||||||
return (dx << 4) | dy;
|
return dx << 4 | dy;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -67,7 +67,7 @@ public final class EquipmentDefinition {
|
|||||||
/**
|
/**
|
||||||
* The array of skill requirement levels.
|
* The array of skill requirement levels.
|
||||||
*/
|
*/
|
||||||
private int[] levels = { 1, 1, 1, 1, 1, 1, 1 };
|
private final int[] levels = { 1, 1, 1, 1, 1, 1, 1 };
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The slot this equipment goes into.
|
* The slot this equipment goes into.
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ public final class ItemDefinition {
|
|||||||
/**
|
/**
|
||||||
* The ground actions array.
|
* The ground actions array.
|
||||||
*/
|
*/
|
||||||
private String[] groundActions = new String[5];
|
private final String[] groundActions = new String[5];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The item's id.
|
* The item's id.
|
||||||
@@ -124,7 +124,7 @@ public final class ItemDefinition {
|
|||||||
/**
|
/**
|
||||||
* The inventory actions array.
|
* The inventory actions array.
|
||||||
*/
|
*/
|
||||||
private String[] inventoryActions = new String[5];
|
private final String[] inventoryActions = new String[5];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A flag indicating if this item is members only.
|
* A flag indicating if this item is members only.
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ public final class NpcDefinition {
|
|||||||
/**
|
/**
|
||||||
* An array of interaction options.
|
* An array of interaction options.
|
||||||
*/
|
*/
|
||||||
private String[] interactions = new String[5];
|
private final String[] interactions = new String[5];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The name of the npc.
|
* The name of the npc.
|
||||||
|
|||||||
@@ -535,7 +535,7 @@ public abstract class Mob extends Entity {
|
|||||||
* @param position The position to face.
|
* @param position The position to face.
|
||||||
*/
|
*/
|
||||||
public final void turnTo(Position position) {
|
public final void turnTo(Position position) {
|
||||||
this.facingPosition = position;
|
facingPosition = position;
|
||||||
blockSet.add(SynchronizationBlock.createTurnToPositionBlock(position));
|
blockSet.add(SynchronizationBlock.createTurnToPositionBlock(position));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ public final class Player extends Mob {
|
|||||||
/**
|
/**
|
||||||
* This player's credentials.
|
* This player's credentials.
|
||||||
*/
|
*/
|
||||||
private PlayerCredentials credentials;
|
private final PlayerCredentials credentials;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A flag which indicates there are npcs that couldn't be added.
|
* A flag which indicates there are npcs that couldn't be added.
|
||||||
@@ -870,7 +870,7 @@ public final class Player extends Mob {
|
|||||||
* @param brightness The screen brightness.
|
* @param brightness The screen brightness.
|
||||||
*/
|
*/
|
||||||
public void setScreenBrightness(ScreenBrightness brightness) {
|
public void setScreenBrightness(ScreenBrightness brightness) {
|
||||||
this.screenBrightness = brightness;
|
screenBrightness = brightness;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -223,7 +223,7 @@ public final class SkillSet {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
current += (current < max ? 1 : -1);
|
current += current < max ? 1 : -1;
|
||||||
setSkill(id, new Skill(skills[id].getExperience(), current, max));
|
setSkill(id, new Skill(skills[id].getExperience(), current, max));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ public final class AttributeMap {
|
|||||||
/**
|
/**
|
||||||
* The map of attribute names to attributes.
|
* The map of attribute names to attributes.
|
||||||
*/
|
*/
|
||||||
private Map<String, Attribute<?>> attributes = new HashMap<>(DEFAULT_MAP_SIZE);
|
private final Map<String, Attribute<?>> attributes = new HashMap<>(DEFAULT_MAP_SIZE);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the {@link Attribute} with the specified name.
|
* Gets the {@link Attribute} with the specified name.
|
||||||
|
|||||||
@@ -30,13 +30,13 @@ public final class NumericalAttribute extends Attribute<Number> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public byte[] encode() {
|
public byte[] encode() {
|
||||||
long encoded = (type == AttributeType.DOUBLE) ? Double.doubleToLongBits((double) value) : (long) value;
|
long encoded = type == AttributeType.DOUBLE ? Double.doubleToLongBits((double) value) : (long) value;
|
||||||
return Longs.toByteArray(encoded);
|
return Longs.toByteArray(encoded);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return (type == AttributeType.DOUBLE) ? Double.toString((double) value) : Long.toString((long) value);
|
return type == AttributeType.DOUBLE ? Double.toString((double) value) : Long.toString((long) value);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -44,7 +44,7 @@ public final class DynamicGameObject extends GameObject {
|
|||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
Player player = get();
|
Player player = get();
|
||||||
return (player == null) ? 0 : player.hashCode();
|
return player == null ? 0 : player.hashCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ public abstract class GameObject extends Entity {
|
|||||||
*/
|
*/
|
||||||
public GameObject(World world, int id, Position position, int type, int orientation) {
|
public GameObject(World world, int id, Position position, int type, int orientation) {
|
||||||
super(world, position);
|
super(world, position);
|
||||||
this.packed = id << 8 | (type & 0x3F) << 2 | orientation & 0x3;
|
packed = id << 8 | (type & 0x3F) << 2 | orientation & 0x3;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -81,7 +81,7 @@ public abstract class GameObject extends Entity {
|
|||||||
* @return The type.
|
* @return The type.
|
||||||
*/
|
*/
|
||||||
public int getType() {
|
public int getType() {
|
||||||
return (packed >> 2) & 0x3F;
|
return packed >> 2 & 0x3F;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ public final class SimplePathfindingAlgorithm extends PathfindingAlgorithm {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Position last = new Position(x, y, height);
|
Position last = new Position(x, y, height);
|
||||||
if (!start.equals(last) && dy != 0 && traversable(last, boundaries, (dy > 0) ? Direction.SOUTH : Direction.NORTH)) {
|
if (!start.equals(last) && dy != 0 && traversable(last, boundaries, dy > 0 ? Direction.SOUTH : Direction.NORTH)) {
|
||||||
return addVertical(last, target, positions);
|
return addVertical(last, target, positions);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -132,7 +132,7 @@ public final class SimplePathfindingAlgorithm extends PathfindingAlgorithm {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Position last = new Position(x, y, height);
|
Position last = new Position(x, y, height);
|
||||||
if (!last.equals(target) && dx != 0 && traversable(last, boundaries, (dx > 0) ? Direction.WEST : Direction.EAST)) {
|
if (!last.equals(target) && dx != 0 && traversable(last, boundaries, dx > 0 ? Direction.WEST : Direction.EAST)) {
|
||||||
return addHorizontal(last, target, positions);
|
return addHorizontal(last, target, positions);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ public final class EventListenerChainSet {
|
|||||||
public <E extends Event> boolean notify(E event) {
|
public <E extends Event> boolean notify(E event) {
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
EventListenerChain<E> chain = (EventListenerChain<E>) chains.get(event.getClass());
|
EventListenerChain<E> chain = (EventListenerChain<E>) chains.get(event.getClass());
|
||||||
return (chain == null) || chain.notify(event);
|
return chain == null || chain.notify(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ public final class InterfaceSet {
|
|||||||
/**
|
/**
|
||||||
* A map of open interfaces.
|
* A map of open interfaces.
|
||||||
*/
|
*/
|
||||||
private Map<InterfaceType, Integer> interfaces = new HashMap<>();
|
private final Map<InterfaceType, Integer> interfaces = new HashMap<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The current listener.
|
* The current listener.
|
||||||
@@ -150,7 +150,7 @@ public final class InterfaceSet {
|
|||||||
public void openDialogue(DialogueListener listener, int dialogueId) {
|
public void openDialogue(DialogueListener listener, int dialogueId) {
|
||||||
closeAndNotify();
|
closeAndNotify();
|
||||||
|
|
||||||
this.dialogueListener = Optional.ofNullable(listener);
|
dialogueListener = Optional.ofNullable(listener);
|
||||||
this.listener = Optional.ofNullable(listener);
|
this.listener = Optional.ofNullable(listener);
|
||||||
|
|
||||||
interfaces.put(InterfaceType.DIALOGUE, dialogueId);
|
interfaces.put(InterfaceType.DIALOGUE, dialogueId);
|
||||||
@@ -175,7 +175,7 @@ public final class InterfaceSet {
|
|||||||
public void openDialogueOverlay(DialogueListener listener, int dialogueId) {
|
public void openDialogueOverlay(DialogueListener listener, int dialogueId) {
|
||||||
closeAndNotify();
|
closeAndNotify();
|
||||||
|
|
||||||
this.dialogueListener = Optional.ofNullable(listener);
|
dialogueListener = Optional.ofNullable(listener);
|
||||||
this.listener = Optional.ofNullable(listener);
|
this.listener = Optional.ofNullable(listener);
|
||||||
|
|
||||||
interfaces.put(InterfaceType.DIALOGUE, dialogueId);
|
interfaces.put(InterfaceType.DIALOGUE, dialogueId);
|
||||||
|
|||||||
@@ -18,7 +18,8 @@ public interface DialogueListener extends InterfaceListener {
|
|||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @param button The button interface id.
|
* @param button The button interface id.
|
||||||
* @return {@code true} if the {@link MessageHandlerChain} should be broken, {@code false} if it should be continued.
|
* @return {@code true} if the {@link MessageHandlerChain} should be broken, {@code false} if it should be
|
||||||
|
* continued.
|
||||||
*/
|
*/
|
||||||
public boolean buttonClicked(int button);
|
public boolean buttonClicked(int button);
|
||||||
|
|
||||||
|
|||||||
@@ -540,7 +540,7 @@ public final class Inventory {
|
|||||||
int removed = Math.min(amount, itemAmount);
|
int removed = Math.min(amount, itemAmount);
|
||||||
int remainder = itemAmount - removed;
|
int remainder = itemAmount - removed;
|
||||||
|
|
||||||
set(slot, (remainder > 0) ? new Item(item.getId(), remainder) : null);
|
set(slot, remainder > 0 ? new Item(item.getId(), remainder) : null);
|
||||||
return removed;
|
return removed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -82,8 +82,8 @@ public final class NpcMovementTask extends ScheduledTask {
|
|||||||
int currentX = current.getX(), currentY = current.getY();
|
int currentX = current.getX(), currentY = current.getY();
|
||||||
|
|
||||||
boolean negativeX = RANDOM.nextBoolean(), negativeY = RANDOM.nextBoolean();
|
boolean negativeX = RANDOM.nextBoolean(), negativeY = RANDOM.nextBoolean();
|
||||||
int x = RANDOM.nextInt(negativeX ? (currentX - min.getX()) : (max.getX() - currentX));
|
int x = RANDOM.nextInt(negativeX ? currentX - min.getX() : max.getX() - currentX);
|
||||||
int y = RANDOM.nextInt(negativeY ? (currentY - min.getY()) : (max.getY() - currentY));
|
int y = RANDOM.nextInt(negativeY ? currentY - min.getY() : max.getY() - currentY);
|
||||||
|
|
||||||
int dx = negativeX ? -x : x;
|
int dx = negativeX ? -x : x;
|
||||||
int dy = negativeY ? -y : y;
|
int dy = negativeY ? -y : y;
|
||||||
|
|||||||
@@ -49,8 +49,7 @@ public final class NpcSynchronizationTask extends SynchronizationTask {
|
|||||||
|
|
||||||
for (Iterator<Npc> it = localNpcs.iterator(); it.hasNext();) {
|
for (Iterator<Npc> it = localNpcs.iterator(); it.hasNext();) {
|
||||||
Npc npc = it.next();
|
Npc npc = it.next();
|
||||||
if (!npc.isActive() || npc.isTeleporting()
|
if (!npc.isActive() || npc.isTeleporting() || npc.getPosition().getLongestDelta(playerPosition) > player.getViewingDistance()) {
|
||||||
|| npc.getPosition().getLongestDelta(playerPosition) > player.getViewingDistance()) {
|
|
||||||
it.remove();
|
it.remove();
|
||||||
segments.add(new RemoveMobSegment());
|
segments.add(new RemoveMobSegment());
|
||||||
} else {
|
} else {
|
||||||
@@ -69,8 +68,7 @@ public final class NpcSynchronizationTask extends SynchronizationTask {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Position npcPosition = npc.getPosition();
|
Position npcPosition = npc.getPosition();
|
||||||
if (npcPosition.isWithinDistance(playerPosition, player.getViewingDistance()) && !localNpcs.contains(npc)
|
if (npcPosition.isWithinDistance(playerPosition, player.getViewingDistance()) && !localNpcs.contains(npc) && npcPosition.getHeight() == playerPosition.getHeight()) {
|
||||||
&& npcPosition.getHeight() == playerPosition.getHeight()) {
|
|
||||||
localNpcs.add(npc);
|
localNpcs.add(npc);
|
||||||
added++;
|
added++;
|
||||||
npc.turnTo(npc.getFacingPosition());
|
npc.turnTo(npc.getFacingPosition());
|
||||||
|
|||||||
@@ -80,8 +80,7 @@ public final class PlayerSynchronizationTask extends SynchronizationTask {
|
|||||||
int added = 0;
|
int added = 0;
|
||||||
|
|
||||||
MobRepository<Player> repository = player.getWorld().getPlayerRepository();
|
MobRepository<Player> repository = player.getWorld().getPlayerRepository();
|
||||||
for (Iterator<Player> it = repository.iterator(); it.hasNext();) {
|
for (Player other : repository) {
|
||||||
Player other = it.next();
|
|
||||||
if (localPlayers.size() >= 255) {
|
if (localPlayers.size() >= 255) {
|
||||||
player.flagExcessivePlayers();
|
player.flagExcessivePlayers();
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -1,6 +1,12 @@
|
|||||||
package org.apollo.game.sync.task;
|
package org.apollo.game.sync.task;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableSet;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Optional;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import org.apollo.game.message.impl.ClearRegionMessage;
|
import org.apollo.game.message.impl.ClearRegionMessage;
|
||||||
import org.apollo.game.message.impl.GroupedRegionUpdateMessage;
|
import org.apollo.game.message.impl.GroupedRegionUpdateMessage;
|
||||||
import org.apollo.game.message.impl.RegionChangeMessage;
|
import org.apollo.game.message.impl.RegionChangeMessage;
|
||||||
@@ -11,7 +17,7 @@ import org.apollo.game.model.area.RegionCoordinates;
|
|||||||
import org.apollo.game.model.area.RegionRepository;
|
import org.apollo.game.model.area.RegionRepository;
|
||||||
import org.apollo.game.model.entity.Player;
|
import org.apollo.game.model.entity.Player;
|
||||||
|
|
||||||
import java.util.*;
|
import com.google.common.collect.ImmutableSet;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A {@link SynchronizationTask} which does pre-synchronization work for the specified {@link Player}.
|
* A {@link SynchronizationTask} which does pre-synchronization work for the specified {@link Player}.
|
||||||
@@ -202,7 +208,7 @@ public final class PrePlayerSynchronizationTask extends SynchronizationTask {
|
|||||||
int deltaX = current.getLocalX(last);
|
int deltaX = current.getLocalX(last);
|
||||||
int deltaY = current.getLocalY(last);
|
int deltaY = current.getLocalY(last);
|
||||||
|
|
||||||
return deltaX <= Position.MAX_DISTANCE || deltaX >= (VIEWPORT_WIDTH - Position.MAX_DISTANCE - 1) || deltaY <= Position.MAX_DISTANCE || deltaY >= (VIEWPORT_WIDTH - Position.MAX_DISTANCE - 1);
|
return deltaX <= Position.MAX_DISTANCE || deltaX >= VIEWPORT_WIDTH - Position.MAX_DISTANCE - 1 || deltaY <= Position.MAX_DISTANCE || deltaY >= VIEWPORT_WIDTH - Position.MAX_DISTANCE - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ public final class BinaryPlayerSerializer extends PlayerSerializer {
|
|||||||
int y = in.readUnsignedShort();
|
int y = in.readUnsignedShort();
|
||||||
int height = in.readUnsignedByte();
|
int height = in.readUnsignedByte();
|
||||||
|
|
||||||
Gender gender = (in.readUnsignedByte() == Gender.MALE.toInteger()) ? Gender.MALE : Gender.FEMALE;
|
Gender gender = in.readUnsignedByte() == Gender.MALE.toInteger() ? Gender.MALE : Gender.FEMALE;
|
||||||
int[] style = new int[7];
|
int[] style = new int[7];
|
||||||
for (int slot = 0; slot < style.length; slot++) {
|
for (int slot = 0; slot < style.length; slot++) {
|
||||||
style[slot] = in.readUnsignedByte();
|
style[slot] = in.readUnsignedByte();
|
||||||
|
|||||||
@@ -19,8 +19,8 @@ public final class FlaggedMouseEventMessageDecoder extends MessageDecoder<Flagge
|
|||||||
int read;
|
int read;
|
||||||
if (reader.getLength() == 2) {
|
if (reader.getLength() == 2) {
|
||||||
read = (int) reader.getUnsigned(DataType.SHORT);
|
read = (int) reader.getUnsigned(DataType.SHORT);
|
||||||
int clicks = (read >> 12);
|
int clicks = read >> 12;
|
||||||
int dX = (read >> 6) & 0x3f;
|
int dX = read >> 6 & 0x3f;
|
||||||
int dY = read & 0x3f;
|
int dY = read & 0x3f;
|
||||||
return new FlaggedMouseEventMessage(clicks, dX, dY, true);
|
return new FlaggedMouseEventMessage(clicks, dX, dY, true);
|
||||||
} else if (reader.getLength() == 3) {
|
} else if (reader.getLength() == 3) {
|
||||||
@@ -29,7 +29,7 @@ public final class FlaggedMouseEventMessageDecoder extends MessageDecoder<Flagge
|
|||||||
read = (int) reader.getUnsigned(DataType.INT) & ~0xc0000000;
|
read = (int) reader.getUnsigned(DataType.INT) & ~0xc0000000;
|
||||||
}
|
}
|
||||||
|
|
||||||
int clicks = (read >> 19);
|
int clicks = read >> 19;
|
||||||
int x = (read & 0x7f) % 765;
|
int x = (read & 0x7f) % 765;
|
||||||
int y = (read & 0x7f) / 765;
|
int y = (read & 0x7f) / 765;
|
||||||
|
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ public final class GroupedRegionUpdateMessageEncoder extends MessageEncoder<Grou
|
|||||||
|
|
||||||
builder.put(DataType.BYTE, region.getLocalY(lastKnownRegion));
|
builder.put(DataType.BYTE, region.getLocalY(lastKnownRegion));
|
||||||
builder.put(DataType.BYTE, DataTransformation.NEGATE, region.getLocalX(lastKnownRegion));
|
builder.put(DataType.BYTE, DataTransformation.NEGATE, region.getLocalX(lastKnownRegion));
|
||||||
System.out.println("Grum: local x: " + lastKnownRegion.getLocalX(region) + ", local y: " + lastKnownRegion.getLocalY(region));
|
System.out.println("Grum: local x: " + lastKnownRegion.getLocalX(region) + ", local y: " + lastKnownRegion.getLocalY(region));
|
||||||
|
|
||||||
for (RegionUpdateMessage update : message.getMessages()) {
|
for (RegionUpdateMessage update : message.getMessages()) {
|
||||||
System.out.println("==== Sending " + update + " as part of grum");
|
System.out.println("==== Sending " + update + " as part of grum");
|
||||||
|
|||||||
@@ -19,9 +19,9 @@ public final class MouseClickedMessageDecoder extends MessageDecoder<MouseClicke
|
|||||||
int value = (int) reader.getUnsigned(DataType.INT);
|
int value = (int) reader.getUnsigned(DataType.INT);
|
||||||
|
|
||||||
long delay = (value >> 20) * 50;
|
long delay = (value >> 20) * 50;
|
||||||
boolean right = ((value >> 19) & 0x1) == 1;
|
boolean right = (value >> 19 & 0x1) == 1;
|
||||||
|
|
||||||
int cords = (value & 0x3FFFF);
|
int cords = value & 0x3FFFF;
|
||||||
int x = cords % 765;
|
int x = cords % 765;
|
||||||
int y = cords / 765;
|
int y = cords / 765;
|
||||||
|
|
||||||
|
|||||||
@@ -20,8 +20,8 @@ public final class FlaggedMouseEventMessageDecoder extends MessageDecoder<Flagge
|
|||||||
|
|
||||||
if (reader.getLength() == 2) {
|
if (reader.getLength() == 2) {
|
||||||
read = (int) reader.getUnsigned(DataType.SHORT);
|
read = (int) reader.getUnsigned(DataType.SHORT);
|
||||||
clicks = (read >> 12);
|
clicks = read >> 12;
|
||||||
x = (read >> 6) & 0x3f;
|
x = read >> 6 & 0x3f;
|
||||||
y = read & 0x3f;
|
y = read & 0x3f;
|
||||||
return new FlaggedMouseEventMessage(clicks, x, y, true);
|
return new FlaggedMouseEventMessage(clicks, x, y, true);
|
||||||
} else if (reader.getLength() == 3) {
|
} else if (reader.getLength() == 3) {
|
||||||
@@ -30,7 +30,7 @@ public final class FlaggedMouseEventMessageDecoder extends MessageDecoder<Flagge
|
|||||||
read = (int) reader.getUnsigned(DataType.INT) & ~0xc0000000;
|
read = (int) reader.getUnsigned(DataType.INT) & ~0xc0000000;
|
||||||
}
|
}
|
||||||
|
|
||||||
clicks = (read >> 19);
|
clicks = read >> 19;
|
||||||
x = (read & 0x7f) % 765;
|
x = (read & 0x7f) % 765;
|
||||||
y = (read & 0x7f) / 765;
|
y = (read & 0x7f) / 765;
|
||||||
return new FlaggedMouseEventMessage(clicks, x, y, false);
|
return new FlaggedMouseEventMessage(clicks, x, y, false);
|
||||||
|
|||||||
@@ -19,9 +19,9 @@ public final class MouseClickedMessageDecoder extends MessageDecoder<MouseClicke
|
|||||||
int value = (int) reader.getUnsigned(DataType.INT);
|
int value = (int) reader.getUnsigned(DataType.INT);
|
||||||
|
|
||||||
long delay = (value >> 20) * 50;
|
long delay = (value >> 20) * 50;
|
||||||
boolean right = ((value >> 19) & 0x1) == 1;
|
boolean right = (value >> 19 & 0x1) == 1;
|
||||||
|
|
||||||
int cords = (value & 0x3FFFF);
|
int cords = value & 0x3FFFF;
|
||||||
int x = cords % 765;
|
int x = cords % 765;
|
||||||
int y = cords / 765;
|
int y = cords / 765;
|
||||||
|
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ public final class LoginSession extends Session {
|
|||||||
*/
|
*/
|
||||||
public LoginSession(ChannelHandlerContext ctx, ServerContext serverContext) {
|
public LoginSession(ChannelHandlerContext ctx, ServerContext serverContext) {
|
||||||
super(ctx.channel());
|
super(ctx.channel());
|
||||||
this.channelContext = ctx;
|
channelContext = ctx;
|
||||||
this.serverContext = serverContext;
|
this.serverContext = serverContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -103,7 +103,7 @@ public final class LoginSession extends Session {
|
|||||||
optional = Optional.empty();
|
optional = Optional.empty();
|
||||||
rights = 0;
|
rights = 0;
|
||||||
|
|
||||||
status = (registration == RegistrationStatus.ALREADY_ONLINE) ? LoginConstants.STATUS_ACCOUNT_ONLINE : LoginConstants.STATUS_SERVER_FULL;
|
status = registration == RegistrationStatus.ALREADY_ONLINE ? LoginConstants.STATUS_ACCOUNT_ONLINE : LoginConstants.STATUS_SERVER_FULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -31,12 +31,11 @@ public final class RsaKeyGenerator {
|
|||||||
do {
|
do {
|
||||||
p = BigInteger.probablePrime(BIT_COUNT / 2, random);
|
p = BigInteger.probablePrime(BIT_COUNT / 2, random);
|
||||||
q = BigInteger.probablePrime(BIT_COUNT / 2, random);
|
q = BigInteger.probablePrime(BIT_COUNT / 2, random);
|
||||||
phi = (p.subtract(BigInteger.ONE)).multiply(q.subtract(BigInteger.ONE));
|
phi = p.subtract(BigInteger.ONE).multiply(q.subtract(BigInteger.ONE));
|
||||||
|
|
||||||
modulus = p.multiply(q);
|
modulus = p.multiply(q);
|
||||||
privateKey = publicKey.modInverse(phi);
|
privateKey = publicKey.modInverse(phi);
|
||||||
} while (modulus.bitLength() != BIT_COUNT || privateKey.bitLength() != BIT_COUNT
|
} while (modulus.bitLength() != BIT_COUNT || privateKey.bitLength() != BIT_COUNT || !phi.gcd(publicKey).equals(BigInteger.ONE));
|
||||||
|| !phi.gcd(publicKey).equals(BigInteger.ONE));
|
|
||||||
|
|
||||||
System.out.println("modulus: " + modulus);
|
System.out.println("modulus: " + modulus);
|
||||||
System.out.println("public key: " + publicKey);
|
System.out.println("public key: " + publicKey);
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ public final class PluginManager {
|
|||||||
/**
|
/**
|
||||||
* A set of all author names.
|
* A set of all author names.
|
||||||
*/
|
*/
|
||||||
private SortedSet<String> authors = new TreeSet<>();
|
private final SortedSet<String> authors = new TreeSet<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The plugin context.
|
* The plugin context.
|
||||||
@@ -164,8 +164,7 @@ public final class PluginManager {
|
|||||||
* @throws DependencyException If a dependency error occurs.
|
* @throws DependencyException If a dependency error occurs.
|
||||||
* @throws IOException If an I/O error occurs.
|
* @throws IOException If an I/O error occurs.
|
||||||
*/
|
*/
|
||||||
private void start(PluginEnvironment env, PluginMetaData plugin, Map<String, PluginMetaData> plugins,
|
private void start(PluginEnvironment env, PluginMetaData plugin, Map<String, PluginMetaData> plugins, Set<PluginMetaData> started) throws DependencyException, IOException {
|
||||||
Set<PluginMetaData> started) throws DependencyException, IOException {
|
|
||||||
// TODO check for cyclic dependencies! this way just won't cut it, we need an exception
|
// TODO check for cyclic dependencies! this way just won't cut it, we need an exception
|
||||||
if (started.contains(plugin)) {
|
if (started.contains(plugin)) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ public final class XmlParser {
|
|||||||
/**
|
/**
|
||||||
* The stack of nodes, used when traversing the document and going through child nodes.
|
* The stack of nodes, used when traversing the document and going through child nodes.
|
||||||
*/
|
*/
|
||||||
private Stack<XmlNode> nodeStack = new Stack<>();
|
private final Stack<XmlNode> nodeStack = new Stack<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The current root node.
|
* The current root node.
|
||||||
|
|||||||
Reference in New Issue
Block a user