fixes
This commit is contained in:
parent
86ef10456c
commit
26b7ea2d59
@ -6,7 +6,7 @@ public class EnclosedObject<T>
|
||||
|
||||
public EnclosedObject()
|
||||
{
|
||||
this(null);
|
||||
this((T) null);
|
||||
}
|
||||
|
||||
public EnclosedObject(T t)
|
||||
@ -23,4 +23,90 @@ public class EnclosedObject<T>
|
||||
{
|
||||
return _value = value;
|
||||
}
|
||||
|
||||
public String toString()
|
||||
{
|
||||
return _value.toString();
|
||||
}
|
||||
|
||||
// Arithmetic operations, will only work if T is an instance of Number
|
||||
public long Add(Number number)
|
||||
{
|
||||
if (!(_value instanceof Number))
|
||||
{
|
||||
throw new RuntimeException("Type of T must be an instance of Number to perform arithmetic.");
|
||||
}
|
||||
|
||||
return ((Number) _value).longValue() + number.longValue();
|
||||
}
|
||||
|
||||
public long Subtract(Number number)
|
||||
{
|
||||
if (!(_value instanceof Number))
|
||||
{
|
||||
throw new RuntimeException("Type of T must be an instance of Number to perform arithmetic.");
|
||||
}
|
||||
|
||||
return ((Number) _value).longValue() - number.longValue();
|
||||
}
|
||||
|
||||
public long Multiply(Number number)
|
||||
{
|
||||
if (!(_value instanceof Number))
|
||||
{
|
||||
throw new RuntimeException("Type of T must be an instance of Number to perform arithmetic.");
|
||||
}
|
||||
|
||||
return ((Number) _value).longValue() * number.longValue();
|
||||
}
|
||||
|
||||
public long Divide(Number number)
|
||||
{
|
||||
if (!(_value instanceof Number))
|
||||
{
|
||||
throw new RuntimeException("Type of T must be an instance of Number to perform arithmetic.");
|
||||
}
|
||||
|
||||
return ((Number) _value).longValue() / number.longValue();
|
||||
}
|
||||
|
||||
public double PreciseAdd(Number number)
|
||||
{
|
||||
if (!(_value instanceof Number))
|
||||
{
|
||||
throw new RuntimeException("Type of T must be an instance of Number to perform arithmetic.");
|
||||
}
|
||||
|
||||
return ((Number) _value).doubleValue() + number.doubleValue();
|
||||
}
|
||||
|
||||
public double PreciseSubtract(Number number)
|
||||
{
|
||||
if (!(_value instanceof Number))
|
||||
{
|
||||
throw new RuntimeException("Type of T must be an instance of Number to perform arithmetic.");
|
||||
}
|
||||
|
||||
return ((Number) _value).doubleValue() - number.doubleValue();
|
||||
}
|
||||
|
||||
public double PreciseMultiply(Number number)
|
||||
{
|
||||
if (!(_value instanceof Number))
|
||||
{
|
||||
throw new RuntimeException("Type of T must be an instance of Number to perform arithmetic.");
|
||||
}
|
||||
|
||||
return ((Number) _value).doubleValue() * number.doubleValue();
|
||||
}
|
||||
|
||||
public double PreciseDivide(Number number)
|
||||
{
|
||||
if (!(_value instanceof Number))
|
||||
{
|
||||
throw new RuntimeException("Type of T must be an instance of Number to perform arithmetic.");
|
||||
}
|
||||
|
||||
return ((Number) _value).doubleValue() / number.doubleValue();
|
||||
}
|
||||
}
|
||||
|
@ -6,14 +6,13 @@ import java.sql.Timestamp;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import mineplex.core.database.MinecraftRepository;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import mineplex.core.account.CoreClient;
|
||||
import mineplex.core.common.util.Callback;
|
||||
import mineplex.core.common.util.NonFinalInteger;
|
||||
import mineplex.core.common.util.EnclosedObject;
|
||||
import mineplex.core.database.MinecraftRepository;
|
||||
import mineplex.serverdata.database.DBPool;
|
||||
import mineplex.serverdata.database.RepositoryBase;
|
||||
import mineplex.serverdata.database.ResultSetCallable;
|
||||
import mineplex.serverdata.database.column.ColumnBoolean;
|
||||
import mineplex.serverdata.database.column.ColumnInt;
|
||||
@ -127,7 +126,7 @@ public class ClansBanRepository extends MinecraftRepository
|
||||
public void processResultSet(ResultSet resultSet) throws SQLException
|
||||
{
|
||||
final List<ClansBanClient> clients = new ArrayList<>();
|
||||
final NonFinalInteger resultsProcessed = new NonFinalInteger();
|
||||
final EnclosedObject<Integer> resultsProcessed = new EnclosedObject<>();
|
||||
int resultsFound = 0;
|
||||
|
||||
while (resultSet.next())
|
||||
|
@ -27,9 +27,9 @@ import org.bukkit.util.Vector;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.ColorFader;
|
||||
import mineplex.core.common.util.EnclosedObject;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.LoopIterator;
|
||||
import mineplex.core.common.util.NonFinalInteger;
|
||||
import mineplex.core.common.util.RGBData;
|
||||
import mineplex.core.common.util.UtilAction;
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
@ -543,18 +543,18 @@ public class Outpost implements Listener
|
||||
{
|
||||
_state = OutpostState.DESTRUCTING;
|
||||
|
||||
NonFinalInteger wait = new NonFinalInteger(0);
|
||||
EnclosedObject<Integer> wait = new EnclosedObject<>(0);
|
||||
|
||||
_blocks.values().stream().filter(block -> UtilMath.random.nextBoolean() && UtilMath.random.nextBoolean()).filter(block -> UtilMath.random.nextBoolean()).limit(13).forEach(block ->
|
||||
_outpostManager.runSyncLater(() -> {
|
||||
UtilParticle.PlayParticleToAll(ParticleType.HUGE_EXPLOSION, block.getLocation(), new Vector(0,0,0), 1f, 1, ViewDist.MAX);
|
||||
_origin.getWorld().playSound(block.getLocation(), Sound.EXPLODE, 1.0f, 1.0f);
|
||||
}, wait.add(4 + UtilMath.random.nextInt(4)).get())
|
||||
}, wait.Add(Integer.valueOf(4 + UtilMath.random.nextInt(4))))
|
||||
);
|
||||
|
||||
_outpostManager.runSyncLater(() -> {
|
||||
_blocks.values().stream().forEach(OutpostBlock::restore);
|
||||
}, wait.get() + 5L);
|
||||
}, wait.Get().intValue() + 5L);
|
||||
|
||||
_outpostManager.runSyncLater(() -> {
|
||||
_blocks.values().stream().forEach(block -> {
|
||||
@ -578,7 +578,7 @@ public class Outpost implements Listener
|
||||
});
|
||||
|
||||
cleanup();
|
||||
}, wait.get() + 6L);
|
||||
}, wait.Get().intValue() + 6L);
|
||||
|
||||
if (_lifetimeLeft != null) _lifetimeLeft.stop();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user