mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-02-11 11:49:12 +00:00
Merge branch '1.13' into 1.13-items
This commit is contained in:
commit
659f1a271a
6 changed files with 64 additions and 27 deletions
|
@ -1529,4 +1529,8 @@ public class OfflinePlayer implements Player {
|
|||
public PistonMoveReaction getPistonMoveReaction() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateCommands() {
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,8 +16,17 @@ import static com.earth2me.essentials.I18n.tl;
|
|||
|
||||
|
||||
public class Commandwhois extends EssentialsCommand {
|
||||
private Statistic playOneTick;
|
||||
|
||||
public Commandwhois() {
|
||||
super("whois");
|
||||
try {
|
||||
// For some reason, in 1.13 PLAY_ONE_MINUTE = ticks played
|
||||
// https://hub.spigotmc.org/stash/projects/SPIGOT/repos/bukkit/commits/b848d8ce633871b52115247b089029749c02f579
|
||||
playOneTick = Statistic.valueOf("PLAY_ONE_MINUTE");
|
||||
} catch (IllegalArgumentException e) {
|
||||
playOneTick = Statistic.valueOf("PLAY_ONE_TICK");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -36,7 +45,7 @@ public class Commandwhois extends EssentialsCommand {
|
|||
sender.sendMessage(tl("whoisHunger", user.getBase().getFoodLevel(), user.getBase().getSaturation()));
|
||||
sender.sendMessage(tl("whoisExp", SetExpFix.getTotalExperience(user.getBase()), user.getBase().getLevel()));
|
||||
sender.sendMessage(tl("whoisLocation", user.getLocation().getWorld().getName(), user.getLocation().getBlockX(), user.getLocation().getBlockY(), user.getLocation().getBlockZ()));
|
||||
long playtimeMs = System.currentTimeMillis() - (user.getBase().getStatistic(Statistic.PLAY_ONE_MINUTE) * 60);
|
||||
long playtimeMs = System.currentTimeMillis() - (user.getBase().getStatistic(playOneTick) * 50);
|
||||
sender.sendMessage(tl("whoisPlaytime", DateUtil.formatDateDiff(playtimeMs)));
|
||||
if (!ess.getSettings().isEcoDisabled()) {
|
||||
sender.sendMessage(tl("whoisMoney", NumberUtil.displayCurrency(user.getMoney(), ess)));
|
||||
|
|
|
@ -708,4 +708,19 @@ public class FakeWorld implements World {
|
|||
public List<Entity> getNearbyEntities(Location loc, double x, double y, double z) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T getGameRuleDefault(GameRule<T> arg0) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T getGameRuleValue(GameRule<T> arg0) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> boolean setGameRule(GameRule<T> arg0, T arg1) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ import org.bukkit.enchantments.Enchantment;
|
|||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.material.MaterialData;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.yaml.snakeyaml.constructor.BaseConstructor;
|
||||
import org.yaml.snakeyaml.constructor.CustomClassLoaderConstructor;
|
||||
import org.yaml.snakeyaml.introspector.PropertyUtils;
|
||||
import org.yaml.snakeyaml.nodes.*;
|
||||
|
@ -34,28 +35,28 @@ public class BukkitConstructor extends CustomClassLoaderConstructor {
|
|||
setPropertyUtils(propertyUtils);
|
||||
}
|
||||
|
||||
private Method constructScalarMethod = null;
|
||||
|
||||
protected String constructScalarRefl(ScalarNode scalarNode) {
|
||||
try {
|
||||
if (constructScalarMethod == null) {
|
||||
constructScalarMethod = BaseConstructor.class.getDeclaredMethod("constructScalar", ScalarNode.class);
|
||||
}
|
||||
return (String) constructScalarMethod.invoke(this, scalarNode);
|
||||
} catch (NoSuchMethodException
|
||||
| SecurityException
|
||||
| IllegalAccessException
|
||||
| IllegalArgumentException
|
||||
| InvocationTargetException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
private class ConstructBukkitScalar extends ConstructScalar {
|
||||
|
||||
private Method constructScalarMethod = null;
|
||||
|
||||
protected String constructScalarRefl(ScalarNode scalarNode) {
|
||||
try {
|
||||
if (constructScalarMethod == null) {
|
||||
constructScalarMethod = ConstructScalar.class.getMethod("constructScalar", ScalarNode.class);
|
||||
}
|
||||
return (String) constructScalarMethod.invoke(this, scalarNode);
|
||||
} catch (NoSuchMethodException
|
||||
| SecurityException
|
||||
| IllegalAccessException
|
||||
| IllegalArgumentException
|
||||
| InvocationTargetException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object construct(final Node node) {
|
||||
if (node.getType().equals(Material.class)) {
|
||||
|
@ -167,6 +168,7 @@ public class BukkitConstructor extends CustomClassLoaderConstructor {
|
|||
}
|
||||
|
||||
private class ConstructBukkitMapping extends ConstructMapping {
|
||||
|
||||
@Override
|
||||
public Object construct(final Node node) {
|
||||
if (node.getType().equals(Location.class)) {
|
||||
|
@ -179,25 +181,25 @@ public class BukkitConstructor extends CustomClassLoaderConstructor {
|
|||
return null;
|
||||
}
|
||||
for (NodeTuple nodeTuple : mnode.getValue()) {
|
||||
final String key = (String) constructScalar((ScalarNode) nodeTuple.getKeyNode());
|
||||
final String key = constructScalarRefl((ScalarNode) nodeTuple.getKeyNode());
|
||||
final ScalarNode snode = (ScalarNode) nodeTuple.getValueNode();
|
||||
if (key.equalsIgnoreCase("world")) {
|
||||
worldName = (String) constructScalar(snode);
|
||||
worldName = constructScalarRefl(snode);
|
||||
}
|
||||
if (key.equalsIgnoreCase("x")) {
|
||||
x = Double.parseDouble((String) constructScalar(snode));
|
||||
x = Double.parseDouble(constructScalarRefl(snode));
|
||||
}
|
||||
if (key.equalsIgnoreCase("y")) {
|
||||
y = Double.parseDouble((String) constructScalar(snode));
|
||||
y = Double.parseDouble(constructScalarRefl(snode));
|
||||
}
|
||||
if (key.equalsIgnoreCase("z")) {
|
||||
z = Double.parseDouble((String) constructScalar(snode));
|
||||
z = Double.parseDouble(constructScalarRefl(snode));
|
||||
}
|
||||
if (key.equalsIgnoreCase("yaw")) {
|
||||
yaw = Float.parseFloat((String) constructScalar(snode));
|
||||
yaw = Float.parseFloat(constructScalarRefl(snode));
|
||||
}
|
||||
if (key.equalsIgnoreCase("pitch")) {
|
||||
pitch = Float.parseFloat((String) constructScalar(snode));
|
||||
pitch = Float.parseFloat(constructScalarRefl(snode));
|
||||
}
|
||||
}
|
||||
if (worldName == null || worldName.isEmpty()) {
|
||||
|
|
|
@ -25,6 +25,7 @@ import org.bukkit.event.player.PlayerJoinEvent;
|
|||
import org.bukkit.generator.ChunkGenerator;
|
||||
import org.bukkit.help.HelpMap;
|
||||
import org.bukkit.inventory.*;
|
||||
import org.bukkit.loot.LootTable;
|
||||
import org.bukkit.map.MapView;
|
||||
import org.bukkit.permissions.Permissible;
|
||||
import org.bukkit.permissions.Permission;
|
||||
|
@ -1152,4 +1153,9 @@ public class FakeServer implements Server {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public LootTable getLootTable(NamespacedKey arg0) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@ public class ReflUtil {
|
|||
public static final NMSVersion V1_10_R1 = NMSVersion.fromString("v1_10_R1");
|
||||
public static final NMSVersion V1_11_R1 = NMSVersion.fromString("v1_11_R1");
|
||||
public static final NMSVersion V1_12_R1 = NMSVersion.fromString("v1_12_R1");
|
||||
public static final NMSVersion V1_13_R1 = NMSVersion.fromString("v1_13_R1");
|
||||
private static NMSVersion nmsVersionObject;
|
||||
private static String nmsVersion;
|
||||
|
||||
|
|
Loading…
Reference in a new issue