Fixes a bunch of grammatical errors, and some warnings
This commit is contained in:
@@ -75,12 +75,10 @@ public class EngineCanCombatHappen extends Engine {
|
||||
}
|
||||
|
||||
ProjectileSource projectileSource = event.getPotion().getShooter();
|
||||
if (!(projectileSource instanceof Entity)) {
|
||||
if (!(projectileSource instanceof Entity thrower)) {
|
||||
return;
|
||||
}
|
||||
|
||||
Entity thrower = (Entity) projectileSource;
|
||||
|
||||
// ... scan through affected entities to make sure they're all valid targets.
|
||||
for (LivingEntity affectedEntity : event.getAffectedEntities()) {
|
||||
EntityDamageByEntityEvent sub = new EntityDamageByEntityEvent(thrower, affectedEntity, EntityDamageEvent.DamageCause.CUSTOM, 0D);
|
||||
@@ -101,12 +99,10 @@ public class EngineCanCombatHappen extends Engine {
|
||||
}
|
||||
|
||||
ProjectileSource projectileSource = event.getEntity().getSource();
|
||||
if (!(projectileSource instanceof Entity)) {
|
||||
if (!(projectileSource instanceof Entity thrower)) {
|
||||
return;
|
||||
}
|
||||
|
||||
Entity thrower = (Entity) projectileSource;
|
||||
|
||||
// ... create a dummy list to avoid ConcurrentModificationException ...
|
||||
List<LivingEntity> affectedList = new ArrayList<>();
|
||||
|
||||
@@ -201,7 +197,7 @@ public class EngineCanCombatHappen extends Engine {
|
||||
|
||||
// ... PVP flag may cause a damage block ...
|
||||
// (just checking the defender as above isn't enough. What about the attacker? It could be in a no-pvp area)
|
||||
// NOTE: This check is probably not that important but we could keep it anyways.
|
||||
// NOTE: This check is probably not that important, but we could keep it anyway.
|
||||
if (attackerPsFaction.getFlag(MFlag.getFlagPvp()) == false) {
|
||||
ret = falseUnlessDisallowedPvpEventCancelled(attacker, defender, DisallowCause.PEACEFUL_LAND, event);
|
||||
if (!ret && notify) {
|
||||
|
@@ -64,7 +64,7 @@ public class EngineChat extends Engine {
|
||||
// SET FORMAT
|
||||
// -------------------------------------------- //
|
||||
|
||||
private class SetFormatEventExecutor implements EventExecutor {
|
||||
private static class SetFormatEventExecutor implements EventExecutor {
|
||||
@Override
|
||||
public void execute(Listener listener, Event event) throws EventException {
|
||||
try {
|
||||
@@ -86,7 +86,7 @@ public class EngineChat extends Engine {
|
||||
// PARSE TAGS
|
||||
// -------------------------------------------- //
|
||||
|
||||
private class ParseTagsEventExecutor implements EventExecutor {
|
||||
private static class ParseTagsEventExecutor implements EventExecutor {
|
||||
@Override
|
||||
public void execute(Listener listener, Event event) throws EventException {
|
||||
try {
|
||||
@@ -115,7 +115,7 @@ public class EngineChat extends Engine {
|
||||
// PARSE RELCOLOR
|
||||
// -------------------------------------------- //
|
||||
|
||||
private class ParseRelcolorEventExecutor implements EventExecutor {
|
||||
private static class ParseRelcolorEventExecutor implements EventExecutor {
|
||||
@Override
|
||||
public void execute(Listener listener, Event event) throws EventException {
|
||||
try {
|
||||
|
@@ -40,7 +40,7 @@ public class EngineCleanInactivity extends Engine {
|
||||
public void applyPlayerAgeBonus(EventMassiveCorePlayerCleanInactivityToleranceMillis event) {
|
||||
// Calculate First Played
|
||||
Long firstPlayed = event.getEntity().getFirstPlayed();
|
||||
Long age = 0L;
|
||||
long age = 0L;
|
||||
if (firstPlayed != null) {
|
||||
age = System.currentTimeMillis() - firstPlayed;
|
||||
}
|
||||
@@ -78,7 +78,7 @@ public class EngineCleanInactivity extends Engine {
|
||||
return null;
|
||||
}
|
||||
|
||||
Long bonus = 0L;
|
||||
long bonus = 0L;
|
||||
for (Entry<Long, Long> entry : ageToBonus.entrySet()) {
|
||||
Long key = entry.getKey();
|
||||
if (key == null) {
|
||||
|
@@ -51,7 +51,7 @@ public class EngineFlagSpawn extends Engine {
|
||||
|
||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||
public void blockMonstersAndAnimals(CreatureSpawnEvent event) {
|
||||
// If this is a natural spawn ..
|
||||
// If this is a natural spawn
|
||||
if (!NATURAL_SPAWN_REASONS.contains(event.getSpawnReason())) {
|
||||
return;
|
||||
}
|
||||
|
@@ -137,10 +137,9 @@ public class EngineFly extends Engine {
|
||||
|
||||
// ... and the attacker is a player ...
|
||||
Entity eattacker = MUtil.getLiableDamager(event);
|
||||
if (!(eattacker instanceof Player)) {
|
||||
if (!(eattacker instanceof Player attacker)) {
|
||||
return;
|
||||
}
|
||||
Player attacker = (Player) eattacker;
|
||||
MPlayer mattacker = MPlayer.get(attacker);
|
||||
|
||||
// ... disable flying for both
|
||||
@@ -195,7 +194,7 @@ public class EngineFly extends Engine {
|
||||
}
|
||||
// ... otherwise ...
|
||||
else {
|
||||
// .. tell them to have someone else edit it ...
|
||||
// ... tell them to have someone else edit it ...
|
||||
ex.addMsg("<i>You can ask a faction admin to change the flag.");
|
||||
}
|
||||
}
|
||||
|
@@ -49,7 +49,8 @@ public class EngineLastActivity extends Engine {
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void updateLastActivity(PlayerJoinEvent event) {
|
||||
// During the join event itself we want to be able to reach the old data.
|
||||
// That is also the way the underlying fallback Mixin system does it and we do it that way for the sake of symmetry.
|
||||
// That is also the way the underlying fallback Mixin system does it, and we do it that way for the sake of
|
||||
// symmetry.
|
||||
// For that reason we wait till the next tick with updating the value.
|
||||
updateLastActivitySoon(event.getPlayer());
|
||||
}
|
||||
|
@@ -238,7 +238,7 @@ public class EnginePermBuild extends Engine {
|
||||
return;
|
||||
}
|
||||
|
||||
// ... or are allowed to right click with the item, this event is safe to perform.
|
||||
// ... or are allowed to right-click with the item, this event is safe to perform.
|
||||
if (event.getAction() != Action.RIGHT_CLICK_BLOCK) {
|
||||
return;
|
||||
}
|
||||
@@ -266,7 +266,7 @@ public class EnginePermBuild extends Engine {
|
||||
// Armor stands are handled in EngineSpigot instead.
|
||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||
public void useEntity(PlayerInteractEntityEvent event) {
|
||||
// Ignore Off Hand
|
||||
// Ignore Off-Hand
|
||||
if (isOffHand(event)) {
|
||||
return;
|
||||
}
|
||||
@@ -276,10 +276,10 @@ public class EnginePermBuild extends Engine {
|
||||
// This is a special Spigot event that fires for Minecraft 1.8 armor stands.
|
||||
// It also fires for other entity types but for those the event is buggy.
|
||||
// It seems we can only cancel interaction with armor stands from here.
|
||||
// Thus we only handle armor stands from here and handle everything else in EngineMain.
|
||||
// Thus, we only handle armor stands from here and handle everything else in EngineMain.
|
||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||
public void handleArmorStand(PlayerInteractAtEntityEvent event) {
|
||||
// Ignore Off Hand
|
||||
// Ignore Off-Hand
|
||||
if (isOffHand(event)) {
|
||||
return;
|
||||
}
|
||||
@@ -328,10 +328,9 @@ public class EnginePermBuild extends Engine {
|
||||
public void combustEntity(EntityCombustByEntityEvent event) {
|
||||
|
||||
// If a burning projectile ...
|
||||
if (!(event.getCombuster() instanceof Projectile)) {
|
||||
if (!(event.getCombuster() instanceof Projectile entityProjectile)) {
|
||||
return;
|
||||
}
|
||||
Projectile entityProjectile = (Projectile) event.getCombuster();
|
||||
|
||||
// ... fired by a player ...
|
||||
ProjectileSource projectileSource = entityProjectile.getShooter();
|
||||
|
@@ -42,10 +42,9 @@ public enum ProtectCase {
|
||||
return MPerm.getPermBuild();
|
||||
|
||||
case USE_ENTITY:
|
||||
if (!(object instanceof Entity)) {
|
||||
if (!(object instanceof Entity entity)) {
|
||||
return null;
|
||||
}
|
||||
Entity entity = (Entity) object;
|
||||
EntityType type = entity.getType();
|
||||
if (EnumerationUtil.isEntityTypeContainer(type)) {
|
||||
return MPerm.getPermContainer();
|
||||
@@ -55,10 +54,9 @@ public enum ProtectCase {
|
||||
}
|
||||
|
||||
case USE_BLOCK:
|
||||
if (!(object instanceof Material)) {
|
||||
if (!(object instanceof Material material)) {
|
||||
return null;
|
||||
}
|
||||
Material material = (Material) object;
|
||||
if (material == Material.LECTERN) {
|
||||
return MPerm.getPermLectern();
|
||||
}
|
||||
|
Reference in New Issue
Block a user