Reformat and clean up "server" package

This commit is contained in:
P0nk
2021-09-09 23:27:38 +02:00
parent d389665bd7
commit e8ef3a492c
80 changed files with 2104 additions and 2087 deletions

View File

@@ -21,7 +21,6 @@
package server.maps;
/**
*
* @author AngelSL
*/
public enum FieldLimit {
@@ -44,7 +43,7 @@ public enum FieldLimit {
//ANTI_MACRO_LIMIT(0x10000), // No notes
CANNOTJUMPDOWN(0x20000),
//SUMMON_NPC_LIMIT(0x40000); // Seems to .. disable Rush if 0x2 is set
//......... EVEN MORE LIMITS ............
//SUMMON_NPC_LIMIT(0x40000),
NO_EXP_DECREASE(0x80000),
@@ -52,10 +51,10 @@ public enum FieldLimit {
//PARCEL_OPEN_LIMIT(0x200000),
DROP_LIMIT(0x400000);
//ROCKETBOOSTER_LIMIT(0x800000) //lol we don't even have mechanics <3
private long i;
private FieldLimit(long i) {
private final long i;
FieldLimit(long i) {
this.i = i;
}

View File

@@ -45,14 +45,14 @@ public class MapMonitor {
monitorSchedule.cancel(false);
monitorSchedule = null;
}
map.killAllMonsters();
map.clearDrops();
if (portal != null) {
portal.setPortalStatus(Portal.OPEN);
}
map.resetReactors();
map = null;
portal = null;
}

View File

@@ -34,34 +34,34 @@ import java.util.List;
* @author Ronan - made MapleTV mechanics synchronous
*/
public class MapleTVEffect {
private final static boolean[] ACTIVE = new boolean[Server.getInstance().getWorldsSize()];
public static synchronized boolean broadcastMapleTVIfNotActive(Character player, Character victim, List<String> messages, int tvType){
int w = player.getWorld();
if(!ACTIVE[w]) {
broadcastTV(true, w, messages, player, tvType, victim);
return true;
}
return false;
}
private static synchronized void broadcastTV(boolean activity, final int userWorld, List<String> message, Character user, int type, Character partner) {
Server server = Server.getInstance();
ACTIVE[userWorld] = activity;
if (activity) {
server.broadcastMessage(userWorld, PacketCreator.enableTV());
server.broadcastMessage(userWorld, PacketCreator.sendTV(user, message, type <= 2 ? type : type - 3, partner));
int delay = 15000;
if (type == 4) {
delay = 30000;
} else if (type == 5) {
delay = 60000;
}
TimerManager.getInstance().schedule(() -> broadcastTV(false, userWorld, null, null, -1, null), delay);
} else {
server.broadcastMessage(userWorld, PacketCreator.removeTV());
}
}
private final static boolean[] ACTIVE = new boolean[Server.getInstance().getWorldsSize()];
public static synchronized boolean broadcastMapleTVIfNotActive(Character player, Character victim, List<String> messages, int tvType) {
int w = player.getWorld();
if (!ACTIVE[w]) {
broadcastTV(true, w, messages, player, tvType, victim);
return true;
}
return false;
}
private static synchronized void broadcastTV(boolean activity, final int userWorld, List<String> message, Character user, int type, Character partner) {
Server server = Server.getInstance();
ACTIVE[userWorld] = activity;
if (activity) {
server.broadcastMessage(userWorld, PacketCreator.enableTV());
server.broadcastMessage(userWorld, PacketCreator.sendTV(user, message, type <= 2 ? type : type - 3, partner));
int delay = 15000;
if (type == 4) {
delay = 30000;
} else if (type == 5) {
delay = 60000;
}
TimerManager.getInstance().schedule(() -> broadcastTV(false, userWorld, null, null, -1, null), delay);
} else {
server.broadcastMessage(userWorld, PacketCreator.removeTV());
}
}
}

View File

@@ -334,7 +334,9 @@ public class Reactor extends AbstractMapObject {
if (this.getDelay() > 0) {
this.delayedRespawn();
}
} else return !this.inDelayedRespawn();
} else {
return !this.inDelayedRespawn();
}
} finally {
reactorLock.unlock();
}

View File

@@ -23,10 +23,11 @@ package server.maps;
public class ReactorDropEntry {
public ReactorDropEntry(int itemId, int chance, int questId) {
this.itemId = itemId;
this.chance = chance;
this.questid = questId;
this.itemId = itemId;
this.chance = chance;
this.questid = questId;
}
public int itemId, chance, questid;
public int assignedRangeStart, assignedRangeLength;
}

View File

@@ -22,7 +22,8 @@
package server.maps;
public class SavedLocation {
private int mapid = 102000000, portal;
private int mapid = 102000000;
private final int portal;
public SavedLocation(int mapid, int portal) {
this.mapid = mapid;

View File

@@ -25,7 +25,7 @@ public enum SummonMovementType {
STATIONARY(0), FOLLOW(1), CIRCLE_FOLLOW(3);
private final int val;
private SummonMovementType(int val) {
SummonMovementType(int val) {
this.val = val;
}