Merge 290b80472e
into 58f1423a6e
This commit is contained in:
commit
25c03b19fb
|
@ -174,8 +174,6 @@ public class ArenaClass
|
|||
* @param p a player
|
||||
*/
|
||||
public void grantItems(Player p) {
|
||||
PlayerInventory inv = p.getInventory();
|
||||
|
||||
// Fork over the items.
|
||||
items.forEach(item -> item.giveTo(p));
|
||||
|
||||
|
@ -294,8 +292,9 @@ public class ArenaClass
|
|||
case ENDER_CHEST:
|
||||
case SHULKER_SHELL:
|
||||
return true;
|
||||
default:
|
||||
return type.name().endsWith("SHULKER_BOX");
|
||||
}
|
||||
return type.name().endsWith("SHULKER_BOX");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1402,6 +1402,9 @@ public class ArenaImpl implements Arena
|
|||
case PRIMED_TNT:
|
||||
case SHULKER_BULLET:
|
||||
e.remove();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -329,6 +329,8 @@ public class ArenaListener
|
|||
case SNOW:
|
||||
event.setCancelled(true);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -354,6 +356,8 @@ public class ArenaListener
|
|||
case LAVA:
|
||||
event.setCancelled(true);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -410,6 +414,8 @@ public class ArenaListener
|
|||
}
|
||||
return;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
// If not custom, we probably don't want it, so get rid of it
|
||||
|
|
|
@ -10,9 +10,6 @@ import com.garbagemule.MobArena.util.Slugs;
|
|||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@CommandInfo(
|
||||
name = "addarena",
|
||||
pattern = "(add|new)arena",
|
||||
|
|
|
@ -328,8 +328,9 @@ public class SetupCommand implements Command, Listener {
|
|||
switch (action) {
|
||||
case LEFT_CLICK_BLOCK: regions(lower, loc); return true;
|
||||
case RIGHT_CLICK_BLOCK: regions(upper, loc); return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean warps(PlayerInteractEvent event) {
|
||||
|
@ -350,8 +351,9 @@ public class SetupCommand implements Command, Listener {
|
|||
}
|
||||
next = formatYellow("Current warp: %s", warpArray[warpIndex]);
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean spawns(PlayerInteractEvent event) {
|
||||
|
@ -364,8 +366,9 @@ public class SetupCommand implements Command, Listener {
|
|||
switch (event.getAction()) {
|
||||
case LEFT_CLICK_BLOCK: spawns(l, true); return true;
|
||||
case RIGHT_CLICK_BLOCK: spawns(l, false); return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean chests(PlayerInteractEvent event) {
|
||||
|
@ -377,8 +380,9 @@ public class SetupCommand implements Command, Listener {
|
|||
switch (event.getAction()) {
|
||||
case LEFT_CLICK_BLOCK: chests(b, true); return true;
|
||||
case RIGHT_CLICK_BLOCK: chests(b, false); return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private void fix(Location loc) {
|
||||
|
|
|
@ -128,7 +128,43 @@ class Environment {
|
|||
operators.add(i, token);
|
||||
}
|
||||
|
||||
@SuppressWarnings("Convert2MethodRef")
|
||||
// math functions implemented here to get rid of "unchecked conversion" warnings...
|
||||
private static Double sqrt(Double a) {
|
||||
return Math.sqrt(a);
|
||||
}
|
||||
|
||||
private static Double abs(Double a) {
|
||||
return Math.abs(a);
|
||||
}
|
||||
|
||||
private static Double ceil(Double a) {
|
||||
return Math.ceil(a);
|
||||
}
|
||||
|
||||
private static Double floor(Double a) {
|
||||
return Math.floor(a);
|
||||
}
|
||||
|
||||
private static Double sin(Double a) {
|
||||
return Math.sin(a);
|
||||
}
|
||||
|
||||
private static Double cos(Double a) {
|
||||
return Math.cos(a);
|
||||
}
|
||||
|
||||
private static Double tan(Double a) {
|
||||
return Math.tan(a);
|
||||
}
|
||||
|
||||
private static Double min(Double a, Double b) {
|
||||
return Math.min(a, b);
|
||||
}
|
||||
|
||||
private static Double max(Double a, Double b) {
|
||||
return Math.max(a, b);
|
||||
}
|
||||
|
||||
static Environment createDefault() {
|
||||
Environment result = new Environment();
|
||||
|
||||
|
@ -149,20 +185,20 @@ class Environment {
|
|||
result.registerBinaryOperator("^", 4, false, (a, b) -> Math.pow(a, b));
|
||||
|
||||
// Unary functions
|
||||
result.registerUnaryFunction("sqrt", Math::sqrt);
|
||||
result.registerUnaryFunction("abs", Math::abs);
|
||||
result.registerUnaryFunction("sqrt", Environment::sqrt);
|
||||
result.registerUnaryFunction("abs", Environment::abs);
|
||||
|
||||
result.registerUnaryFunction("ceil", Math::ceil);
|
||||
result.registerUnaryFunction("floor", Math::floor);
|
||||
result.registerUnaryFunction("ceil", Environment::ceil);
|
||||
result.registerUnaryFunction("floor", Environment::floor);
|
||||
result.registerUnaryFunction("round", value -> (double) Math.round(value));
|
||||
|
||||
result.registerUnaryFunction("sin", Math::sin);
|
||||
result.registerUnaryFunction("cos", Math::cos);
|
||||
result.registerUnaryFunction("tan", Math::tan);
|
||||
result.registerUnaryFunction("sin", Environment::sin);
|
||||
result.registerUnaryFunction("cos", Environment::cos);
|
||||
result.registerUnaryFunction("tan", Environment::tan);
|
||||
|
||||
// Binary functions
|
||||
result.registerBinaryFunction("min", Math::min);
|
||||
result.registerBinaryFunction("max", Math::max);
|
||||
result.registerBinaryFunction("min", Environment::min);
|
||||
result.registerBinaryFunction("max", Environment::max);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -20,32 +20,26 @@ public class FormulaManager {
|
|||
this.parser = parser;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public void registerConstant(String name, double value) {
|
||||
env.registerConstant(name, value);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public void registerVariable(String name, Formula formula) {
|
||||
env.registerVariable(name, formula);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public void registerUnaryOperator(String symbol, int precedence, UnaryOperation operation) {
|
||||
env.registerUnaryOperator(symbol, precedence, operation);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public void registerBinaryOperator(String symbol, int precedence, boolean left, BinaryOperation operation) {
|
||||
env.registerBinaryOperator(symbol, precedence, left, operation);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public void registerUnaryFunction(String name, UnaryOperation operation) {
|
||||
env.registerUnaryFunction(name, operation);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public void registerBinaryFunction(String name, BinaryOperation operation) {
|
||||
env.registerBinaryFunction(name, operation);
|
||||
}
|
||||
|
|
|
@ -266,6 +266,8 @@ public class Leaderboard
|
|||
case SOUTH: return BlockFace.EAST;
|
||||
case WEST: return BlockFace.SOUTH;
|
||||
case EAST: return BlockFace.NORTH;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
|
|
@ -9,7 +9,6 @@ import java.io.Serializable;
|
|||
* NOTE: I (garbagemule) DID NOT WRITE THIS CLASS (notice the author below)
|
||||
* @author creadri
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class EntityPosition implements Serializable{
|
||||
private double x;
|
||||
private double y;
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package com.garbagemule.MobArena.waves;
|
||||
|
||||
import com.garbagemule.MobArena.healthbar.HealthBar;
|
||||
import com.garbagemule.MobArena.things.Thing;
|
||||
import com.garbagemule.MobArena.things.ThingPicker;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.attribute.Attribute;
|
||||
|
|
|
@ -4,7 +4,6 @@ import com.garbagemule.MobArena.Msg;
|
|||
import com.garbagemule.MobArena.formula.Formula;
|
||||
import com.garbagemule.MobArena.formula.Formulas;
|
||||
import com.garbagemule.MobArena.framework.Arena;
|
||||
import com.garbagemule.MobArena.things.Thing;
|
||||
import com.garbagemule.MobArena.things.ThingPicker;
|
||||
import com.garbagemule.MobArena.waves.AbstractWave;
|
||||
import com.garbagemule.MobArena.waves.BossAbilityThread;
|
||||
|
|
Loading…
Reference in New Issue