Clean up code & Upgrade syntax to new Java

This commit is contained in:
Đạt Nhân Trương
2022-08-07 01:35:02 +07:00
parent bbdf236a10
commit f983b4dccf
17 changed files with 44 additions and 61 deletions

View File

@@ -1033,8 +1033,7 @@ public class ItemInformationProvider {
public Item scrollEquipWithId(Item equip, int scrollId, boolean usingWhiteScroll, int vegaItemId, boolean isGM) {
boolean assertGM = (isGM && YamlConfig.config.server.USE_PERFECT_GM_SCROLL);
if (equip instanceof Equip) {
Equip nEquip = (Equip) equip;
if (equip instanceof Equip nEquip) {
Map<String, Integer> stats = this.getEquipStats(scrollId);
if (((nEquip.getUpgradeSlots() > 0 || ItemConstants.isCleanSlate(scrollId))) || assertGM) {

View File

@@ -112,8 +112,7 @@ public class MapFactory {
private static void loadLifeRaw(MapleMap map, int id, String type, int cy, int f, int fh, int rx0, int rx1, int x, int y, int hide, int mobTime, int team) {
AbstractLoadedLife myLife = loadLife(id, type, cy, f, fh, rx0, rx1, x, y, hide);
if (myLife instanceof Monster) {
Monster monster = (Monster) myLife;
if (myLife instanceof Monster monster) {
if (mobTime == -1) { //does not respawn, force spawn once
map.spawnMonster(monster);

View File

@@ -1650,8 +1650,7 @@ public class MapleMap {
objectRLock.lock();
try {
for (Object ob : list) {
if (ob instanceof MapObject) {
MapObject mmo = (MapObject) ob;
if (ob instanceof MapObject mmo) {
if (mapobjects.containsValue(mmo) && mmo.getType() == MapObjectType.REACTOR) {
listObjects.add(mmo);