Code cleanup
This commit is contained in:
parent
5440987d8d
commit
28604c1d9a
@ -67,7 +67,7 @@ public class SimpleConfig
|
||||
{
|
||||
try
|
||||
{
|
||||
toShallowLoad = this.getClass().newInstance();
|
||||
toShallowLoad = this.getClass().getDeclaredConstructor().newInstance();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
@ -0,0 +1,18 @@
|
||||
package com.massivecraft.massivecore.command.type.enumeration;
|
||||
|
||||
import org.bukkit.permissions.PermissionDefault;
|
||||
|
||||
public class TypePermissionDefault extends TypeEnum<PermissionDefault>
|
||||
{
|
||||
// -------------------------------------------- //
|
||||
// INSTANCE & CONSTRUCT
|
||||
// -------------------------------------------- //
|
||||
|
||||
private static TypePermissionDefault i = new TypePermissionDefault();
|
||||
public static TypePermissionDefault get() { return i; }
|
||||
public TypePermissionDefault()
|
||||
{
|
||||
super(PermissionDefault.class);
|
||||
}
|
||||
|
||||
}
|
@ -2,7 +2,7 @@ package com.massivecraft.massivecore.event;
|
||||
|
||||
import com.massivecraft.massivecore.collections.MassiveSet;
|
||||
import com.massivecraft.massivecore.util.MUtil;
|
||||
import org.bukkit.entity.Damageable;
|
||||
import org.bukkit.attribute.Attribute;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
@ -113,7 +113,7 @@ public class EventMassiveCorePlayerUpdate extends EventMassiveCore
|
||||
if (getMaxHealth(player) == maxHealth) return false;
|
||||
|
||||
// Apply
|
||||
player.setMaxHealth(maxHealth);
|
||||
player.getAttribute(Attribute.GENERIC_MAX_HEALTH).setBaseValue(maxHealth);
|
||||
|
||||
// Return
|
||||
return true;
|
||||
@ -121,10 +121,9 @@ public class EventMassiveCorePlayerUpdate extends EventMassiveCore
|
||||
|
||||
public static double getMaxHealth(Player player, boolean current)
|
||||
{
|
||||
if ( ! current) return 20D;
|
||||
|
||||
Damageable d = (Damageable) player;
|
||||
return d.getMaxHealth();
|
||||
if ( ! current) player.getAttribute(Attribute.GENERIC_MAX_HEALTH).getDefaultValue();
|
||||
|
||||
return player.getAttribute(Attribute.GENERIC_MAX_HEALTH).getBaseValue();
|
||||
}
|
||||
|
||||
public static double getMaxHealth(Player player)
|
||||
|
@ -214,7 +214,7 @@ public abstract class EntityContainerAbstract<E extends EntityInternal<E>> imple
|
||||
{
|
||||
try
|
||||
{
|
||||
return this.getEntityClass().newInstance();
|
||||
return this.getEntityClass().getDeclaredConstructor().newInstance();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
@ -1,9 +1,9 @@
|
||||
package com.massivecraft.massivecore.util;
|
||||
|
||||
import com.massivecraft.massivecore.collections.MassiveSet;
|
||||
import com.massivecraft.massivecore.predicate.Predicate;
|
||||
import com.massivecraft.massivecore.ps.PS;
|
||||
|
||||
import java.util.function.Predicate;
|
||||
import java.util.Set;
|
||||
|
||||
public class ChunkUtil
|
||||
@ -89,7 +89,7 @@ public class ChunkUtil
|
||||
for (PS neighbour : neighbours)
|
||||
{
|
||||
if (set.contains(neighbour)) continue;
|
||||
if ( ! matcher.apply(neighbour)) continue;
|
||||
if ( ! matcher.test(neighbour)) continue;
|
||||
|
||||
expansion.add(neighbour);
|
||||
}
|
||||
|
@ -213,7 +213,7 @@ public class ReflectionUtil
|
||||
{
|
||||
try
|
||||
{
|
||||
return (T) clazz.newInstance();
|
||||
return (T) clazz.getDeclaredConstructor().newInstance();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
@ -5,7 +5,6 @@ import com.massivecraft.massivecore.collections.MassiveList;
|
||||
import com.massivecraft.massivecore.command.MassiveCommand;
|
||||
import com.massivecraft.massivecore.mson.Mson;
|
||||
import com.massivecraft.massivecore.mson.MsonEvent;
|
||||
import com.massivecraft.massivecore.predicate.Predicate;
|
||||
import com.massivecraft.massivecore.predicate.PredicateStartsWithIgnoreCase;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
@ -23,6 +22,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
@ -852,7 +852,7 @@ public class Txt
|
||||
// Fill Ret
|
||||
for (T element : elements)
|
||||
{
|
||||
if ( ! predicate.apply(element)) continue;
|
||||
if ( ! predicate.test(element)) continue;
|
||||
ret.add(element);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user