mirror of
https://github.com/EssentialsX/Essentials.git
synced 2026-11-05 01:00:13 -05:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f57557b43a | ||
|
|
0711fd6f9e | ||
|
|
b5ecbd1739 | ||
|
|
dda5e4e333 | ||
|
|
dde4a36df0 | ||
|
|
31b98fb9f3 | ||
|
|
289d34d96c | ||
|
|
eafd110ed0 | ||
|
|
e72644abf4 | ||
|
|
b267103274 | ||
|
|
3856a690eb | ||
|
|
f214696664 | ||
|
|
9e73c29b40 | ||
|
|
aca83bd462 | ||
|
|
189d6a23c6 | ||
|
|
441f88deea | ||
|
|
6d6666dace | ||
|
|
fb779533e6 | ||
|
|
7325113a8c | ||
|
|
827217823e | ||
|
|
060dfc69f4 | ||
|
|
b831713737 | ||
|
|
7da90b3a6b | ||
|
|
32540c23ab | ||
|
|
d24b0616f8 | ||
|
|
9aef2ef883 | ||
|
|
727d473319 | ||
|
|
8225e51867 | ||
|
|
1ba6c2a596 | ||
|
|
60a166aeb0 | ||
|
|
65c2155bca | ||
|
|
6031c01584 | ||
|
|
da8e8c8a25 | ||
|
|
70a750a32d | ||
|
|
7c63324504 | ||
|
|
dd41b10522 | ||
|
|
7948e764d4 | ||
|
|
82ede4530a | ||
|
|
e8ab2db8e8 | ||
|
|
8882e0214c | ||
|
|
4adb669cdd | ||
|
|
7e1d258dd3 | ||
|
|
417fe29e21 | ||
|
|
bd8ef2a25d | ||
|
|
fd01b75c33 | ||
|
|
1388755d2a | ||
|
|
97cc3d0066 | ||
|
|
694cf7a79e | ||
|
|
da89efb79f | ||
|
|
04ec013407 | ||
|
|
023cf6a1aa | ||
|
|
f7cbb141f8 | ||
|
|
5690952516 | ||
|
|
e94202c55a | ||
|
|
aa6ad271a0 | ||
|
|
3b41bb47b6 | ||
|
|
e7bdb7fabc | ||
|
|
110698223d | ||
|
|
437be593b9 | ||
|
|
502d37b574 | ||
|
|
df59f9f859 | ||
|
|
f436fbab6b | ||
|
|
8404720501 | ||
|
|
4431d452f1 | ||
|
|
6a529d6671 | ||
|
|
78fca9a67a | ||
|
|
0114b5e4f6 | ||
|
|
5a14a64b6c | ||
|
|
b555ea6350 | ||
|
|
361ae1dd16 | ||
|
|
58117eba88 | ||
|
|
6260b49b4f | ||
|
|
988239267b | ||
|
|
19cffe3872 | ||
|
|
3b1cef918e | ||
|
|
246fd03265 |
No files matched your search
+18
-53
@@ -1,53 +1,18 @@
|
||||
.DS_Store
|
||||
/BuildAll/nbproject/private/
|
||||
/EssentialsProtect/nbproject/private/
|
||||
/EssentialsChat/nbproject/private/
|
||||
/EssentialsGroupBridge/nbproject/private/
|
||||
/EssentialsGeoIP/nbproject/private/
|
||||
/EssentialsSpawn/nbproject/private/
|
||||
/EssentialsXMPP/nbproject/private/
|
||||
/BuildAll/build/
|
||||
/EssentialsGroupBridge/dist/
|
||||
/EssentialsGroupBridge/build/
|
||||
/EssentialsGeoIP/dist/
|
||||
/EssentialsGeoIP/build/
|
||||
/BuildAll/dist/
|
||||
/EssentialsChat/build/
|
||||
/EssentialsChat/dist/
|
||||
/EssentialsSpawn/build/
|
||||
/EssentialsSpawn/dist/
|
||||
/EssentialsXMPP/dist/
|
||||
/EssentialsXMPP/build/
|
||||
/EssentialsProtect/dist/
|
||||
/EssentialsProtect/build/
|
||||
/EssentialsPermissionsCommands/nbproject/private/
|
||||
/EssentialsPermissionsCommands/build/
|
||||
/EssentialsPermissionsCommands/dist/
|
||||
/Essentials/nbproject/private/
|
||||
/Essentials/dist/
|
||||
/Essentials/build/
|
||||
/YamlAnnotations/
|
||||
/EssentialsUpdate/nbproject/private/
|
||||
/EssentialsRelease/
|
||||
/EssentialsUpdate/dist/
|
||||
/EssentialsUpdate/build/
|
||||
/WebPush/apikey.php
|
||||
/WebPush/nbproject/private
|
||||
/EssentialsAntiBuild/nbproject/private/
|
||||
/EssentialsAntiBuild/dist/
|
||||
/EssentialsAntiBuild/build/
|
||||
/jars
|
||||
/out
|
||||
.idea/
|
||||
*.iml
|
||||
*.classpath
|
||||
*.project
|
||||
*.settings/
|
||||
target/
|
||||
dependency-reduced-pom.xml
|
||||
/Essentials/config.yml
|
||||
/Essentials/kits.yml
|
||||
/Essentials/userdata/testplayer1.yml
|
||||
/Essentials/usermap.csv
|
||||
/Essentials/userdata
|
||||
/EssentialsGroupManager/target/
|
||||
# IDE files
|
||||
*.classpath
|
||||
*.project
|
||||
*.settings/
|
||||
.idea/
|
||||
*.iml
|
||||
.DS_Store
|
||||
|
||||
# Essentials files
|
||||
/Essentials/userdata
|
||||
/Essentials/config.yml
|
||||
/Essentials/kits.yml
|
||||
/Essentials/userdata/testplayer1.yml
|
||||
/Essentials/usermap.csv
|
||||
|
||||
# Build files
|
||||
target/
|
||||
jars/
|
||||
+2
-15
@@ -1,23 +1,10 @@
|
||||
language: java
|
||||
|
||||
branches:
|
||||
only:
|
||||
- 2.x
|
||||
- 1.13
|
||||
|
||||
cache:
|
||||
directories:
|
||||
- .buildtools
|
||||
- $HOME/.m2
|
||||
|
||||
before_install:
|
||||
- mkdir -p .buildtools
|
||||
- cd .buildtools
|
||||
- wget -O BuildTools.jar https://hub.spigotmc.org/jenkins/job/BuildTools/lastSuccessfulBuild/artifact/target/BuildTools.jar
|
||||
- rm -r work/
|
||||
- java -jar BuildTools.jar --rev 1.8
|
||||
- java -jar BuildTools.jar --rev 1.8.3
|
||||
- java -jar BuildTools.jar --rev 1.9
|
||||
- java -jar BuildTools.jar --rev 1.9.4
|
||||
- java -jar BuildTools.jar --rev 1.13.1
|
||||
- cd ..
|
||||
- chmod +x scripts/buildtools.sh
|
||||
- scripts/buildtools.sh
|
||||
+27
-31
@@ -6,25 +6,18 @@
|
||||
<parent>
|
||||
<groupId>net.ess3</groupId>
|
||||
<artifactId>EssentialsXParent</artifactId>
|
||||
<version>2.16.0</version>
|
||||
<version>2.16.1</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>EssentialsX</artifactId>
|
||||
|
||||
<licenses>
|
||||
<license>
|
||||
<name>GPLv3</name>
|
||||
<url>http://www.gnu.org/copyleft/gpl.html</url>
|
||||
</license>
|
||||
</licenses>
|
||||
|
||||
<build>
|
||||
<finalName>EssentialsX-${full.version}</finalName>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.7.0</version>
|
||||
<version>3.8.0</version>
|
||||
<configuration>
|
||||
<showDeprecation>false</showDeprecation>
|
||||
</configuration>
|
||||
@@ -32,7 +25,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>3.1.0</version>
|
||||
<version>3.2.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
@@ -41,6 +34,15 @@
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<createDependencyReducedPom>false</createDependencyReducedPom>
|
||||
<relocations>
|
||||
<relocation>
|
||||
<pattern>io.papermc.lib</pattern>
|
||||
<shadedPattern>com.earth2me.essentials.paperlib</shadedPattern>
|
||||
</relocation>
|
||||
</relocations>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
@@ -48,26 +50,32 @@
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>net.milkbowl.vault</groupId>
|
||||
<artifactId>Vault</artifactId>
|
||||
<version>1.5.6</version>
|
||||
<artifactId>VaultAPI</artifactId>
|
||||
<version>1.7</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.papermc</groupId>
|
||||
<artifactId>paperlib</artifactId>
|
||||
<version>1.0.2</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.ess3</groupId>
|
||||
<artifactId>NMSProvider</artifactId>
|
||||
<version>2.16.0</version>
|
||||
<version>2.16.1</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.ess3</groupId>
|
||||
<artifactId>UpdatedMetaProvider</artifactId>
|
||||
<version>2.16.0</version>
|
||||
<version>2.16.1</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.ess3</groupId>
|
||||
<artifactId>1_8_R1Provider</artifactId>
|
||||
<version>2.16.0</version>
|
||||
<version>2.16.1</version>
|
||||
<scope>compile</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
@@ -79,7 +87,7 @@
|
||||
<dependency>
|
||||
<groupId>net.ess3</groupId>
|
||||
<artifactId>1_8_R2Provider</artifactId>
|
||||
<version>2.16.0</version>
|
||||
<version>2.16.1</version>
|
||||
<scope>compile</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
@@ -91,32 +99,20 @@
|
||||
<dependency>
|
||||
<groupId>net.ess3</groupId>
|
||||
<artifactId>LegacyProvider</artifactId>
|
||||
<version>2.16.0</version>
|
||||
<version>2.16.1</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.ess3</groupId>
|
||||
<artifactId>ReflectionProvider</artifactId>
|
||||
<version>2.16.0</version>
|
||||
<version>2.16.1</version>
|
||||
<scope>compile</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>craftbukkit</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.ess3</groupId>
|
||||
<artifactId>FlattenedProvider</artifactId>
|
||||
<version>2.16.0</version>
|
||||
<version>2.16.1</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>vault-repo</id>
|
||||
<url>http://nexus.hc.to/content/repositories/pub_releases</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
</project>
|
||||
@@ -1,7 +1,5 @@
|
||||
package com.earth2me.essentials;
|
||||
|
||||
import com.earth2me.essentials.utils.NumberUtil;
|
||||
|
||||
import org.bukkit.NamespacedKey;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
|
||||
@@ -15,6 +13,7 @@ import java.util.Set;
|
||||
public class Enchantments {
|
||||
private static final Map<String, Enchantment> ENCHANTMENTS = new HashMap<String, Enchantment>();
|
||||
private static final Map<String, Enchantment> ALIASENCHANTMENTS = new HashMap<String, Enchantment>();
|
||||
private static boolean isFlat;
|
||||
|
||||
static {
|
||||
ENCHANTMENTS.put("alldamage", Enchantment.DAMAGE_ALL);
|
||||
@@ -231,10 +230,23 @@ public class Enchantments {
|
||||
ALIASENCHANTMENTS.put("channel", channelling);
|
||||
}
|
||||
} catch (IllegalArgumentException ignored) {}
|
||||
|
||||
try {
|
||||
Class<?> namespacedKeyClass = Class.forName("org.bukkit.NamespacedKey");
|
||||
Class<?> enchantmentClass = Class.forName("org.bukkit.enchantments.Enchantment");
|
||||
enchantmentClass.getDeclaredMethod("getByKey", namespacedKeyClass);
|
||||
isFlat = true;
|
||||
} catch (ClassNotFoundException | NoSuchMethodException e) {
|
||||
isFlat = false;
|
||||
}
|
||||
}
|
||||
|
||||
public static Enchantment getByName(String name) {
|
||||
Enchantment enchantment = Enchantment.getByKey(NamespacedKey.minecraft(name.toLowerCase()));
|
||||
Enchantment enchantment = null;
|
||||
if (isFlat) { // 1.13+ only
|
||||
enchantment = Enchantment.getByKey(NamespacedKey.minecraft(name.toLowerCase()));
|
||||
}
|
||||
|
||||
if (enchantment == null) {
|
||||
enchantment = Enchantment.getByName(name.toUpperCase());
|
||||
}
|
||||
|
||||
@@ -196,27 +196,34 @@ public class Essentials extends JavaPlugin implements net.ess3.api.IEssentials {
|
||||
final EssentialsUpgrade upgrade = new EssentialsUpgrade(this);
|
||||
upgrade.beforeSettings();
|
||||
execTimer.mark("Upgrade");
|
||||
|
||||
confList = new ArrayList<>();
|
||||
settings = new Settings(this);
|
||||
confList.add(settings);
|
||||
execTimer.mark("Settings");
|
||||
|
||||
userMap = new UserMap(this);
|
||||
confList.add(userMap);
|
||||
execTimer.mark("Init(Usermap)");
|
||||
|
||||
kits = new Kits(this);
|
||||
confList.add(kits);
|
||||
upgrade.convertKits();
|
||||
execTimer.mark("Kits");
|
||||
|
||||
upgrade.afterSettings();
|
||||
execTimer.mark("Upgrade2");
|
||||
|
||||
warps = new Warps(getServer(), this.getDataFolder());
|
||||
confList.add(warps);
|
||||
execTimer.mark("Init(Spawn/Warp)");
|
||||
|
||||
worth = new Worth(this.getDataFolder());
|
||||
confList.add(worth);
|
||||
itemDb = getItemDbFromConfig();
|
||||
confList.add(itemDb);
|
||||
execTimer.mark("Init(Worth/ItemDB)");
|
||||
|
||||
jails = new Jails(this);
|
||||
confList.add(jails);
|
||||
execTimer.mark("Init(Jails)");
|
||||
@@ -241,6 +248,10 @@ public class Essentials extends JavaPlugin implements net.ess3.api.IEssentials {
|
||||
), "potion meta").getProvider();
|
||||
execTimer.mark("Init(Providers)");
|
||||
reload();
|
||||
|
||||
// The item spawn blacklist is loaded with all other settings, before the item
|
||||
// DB, but it depends on the item DB, so we need to reload it again here:
|
||||
((Settings) settings)._lateLoadItemSpawnBlacklist();
|
||||
} catch (YAMLException exception) {
|
||||
if (pm.getPlugin("EssentialsUpdate") != null) {
|
||||
LOGGER.log(Level.SEVERE, tl("essentialsHelp2"));
|
||||
|
||||
@@ -7,6 +7,7 @@ import com.earth2me.essentials.textreader.TextPager;
|
||||
import com.earth2me.essentials.utils.DateUtil;
|
||||
import com.earth2me.essentials.utils.LocationUtil;
|
||||
import com.earth2me.essentials.utils.MaterialUtil;
|
||||
import io.papermc.lib.PaperLib;
|
||||
import net.ess3.api.IEssentials;
|
||||
|
||||
import org.bukkit.BanEntry;
|
||||
@@ -14,6 +15,7 @@ import org.bukkit.BanList;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.command.PluginCommand;
|
||||
import org.bukkit.entity.HumanEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -601,7 +603,7 @@ public class EssentialsPlayerListener implements Listener {
|
||||
case RIGHT_CLICK_BLOCK:
|
||||
if (!event.isCancelled() && MaterialUtil.isBed(event.getClickedBlock().getType()) && ess.getSettings().getUpdateBedAtDaytime()) {
|
||||
User player = ess.getUser(event.getPlayer());
|
||||
if (player.isAuthorized("essentials.sethome.bed")) {
|
||||
if (player.isAuthorized("essentials.sethome.bed") && player.getWorld().getEnvironment().equals(World.Environment.NORMAL)) {
|
||||
player.getBase().setBedSpawnLocation(event.getClickedBlock().getLocation());
|
||||
player.sendMessage(tl("bedSet", player.getLocation().getWorld().getName(), player.getLocation().getBlockX(), player.getLocation().getBlockY(), player.getLocation().getBlockZ()));
|
||||
}
|
||||
@@ -641,7 +643,7 @@ public class EssentialsPlayerListener implements Listener {
|
||||
while (LocationUtil.isBlockDamaging(loc.getWorld(), loc.getBlockX(), loc.getBlockY() - 1, loc.getBlockZ())) {
|
||||
loc.setY(loc.getY() + 1d);
|
||||
}
|
||||
user.getBase().teleport(loc, TeleportCause.PLUGIN);
|
||||
PaperLib.teleportAsync(user.getBase(), loc, TeleportCause.PLUGIN);
|
||||
}
|
||||
}
|
||||
ess.scheduleSyncDelayedTask(new DelayedClickJumpTask());
|
||||
@@ -727,6 +729,7 @@ public class EssentialsPlayerListener implements Listener {
|
||||
} else if (clickedInventory != null && clickedInventory.getType() == InventoryType.PLAYER) {
|
||||
if (ess.getSettings().isDirectHatAllowed() && event.getClick() == ClickType.LEFT && event.getSlot() == 39
|
||||
&& event.getCursor().getType() != Material.AIR && event.getCursor().getType().getMaxDurability() == 0
|
||||
&& !MaterialUtil.isSkull(event.getCursor().getType())
|
||||
&& ess.getUser(event.getWhoClicked()).isAuthorized("essentials.hat")) {
|
||||
event.setCancelled(true);
|
||||
final PlayerInventory inv = (PlayerInventory) clickedInventory;
|
||||
|
||||
@@ -10,12 +10,17 @@ import org.bukkit.event.server.ServerListPingEvent;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Arrays;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
|
||||
|
||||
public class EssentialsServerListener implements Listener {
|
||||
private static List<String> ignoredSLPECallers = Arrays.asList(
|
||||
".LegacyPingHandler.channelRead(" // CB responding to pings from pre-Netty clients
|
||||
);
|
||||
|
||||
private final transient IEssentials ess;
|
||||
private boolean unsupportedLogged = false;
|
||||
private boolean npeWarned = false;
|
||||
@@ -31,13 +36,13 @@ public class EssentialsServerListener implements Listener {
|
||||
setSampleText = ReflUtil.getMethodCached(ServerListPingEvent.class, "setSampleText", List.class);
|
||||
getSampleText = ReflUtil.getMethodCached(ServerListPingEvent.class, "getSampleText");
|
||||
if (setSampleText != null && getSampleText != null) {
|
||||
ess.getLogger().info("Using Paper 1.12+ ServerListPingEvent methods");
|
||||
ess.getLogger().info("ServerListPingEvent: Paper 1.12.2 setSampleText API");
|
||||
isPaperSample = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
ess.getLogger().info("Using Spigot 1.7.10+ ServerListPingEvent iterator");
|
||||
ess.getLogger().info("ServerListPingEvent: Spigot iterator API");
|
||||
isPaperSample = false;
|
||||
}
|
||||
|
||||
@@ -46,22 +51,16 @@ public class EssentialsServerListener implements Listener {
|
||||
if (isPaperSample) {
|
||||
try {
|
||||
List<String> playerNames = (List<String>) getSampleText.invoke(event, null);
|
||||
Iterator<String> iterator = playerNames.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
String player = iterator.next();
|
||||
if (ess.getUser(player).isVanished()) {
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
playerNames.removeIf(player -> ess.getUser(player).isVanished());
|
||||
setSampleText.invoke(event, playerNames);
|
||||
} catch (IllegalAccessException | InvocationTargetException | ClassCastException e) {
|
||||
if (!unsupportedLogged) {
|
||||
if (!unsupportedLogged && shouldWarnSLPECaller(e)) {
|
||||
ess.getLogger().log(Level.WARNING, "Unable to hide players from server list ping "
|
||||
+ "using Paper 1.12+ method!", e);
|
||||
+ "using Paper 1.12 method!", e);
|
||||
unsupportedLogged = true;
|
||||
}
|
||||
} catch (NullPointerException e) {
|
||||
if (!npeWarned) {
|
||||
if (!npeWarned && shouldWarnSLPECaller(e)) {
|
||||
npeWarned = true;
|
||||
Exception ex = new Exception("A plugin has fired a ServerListPingEvent "
|
||||
+ "without implementing Paper's methods. Point the author to https://git.io/v7Xzl.");
|
||||
@@ -79,12 +78,38 @@ public class EssentialsServerListener implements Listener {
|
||||
}
|
||||
}
|
||||
} catch (UnsupportedOperationException e) {
|
||||
if (!unsupportedLogged) {
|
||||
ess.getLogger().warning("Current server implementation does not support "
|
||||
+ "hiding players from server list ping. Update or contact the maintainers.");
|
||||
if (!unsupportedLogged && shouldWarnSLPECaller(e)) {
|
||||
ess.getLogger().log(Level.WARNING, "Could not hide vanished players while handling " + event.getClass().getName(), e);
|
||||
unsupportedLogged = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Should we warn about this SLPE caller, or should we silently ignore it?
|
||||
* This checks against the ignoredSLPECallers strings, and if it matches one of those, we
|
||||
* return false.
|
||||
*
|
||||
* @param throwable A throwable caught by a catch block
|
||||
* @return Whether or not to send a warning about this particular caller
|
||||
*/
|
||||
private boolean shouldWarnSLPECaller(Throwable throwable) {
|
||||
final int maxStackDepth = 20; // Limit the depth when searching through the stack trace
|
||||
int depth = 0;
|
||||
for (StackTraceElement element : throwable.getStackTrace()) {
|
||||
depth++;
|
||||
if (depth > maxStackDepth) {
|
||||
break;
|
||||
}
|
||||
|
||||
for (String ignoredString : ignoredSLPECallers) {
|
||||
if (element.toString().contains(ignoredString)) {
|
||||
return false; // We know about this error and should ignore it, so don't warn
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true; // We don't know for certain that we can ignore this, so warn just to be safe
|
||||
}
|
||||
}
|
||||
@@ -93,7 +93,7 @@ public class I18n implements net.ess3.api.II18n {
|
||||
}
|
||||
messageFormatCache.put(format, messageFormat);
|
||||
}
|
||||
return messageFormat.format(objects);
|
||||
return messageFormat.format(objects).replace(' ', ' '); // replace nbsp with a space
|
||||
}
|
||||
|
||||
public void updateLocale(final String loc) {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.earth2me.essentials;
|
||||
|
||||
import com.earth2me.essentials.craftbukkit.InventoryWorkaround;
|
||||
import com.earth2me.essentials.utils.EnumUtil;
|
||||
import com.earth2me.essentials.utils.StringUtil;
|
||||
import org.bukkit.DyeColor;
|
||||
import org.bukkit.Material;
|
||||
@@ -53,9 +54,9 @@ public enum MobData {
|
||||
BAY_HORSE("bay", EntityType.HORSE, Horse.Color.BROWN, true),
|
||||
BROWN_HORSE("brown", EntityType.HORSE, Horse.Color.BROWN, false),
|
||||
SADDLE_HORSE("saddle", EntityType.HORSE, Data.HORSESADDLE, true),
|
||||
GOLD_ARMOR_HORSE("goldarmor", EntityType.HORSE, Material.GOLDEN_HORSE_ARMOR, true),
|
||||
DIAMOND_ARMOR_HORSE("diamondarmor", EntityType.HORSE, Material.DIAMOND_HORSE_ARMOR, true),
|
||||
ARMOR_HORSE("armor", EntityType.HORSE, Material.IRON_HORSE_ARMOR, true),
|
||||
GOLD_ARMOR_HORSE("goldarmor", EntityType.HORSE, EnumUtil.getMaterial("GOLDEN_HORSE_ARMOR", "GOLD_BARDING"), true),
|
||||
DIAMOND_ARMOR_HORSE("diamondarmor", EntityType.HORSE, EnumUtil.getMaterial("DIAMOND_HORSE_ARMOR", "DIAMOND_BARDING"), true),
|
||||
ARMOR_HORSE("armor", EntityType.HORSE, EnumUtil.getMaterial("IRON_HORSE_ARMOR", "IRON_BARDING"), true),
|
||||
SIAMESE_CAT("siamese", EntityType.OCELOT, Ocelot.Type.SIAMESE_CAT, true),
|
||||
WHITE_CAT("white", EntityType.OCELOT, Ocelot.Type.SIAMESE_CAT, false),
|
||||
RED_CAT("red", EntityType.OCELOT, Ocelot.Type.RED_CAT, true),
|
||||
@@ -66,12 +67,12 @@ public enum MobData {
|
||||
BABY_ZOMBIE("baby", EntityType.ZOMBIE.getEntityClass(), Data.BABYZOMBIE, true),
|
||||
ADULT_ZOMBIE("adult", EntityType.ZOMBIE.getEntityClass(), Data.ADULTZOMBIE, true),
|
||||
DIAMOND_SWORD_ZOMBIE("diamondsword", EntityType.ZOMBIE.getEntityClass(), Material.DIAMOND_SWORD, true),
|
||||
GOLD_SWORD_ZOMBIE("goldsword", EntityType.ZOMBIE.getEntityClass(), Material.GOLDEN_SWORD, true),
|
||||
GOLD_SWORD_ZOMBIE("goldsword", EntityType.ZOMBIE.getEntityClass(), EnumUtil.getMaterial("GOLDEN_SWORD", "GOLD_SWORD"), true),
|
||||
IRON_SWORD_ZOMBIE("ironsword", EntityType.ZOMBIE.getEntityClass(), Material.IRON_SWORD, true),
|
||||
STONE_SWORD_ZOMBIE("stonesword", EntityType.ZOMBIE.getEntityClass(), Material.STONE_SWORD, false),
|
||||
SWORD_ZOMBIE("sword", EntityType.ZOMBIE.getEntityClass(), Material.STONE_SWORD, true),
|
||||
DIAMOND_SWORD_SKELETON("diamondsword", EntityType.SKELETON, Material.DIAMOND_SWORD, true),
|
||||
GOLD_SWORD_SKELETON("goldsword", EntityType.SKELETON, Material.GOLDEN_SWORD, true),
|
||||
GOLD_SWORD_SKELETON("goldsword", EntityType.SKELETON, EnumUtil.getMaterial("GOLDEN_SWORD", "GOLD_SWORD"), true),
|
||||
IRON_SWORD_SKELETON("ironsword", EntityType.SKELETON, Material.IRON_SWORD, true),
|
||||
STONE_SWORD_SKELETON("stonesword", EntityType.SKELETON, Material.STONE_SWORD, false),
|
||||
SWORD_SKELETON("sword", EntityType.SKELETON, Material.STONE_SWORD, true),
|
||||
|
||||
@@ -787,6 +787,21 @@ public class OfflinePlayer implements Player {
|
||||
public void setBedSpawnLocation(Location lctn, boolean force) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean sleep(Location location, boolean force) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void wakeup(boolean setSpawnLocation) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Location getBedLocation() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void playEffect(EntityEffect ee) {
|
||||
}
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
package com.earth2me.essentials;
|
||||
|
||||
import com.earth2me.essentials.api.IItemDb;
|
||||
import com.earth2me.essentials.commands.IEssentialsCommand;
|
||||
import com.earth2me.essentials.signs.EssentialsSign;
|
||||
import com.earth2me.essentials.signs.Signs;
|
||||
import com.earth2me.essentials.textreader.IText;
|
||||
import com.earth2me.essentials.textreader.SimpleTextInput;
|
||||
import com.earth2me.essentials.utils.EnumUtil;
|
||||
import com.earth2me.essentials.utils.FormatUtil;
|
||||
import com.earth2me.essentials.utils.NumberUtil;
|
||||
|
||||
@@ -36,7 +38,6 @@ public class Settings implements net.ess3.api.ISettings {
|
||||
private final transient EssentialsConf config;
|
||||
private static final Logger logger = Logger.getLogger("Essentials");
|
||||
private final transient IEssentials ess;
|
||||
private boolean metricsEnabled = true;
|
||||
|
||||
public Settings(IEssentials ess) {
|
||||
this.ess = ess;
|
||||
@@ -542,7 +543,11 @@ public class Settings implements net.ess3.api.ISettings {
|
||||
allowOldIdSigns = _allowOldIdSigns();
|
||||
}
|
||||
|
||||
private List<Material> itemSpawnBl = new ArrayList<Material>();
|
||||
void _lateLoadItemSpawnBlacklist() {
|
||||
itemSpawnBl = _getItemSpawnBlacklist();
|
||||
}
|
||||
|
||||
private List<Material> itemSpawnBl = new ArrayList<>();
|
||||
|
||||
@Override
|
||||
public List<Material> itemSpawnBlacklist() {
|
||||
@@ -551,7 +556,8 @@ public class Settings implements net.ess3.api.ISettings {
|
||||
|
||||
private List<Material> _getItemSpawnBlacklist() {
|
||||
final List<Material> epItemSpwn = new ArrayList<>();
|
||||
if (ess.getItemDb() == null) {
|
||||
final IItemDb itemDb = ess.getItemDb();
|
||||
if (itemDb == null || !itemDb.isReady()) {
|
||||
logger.log(Level.FINE, "Skipping item spawn blacklist read; item DB not yet loaded.");
|
||||
return epItemSpwn;
|
||||
}
|
||||
@@ -561,7 +567,7 @@ public class Settings implements net.ess3.api.ISettings {
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
final ItemStack iStack = ess.getItemDb().get(itemName);
|
||||
final ItemStack iStack = itemDb.get(itemName);
|
||||
epItemSpwn.add(iStack.getType());
|
||||
} catch (Exception ex) {
|
||||
logger.log(Level.SEVERE, tl("unknownItemInList", itemName, "item-spawn-blacklist"), ex);
|
||||
@@ -686,12 +692,20 @@ public class Settings implements net.ess3.api.ISettings {
|
||||
if (itemName.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
ItemStack itemStack;
|
||||
try {
|
||||
itemStack = ess.getItemDb().get(itemName);
|
||||
list.add(itemStack.getType());
|
||||
} catch (Exception ex) {
|
||||
|
||||
Material mat = EnumUtil.getMaterial(itemName.toUpperCase());
|
||||
|
||||
if (mat == null) {
|
||||
try {
|
||||
ItemStack itemStack = ess.getItemDb().get(itemName);
|
||||
mat = itemStack.getType();
|
||||
} catch (Exception ignored) {}
|
||||
}
|
||||
|
||||
if (mat == null) {
|
||||
logger.log(Level.SEVERE, tl("unknownItemInList", itemName, configName));
|
||||
} else {
|
||||
list.add(mat);
|
||||
}
|
||||
}
|
||||
return list;
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.earth2me.essentials;
|
||||
|
||||
import com.earth2me.essentials.Mob.MobException;
|
||||
import com.earth2me.essentials.craftbukkit.InventoryWorkaround;
|
||||
import com.earth2me.essentials.utils.EnumUtil;
|
||||
import com.earth2me.essentials.utils.LocationUtil;
|
||||
import com.earth2me.essentials.utils.StringUtil;
|
||||
import net.ess3.api.IEssentials;
|
||||
@@ -19,6 +20,13 @@ import static com.earth2me.essentials.I18n.tl;
|
||||
|
||||
|
||||
public class SpawnMob {
|
||||
|
||||
private static final Material GOLDEN_HELMET = EnumUtil.getMaterial("GOLDEN_HELMET", "GOLD_HELMET");
|
||||
private static final Material GOLDEN_CHESTPLATE = EnumUtil.getMaterial("GOLDEN_CHESTPLATE", "GOLD_CHESTPLATE");
|
||||
private static final Material GOLDEN_LEGGINGS = EnumUtil.getMaterial("GOLDEN_LEGGINGS", "GOLD_LEGGINGS");
|
||||
private static final Material GOLDEN_BOOTS = EnumUtil.getMaterial("GOLDEN_BOOTS", "GOLD_BOOTS");
|
||||
private static final Material GOLDEN_SWORD = EnumUtil.getMaterial("GOLDEN_SWORD", "GOLD_SWORD");
|
||||
|
||||
public static String mobList(final User user) {
|
||||
final Set<String> mobList = Mob.getMobList();
|
||||
final Set<String> availableList = new HashSet<String>();
|
||||
@@ -191,10 +199,10 @@ public class SpawnMob {
|
||||
invent.setChestplate(new ItemStack(Material.DIAMOND_CHESTPLATE, 1));
|
||||
invent.setHelmet(new ItemStack(Material.DIAMOND_HELMET, 1));
|
||||
} else if (inputData.contains("gold")) {
|
||||
invent.setBoots(new ItemStack(Material.GOLDEN_BOOTS, 1));
|
||||
invent.setLeggings(new ItemStack(Material.GOLDEN_LEGGINGS, 1));
|
||||
invent.setChestplate(new ItemStack(Material.GOLDEN_CHESTPLATE, 1));
|
||||
invent.setHelmet(new ItemStack(Material.GOLDEN_HELMET, 1));
|
||||
invent.setBoots(new ItemStack(GOLDEN_BOOTS, 1));
|
||||
invent.setLeggings(new ItemStack(GOLDEN_LEGGINGS, 1));
|
||||
invent.setChestplate(new ItemStack(GOLDEN_CHESTPLATE, 1));
|
||||
invent.setHelmet(new ItemStack(GOLDEN_HELMET, 1));
|
||||
} else if (inputData.contains("leather")) {
|
||||
invent.setBoots(new ItemStack(Material.LEATHER_BOOTS, 1));
|
||||
invent.setLeggings(new ItemStack(Material.LEATHER_LEGGINGS, 1));
|
||||
@@ -228,7 +236,7 @@ public class SpawnMob {
|
||||
InventoryWorkaround.setItemInMainHand(invent, new ItemStack(Material.BOW, 1));
|
||||
InventoryWorkaround.setItemInMainHandDropChance(invent, 0.1f);
|
||||
|
||||
invent.setBoots(new ItemStack(Material.GOLDEN_BOOTS, 1));
|
||||
invent.setBoots(new ItemStack(GOLDEN_BOOTS, 1));
|
||||
invent.setBootsDropChance(0.0f);
|
||||
}
|
||||
|
||||
@@ -237,10 +245,10 @@ public class SpawnMob {
|
||||
setVillager(zombie, false);
|
||||
|
||||
final EntityEquipment invent = zombie.getEquipment();
|
||||
InventoryWorkaround.setItemInMainHand(invent, new ItemStack(Material.GOLDEN_SWORD, 1));
|
||||
InventoryWorkaround.setItemInMainHand(invent, new ItemStack(GOLDEN_SWORD, 1));
|
||||
InventoryWorkaround.setItemInMainHandDropChance(invent, 0.1f);
|
||||
|
||||
invent.setBoots(new ItemStack(Material.GOLDEN_BOOTS, 1));
|
||||
invent.setBoots(new ItemStack(GOLDEN_BOOTS, 1));
|
||||
invent.setBootsDropChance(0.0f);
|
||||
}
|
||||
|
||||
@@ -249,7 +257,7 @@ public class SpawnMob {
|
||||
setVillager(zombie, false);
|
||||
|
||||
final EntityEquipment invent = zombie.getEquipment();
|
||||
invent.setBoots(new ItemStack(Material.GOLDEN_BOOTS, 1));
|
||||
invent.setBoots(new ItemStack(GOLDEN_BOOTS, 1));
|
||||
invent.setBootsDropChance(0.0f);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,9 @@ package com.earth2me.essentials;
|
||||
|
||||
import com.earth2me.essentials.utils.DateUtil;
|
||||
import com.earth2me.essentials.utils.LocationUtil;
|
||||
import io.papermc.lib.PaperLib;
|
||||
import net.ess3.api.IEssentials;
|
||||
import net.ess3.api.ITeleport;
|
||||
import net.ess3.api.IUser;
|
||||
import net.ess3.api.events.UserWarpEvent;
|
||||
import org.bukkit.Bukkit;
|
||||
@@ -18,7 +20,7 @@ import java.util.GregorianCalendar;
|
||||
import static com.earth2me.essentials.I18n.tl;
|
||||
|
||||
|
||||
public class Teleport implements net.ess3.api.ITeleport {
|
||||
public class Teleport implements ITeleport {
|
||||
private final IUser teleportOwner;
|
||||
private final IEssentials ess;
|
||||
private TimedTeleport timedTeleport;
|
||||
@@ -49,7 +51,7 @@ public class Teleport implements net.ess3.api.ITeleport {
|
||||
final long earliestLong = earliestTime.getTimeInMillis();
|
||||
|
||||
// When was the last teleportPlayer used?
|
||||
final Long lastTime = teleportOwner.getLastTeleportTimestamp();
|
||||
final long lastTime = teleportOwner.getLastTeleportTimestamp();
|
||||
|
||||
if (lastTime > time.getTimeInMillis()) {
|
||||
// This is to make sure time didn't get messed up on last teleportPlayer use.
|
||||
@@ -124,21 +126,21 @@ public class Teleport implements net.ess3.api.ITeleport {
|
||||
if (LocationUtil.isBlockUnsafeForUser(teleportee, loc.getWorld(), loc.getBlockX(), loc.getBlockY(), loc.getBlockZ())) {
|
||||
if (ess.getSettings().isTeleportSafetyEnabled()) {
|
||||
if (ess.getSettings().isForceDisableTeleportSafety()) {
|
||||
teleportee.getBase().teleport(loc, cause);
|
||||
PaperLib.teleportAsync(teleportee.getBase(), loc, cause);
|
||||
} else {
|
||||
teleportee.getBase().teleport(LocationUtil.getSafeDestination(ess, teleportee, loc), cause);
|
||||
PaperLib.teleportAsync(teleportee.getBase(), LocationUtil.getSafeDestination(ess, teleportee, loc), cause);
|
||||
}
|
||||
} else {
|
||||
throw new Exception(tl("unsafeTeleportDestination", loc.getWorld().getName(), loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()));
|
||||
}
|
||||
} else {
|
||||
if (ess.getSettings().isForceDisableTeleportSafety()) {
|
||||
teleportee.getBase().teleport(loc, cause);
|
||||
PaperLib.teleportAsync(teleportee.getBase(), loc, cause);
|
||||
} else {
|
||||
if (ess.getSettings().isTeleportToCenterLocation()) {
|
||||
loc = LocationUtil.getRoundedDestination(loc);
|
||||
}
|
||||
teleportee.getBase().teleport(loc, cause);
|
||||
PaperLib.teleportAsync(teleportee.getBase(), loc, cause);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -231,7 +233,7 @@ public class Teleport implements net.ess3.api.ITeleport {
|
||||
initTimer((long) (delay * 1000.0), teleportOwner, null, chargeFor, cause, true);
|
||||
}
|
||||
|
||||
protected void respawnNow(IUser teleportee, TeleportCause cause) throws Exception {
|
||||
void respawnNow(IUser teleportee, TeleportCause cause) throws Exception {
|
||||
final Player player = teleportee.getBase();
|
||||
Location bed = player.getBedSpawnLocation();
|
||||
if (bed != null) {
|
||||
|
||||
@@ -16,9 +16,9 @@ public class TimedTeleport implements Runnable {
|
||||
private final IEssentials ess;
|
||||
private final Teleport teleport;
|
||||
private final UUID timer_teleportee;
|
||||
private int timer_task = -1;
|
||||
private final long timer_started; // time this task was initiated
|
||||
private final long timer_delay; // how long to delay the teleportPlayer
|
||||
private int timer_task;
|
||||
private final long timer_started; // time this task was initiated
|
||||
private final long timer_delay; // how long to delay the teleportPlayer
|
||||
private double timer_health;
|
||||
// note that I initially stored a clone of the location for reference, but...
|
||||
// when comparing locations, I got incorrect mismatches (rounding errors, looked like)
|
||||
@@ -32,8 +32,7 @@ public class TimedTeleport implements Runnable {
|
||||
private final Trade timer_chargeFor;
|
||||
private final TeleportCause timer_cause;
|
||||
|
||||
public TimedTeleport(IUser user, IEssentials ess, Teleport teleport, long delay, IUser teleportUser, ITarget target, Trade chargeFor, TeleportCause cause, boolean respawn) {
|
||||
|
||||
TimedTeleport(IUser user, IEssentials ess, Teleport teleport, long delay, IUser teleportUser, ITarget target, Trade chargeFor, TeleportCause cause, boolean respawn) {
|
||||
this.teleportOwner = user;
|
||||
this.ess = ess;
|
||||
this.teleport = teleport;
|
||||
@@ -111,8 +110,7 @@ public class TimedTeleport implements Runnable {
|
||||
if (timer_chargeFor != null) {
|
||||
timer_chargeFor.charge(teleportOwner);
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
}
|
||||
} catch (Exception ignored) {}
|
||||
|
||||
} catch (Exception ex) {
|
||||
ess.showError(teleportOwner.getSource(), ex, "\\ teleport");
|
||||
@@ -124,7 +122,7 @@ public class TimedTeleport implements Runnable {
|
||||
}
|
||||
|
||||
//If we need to cancelTimer a pending teleportPlayer call this method
|
||||
public void cancelTimer(boolean notifyUser) {
|
||||
void cancelTimer(boolean notifyUser) {
|
||||
if (timer_task == -1) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import com.earth2me.essentials.register.payment.Methods;
|
||||
import com.earth2me.essentials.utils.DateUtil;
|
||||
import com.earth2me.essentials.utils.FormatUtil;
|
||||
import com.earth2me.essentials.utils.NumberUtil;
|
||||
import com.earth2me.essentials.utils.VersionUtil;
|
||||
import net.ess3.api.IEssentials;
|
||||
import net.ess3.api.MaxMoneyException;
|
||||
import net.ess3.api.events.AfkStatusChangeEvent;
|
||||
@@ -27,12 +28,7 @@ import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Calendar;
|
||||
import java.util.GregorianCalendar;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import java.util.WeakHashMap;
|
||||
import java.util.*;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
@@ -224,7 +220,18 @@ public class User extends UserData implements Comparable<User>, IMessageRecipien
|
||||
|
||||
@Override
|
||||
public Boolean canSpawnItem(final Material material) {
|
||||
return !ess.getSettings().itemSpawnBlacklist().contains(material);
|
||||
if (ess.getSettings().permissionBasedItemSpawn()) {
|
||||
final String name = material.toString().toLowerCase(Locale.ENGLISH).replace("_", "");
|
||||
|
||||
if (isAuthorized("essentials.itemspawn.item-all") || isAuthorized("essentials.itemspawn.item-" + name)) return true;
|
||||
|
||||
if (VersionUtil.getServerBukkitVersion().isLowerThan(VersionUtil.v1_13_0_R01)) {
|
||||
final int id = material.getId();
|
||||
if (isAuthorized("essentials.itemspawn.item-" + id)) return true;
|
||||
}
|
||||
}
|
||||
|
||||
return isAuthorized("essentials.itemspawn.exempt") || !ess.getSettings().itemSpawnBlacklist().contains(material);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -872,7 +879,7 @@ public class User extends UserData implements Comparable<User>, IMessageRecipien
|
||||
* Returns the {@link ItemStack} in the main hand or off-hand. If the main hand is empty then the offhand item is returned - also nullable.
|
||||
*/
|
||||
public ItemStack getItemInHand() {
|
||||
if (ReflUtil.getNmsVersionObject().isLowerThan(ReflUtil.V1_9_R1)) {
|
||||
if (VersionUtil.getServerBukkitVersion().isLowerThan(VersionUtil.v1_9_R01)) {
|
||||
return getBase().getInventory().getItemInHand();
|
||||
} else {
|
||||
PlayerInventory inventory = getBase().getInventory();
|
||||
|
||||
@@ -8,6 +8,7 @@ import com.earth2me.essentials.utils.StringUtil;
|
||||
import com.google.common.base.Charsets;
|
||||
import net.ess3.api.IEssentials;
|
||||
import net.ess3.api.MaxMoneyException;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.io.File;
|
||||
import java.math.BigDecimal;
|
||||
@@ -18,7 +19,7 @@ import java.util.logging.Logger;
|
||||
|
||||
|
||||
/**
|
||||
* Instead of using this api directly, we recommend to use the register plugin: http://bit.ly/RegisterMethod
|
||||
* You should use Vault instead of directly using this class.
|
||||
*/
|
||||
public class Economy {
|
||||
public Economy() {
|
||||
@@ -64,7 +65,24 @@ public class Economy {
|
||||
if (name == null) {
|
||||
throw new RuntimeException("Economy username cannot be null");
|
||||
}
|
||||
return ess.getUser(name);
|
||||
|
||||
User user = ess.getUser(name);
|
||||
if (user == null) {
|
||||
/*
|
||||
Attempt lookup using UUID - this prevents balance resets when accessing economy
|
||||
via Vault during player join.
|
||||
See: https://github.com/EssentialsX/Essentials/issues/2400
|
||||
*/
|
||||
Player player = ess.getServer().getPlayerExact(name);
|
||||
if (player != null) {
|
||||
user = ess.getUser(player.getUniqueId());
|
||||
if (user != null) {
|
||||
logger.info(String.format("[Economy] Found player %s by UUID %s but not by their actual name - they may have changed their username", name, player.getUniqueId().toString()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return user;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -153,4 +153,11 @@ public interface IItemDb {
|
||||
default Material getFromLegacy(final int id, final byte damage) {
|
||||
return MaterialUtil.convertFromLegacy(id, damage);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether the item database is loaded and ready for use.
|
||||
*
|
||||
* @return Whether items have finished loading
|
||||
*/
|
||||
boolean isReady();
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package com.earth2me.essentials.commands;
|
||||
|
||||
import com.earth2me.essentials.User;
|
||||
import com.earth2me.essentials.craftbukkit.InventoryWorkaround;
|
||||
import com.earth2me.essentials.utils.EnumUtil;
|
||||
import com.google.common.collect.Lists;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Server;
|
||||
@@ -15,6 +16,9 @@ import static com.earth2me.essentials.I18n.tl;
|
||||
|
||||
|
||||
public class Commandbook extends EssentialsCommand {
|
||||
|
||||
private static final Material WRITABLE_BOOK = EnumUtil.getMaterial("WRITABLE_BOOK", "BOOK_AND_QUILL");
|
||||
|
||||
public Commandbook() {
|
||||
super("book");
|
||||
}
|
||||
@@ -44,7 +48,7 @@ public class Commandbook extends EssentialsCommand {
|
||||
}
|
||||
} else {
|
||||
if (isAuthor(bmeta, player) || user.isAuthorized("essentials.book.others")) {
|
||||
ItemStack newItem = new ItemStack(Material.WRITABLE_BOOK, item.getAmount());
|
||||
ItemStack newItem = new ItemStack(WRITABLE_BOOK, item.getAmount());
|
||||
newItem.setItemMeta(bmeta);
|
||||
InventoryWorkaround.setItemInMainHand(user.getBase(), newItem);
|
||||
user.sendMessage(tl("editBookContents"));
|
||||
@@ -52,7 +56,7 @@ public class Commandbook extends EssentialsCommand {
|
||||
throw new Exception(tl("denyBookEdit"));
|
||||
}
|
||||
}
|
||||
} else if (item.getType() == Material.WRITABLE_BOOK) {
|
||||
} else if (item.getType() == WRITABLE_BOOK) {
|
||||
BookMeta bmeta = (BookMeta) item.getItemMeta();
|
||||
if (!user.isAuthorized("essentials.book.author")) {
|
||||
bmeta.setAuthor(player);
|
||||
|
||||
@@ -4,7 +4,6 @@ import com.earth2me.essentials.CommandSource;
|
||||
import com.earth2me.essentials.EssentialsUpgrade;
|
||||
import com.earth2me.essentials.User;
|
||||
import com.earth2me.essentials.UserMap;
|
||||
import com.earth2me.essentials.metrics.Metrics;
|
||||
import com.earth2me.essentials.utils.*;
|
||||
import com.google.common.base.Charsets;
|
||||
import com.google.common.collect.Lists;
|
||||
@@ -17,13 +16,15 @@ import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.PluginDescriptionFile;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
|
||||
import static com.earth2me.essentials.I18n.tl;
|
||||
|
||||
// This command has 4 undocumented behaviours #EasterEgg
|
||||
public class Commandessentials extends EssentialsCommand {
|
||||
|
||||
private final Sound NOTE_HARP = EnumUtil.valueOf(Sound.class, "BLOCK_NOTE_HARP", "NOTE_PIANO");
|
||||
|
||||
public Commandessentials() {
|
||||
super("essentials");
|
||||
}
|
||||
@@ -154,15 +155,9 @@ public class Commandessentials extends EssentialsCommand {
|
||||
if (note == null || note.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
Sound noteHarp;
|
||||
try {
|
||||
noteHarp = Sound.valueOf("NOTE_PIANO"); // pre-1.9, referenced internally as note.harp
|
||||
} catch (IllegalArgumentException e) {
|
||||
noteHarp = Sound.valueOf("BLOCK_NOTE_HARP"); // 1.9
|
||||
}
|
||||
|
||||
for (Player onlinePlayer : ess.getOnlinePlayers()) {
|
||||
onlinePlayer.playSound(onlinePlayer.getLocation(), noteHarp, 1, noteMap.get(note));
|
||||
onlinePlayer.playSound(onlinePlayer.getLocation(), NOTE_HARP, 1, noteMap.get(note));
|
||||
}
|
||||
}
|
||||
}, 20, 2);
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.earth2me.essentials.commands;
|
||||
|
||||
import com.earth2me.essentials.MetaItemStack;
|
||||
import com.earth2me.essentials.User;
|
||||
import com.earth2me.essentials.utils.MaterialUtil;
|
||||
import com.earth2me.essentials.utils.NumberUtil;
|
||||
import com.google.common.collect.Lists;
|
||||
import org.bukkit.DyeColor;
|
||||
@@ -43,8 +44,8 @@ public class Commandfirework extends EssentialsCommand {
|
||||
|
||||
@Override
|
||||
protected void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception {
|
||||
final ItemStack stack = user.getBase().getInventory().getItemInMainHand();
|
||||
if (stack.getType() == Material.FIREWORK_ROCKET || stack.getType() == Material.FIREWORK_STAR) {
|
||||
final ItemStack stack = user.getItemInHand();
|
||||
if (MaterialUtil.isFirework(stack.getType())) {
|
||||
if (args.length > 0) {
|
||||
if (args[0].equalsIgnoreCase("clear")) {
|
||||
FireworkMeta fmeta = (FireworkMeta) stack.getItemMeta();
|
||||
|
||||
@@ -31,9 +31,9 @@ public class Commandgive extends EssentialsCommand {
|
||||
}
|
||||
|
||||
ItemStack stack = ess.getItemDb().get(args[1]);
|
||||
|
||||
final String itemname = stack.getType().toString().toLowerCase(Locale.ENGLISH).replace("_", "");
|
||||
if (sender.isPlayer() && (ess.getSettings().permissionBasedItemSpawn() ? (!ess.getUser(sender.getPlayer()).isAuthorized("essentials.itemspawn.item-all") && !ess.getUser(sender.getPlayer()).isAuthorized("essentials.itemspawn.item-" + itemname)) : (!ess.getUser(sender.getPlayer()).isAuthorized("essentials.itemspawn.exempt") && !ess.getUser(sender.getPlayer()).canSpawnItem(stack.getType())))) {
|
||||
|
||||
if (sender.isPlayer() && !ess.getUser(sender.getPlayer()).canSpawnItem(stack.getType())) {
|
||||
throw new Exception(tl("cantSpawnItem", itemname));
|
||||
}
|
||||
|
||||
|
||||
@@ -33,8 +33,8 @@ public class Commandhat extends EssentialsCommand {
|
||||
user.sendMessage(tl("hatRemoved"));
|
||||
}
|
||||
} else {
|
||||
if (user.getBase().getInventory().getItemInMainHand().getType() != Material.AIR) {
|
||||
final ItemStack hand = user.getBase().getInventory().getItemInMainHand();
|
||||
final ItemStack hand = user.getItemInHand();
|
||||
if (hand != null && hand.getType() != Material.AIR) {
|
||||
if (hand.getType().getMaxDurability() == 0) {
|
||||
final PlayerInventory inv = user.getBase().getInventory();
|
||||
final ItemStack head = inv.getHelmet();
|
||||
|
||||
@@ -29,9 +29,10 @@ public class Commanditem extends EssentialsCommand {
|
||||
ItemStack stack = ess.getItemDb().get(args[0]);
|
||||
|
||||
final String itemname = stack.getType().toString().toLowerCase(Locale.ENGLISH).replace("_", "");
|
||||
if (ess.getSettings().permissionBasedItemSpawn() ? (!user.isAuthorized("essentials.itemspawn.item-all") && !user.isAuthorized("essentials.itemspawn.item-" + itemname)) : (!user.isAuthorized("essentials.itemspawn.exempt") && !user.canSpawnItem(stack.getType()))) {
|
||||
if (!user.canSpawnItem(stack.getType())) {
|
||||
throw new Exception(tl("cantSpawnItem", itemname));
|
||||
}
|
||||
|
||||
try {
|
||||
if (args.length > 1 && Integer.parseInt(args[1]) > 0) {
|
||||
stack.setAmount(Integer.parseInt(args[1]));
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.earth2me.essentials.commands;
|
||||
|
||||
import com.earth2me.essentials.CommandSource;
|
||||
import com.earth2me.essentials.utils.VersionUtil;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
@@ -23,7 +24,7 @@ public class Commanditemdb extends EssentialsCommand {
|
||||
if (args.length < 1) {
|
||||
if (sender.isPlayer() && sender.getPlayer() != null) {
|
||||
itemHeld = true;
|
||||
itemStack = sender.getPlayer().getInventory().getItemInMainHand();
|
||||
itemStack = ess.getUser(sender.getPlayer()).getItemInHand();
|
||||
}
|
||||
if (itemStack == null) {
|
||||
throw new NotEnoughArgumentsException();
|
||||
@@ -32,7 +33,18 @@ public class Commanditemdb extends EssentialsCommand {
|
||||
itemStack = ess.getItemDb().get(args[0]);
|
||||
}
|
||||
|
||||
sender.sendMessage(tl("itemType", itemStack.getType().toString()));
|
||||
String itemId = "none";
|
||||
|
||||
if (VersionUtil.getServerBukkitVersion().isLowerThan(VersionUtil.v1_13_0_R01)) {
|
||||
itemId = itemStack.getType().getId() + ":" + itemStack.getDurability();
|
||||
}
|
||||
|
||||
sender.sendMessage(tl("itemType", itemStack.getType().toString(), itemId));
|
||||
|
||||
// Don't send IDs twice
|
||||
if (!tl("itemType").contains("{1}") && !itemId.equals("none")) {
|
||||
sender.sendMessage(tl("itemId", itemId));
|
||||
}
|
||||
|
||||
if (itemHeld && itemStack.getType() != Material.AIR) {
|
||||
int maxuses = itemStack.getType().getMaxDurability();
|
||||
|
||||
@@ -105,11 +105,11 @@ public class Commandmail extends EssentialsCommand {
|
||||
if (u == null) {
|
||||
throw new Exception(tl("playerNeverOnServer", args[1]));
|
||||
}
|
||||
u.addMail(tl("mailFormat", "Server", getFinalArg(args, 2)));
|
||||
u.addMail(tl("mailFormat", "Server", FormatUtil.replaceFormat(getFinalArg(args, 2))));
|
||||
sender.sendMessage(tl("mailSent"));
|
||||
return;
|
||||
} else if (args.length >= 2 && "sendall".equalsIgnoreCase(args[0])) {
|
||||
ess.runTaskAsynchronously(new SendAll(tl("mailFormat", "Server", getFinalArg(args, 1))));
|
||||
ess.runTaskAsynchronously(new SendAll(tl("mailFormat", "Server", FormatUtil.replaceFormat(getFinalArg(args, 1)))));
|
||||
sender.sendMessage(tl("mailSent"));
|
||||
return;
|
||||
} else if (args.length >= 2) {
|
||||
@@ -118,7 +118,7 @@ public class Commandmail extends EssentialsCommand {
|
||||
if (u == null) {
|
||||
throw new Exception(tl("playerNeverOnServer", args[0]));
|
||||
}
|
||||
u.addMail(tl("mailFormat", "Server", getFinalArg(args, 1)));
|
||||
u.addMail(tl("mailFormat", "Server", FormatUtil.replaceFormat(getFinalArg(args, 1))));
|
||||
sender.sendMessage(tl("mailSent"));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ public class Commandmore extends EssentialsCommand {
|
||||
|
||||
@Override
|
||||
public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception {
|
||||
final ItemStack stack = user.getBase().getInventory().getItemInMainHand();
|
||||
final ItemStack stack = user.getItemInHand();
|
||||
if (stack == null) {
|
||||
throw new Exception(tl("cantSpawnItem", "Air"));
|
||||
}
|
||||
@@ -25,7 +25,7 @@ public class Commandmore extends EssentialsCommand {
|
||||
throw new Exception(tl("fullStack"));
|
||||
}
|
||||
final String itemname = stack.getType().toString().toLowerCase(Locale.ENGLISH).replace("_", "");
|
||||
if (ess.getSettings().permissionBasedItemSpawn() ? (!user.isAuthorized("essentials.itemspawn.item-all") && !user.isAuthorized("essentials.itemspawn.item-" + itemname)) : (!user.isAuthorized("essentials.itemspawn.exempt") && !user.canSpawnItem(stack.getType()))) {
|
||||
if (!user.canSpawnItem(stack.getType())) {
|
||||
throw new Exception(tl("cantSpawnItem", itemname));
|
||||
}
|
||||
if (user.isAuthorized("essentials.oversizedstacks")) {
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.earth2me.essentials.commands;
|
||||
|
||||
import com.earth2me.essentials.CommandSource;
|
||||
import com.earth2me.essentials.User;
|
||||
import com.earth2me.essentials.utils.EnumUtil;
|
||||
import com.earth2me.essentials.utils.NumberUtil;
|
||||
import com.earth2me.essentials.utils.VersionUtil;
|
||||
import org.bukkit.Material;
|
||||
@@ -20,6 +21,11 @@ import net.ess3.nms.refl.ReflUtil;
|
||||
|
||||
|
||||
public class Commandrecipe extends EssentialsCommand {
|
||||
|
||||
private static final Material FIREWORK_ROCKET = EnumUtil.getMaterial("FIREWORK_ROCKET", "FIREWORK");
|
||||
private static final Material FIREWORK_STAR = EnumUtil.getMaterial("FIREWORK_STAR", "FIREWORK_CHARGE");
|
||||
private static final Material GUNPOWDER = EnumUtil.getMaterial("GUNPOWDER", "SULPHUR");
|
||||
|
||||
public Commandrecipe() {
|
||||
super("recipe");
|
||||
}
|
||||
@@ -67,11 +73,11 @@ public class Commandrecipe extends EssentialsCommand {
|
||||
} else if (selectedRecipe instanceof ShapedRecipe) {
|
||||
shapedRecipe(sender, (ShapedRecipe) selectedRecipe, sender.isPlayer());
|
||||
} else if (selectedRecipe instanceof ShapelessRecipe) {
|
||||
if (recipesOfType.size() == 1 && (itemType.getType() == Material.FIREWORK_ROCKET || itemType.getType() == Material.FIREWORK_STAR)) {
|
||||
if (recipesOfType.size() == 1 && (itemType.getType() == FIREWORK_ROCKET)) {
|
||||
ShapelessRecipe shapelessRecipe = new ShapelessRecipe(itemType);
|
||||
shapelessRecipe.addIngredient(Material.LEGACY_SULPHUR);
|
||||
shapelessRecipe.addIngredient(GUNPOWDER);
|
||||
shapelessRecipe.addIngredient(Material.PAPER);
|
||||
shapelessRecipe.addIngredient(Material.FIREWORK_ROCKET);
|
||||
shapelessRecipe.addIngredient(FIREWORK_STAR);
|
||||
shapelessRecipe(sender, shapelessRecipe, sender.isPlayer());
|
||||
} else {
|
||||
shapelessRecipe(sender, (ShapelessRecipe) selectedRecipe, sender.isPlayer());
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.earth2me.essentials.ChargeException;
|
||||
import com.earth2me.essentials.Trade;
|
||||
import com.earth2me.essentials.User;
|
||||
import com.earth2me.essentials.utils.StringUtil;
|
||||
import com.earth2me.essentials.utils.VersionUtil;
|
||||
import com.google.common.collect.Lists;
|
||||
import net.ess3.api.IUser;
|
||||
import org.bukkit.Material;
|
||||
@@ -38,7 +39,7 @@ public class Commandrepair extends EssentialsCommand {
|
||||
}
|
||||
|
||||
public void repairHand(User user) throws Exception {
|
||||
final ItemStack item = user.getBase().getInventory().getItemInMainHand();
|
||||
final ItemStack item = user.getItemInHand();
|
||||
if (item == null || item.getType().isBlock() || item.getDurability() == 0) {
|
||||
throw new Exception(tl("repairInvalidType"));
|
||||
}
|
||||
@@ -48,7 +49,7 @@ public class Commandrepair extends EssentialsCommand {
|
||||
}
|
||||
|
||||
final String itemName = item.getType().toString().toLowerCase(Locale.ENGLISH);
|
||||
final Trade charge = new Trade("repair-" + itemName.replace('_', '-'), new Trade("repair-item", ess), ess);
|
||||
final Trade charge = getCharge(item.getType());
|
||||
|
||||
charge.isAffordableFor(user);
|
||||
|
||||
@@ -95,7 +96,8 @@ public class Commandrepair extends EssentialsCommand {
|
||||
}
|
||||
|
||||
final String itemName = item.getType().toString().toLowerCase(Locale.ENGLISH);
|
||||
final Trade charge = new Trade("repair-" + itemName.replace('_', '-'), new Trade("repair-item", ess), ess);
|
||||
final Trade charge = getCharge(item.getType());
|
||||
|
||||
try {
|
||||
charge.isAffordableFor(user);
|
||||
} catch (ChargeException ex) {
|
||||
@@ -120,6 +122,16 @@ public class Commandrepair extends EssentialsCommand {
|
||||
}
|
||||
}
|
||||
|
||||
private Trade getCharge(final Material material) {
|
||||
final String itemName = material.toString().toLowerCase(Locale.ENGLISH);
|
||||
if (VersionUtil.getServerBukkitVersion().isLowerThan(VersionUtil.v1_13_0_R01)) {
|
||||
final int itemId = material.getId();
|
||||
return new Trade("repair-" + itemName.replace('_', '-'), new Trade("repair-" + itemId, new Trade("repair-item", ess), ess), ess);
|
||||
} else {
|
||||
return new Trade("repair-" + itemName.replace('_', '-'), new Trade("repair-item", ess), ess);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<String> getTabCompleteOptions(Server server, User user, String commandLabel, String[] args) {
|
||||
if (args.length == 1) {
|
||||
|
||||
@@ -2,6 +2,8 @@ package com.earth2me.essentials.commands;
|
||||
|
||||
import com.earth2me.essentials.User;
|
||||
import com.earth2me.essentials.craftbukkit.InventoryWorkaround;
|
||||
import com.earth2me.essentials.utils.EnumUtil;
|
||||
import com.earth2me.essentials.utils.MaterialUtil;
|
||||
import com.google.common.collect.Lists;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Server;
|
||||
@@ -14,6 +16,9 @@ import java.util.List;
|
||||
import static com.earth2me.essentials.I18n.tl;
|
||||
|
||||
public class Commandskull extends EssentialsCommand {
|
||||
|
||||
private static final Material SKULL_ITEM = EnumUtil.getMaterial("PLAYER_HEAD", "SKULL_ITEM");
|
||||
|
||||
public Commandskull() {
|
||||
super("skull");
|
||||
}
|
||||
@@ -31,14 +36,14 @@ public class Commandskull extends EssentialsCommand {
|
||||
owner = user.getName();
|
||||
}
|
||||
|
||||
ItemStack itemSkull = user.getBase().getInventory().getItemInMainHand();
|
||||
ItemStack itemSkull = user.getItemInHand();
|
||||
SkullMeta metaSkull = null;
|
||||
boolean spawn = false;
|
||||
|
||||
if (itemSkull != null && itemSkull.getType() == Material.LEGACY_SKULL_ITEM && itemSkull.getDurability() == 3) {
|
||||
if (itemSkull != null && MaterialUtil.isPlayerHead(itemSkull.getType(), itemSkull.getDurability())) {
|
||||
metaSkull = (SkullMeta) itemSkull.getItemMeta();
|
||||
} else if (user.isAuthorized("essentials.skull.spawn")) {
|
||||
itemSkull = new ItemStack(Material.LEGACY_SKULL_ITEM, 1, (byte) 3);
|
||||
itemSkull = new ItemStack(SKULL_ITEM, 1, (byte) 3);
|
||||
metaSkull = (SkullMeta) itemSkull.getItemMeta();
|
||||
spawn = true;
|
||||
} else {
|
||||
|
||||
@@ -13,9 +13,9 @@ import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.earth2me.essentials.I18n.tl;
|
||||
|
||||
@@ -64,17 +64,8 @@ public class Commandwarp extends EssentialsCommand {
|
||||
//TODO: Use one of the new text classes, like /help ?
|
||||
private void warpList(final CommandSource sender, final String[] args, final IUser user) throws Exception {
|
||||
final IWarps warps = ess.getWarps();
|
||||
final List<String> warpNameList = new ArrayList<>(warps.getList());
|
||||
final List<String> warpNameList = getAvailableWarpsFor(user);
|
||||
|
||||
if (user != null) {
|
||||
final Iterator<String> iterator = warpNameList.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
final String warpName = iterator.next();
|
||||
if (ess.getSettings().getPerWarpPermission() && !user.isAuthorized("essentials.warps." + warpName)) {
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (warpNameList.isEmpty()) {
|
||||
throw new Exception(tl("noWarpsDefined"));
|
||||
}
|
||||
@@ -112,10 +103,20 @@ public class Commandwarp extends EssentialsCommand {
|
||||
owner.getTeleport().warp(user, name, charge, TeleportCause.COMMAND);
|
||||
}
|
||||
|
||||
private List<String> getAvailableWarpsFor(final IUser user) {
|
||||
if (ess.getSettings().getPerWarpPermission() && user != null) {
|
||||
return ess.getWarps().getList().stream()
|
||||
.filter(warpName -> user.isAuthorized("essentials.warps." + warpName))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
return new ArrayList<>(ess.getWarps().getList());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<String> getTabCompleteOptions(final Server server, final User user, final String commandLabel, final String[] args) {
|
||||
if (args.length == 1 && user.isAuthorized("essentials.warp.list")) {
|
||||
return new ArrayList<>(ess.getWarps().getList());
|
||||
return getAvailableWarpsFor(user);
|
||||
} else if (args.length == 2 && (user.isAuthorized("essentials.warp.otherplayers") || user.isAuthorized("essentials.warp.others"))) {
|
||||
//TODO: Remove 'otherplayers' permission.
|
||||
return getPlayers(server, user);
|
||||
|
||||
@@ -17,13 +17,12 @@ import static com.earth2me.essentials.I18n.tl;
|
||||
|
||||
|
||||
public class Commandwhois extends EssentialsCommand {
|
||||
private final Statistic playOneTick;
|
||||
// For some reason, in 1.13 PLAY_ONE_MINUTE = ticks played = what used to be PLAY_ONE_TICK
|
||||
// https://hub.spigotmc.org/stash/projects/SPIGOT/repos/bukkit/commits/b848d8ce633871b52115247b089029749c02f579
|
||||
private static final Statistic PLAY_ONE_TICK = EnumUtil.getStatistic("PLAY_ONE_MINUTE", "PLAY_ONE_TICK");
|
||||
|
||||
public Commandwhois() {
|
||||
super("whois");
|
||||
// For some reason, in 1.13 PLAY_ONE_MINUTE = ticks played
|
||||
// https://hub.spigotmc.org/stash/projects/SPIGOT/repos/bukkit/commits/b848d8ce633871b52115247b089029749c02f579
|
||||
playOneTick = EnumUtil.getStatistic("PLAY_ONE_MINUTE", "PLAY_ONE_TICK");
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -42,7 +41,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(playOneTick) * 50);
|
||||
long playtimeMs = System.currentTimeMillis() - (user.getBase().getStatistic(PLAY_ONE_TICK) * 50);
|
||||
sender.sendMessage(tl("whoisPlaytime", DateUtil.formatDateDiff(playtimeMs)));
|
||||
if (!ess.getSettings().isEcoDisabled()) {
|
||||
sender.sendMessage(tl("whoisMoney", NumberUtil.displayCurrency(user.getMoney(), ess)));
|
||||
|
||||
@@ -27,6 +27,8 @@ import static com.earth2me.essentials.I18n.tl;
|
||||
|
||||
public abstract class AbstractItemDb implements IConf, net.ess3.api.IItemDb {
|
||||
|
||||
protected boolean ready = false;
|
||||
|
||||
@Override
|
||||
public List<ItemStack> getMatching(User user, String[] args) throws Exception {
|
||||
List<ItemStack> is = new ArrayList<>();
|
||||
@@ -62,7 +64,7 @@ public abstract class AbstractItemDb implements IConf, net.ess3.api.IItemDb {
|
||||
|
||||
@Override
|
||||
public String serialize(ItemStack is) {
|
||||
String mat = is.getType().name();
|
||||
String mat = name(is);
|
||||
if (VersionUtil.getServerBukkitVersion().isLowerThanOrEqualTo(VersionUtil.v1_12_2_R01) && is.getData().getData() != 0) {
|
||||
mat = mat + ":" + is.getData().getData();
|
||||
}
|
||||
@@ -224,4 +226,9 @@ public abstract class AbstractItemDb implements IConf, net.ess3.api.IItemDb {
|
||||
|
||||
return sb.toString().trim().replaceAll("§", "&");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isReady() {
|
||||
return ready;
|
||||
}
|
||||
}
|
||||
@@ -8,11 +8,11 @@ import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
import net.ess3.api.IEssentials;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.Damageable;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.bukkit.inventory.meta.PotionMeta;
|
||||
import org.bukkit.inventory.meta.Repairable;
|
||||
import org.bukkit.potion.PotionData;
|
||||
|
||||
import java.util.*;
|
||||
@@ -24,10 +24,8 @@ import static com.earth2me.essentials.I18n.tl;
|
||||
|
||||
public class FlatItemDb extends AbstractItemDb {
|
||||
protected static final Logger LOGGER = Logger.getLogger("Essentials");
|
||||
private final transient IEssentials ess;
|
||||
|
||||
private static Gson gson = new Gson();
|
||||
|
||||
private final transient IEssentials ess;
|
||||
// Maps primary name to ItemData
|
||||
private final transient Map<String, ItemData> items = new HashMap<>();
|
||||
|
||||
@@ -57,13 +55,16 @@ public class FlatItemDb extends AbstractItemDb {
|
||||
this.reset();
|
||||
|
||||
String json = file.getLines().stream()
|
||||
.filter(line -> !line.startsWith("#"))
|
||||
.collect(Collectors.joining());
|
||||
|
||||
.filter(line -> !line.startsWith("#"))
|
||||
.collect(Collectors.joining());
|
||||
|
||||
this.loadJSON(String.join("\n", json));
|
||||
|
||||
ready = true;
|
||||
}
|
||||
|
||||
private void reset() {
|
||||
ready = false;
|
||||
items.clear();
|
||||
itemAliases.clear();
|
||||
allAliases.clear();
|
||||
@@ -108,12 +109,14 @@ public class FlatItemDb extends AbstractItemDb {
|
||||
throw new Exception(tl("unknownItemName", id));
|
||||
}
|
||||
|
||||
PotionData potionData = data.getPotionData();
|
||||
Material material = data.getMaterial();
|
||||
|
||||
if (!material.isItem()) throw new Exception(tl("unableToSpawnItem", id));
|
||||
|
||||
ItemStack stack = new ItemStack(material);
|
||||
stack.setAmount(material.getMaxStackSize());
|
||||
|
||||
PotionData potionData = data.getPotionData();
|
||||
ItemMeta meta = stack.getItemMeta();
|
||||
|
||||
if (potionData != null && meta instanceof PotionMeta) {
|
||||
@@ -130,6 +133,13 @@ public class FlatItemDb extends AbstractItemDb {
|
||||
|
||||
stack.setItemMeta(meta);
|
||||
|
||||
// The spawner provider will update the meta again, so we need to call it after
|
||||
// setItemMeta to prevent a race condition
|
||||
EntityType entity = data.getEntity();
|
||||
if (entity != null && material.toString().contains("SPAWNER")) {
|
||||
ess.getSpawnerProvider().setEntityType(stack, entity);
|
||||
}
|
||||
|
||||
return stack;
|
||||
}
|
||||
|
||||
@@ -161,14 +171,7 @@ public class FlatItemDb extends AbstractItemDb {
|
||||
|
||||
@Override
|
||||
public String name(ItemStack item) {
|
||||
Material type = item.getType();
|
||||
PotionData potion = null;
|
||||
|
||||
if (MaterialUtil.isPotion(type) && item.getItemMeta() instanceof PotionMeta) {
|
||||
potion = ((PotionMeta) item.getItemMeta()).getBasePotionData();
|
||||
}
|
||||
|
||||
ItemData data = new ItemData(type, potion);
|
||||
ItemData data = lookup(item);
|
||||
|
||||
for (Map.Entry<String, ItemData> entry : items.entrySet()) {
|
||||
if (entry.getValue().equals(data)) {
|
||||
@@ -185,20 +188,44 @@ public class FlatItemDb extends AbstractItemDb {
|
||||
throw new UnsupportedOperationException("Legacy IDs aren't supported on this version.");
|
||||
}
|
||||
|
||||
public ItemData lookup(ItemStack item) {
|
||||
Material type = item.getType();
|
||||
|
||||
if (MaterialUtil.isPotion(type) && item.getItemMeta() instanceof PotionMeta) {
|
||||
PotionData potion = ((PotionMeta) item.getItemMeta()).getBasePotionData();
|
||||
return new ItemData(type, potion);
|
||||
} else if (type.toString().contains("SPAWNER")) {
|
||||
EntityType entity = ess.getSpawnerProvider().getEntityType(item);
|
||||
return new ItemData(type, entity);
|
||||
} else {
|
||||
return new ItemData(type);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<String> listNames() {
|
||||
return Collections.unmodifiableSet(allAliases);
|
||||
}
|
||||
|
||||
public static class ItemData {
|
||||
private Material material;
|
||||
private PotionData potionData;
|
||||
private final Material material;
|
||||
private PotionData potionData = null;
|
||||
private EntityType entity = null;
|
||||
|
||||
public ItemData(Material material) {
|
||||
this.material = material;
|
||||
}
|
||||
|
||||
public ItemData(Material material, PotionData potionData) {
|
||||
this.material = material;
|
||||
this.potionData = potionData;
|
||||
}
|
||||
|
||||
public ItemData(Material material, EntityType entity) {
|
||||
this.material = material;
|
||||
this.entity = entity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return (31 * material.hashCode()) ^ potionData.hashCode();
|
||||
@@ -213,7 +240,7 @@ public class FlatItemDb extends AbstractItemDb {
|
||||
return false;
|
||||
}
|
||||
ItemData that = (ItemData) o;
|
||||
return this.material == that.getMaterial() && potionDataEquals(that);
|
||||
return this.material == that.getMaterial() && potionDataEquals(that) && entityEquals(that);
|
||||
}
|
||||
|
||||
public Material getMaterial() {
|
||||
@@ -224,6 +251,10 @@ public class FlatItemDb extends AbstractItemDb {
|
||||
return this.potionData;
|
||||
}
|
||||
|
||||
public EntityType getEntity() {
|
||||
return this.entity;
|
||||
}
|
||||
|
||||
private boolean potionDataEquals(ItemData o) {
|
||||
if (this.potionData == null && o.getPotionData() == null) {
|
||||
return true;
|
||||
@@ -233,5 +264,15 @@ public class FlatItemDb extends AbstractItemDb {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private boolean entityEquals(ItemData o) {
|
||||
if (this.entity == null && o.getEntity() == null) { // neither have an entity
|
||||
return true;
|
||||
} else if (this.entity != null && o.getEntity() != null) { // both have an entity; check if it's the same one
|
||||
return this.entity.equals(o.getEntity());
|
||||
} else { // one has an entity but the other doesn't, so they can't be equal
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -44,6 +44,7 @@ public class LegacyItemDb extends AbstractItemDb {
|
||||
return;
|
||||
}
|
||||
|
||||
ready = false;
|
||||
durabilities.clear();
|
||||
items.clear();
|
||||
names.clear();
|
||||
@@ -90,18 +91,13 @@ public class LegacyItemDb extends AbstractItemDb {
|
||||
continue;
|
||||
}
|
||||
|
||||
Material material = Material.matchMaterial(itemName);
|
||||
if (material == null) {
|
||||
LOGGER.warning(String.format("Failed to find material for %s", itemName));
|
||||
continue;
|
||||
}
|
||||
durabilities.put(itemName, data);
|
||||
items.put(itemName, numeric);
|
||||
if (nbt != null) {
|
||||
nbtData.put(itemName, nbt);
|
||||
}
|
||||
|
||||
ItemData itemData = new ItemData(material, numeric, data);
|
||||
ItemData itemData = new ItemData(numeric, data);
|
||||
if (names.containsKey(itemData)) {
|
||||
List<String> nameList = names.get(itemData);
|
||||
nameList.add(itemName);
|
||||
@@ -120,6 +116,8 @@ public class LegacyItemDb extends AbstractItemDb {
|
||||
}
|
||||
|
||||
LOGGER.info(String.format("Loaded %s items from items.csv.", listNames().size()));
|
||||
|
||||
ready = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -152,6 +150,13 @@ public class LegacyItemDb extends AbstractItemDb {
|
||||
}
|
||||
}
|
||||
|
||||
if (itemid < 1) {
|
||||
Material matFromName = EnumUtil.getMaterial(itemname.toUpperCase());
|
||||
if (matFromName != null) {
|
||||
itemid = matFromName.getId();
|
||||
}
|
||||
}
|
||||
|
||||
if (itemid < 1) {
|
||||
throw new Exception(tl("unknownItemName", itemname));
|
||||
}
|
||||
@@ -161,7 +166,7 @@ public class LegacyItemDb extends AbstractItemDb {
|
||||
throw new Exception(tl("unknownItemId", itemid));
|
||||
}
|
||||
|
||||
Material mat = data.getMaterial();
|
||||
Material mat = getFromLegacy(itemid, (byte) metaData);
|
||||
ItemStack retval = new ItemStack(mat);
|
||||
if (nbtData.containsKey(itemname)) {
|
||||
String nbt = nbtData.get(itemname);
|
||||
@@ -198,10 +203,10 @@ public class LegacyItemDb extends AbstractItemDb {
|
||||
|
||||
@Override
|
||||
public List<String> nameList(ItemStack item) {
|
||||
ItemData itemData = new ItemData(item.getType(), item.getDurability());
|
||||
ItemData itemData = new ItemData(item.getType().getId(), item.getDurability());
|
||||
List<String> nameList = names.get(itemData);
|
||||
if (nameList == null) {
|
||||
itemData = new ItemData(item.getType(), (short) 0);
|
||||
itemData = new ItemData(item.getType().getId(), (short) 0);
|
||||
nameList = names.get(itemData);
|
||||
if (nameList == null) {
|
||||
return null;
|
||||
@@ -213,10 +218,10 @@ public class LegacyItemDb extends AbstractItemDb {
|
||||
|
||||
@Override
|
||||
public String name(ItemStack item) {
|
||||
ItemData itemData = new ItemData(item.getType(), item.getDurability());
|
||||
ItemData itemData = new ItemData(item.getType().getId(), item.getDurability());
|
||||
String name = primaryName.get(itemData);
|
||||
if (name == null) {
|
||||
itemData = new ItemData(item.getType(), (short) 0);
|
||||
itemData = new ItemData(item.getType().getId(), (short) 0);
|
||||
name = primaryName.get(itemData);
|
||||
if (name == null) {
|
||||
return null;
|
||||
@@ -225,16 +230,6 @@ public class LegacyItemDb extends AbstractItemDb {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Material getFromLegacy(final int id, final byte damage) {
|
||||
ItemData data = this.legacyIds.get(id);
|
||||
if (data == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return data.getMaterial();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLegacyId(Material material) throws Exception {
|
||||
for(Map.Entry<String, Integer> entry : items.entrySet()) {
|
||||
@@ -252,29 +247,16 @@ public class LegacyItemDb extends AbstractItemDb {
|
||||
}
|
||||
|
||||
static class ItemData {
|
||||
final private Material material;
|
||||
private int legacyId;
|
||||
private int itemNo;
|
||||
final private short itemData;
|
||||
|
||||
ItemData(Material material, short itemData) {
|
||||
this.material = material;
|
||||
ItemData(final int itemNo, final short itemData) {
|
||||
this.itemNo = itemNo;
|
||||
this.itemData = itemData;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
ItemData(Material material, final int legacyId, final short itemData) {
|
||||
this.material = material;
|
||||
this.legacyId = legacyId;
|
||||
this.itemData = itemData;
|
||||
}
|
||||
|
||||
public Material getMaterial() {
|
||||
return material;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public int getItemNo() {
|
||||
return legacyId;
|
||||
return itemNo;
|
||||
}
|
||||
|
||||
public short getItemData() {
|
||||
@@ -283,7 +265,7 @@ public class LegacyItemDb extends AbstractItemDb {
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return (31 * material.hashCode()) ^ itemData;
|
||||
return (31 * itemNo) ^ itemData;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -295,7 +277,7 @@ public class LegacyItemDb extends AbstractItemDb {
|
||||
return false;
|
||||
}
|
||||
ItemData pairo = (ItemData) o;
|
||||
return this.material == pairo.getMaterial() && this.itemData == pairo.getItemData();
|
||||
return this.itemNo == pairo.getItemNo() && this.itemData == pairo.getItemData();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@ package com.earth2me.essentials.messaging;
|
||||
|
||||
import static com.earth2me.essentials.I18n.tl;
|
||||
|
||||
import com.earth2me.essentials.Console;
|
||||
import com.earth2me.essentials.IEssentials;
|
||||
import com.earth2me.essentials.IUser;
|
||||
import com.earth2me.essentials.User;
|
||||
|
||||
@@ -189,7 +189,7 @@ public class Metrics {
|
||||
public JSONObject getPluginData() {
|
||||
JSONObject data = new JSONObject();
|
||||
|
||||
String pluginName = "EssentialsX";
|
||||
String pluginName = plugin.getDescription().getName().replace("Essentials", "EssentialsX");
|
||||
String pluginVersion = plugin.getDescription().getVersion();
|
||||
|
||||
data.put("pluginName", pluginName); // Append the name of the plugin
|
||||
|
||||
@@ -13,7 +13,7 @@ public class PermissionsHandler implements IPermissionsHandler {
|
||||
private transient IPermissionsHandler handler = null;
|
||||
private transient String defaultGroup = "default";
|
||||
private final transient Essentials ess;
|
||||
private transient boolean useSuperperms = false;
|
||||
private transient boolean useSuperperms;
|
||||
|
||||
private Class<?> lastHandler = null;
|
||||
|
||||
@@ -92,10 +92,7 @@ public class PermissionsHandler implements IPermissionsHandler {
|
||||
public void checkPermissions() {
|
||||
// load and assign a handler
|
||||
List<Class<? extends SuperpermsHandler>> providerClazz = Arrays.asList(
|
||||
BPermissions2Handler.class,
|
||||
PermissionsExHandler.class,
|
||||
PrivilegesHandler.class,
|
||||
SimplyPermsHandler.class,
|
||||
GenericVaultHandler.class,
|
||||
SuperpermsHandler.class
|
||||
);
|
||||
@@ -158,7 +155,4 @@ public class PermissionsHandler implements IPermissionsHandler {
|
||||
}
|
||||
}
|
||||
|
||||
private void checkPermLag(long start) {
|
||||
checkPermLag(start, "not defined");
|
||||
}
|
||||
}
|
||||
@@ -13,7 +13,7 @@ public abstract class AbstractVaultHandler extends SuperpermsHandler {
|
||||
protected static Permission perms = null;
|
||||
protected static Chat chat = null;
|
||||
|
||||
public boolean setupProviders() {
|
||||
private boolean setupProviders() {
|
||||
try {
|
||||
Class.forName("net.milkbowl.vault.permission.Permission");
|
||||
Class.forName("net.milkbowl.vault.chat.Chat");
|
||||
@@ -65,7 +65,7 @@ public abstract class AbstractVaultHandler extends SuperpermsHandler {
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean canLoad() {
|
||||
boolean canLoad() {
|
||||
if (Bukkit.getPluginManager().getPlugin("Vault") == null) return false;
|
||||
try {
|
||||
return setupProviders();
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
package com.earth2me.essentials.perm.impl;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
|
||||
public class BPermissions2Handler extends AbstractVaultHandler {
|
||||
@Override
|
||||
public boolean canBuild(final Player base, final String group) {
|
||||
return hasPermission(base, "bPermissions.build");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean tryProvider() {
|
||||
return super.canLoad() && Bukkit.getPluginManager().getPlugin("bPermissions") != null;
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
package com.earth2me.essentials.perm.impl;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class PrivilegesHandler extends AbstractVaultHandler {
|
||||
@Override
|
||||
public boolean canBuild(Player base, String group) {
|
||||
return hasPermission(base, "privileges.build");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean tryProvider() {
|
||||
return super.canLoad() && Bukkit.getPluginManager().getPlugin("Privileges") != null;
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
package com.earth2me.essentials.perm.impl;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class SimplyPermsHandler extends AbstractVaultHandler {
|
||||
@Override
|
||||
public boolean canBuild(Player base, String group) {
|
||||
return hasPermission(base, "permissions.allow.build");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean tryProvider() {
|
||||
return super.canLoad() && Bukkit.getPluginManager().getPlugin("SimplyPerms") != null;
|
||||
}
|
||||
}
|
||||
@@ -5,10 +5,10 @@ import org.bukkit.plugin.Plugin;
|
||||
|
||||
/**
|
||||
* Interface to be implemented by a payment method.
|
||||
* Copyright (C) 2011
|
||||
* AOL license <http://aol.nexua.org>
|
||||
*
|
||||
* @author Nijikokun <nijikokun@shortmail.com> (@nijikokun)
|
||||
* @copyright Copyright (C) 2011
|
||||
* @license AOL license <http://aol.nexua.org>
|
||||
*/
|
||||
public interface Method {
|
||||
/**
|
||||
|
||||
@@ -22,7 +22,7 @@ import java.util.Set;
|
||||
* preferred: "iConomy"
|
||||
* </pre></blockquote>
|
||||
*
|
||||
* @author: Nijikokun <nijikokun@shortmail.com> (@nijikokun) @copyright: Copyright (C) 2011 @license: AOL license
|
||||
* @author Nijikokun <nijikokun@shortmail.com> (@nijikokun) @copyright: Copyright (C) 2011 @license: AOL license
|
||||
* <http://aol.nexua.org>
|
||||
*/
|
||||
public class Methods {
|
||||
@@ -30,9 +30,9 @@ public class Methods {
|
||||
private static boolean self = false;
|
||||
private static Method Method = null;
|
||||
private static String preferred = "";
|
||||
private static final Set<Method> Methods = new HashSet<Method>();
|
||||
private static final Set<String> Dependencies = new HashSet<String>();
|
||||
private static final Set<Method> Attachables = new HashSet<Method>();
|
||||
private static final Set<Method> Methods = new HashSet<>();
|
||||
private static final Set<String> Dependencies = new HashSet<>();
|
||||
private static final Set<Method> Attachables = new HashSet<>();
|
||||
|
||||
static {
|
||||
_init();
|
||||
@@ -79,7 +79,7 @@ public class Methods {
|
||||
*
|
||||
* @return <code>Set<String></code> - Array of payment methods that are loaded.
|
||||
*
|
||||
* @see #setMethod(org.bukkit.plugin.Plugin)
|
||||
* @see #setMethod(PluginManager)
|
||||
*/
|
||||
public static Set<String> getDependencies() {
|
||||
return Dependencies;
|
||||
@@ -114,8 +114,8 @@ public class Methods {
|
||||
*
|
||||
* @return <code>boolean</code>
|
||||
*
|
||||
* @see #setMethod(org.bukkit.plugin.Plugin)
|
||||
* @see #checkDisabled(org.bukkit.plugin.Plugin)
|
||||
* @see #setMethod(PluginManager)
|
||||
* @see #checkDisabled(Plugin)
|
||||
*/
|
||||
public static boolean hasMethod() {
|
||||
return (Method != null);
|
||||
@@ -124,7 +124,7 @@ public class Methods {
|
||||
/**
|
||||
* Checks Plugin Class against a multitude of checks to verify it's usability as a payment method.
|
||||
*
|
||||
* @param <code>PluginManager</code> the plugin manager for the server
|
||||
* @param manager the plugin manager for the server
|
||||
*
|
||||
* @return <code>boolean</code> True on success, False on failure.
|
||||
*/
|
||||
@@ -140,7 +140,7 @@ public class Methods {
|
||||
|
||||
int count = 0;
|
||||
boolean match = false;
|
||||
Plugin plugin = null;
|
||||
Plugin plugin;
|
||||
|
||||
for (String name : getDependencies()) {
|
||||
if (hasMethod()) {
|
||||
|
||||
@@ -1,18 +1,17 @@
|
||||
package com.earth2me.essentials.register.payment.methods;
|
||||
|
||||
import com.earth2me.essentials.register.payment.Method;
|
||||
import net.milkbowl.vault.Vault;
|
||||
import net.milkbowl.vault.economy.Economy;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.RegisteredServiceProvider;
|
||||
|
||||
|
||||
public class VaultEco implements Method {
|
||||
private Vault vault;
|
||||
private Plugin vault;
|
||||
private Economy economy;
|
||||
|
||||
@Override
|
||||
public Vault getPlugin() {
|
||||
public Plugin getPlugin() {
|
||||
return this.vault;
|
||||
}
|
||||
|
||||
@@ -108,17 +107,15 @@ public class VaultEco implements Method {
|
||||
public boolean isCompatible(Plugin plugin) {
|
||||
try {
|
||||
RegisteredServiceProvider<Economy> ecoPlugin = plugin.getServer().getServicesManager().getRegistration(net.milkbowl.vault.economy.Economy.class);
|
||||
return plugin instanceof Vault && ecoPlugin != null && !ecoPlugin.getProvider().getName().equals("Essentials Economy");
|
||||
} catch (LinkageError e) {
|
||||
return false;
|
||||
} catch (Exception e) {
|
||||
return plugin.getName().equals("Vault") && ecoPlugin != null && !ecoPlugin.getProvider().getName().equals("Essentials Economy");
|
||||
} catch (LinkageError | Exception e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPlugin(Plugin plugin) {
|
||||
this.vault = (Vault) plugin;
|
||||
this.vault = plugin;
|
||||
RegisteredServiceProvider<Economy> economyProvider = this.vault.getServer().getServicesManager().getRegistration(net.milkbowl.vault.economy.Economy.class);
|
||||
if (economyProvider != null) {
|
||||
this.economy = economyProvider.getProvider();
|
||||
@@ -130,7 +127,7 @@ public class VaultEco implements Method {
|
||||
private final String name;
|
||||
private final Economy economy;
|
||||
|
||||
public VaultAccount(String name, Economy economy) {
|
||||
VaultAccount(String name, Economy economy) {
|
||||
this.name = name;
|
||||
this.economy = economy;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.earth2me.essentials.signs;
|
||||
|
||||
import com.earth2me.essentials.*;
|
||||
import com.earth2me.essentials.utils.EnumUtil;
|
||||
import com.earth2me.essentials.utils.NumberUtil;
|
||||
import net.ess3.api.IEssentials;
|
||||
import net.ess3.api.MaxMoneyException;
|
||||
@@ -25,6 +26,7 @@ import static com.earth2me.essentials.I18n.tl;
|
||||
|
||||
|
||||
public class EssentialsSign {
|
||||
private static final Material SIGN_POST = EnumUtil.getMaterial("SIGN", "SIGN_POST");
|
||||
private static final Set<Material> EMPTY_SET = new HashSet<Material>();
|
||||
protected static final BigDecimal MINTRANSACTION = new BigDecimal("0.01");
|
||||
protected transient final String signName;
|
||||
@@ -58,9 +60,7 @@ public class EssentialsSign {
|
||||
sign.setLine(0, getSuccessName(ess));
|
||||
}
|
||||
return ret;
|
||||
} catch (ChargeException ex) {
|
||||
showError(ess, user.getSource(), ex, signName);
|
||||
} catch (SignException ex) {
|
||||
} catch (ChargeException | SignException ex) {
|
||||
showError(ess, user.getSource(), ex, signName);
|
||||
}
|
||||
// Return true, so the player sees the wrong sign.
|
||||
@@ -115,9 +115,6 @@ public class EssentialsSign {
|
||||
}
|
||||
|
||||
return onSignInteract(sign, user, getUsername(user), ess);
|
||||
} catch (ChargeException ex) {
|
||||
showError(ess, user.getSource(), ex, signName);
|
||||
return false;
|
||||
} catch (Exception ex) {
|
||||
showError(ess, user.getSource(), ex, signName);
|
||||
return false;
|
||||
@@ -161,9 +158,7 @@ public class EssentialsSign {
|
||||
User user = ess.getUser(player);
|
||||
try {
|
||||
return onBlockPlace(block, user, getUsername(user), ess);
|
||||
} catch (ChargeException ex) {
|
||||
showError(ess, user.getSource(), ex, signName);
|
||||
} catch (SignException ex) {
|
||||
} catch (ChargeException | SignException ex) {
|
||||
showError(ess, user.getSource(), ex, signName);
|
||||
}
|
||||
return false;
|
||||
@@ -173,9 +168,7 @@ public class EssentialsSign {
|
||||
User user = ess.getUser(player);
|
||||
try {
|
||||
return onBlockInteract(block, user, getUsername(user), ess);
|
||||
} catch (ChargeException ex) {
|
||||
showError(ess, user.getSource(), ex, signName);
|
||||
} catch (SignException ex) {
|
||||
} catch (ChargeException | SignException ex) {
|
||||
showError(ess, user.getSource(), ex, signName);
|
||||
}
|
||||
return false;
|
||||
@@ -213,7 +206,7 @@ public class EssentialsSign {
|
||||
|
||||
protected static boolean checkIfBlockBreaksSigns(final Block block) {
|
||||
final Block sign = block.getRelative(BlockFace.UP);
|
||||
if (sign.getType() == Material.SIGN && isValidSign(new BlockSign(sign))) {
|
||||
if (sign.getType() == SIGN_POST && isValidSign(new BlockSign(sign))) {
|
||||
return true;
|
||||
}
|
||||
final BlockFace[] directions = new BlockFace[]{BlockFace.NORTH, BlockFace.EAST, BlockFace.SOUTH, BlockFace.WEST};
|
||||
@@ -304,12 +297,16 @@ public class EssentialsSign {
|
||||
}
|
||||
|
||||
protected final Trade getTrade(final ISign sign, final int amountIndex, final int itemIndex, final User player, final IEssentials ess) throws SignException {
|
||||
return getTrade(sign, amountIndex, itemIndex, player, false, ess);
|
||||
}
|
||||
|
||||
protected final Trade getTrade(final ISign sign, final int amountIndex, final int itemIndex, final User player, final boolean allowId, final IEssentials ess) throws SignException {
|
||||
final String itemType = getSignText(sign, itemIndex);
|
||||
if (itemType.equalsIgnoreCase("exp") || itemType.equalsIgnoreCase("xp")) {
|
||||
final int amount = getIntegerPositive(getSignText(sign, amountIndex));
|
||||
return new Trade(amount, ess);
|
||||
}
|
||||
final ItemStack item = getItemStack(itemType, 1, true, ess);
|
||||
final ItemStack item = getItemStack(itemType, 1, allowId, ess);
|
||||
final int amount = Math.min(getIntegerPositive(getSignText(sign, amountIndex)), item.getType().getMaxStackSize() * player.getBase().getInventory().getSize());
|
||||
if (item.getType() == Material.AIR || amount < 1) {
|
||||
throw new SignException(tl("moreThanZero"));
|
||||
@@ -409,6 +406,10 @@ public class EssentialsSign {
|
||||
}
|
||||
|
||||
protected final Trade getTrade(final ISign sign, final int index, final int decrement, final IEssentials ess) throws SignException {
|
||||
return getTrade(sign, index, decrement, false, ess);
|
||||
}
|
||||
|
||||
protected final Trade getTrade(final ISign sign, final int index, final int decrement, final boolean allowId, final IEssentials ess) throws SignException {
|
||||
final String line = getSignText(sign, index);
|
||||
if (line.isEmpty()) {
|
||||
return new Trade(signName.toLowerCase(Locale.ENGLISH) + "sign", ess);
|
||||
@@ -431,7 +432,7 @@ public class EssentialsSign {
|
||||
sign.setLine(index, quantity + " exp");
|
||||
return new Trade(quantity, ess);
|
||||
} else {
|
||||
final ItemStack stack = getItemStack(item, quantity, true, ess);
|
||||
final ItemStack stack = getItemStack(item, quantity, allowId, ess);
|
||||
sign.setLine(index, quantity + " " + item);
|
||||
return new Trade(stack, ess);
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.earth2me.essentials.signs;
|
||||
|
||||
import com.earth2me.essentials.I18n;
|
||||
import com.earth2me.essentials.User;
|
||||
import com.earth2me.essentials.utils.EnumUtil;
|
||||
import com.earth2me.essentials.utils.FormatUtil;
|
||||
import net.ess3.api.IEssentials;
|
||||
import net.ess3.api.MaxMoneyException;
|
||||
@@ -22,7 +23,7 @@ import java.util.logging.Logger;
|
||||
public class SignBlockListener implements Listener {
|
||||
private static final Logger LOGGER = Logger.getLogger("Essentials");
|
||||
private static final Material WALL_SIGN = Material.WALL_SIGN;
|
||||
private static final Material SIGN_POST = Material.SIGN;
|
||||
private static final Material SIGN_POST = EnumUtil.getMaterial("SIGN", "SIGN_POST");
|
||||
private final transient IEssentials ess;
|
||||
|
||||
public SignBlockListener(IEssentials ess) {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.earth2me.essentials.signs;
|
||||
|
||||
import com.earth2me.essentials.utils.EnumUtil;
|
||||
import net.ess3.api.IEssentials;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
@@ -11,6 +12,8 @@ import org.bukkit.event.entity.EntityExplodeEvent;
|
||||
|
||||
|
||||
public class SignEntityListener implements Listener {
|
||||
|
||||
private static final Material SIGN_POST = EnumUtil.getMaterial("SIGN", "SIGN_POST");
|
||||
private final transient IEssentials ess;
|
||||
|
||||
public SignEntityListener(final IEssentials ess) {
|
||||
@@ -25,7 +28,7 @@ public class SignEntityListener implements Listener {
|
||||
}
|
||||
|
||||
for (Block block : event.blockList()) {
|
||||
if (((block.getType() == Material.WALL_SIGN || block.getType() == Material.SIGN) && EssentialsSign.isValidSign(ess, new EssentialsSign.BlockSign(block))) || EssentialsSign.checkIfBlockBreaksSigns(block)) {
|
||||
if (((block.getType() == Material.WALL_SIGN || block.getType() == SIGN_POST) && EssentialsSign.isValidSign(ess, new EssentialsSign.BlockSign(block))) || EssentialsSign.checkIfBlockBreaksSigns(block)) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
@@ -46,7 +49,7 @@ public class SignEntityListener implements Listener {
|
||||
}
|
||||
|
||||
final Block block = event.getBlock();
|
||||
if (((block.getType() == Material.WALL_SIGN || block.getType() == Material.SIGN) && EssentialsSign.isValidSign(ess, new EssentialsSign.BlockSign(block))) || EssentialsSign.checkIfBlockBreaksSigns(block)) {
|
||||
if (((block.getType() == Material.WALL_SIGN || block.getType() == SIGN_POST) && EssentialsSign.isValidSign(ess, new EssentialsSign.BlockSign(block))) || EssentialsSign.checkIfBlockBreaksSigns(block)) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -54,6 +54,8 @@ public class SignGameMode extends EssentialsSign {
|
||||
player.setGameMode(GameMode.CREATIVE);
|
||||
} else if (mode.contains("advent") || mode.equalsIgnoreCase("2")) {
|
||||
player.setGameMode(GameMode.ADVENTURE);
|
||||
} else if (mode.contains("spec") || mode.equalsIgnoreCase("3")) {
|
||||
player.setGameMode(GameMode.SPECTATOR);
|
||||
} else {
|
||||
throw new SignException(tl("invalidSignLine", 2));
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.earth2me.essentials.signs;
|
||||
|
||||
import com.earth2me.essentials.utils.MaterialUtil;
|
||||
import net.ess3.api.IEssentials;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
@@ -54,7 +55,7 @@ public class SignPlayerListener implements Listener {
|
||||
}
|
||||
|
||||
final Material mat = block.getType();
|
||||
if (mat == Material.SIGN || mat == Material.WALL_SIGN) {
|
||||
if (MaterialUtil.isSign(mat)) {
|
||||
final String csign = ((Sign) block.getState()).getLine(0);
|
||||
for (EssentialsSign sign : ess.getSettings().enabledSigns()) {
|
||||
if (csign.equalsIgnoreCase(sign.getSuccessName(ess))) {
|
||||
|
||||
@@ -4,7 +4,9 @@ import com.earth2me.essentials.ChargeException;
|
||||
import com.earth2me.essentials.Trade;
|
||||
import com.earth2me.essentials.Trade.OverflowType;
|
||||
import com.earth2me.essentials.User;
|
||||
import com.earth2me.essentials.utils.EnumUtil;
|
||||
import com.earth2me.essentials.utils.FormatUtil;
|
||||
import com.earth2me.essentials.utils.MaterialUtil;
|
||||
import net.ess3.api.IEssentials;
|
||||
import net.ess3.api.MaxMoneyException;
|
||||
import org.bukkit.Location;
|
||||
@@ -21,13 +23,14 @@ import static com.earth2me.essentials.I18n.tl;
|
||||
|
||||
@Deprecated // This sign will be removed soon
|
||||
public class SignProtection extends EssentialsSign {
|
||||
private final transient Set<Material> protectedBlocks = EnumSet.noneOf(Material.class);
|
||||
private final transient Set<Material> protectedBlocks = EnumUtil.getAllMatching(Material.class,
|
||||
"CHEST",
|
||||
"FURNACE",
|
||||
"BURNING_FURNACE",
|
||||
"DISPENSER");
|
||||
|
||||
public SignProtection() {
|
||||
super("Protection");
|
||||
protectedBlocks.add(Material.CHEST);
|
||||
protectedBlocks.add(Material.FURNACE);
|
||||
protectedBlocks.add(Material.DISPENSER);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -102,7 +105,7 @@ public class SignProtection extends EssentialsSign {
|
||||
}
|
||||
|
||||
private SignProtectionState checkProtectionSign(final Block block, final User user, final String username) {
|
||||
if (block.getType() == Material.SIGN || block.getType() == Material.WALL_SIGN) {
|
||||
if (MaterialUtil.isSign(block.getType())) {
|
||||
final BlockSign sign = new BlockSign(block);
|
||||
if (sign.getLine(0).equals(this.getSuccessName())) { // TODO call getSuccessName(IEssentials)
|
||||
return checkProtectionSign(sign, user, username);
|
||||
@@ -159,7 +162,7 @@ public class SignProtection extends EssentialsSign {
|
||||
public boolean isBlockProtected(final Block block) {
|
||||
final Block[] faces = getAdjacentBlocks(block);
|
||||
for (Block b : faces) {
|
||||
if (b.getType() == Material.SIGN || b.getType() == Material.WALL_SIGN) {
|
||||
if (MaterialUtil.isSign(b.getType())) {
|
||||
final Sign sign = (Sign) b.getState();
|
||||
if (sign.getLine(0).equalsIgnoreCase("§1[Protection]")) {
|
||||
return true;
|
||||
@@ -169,7 +172,7 @@ public class SignProtection extends EssentialsSign {
|
||||
final Block[] faceChest = getAdjacentBlocks(b);
|
||||
|
||||
for (Block a : faceChest) {
|
||||
if (a.getType() == Material.SIGN || a.getType() == Material.WALL_SIGN) {
|
||||
if (MaterialUtil.isSign(a.getType())) {
|
||||
final Sign sign = (Sign) a.getState();
|
||||
if (sign.getLine(0).equalsIgnoreCase("§1[Protection]")) {
|
||||
return true;
|
||||
|
||||
@@ -26,8 +26,8 @@ public class SignTrade extends EssentialsSign {
|
||||
protected boolean onSignCreate(final ISign sign, final User player, final String username, final IEssentials ess) throws SignException, ChargeException {
|
||||
validateTrade(sign, 1, false, ess);
|
||||
validateTrade(sign, 2, true, ess);
|
||||
final Trade trade = getTrade(sign, 2, AmountType.ROUNDED, true, ess);
|
||||
final Trade charge = getTrade(sign, 1, AmountType.ROUNDED, false, ess);
|
||||
final Trade trade = getTrade(sign, 2, AmountType.ROUNDED, true, true, ess);
|
||||
final Trade charge = getTrade(sign, 1, AmountType.ROUNDED, false, true, ess);
|
||||
if (trade.getType() == charge.getType() && (trade.getType() != TradeType.ITEM || trade.getItemStack().isSimilar(charge.getItemStack()))) {
|
||||
throw new SignException("You cannot trade for the same item type.");
|
||||
}
|
||||
@@ -44,7 +44,7 @@ public class SignTrade extends EssentialsSign {
|
||||
final Trade store = rechargeSign(sign, ess, player);
|
||||
Trade stored;
|
||||
try {
|
||||
stored = getTrade(sign, 1, AmountType.TOTAL, true, ess);
|
||||
stored = getTrade(sign, 1, AmountType.TOTAL, true, true, ess);
|
||||
subtractAmount(sign, 1, stored, ess);
|
||||
|
||||
Map<Integer, ItemStack> withdraw = stored.pay(player, OverflowType.RETURN);
|
||||
@@ -62,8 +62,8 @@ public class SignTrade extends EssentialsSign {
|
||||
}
|
||||
Trade.log("Sign", "Trade", "Deposit", username, store, username, null, sign.getBlock().getLocation(), ess);
|
||||
} else {
|
||||
final Trade charge = getTrade(sign, 1, AmountType.COST, false, ess);
|
||||
final Trade trade = getTrade(sign, 2, AmountType.COST, true, ess);
|
||||
final Trade charge = getTrade(sign, 1, AmountType.COST, false, true, ess);
|
||||
final Trade trade = getTrade(sign, 2, AmountType.COST, true, true, ess);
|
||||
charge.isAffordableFor(player);
|
||||
addAmount(sign, 1, charge, ess);
|
||||
subtractAmount(sign, 2, trade, ess);
|
||||
@@ -80,7 +80,7 @@ public class SignTrade extends EssentialsSign {
|
||||
}
|
||||
|
||||
private Trade rechargeSign(final ISign sign, final IEssentials ess, final User player) throws SignException, ChargeException {
|
||||
final Trade trade = getTrade(sign, 2, AmountType.COST, false, ess);
|
||||
final Trade trade = getTrade(sign, 2, AmountType.COST, false, true, ess);
|
||||
if (trade.getItemStack() != null && player.getBase().getItemInHand() != null && trade.getItemStack().getType() == player.getBase().getItemInHand().getType() && trade.getItemStack().getDurability() == player.getBase().getItemInHand().getDurability() && trade.getItemStack().getEnchantments().equals(player.getBase().getItemInHand().getEnchantments())) {
|
||||
int amount = player.getBase().getItemInHand().getAmount();
|
||||
amount -= amount % trade.getItemStack().getAmount();
|
||||
@@ -106,8 +106,8 @@ public class SignTrade extends EssentialsSign {
|
||||
|
||||
if (canBreak) {
|
||||
try {
|
||||
final Trade stored1 = getTrade(sign, 1, AmountType.TOTAL, false, ess);
|
||||
final Trade stored2 = getTrade(sign, 2, AmountType.TOTAL, false, ess);
|
||||
final Trade stored1 = getTrade(sign, 1, AmountType.TOTAL, false, true, ess);
|
||||
final Trade stored2 = getTrade(sign, 2, AmountType.TOTAL, false, true, ess);
|
||||
|
||||
if (!canCollect) {
|
||||
Trade.log("Sign", "Trade", "Destroy", signOwner, stored2, username, stored1, sign.getBlock().getLocation(), ess);
|
||||
@@ -206,6 +206,10 @@ public class SignTrade extends EssentialsSign {
|
||||
}
|
||||
|
||||
protected final Trade getTrade(final ISign sign, final int index, final AmountType amountType, final boolean notEmpty, final IEssentials ess) throws SignException {
|
||||
return getTrade(sign, index, amountType, notEmpty, false, ess);
|
||||
}
|
||||
|
||||
protected final Trade getTrade(final ISign sign, final int index, final AmountType amountType, final boolean notEmpty, final boolean allowId, final IEssentials ess) throws SignException {
|
||||
final String line = sign.getLine(index).trim();
|
||||
if (line.isEmpty()) {
|
||||
throw new SignException("Empty line");
|
||||
@@ -237,7 +241,7 @@ public class SignTrade extends EssentialsSign {
|
||||
return new Trade((amountType == AmountType.COST ? stackamount : amount), ess);
|
||||
} else {
|
||||
final int stackamount = getIntegerPositive(split[0]);
|
||||
final ItemStack item = getItemStack(split[1], stackamount, true, ess);
|
||||
final ItemStack item = getItemStack(split[1], stackamount, allowId, ess);
|
||||
int amount = getInteger(split[2]);
|
||||
if (amountType == AmountType.ROUNDED) {
|
||||
amount -= amount % stackamount;
|
||||
|
||||
@@ -12,7 +12,7 @@ public class EnumUtil {
|
||||
|
||||
/**
|
||||
* Returns the field matching the first provided enum name that exists within the given
|
||||
* enum class.
|
||||
* enum class. If no field is found, this method returns null.
|
||||
*
|
||||
* @param enumClass The class to search through
|
||||
* @param names The names of the fields to search for
|
||||
|
||||
@@ -17,7 +17,7 @@ import static com.earth2me.essentials.I18n.tl;
|
||||
|
||||
public class LocationUtil {
|
||||
// The player can stand inside these materials
|
||||
public static final Set<Material> HOLLOW_MATERIALS = new HashSet<>();
|
||||
private static final Set<Material> HOLLOW_MATERIALS = new HashSet<>();
|
||||
private static final Set<Material> TRANSPARENT_MATERIALS = new HashSet<>();
|
||||
|
||||
static {
|
||||
@@ -32,8 +32,7 @@ public class LocationUtil {
|
||||
TRANSPARENT_MATERIALS.add(Material.WATER);
|
||||
try {
|
||||
TRANSPARENT_MATERIALS.add(Material.valueOf("FLOWING_WATER"));
|
||||
} catch (Exception ignored) { // 1.13 WATER uses Levelled
|
||||
}
|
||||
} catch (Exception ignored) {} // 1.13 WATER uses Levelled
|
||||
}
|
||||
|
||||
public static final int RADIUS = 3;
|
||||
@@ -49,7 +48,7 @@ public class LocationUtil {
|
||||
public int y;
|
||||
public int z;
|
||||
|
||||
public Vector3D(int x, int y, int z) {
|
||||
Vector3D(int x, int y, int z) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
@@ -57,7 +56,7 @@ public class LocationUtil {
|
||||
}
|
||||
|
||||
static {
|
||||
List<Vector3D> pos = new ArrayList<Vector3D>();
|
||||
List<Vector3D> pos = new ArrayList<>();
|
||||
for (int x = -RADIUS; x <= RADIUS; x++) {
|
||||
for (int y = -RADIUS; y <= RADIUS; y++) {
|
||||
for (int z = -RADIUS; z <= RADIUS; z++) {
|
||||
@@ -65,30 +64,22 @@ public class LocationUtil {
|
||||
}
|
||||
}
|
||||
}
|
||||
Collections.sort(pos, new Comparator<Vector3D>() {
|
||||
@Override
|
||||
public int compare(Vector3D a, Vector3D b) {
|
||||
return (a.x * a.x + a.y * a.y + a.z * a.z) - (b.x * b.x + b.y * b.y + b.z * b.z);
|
||||
}
|
||||
});
|
||||
pos.sort(Comparator.comparingInt(a -> (a.x * a.x + a.y * a.y + a.z * a.z)));
|
||||
VOLUME = pos.toArray(new Vector3D[0]);
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public static Location getTarget(final LivingEntity entity) throws Exception {
|
||||
Block block = null;
|
||||
try {
|
||||
block = entity.getTargetBlock(TRANSPARENT_MATERIALS, 300);
|
||||
} catch (NoSuchMethodError e) {
|
||||
// failing now :(
|
||||
}
|
||||
} catch (NoSuchMethodError ignored) {} // failing now :(
|
||||
if (block == null) {
|
||||
throw new Exception("Not targeting a block");
|
||||
}
|
||||
return block.getLocation();
|
||||
}
|
||||
|
||||
static boolean isBlockAboveAir(final World world, final int x, final int y, final int z) {
|
||||
public static boolean isBlockAboveAir(final World world, final int x, final int y, final int z) {
|
||||
return y > world.getMaxHeight() || HOLLOW_MATERIALS.contains(world.getBlockAt(x, y - 1, z).getType());
|
||||
}
|
||||
|
||||
@@ -124,8 +115,7 @@ public class LocationUtil {
|
||||
if (below.getType() == Material.valueOf("FLOWING_LAVA")) {
|
||||
return true;
|
||||
}
|
||||
} catch (Exception ignored) { // 1.13 LAVA uses Levelled
|
||||
}
|
||||
} catch (Exception ignored) {} // 1.13 LAVA uses Levelled
|
||||
|
||||
Material PORTAL = EnumUtil.getMaterial("NETHER_PORTAL", "PORTAL");
|
||||
|
||||
@@ -159,7 +149,6 @@ public class LocationUtil {
|
||||
user.getBase().setFlying(true);
|
||||
}
|
||||
// ess can be null if old deprecated method is calling it.
|
||||
System.out.println((ess == null) + " " + ess.getSettings().isTeleportToCenterLocation());
|
||||
if (ess == null || ess.getSettings().isTeleportToCenterLocation()) {
|
||||
return getRoundedDestination(loc);
|
||||
} else {
|
||||
|
||||
@@ -103,11 +103,16 @@ public class MaterialUtil {
|
||||
}
|
||||
|
||||
public static Material convertFromLegacy(int id, byte damage) {
|
||||
return EnumSet.allOf(Material.class).stream()
|
||||
.filter(material -> material.getId() == id)
|
||||
.findFirst()
|
||||
.map(material -> Bukkit.getUnsafe().fromLegacy(new MaterialData(material, damage)))
|
||||
.orElse(null);
|
||||
for (Material material : EnumSet.allOf(Material.class)) {
|
||||
if (material.getId() == id) {
|
||||
try {
|
||||
return Bukkit.getUnsafe().fromLegacy(new MaterialData(material, damage));
|
||||
} catch (NoSuchMethodError error) {
|
||||
return material;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static DyeColor getColorOf(Material material) {
|
||||
|
||||
@@ -12,6 +12,7 @@ import java.util.regex.Pattern;
|
||||
public class VersionUtil {
|
||||
|
||||
public static final BukkitVersion v1_8_8_R01 = BukkitVersion.fromString("1.8.8-R0.1-SNAPSHOT");
|
||||
public static final BukkitVersion v1_9_R01 = BukkitVersion.fromString("1.9-R0.1-SNAPSHOT");
|
||||
public static final BukkitVersion v1_9_4_R01 = BukkitVersion.fromString("1.9.4-R0.1-SNAPSHOT");
|
||||
public static final BukkitVersion v1_10_2_R01 = BukkitVersion.fromString("1.10.2-R0.1-SNAPSHOT");
|
||||
public static final BukkitVersion v1_11_2_R01 = BukkitVersion.fromString("1.11.2-R0.1-SNAPSHOT");
|
||||
@@ -22,8 +23,13 @@ public class VersionUtil {
|
||||
|
||||
private static final Set<BukkitVersion> supportedVersions = ImmutableSet.of(v1_8_8_R01, v1_9_4_R01, v1_10_2_R01, v1_11_2_R01, v1_12_2_R01, v1_13_2_R01);
|
||||
|
||||
private static BukkitVersion serverVersion = null;
|
||||
|
||||
public static BukkitVersion getServerBukkitVersion() {
|
||||
return BukkitVersion.fromString(Bukkit.getServer().getBukkitVersion());
|
||||
if (serverVersion == null) {
|
||||
serverVersion = BukkitVersion.fromString(Bukkit.getServer().getBukkitVersion());
|
||||
}
|
||||
return serverVersion;
|
||||
}
|
||||
|
||||
public static boolean isServerSupported() {
|
||||
@@ -48,7 +54,16 @@ public class VersionUtil {
|
||||
matcher = VERSION_PATTERN.matcher(v1_13_2_R01.toString());
|
||||
Preconditions.checkArgument(matcher.matches(), string + " is not in valid version format. e.g. 1.8.8-R0.1");
|
||||
}
|
||||
return new BukkitVersion(Integer.parseInt(matcher.group(1)), Integer.parseInt(matcher.group(2)), Integer.parseInt(matcher.group(3)), Double.parseDouble(matcher.group(4)));
|
||||
|
||||
return from(matcher.group(1), matcher.group(2), matcher.group(3), matcher.group(4));
|
||||
}
|
||||
|
||||
private static BukkitVersion from(String major, String minor, String patch, String revision) {
|
||||
if (patch.isEmpty()) patch = "0";
|
||||
return new BukkitVersion(Integer.parseInt(major),
|
||||
Integer.parseInt(minor),
|
||||
Integer.parseInt(patch),
|
||||
Double.parseDouble(revision));
|
||||
}
|
||||
|
||||
private BukkitVersion(int major, int minor, int patch, double revision) {
|
||||
|
||||
@@ -1901,9 +1901,6 @@ plantren,91,0
|
||||
glowpumpkin,91,0
|
||||
gpumpkin,91,0
|
||||
lpumpkin,91,0
|
||||
lockedchest,95,0
|
||||
lockchest,95,0
|
||||
jokechest,95,0
|
||||
whiteglass,95,0
|
||||
whitesglass,95,0
|
||||
whitestainedglass,95,0
|
||||
|
||||
|
+2874
-826
File diff suppressed because it is too large.
Load diff
@@ -211,6 +211,7 @@ is=is
|
||||
isIpBanned=\u00a76IP \u00a7c{0} \u00a76is banned.
|
||||
internalError=\u00a7cAn internal error occurred while attempting to perform this command.
|
||||
itemCannotBeSold=\u00a74That item cannot be sold to the server.
|
||||
itemId=\u00a76ID\:\u00a7c {0}
|
||||
itemMustBeStacked=\u00a74Item must be traded in stacks. A quantity of 2s would be two stacks, etc.
|
||||
itemNames=\u00a76Item short names\:\u00a7r {0}
|
||||
itemNotEnough1=\u00a74You do not have enough of that item to sell.
|
||||
@@ -544,7 +545,7 @@ typeTpacancel=\u00a76To cancel this request, type \u00a7c/tpacancel\u00a76.
|
||||
typeTpaccept=\u00a76To teleport, type \u00a7c/tpaccept\u00a76.
|
||||
typeTpdeny=\u00a76To deny this request, type \u00a7c/tpdeny\u00a76.
|
||||
typeWorldName=\u00a76You can also type the name of a specific world.
|
||||
unableToSpawnItem=\u00a74Cannot spawn \u00a7c{0}\u00a74, this is not a spawnable item.
|
||||
unableToSpawnItem=\u00a74Cannot spawn \u00a7c{0}\u00a74; this is not a spawnable item.
|
||||
unableToSpawnMob=\u00a74Unable to spawn mob.
|
||||
unignorePlayer=\u00a76You are not ignoring player\u00a7c {0} \u00a76anymore.
|
||||
unknownItemId=\u00a74Unknown item id\:\u00a7r {0}\u00a74.
|
||||
|
||||
@@ -211,6 +211,7 @@ is=je
|
||||
isIpBanned=\u00a76IP \u00a7c{0} \u00a76je zabanovana.
|
||||
internalError=\u00a7cAn internal error occurred while attempting to perform this command.
|
||||
itemCannotBeSold=\u00a74Tento predmet nelze prodat serveru.
|
||||
itemId=\u00a76ID\:\u00a7c {0}
|
||||
itemMustBeStacked=\u00a74Predmety musi byt vymeneny ve stacku.
|
||||
itemNames=\u00a76Zkracene nazvy predmetu\:\u00a7r {0}
|
||||
itemNotEnough1=\u00a74Nemas dostatek, aby jsi jej mohl prodat.
|
||||
|
||||
@@ -211,6 +211,7 @@ is=er
|
||||
isIpBanned=\u00a76IP \u00a7c{0} \u00a76er banlyst.
|
||||
internalError=\u00a7cAn internal error occurred while attempting to perform this command.
|
||||
itemCannotBeSold=\u00a74Det element kan ikke s\u00e6lges til serveren.
|
||||
itemId=\u00a76ID\:\u00a7c {0}
|
||||
itemMustBeStacked=\u00a74Elementet skal forhandles i form at stakke. En m\u00e6ngde af 2s vil v\u00e6re 2 stakke, osv.
|
||||
itemNames=\u00a76Elementforkortelser\:\u00a7r {0}
|
||||
itemNotEnough1=\u00a74Du har ikke nok af det element til at s\u00e6lge det.
|
||||
|
||||
@@ -211,6 +211,7 @@ is=ist
|
||||
isIpBanned=\u00a76IP \u00a7c{0} \u00a76wurde gesperrt.
|
||||
internalError=\u00a7cBeim ausf\u00fchren des Befehls ist ein interner Fehler aufgetreten.
|
||||
itemCannotBeSold=\u00a74Dieser Gegenstand kann nicht verkauft werden.
|
||||
itemId=\u00a76ID\:\u00a7c {0}
|
||||
itemMustBeStacked=\u00a74Gegenstand muss als Stapel verkauft werden. Eine Anzahl von 2s verkauft 2 Stapel usw.
|
||||
itemNames=\u00a76Kurze Gegenstandsnamen\:\u00a7r {0}
|
||||
itemNotEnough1=\u00a74Du hast nicht genug Gegenst\u00e4nde zu verkaufen.
|
||||
@@ -223,7 +224,7 @@ itemsNotConverted=\u00a74Du hast keine Items, die in Bl\u00f6cke konvertiert wer
|
||||
itemSold=\u00a7aVerkauft f\u00fcr \u00a7c{0}\u00a7a ({1} {2} Einheiten je {3})
|
||||
itemSoldConsole=\u00a7a{0} $averkauft {1} f\u00fcr \u00a7a{2} \u00a7a({3} Einheiten je {4})
|
||||
itemSpawn=\u00a76Du gibst dir\u00a7c {0}\u00a76x\u00a7c {1}
|
||||
itemType=\u00a76Gegenstand\:\u00a7c {0} \u00a76-\u00a7c {1}
|
||||
itemType=\u00a76Gegenstand\:\u00a7c {0} \u00a76
|
||||
jailAlreadyIncarcerated=\u00a74Spieler ist bereits im Gef\u00e4ngnis\:\u00a7c {0}
|
||||
jailList=\u00a76Jails\:\u00a7r {0}
|
||||
jailMessage=\u00a74Du hast ein Verbrechen begangen, also musst du deine Zeit absitzen.
|
||||
@@ -574,7 +575,7 @@ versionOutputVaultMissing=\u00a74Vault ist nicht installiert. Der Chat und die P
|
||||
versionOutputFine=\u00a76{0} Version: \u00a7a{1}
|
||||
versionOutputWarn=\u00a76{0} Version: \u00a7c{1}
|
||||
versionOutputUnsupported=\u00a7d{0} \u00a76Version: \u00a7d{1}
|
||||
versionOutputUnsupportedPlugins=\u00a76Du verwendest Plugins, die \u00a7nicht unterst\u00fctzt\u00a76 werden.!
|
||||
versionOutputUnsupportedPlugins=\u00a76Du verwendest Plugins, die \u00A7dnicht \u00a76unterst\u00fctzt werden!
|
||||
versionMismatch=\u00a74Versionen sind nicht gleich\! Bitte aktualisiere {0}.
|
||||
versionMismatchAll=\u00a74Versionen sind nicht gleich\! Bitte aktualisiere alle Essentials jar-Dateien auf die gleiche Version.
|
||||
voiceSilenced=\u00a76Du bist nun stummgeschaltet\!
|
||||
|
||||
@@ -211,6 +211,7 @@ is=is
|
||||
isIpBanned=\u00a76IP \u00a7c{0} \u00a76is banned.
|
||||
internalError=\u00a7cAn internal error occurred while attempting to perform this command.
|
||||
itemCannotBeSold=\u00a74That item cannot be sold to the server.
|
||||
itemId=\u00a76ID\:\u00a7c {0}
|
||||
itemMustBeStacked=\u00a74Item must be traded in stacks. A quantity of 2s would be two stacks, etc.
|
||||
itemNames=\u00a76Item short names\:\u00a7r {0}
|
||||
itemNotEnough1=\u00a74You do not have enough of that item to sell.
|
||||
@@ -544,7 +545,7 @@ typeTpacancel=\u00a76To cancel this request, type \u00a7c/tpacancel\u00a76.
|
||||
typeTpaccept=\u00a76To teleport, type \u00a7c/tpaccept\u00a76.
|
||||
typeTpdeny=\u00a76To deny this request, type \u00a7c/tpdeny\u00a76.
|
||||
typeWorldName=\u00a76You can also type the name of a specific world.
|
||||
unableToSpawnItem=\u00a74Cannot spawn \u00a7c{0}\u00a74, this is not a spawnable item.
|
||||
unableToSpawnItem=\u00a74Cannot spawn \u00a7c{0}\u00a74; this is not a spawnable item.
|
||||
unableToSpawnMob=\u00a74Unable to spawn mob.
|
||||
unignorePlayer=\u00a76You are not ignoring player\u00a7c {0} \u00a76anymore.
|
||||
unknownItemId=\u00a74Unknown item id\:\u00a7r {0}\u00a74.
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -210,6 +210,7 @@ inventoryClearingStack=\u00a76Eliminado\u00a7c {0} \u00a76de\u00a7c {1} \u00a76d
|
||||
is=es
|
||||
isIpBanned=\u00a76IP \u00a7c{0} \u00a76est\u00e1 baneada.
|
||||
itemCannotBeSold=\u00a74\u00a1Ese objeto no puede ser vendido al servidor\!
|
||||
itemId=\u00a76ID\:\u00a7c {0}
|
||||
internalError=\u00a7cAn internal error occurred while attempting to perform this command.
|
||||
itemMustBeStacked=El objeto tiene que ser intercambiado en montones. Una cantidad de 2s ser\u00edan dos montones, etc.
|
||||
itemNames=\u00a76Nombre corto del \u00edtem\:\u00a7r {0}
|
||||
|
||||
@@ -211,6 +211,7 @@ is=on
|
||||
isIpBanned=\u00a76IP \u00a7c{0} \u00a76on blokeeritud.
|
||||
internalError=\u00a7cSelle k\u00e4skluse t\u00e4itmisel esines sisemine viga.
|
||||
itemCannotBeSold=\u00a74Seda eset ei saa serverile m\u00fc\u00fca.
|
||||
itemId=\u00a76ID\:\u00a7c {0}
|
||||
itemMustBeStacked=\u00a74Eset peab vahetama kuhjadena. N\u00e4iteks kogus 2s oleks kaks kuhja jne.
|
||||
itemNames=\u00a76Eseme l\u00fchinimed\:\u00a7r {0}
|
||||
itemNotEnough1=\u00a74Sul pole sellest esemest m\u00fc\u00fcmiseks piisavat hulka.
|
||||
@@ -223,7 +224,7 @@ itemsNotConverted=\u00a74Sul pole esemeid, mida saaks plokkideks konverteerida.
|
||||
itemSold=\u00a7aM\u00fc\u00fcdud hinnaga \u00a7c{0} \u00a7a({1} {2} hinnaga {3} t\u00fckk).
|
||||
itemSoldConsole=\u00a7aM\u00e4ngija {0} \u00a7am\u00fc\u00fcs {1} hinnaga \u00a7a{2} \u00a7a({3} eset hinnaga {4} t\u00fckk).
|
||||
itemSpawn=\u00a76Annan m\u00e4ngijale\u00a7c {0} {1}
|
||||
itemType=\u00a76Ese\:\u00a7c {0} \u00a76-\u00a7c {1}
|
||||
itemType=\u00a76Ese\:\u00a7c {0} \u00a76
|
||||
jailAlreadyIncarcerated=\u00a74M\u00e4ngija on juba vanglas\:\u00a7c {0}
|
||||
jailList=\u00a76Vanglad\:\u00a7r {0}
|
||||
jailMessage=\u00a74Sooritasid kuriteo, istud oma aja \u00e4ra.
|
||||
|
||||
@@ -210,6 +210,7 @@ inventoryClearingStack=\u00a76Removed\u00a7c {0} \u00a76of\u00a7c {1} \u00a76fro
|
||||
is=on
|
||||
isIpBanned=\u00a76IP \u00a7c {0} \u00a76On karkoitettu.
|
||||
itemCannotBeSold=Tuota tavaraa ei voi myyd\u00e4 t\u00e4ll\u00e4 palvelimella.
|
||||
itemId=\u00a76ID\:\u00a7c {0}
|
||||
internalError=\u00a7cAn internal error occurred while attempting to perform this command.
|
||||
itemMustBeStacked=Tavara pit\u00e4\u00e4 vaihtaa pakattuina. M\u00e4\u00e4r\u00e4 2s olisi kaksi pakettia, jne.
|
||||
itemNames=\u00a76Item short names\:\u00a7r {0}
|
||||
|
||||
@@ -211,6 +211,7 @@ is=est
|
||||
isIpBanned=\u00a76L''IP \u00a7c{0} \u00a76est bannie.
|
||||
internalError=\u00a7cAn internal error occurred while attempting to perform this command.
|
||||
itemCannotBeSold=Cet objet ne peut \u00eatre vendu au serveur.
|
||||
itemId=\u00a76ID\:\u00a7c {0}
|
||||
itemMustBeStacked=Cet objet doit \u00eatre vendu par 64. Une quantit\u00e9 de 2 serait deux fois 64.
|
||||
itemNames=Noms d''item courts \: {0}
|
||||
itemNotEnough1=\u00a7cVous n''avez pas assez de cet objet pour le vendre.
|
||||
|
||||
@@ -211,6 +211,7 @@ is=van
|
||||
isIpBanned=\u00a76IP \u00a7c{0} \u00a76m\u00e1r ki van tiltva.
|
||||
internalError=\u00a7cBels\u00f5 hiba t\u00f6rt\u00e9nt a parancs v\u00e9grehajt\u00e1sa k\u00f6zben.
|
||||
itemCannotBeSold=\u00a74Ezt nem adhatod el a szerveren.
|
||||
itemId=\u00a76ID\:\u00a7c {0}
|
||||
itemMustBeStacked=\u00a74A t\u00e1rgyat k\u00f6tegben kell \u00e9rt\u00e9kes\u00edteni. A 2s mennyis\u00e9ge k\u00e9t stack lenne, stb.
|
||||
itemNames=\u00a76T\u00e1rgy r\u00f6vid nevei\:\u00a7r {0}
|
||||
itemNotEnough1=\u00a74Nincs el\u00e9g eladni val\u00f3 t\u00e1rgyad.
|
||||
|
||||
@@ -211,6 +211,7 @@ is=\u00E8
|
||||
isIpBanned=\u00a76L''IP \u00a7c{0} \u00a76\u00e8 bannato.
|
||||
internalError=\u00a7cSi \u00e8 verificato un errore durante l''esecuzione di questo comando.
|
||||
itemCannotBeSold=\u00a74Quell''oggetto non pu\u00F2 essere venduto al server.
|
||||
itemId=\u00a76ID\:\u00a7c {0}
|
||||
itemMustBeStacked=\u00a74L''oggetto deve essere scambiato in stack. Una quantit\u00E0 di 2 sarebbero due stack, etc.
|
||||
itemNames=\u00a76Nomi corti oggetti\:\u00a7r {0}
|
||||
itemNotEnough1=\u00a74Non hai abbastanza di quell''oggetto per venderlo.
|
||||
|
||||
@@ -210,6 +210,7 @@ inventoryClearingStack=\u00a76Removed\u00a7c {0} \u00a76of\u00a7c {1} \u00a76fro
|
||||
is=\uc740/\ub294
|
||||
isIpBanned=\u00a76IP \u00a7c{0} \u00a76\ub294 \ucc28\ub2e8 \ub418\uc5c8\uc2b5\ub2c8\ub2e4.
|
||||
itemCannotBeSold=\uadf8 \uc544\uc774\ud15c\uc740 \uc11c\ubc84\uc5d0 \ud314 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4.
|
||||
itemId=\u00a76ID\:\u00a7c {0}
|
||||
internalError=\u00a7cAn internal error occurred while attempting to perform this command.
|
||||
itemMustBeStacked=\uc544\uc774\ud15c\uc744 \uac70\ub798\ud558\uae30 \uc704\ud574\uc11c 2\uac1c \uc774\uc0c1\uc758 \uac19\uc740\uc544\uc774\ud15c\uc744 \uac00\uc9c0\uace0\uc788\uc5b4\uc57c\ud569\ub2c8\ub2e4.
|
||||
itemNames=\u00a76\uc9e7\uc740 \uc544\uc774\ud15c \uc774\ub984\:\u00a7r {0}
|
||||
|
||||
@@ -211,6 +211,7 @@ is=is
|
||||
isIpBanned=\u00a76IP \u00a7c{0} \u00a76yra u\u017eblokuotas.
|
||||
internalError=\u00a7cAn internal error occurred while attempting to perform this command.
|
||||
itemCannotBeSold=\u00a74\u0160is daiktas negali b\u016bti parduotas serveryje.
|
||||
itemId=\u00a76ID\:\u00a7c {0}
|
||||
itemMustBeStacked=\u00a74Daiktas turi buti parduotas po 1 stack.
|
||||
itemNames=\u00a76Daikt\u0173 trumpi pavadinimai\:\u00a7r {0}
|
||||
itemNotEnough1=\u00a74Tu neturi pakankamai daiktu pardavimui.
|
||||
|
||||
@@ -210,6 +210,7 @@ inventoryClearingStack=\u00a76\u00a7c {0} \u00a76stuks\u00a7c {1} \u00a76zijn ve
|
||||
is=is
|
||||
isIpBanned=\u00a76IP \u00a7c {0} \u00a76is verbannen.
|
||||
itemCannotBeSold=Dat voorwerp kan niet aan de server worden verkocht.
|
||||
itemId=\u00a76ID\:\u00a7c {0}
|
||||
internalError=\u00a7cAn internal error occurred while attempting to perform this command.
|
||||
itemMustBeStacked=Voorwerp moet geruild worden als stapel. Een hoeveelheid van 2 moet dus geruild worden als twee stapels, etc.
|
||||
itemNames=Kortere namen voor het item\: {0}
|
||||
|
||||
@@ -211,6 +211,7 @@ is=jest
|
||||
isIpBanned=\u00a77IP \u00a7c{0} \u00a77jest zbanowany.
|
||||
internalError=\u00a7cAn internal error occurred while attempting to perform this command.
|
||||
itemCannotBeSold=\u00a7rNie mo\u017Cesz sprzeda\u0107 tego przedmiotu serwerowi.
|
||||
itemId=\u00a76ID\:\u00a7c {0}
|
||||
itemMustBeStacked=\u00a74Przedmiotem handluje si\u0119 w stackach. Wielko\u015B\u0107 2s to dwa stacki itd.
|
||||
itemNames=\u00a77Kr\u00F3tka nazwa\:\u00a7r {0}
|
||||
itemNotEnough1=\u00a74Masz za ma\u0142o tego przedmiotu, aby go sprzeda\u0107.
|
||||
|
||||
@@ -210,6 +210,7 @@ inventoryClearingStack=\u00A76Removido\u00A7c {0} \u00A76de\u00A7c {1} \u00A76de
|
||||
is=\u00E9
|
||||
isIpBanned=\u00A76IP \u00A7c{0} \u00A76 est\u00E1 banido.
|
||||
itemCannotBeSold=\u00A74Esse item n\u00E3o pode ser vendido ao servidor.
|
||||
itemId=\u00a76ID\:\u00a7c {0}
|
||||
internalError=\u00a7cAn internal error occurred while attempting to perform this command.
|
||||
itemMustBeStacked=\u00A74O item tem de ser trocado em stacks. A quantidade de 2 deveria ser 2 stacks, etc.
|
||||
itemNames=\u00A76Nomes pequenos para o itens:\u00A7r {0}
|
||||
|
||||
@@ -210,6 +210,7 @@ inventoryClearingStack=\u00A76Removido\u00A7c {0} \u00A76de\u00A7c {1} \u00A76de
|
||||
is=\u00E9
|
||||
isIpBanned=\u00A76IP \u00A7c{0} \u00A76 est\u00E1 banido.
|
||||
itemCannotBeSold=\u00A74Esse item n\u00E3o pode ser vendido para o servidor.
|
||||
itemId=\u00a76ID\:\u00a7c {0}
|
||||
internalError=\u00a7cAn internal error occurred while attempting to perform this command.
|
||||
itemMustBeStacked=\u00A74O item deve ser trocado em packs. A quantidade de 2 deveria ser 2 packs, etc.
|
||||
itemNames=\u00A76Nomes pequenos para o item\:\u00A7r {0}
|
||||
|
||||
@@ -211,6 +211,7 @@ is=este
|
||||
isIpBanned=\u00a76IP-ul \u00a7c {0} \u00a76este interzis.
|
||||
internalError=\u00a7cAn internal error occurred while attempting to perform this command.
|
||||
itemCannotBeSold=\u00a74Acest obiect nu poate fi vandut pe server.
|
||||
itemId=\u00a76ID\:\u00a7c {0}
|
||||
itemMustBeStacked=\u00a74Obiectul trebuie comercializat in stacuri. O cantitate de 2s ar trebuie sa fie 2 stacuri, s.a.m.d.
|
||||
itemNames=\u00a76Numele scurte ale obiectului\:\u00a7r {0}
|
||||
itemNotEnough1=\u00a74YNu ai destul din acest obiect pentru a-l putea vinde.
|
||||
|
||||
@@ -211,6 +211,7 @@ is=\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f
|
||||
isIpBanned=\u00a76IP \u00a7c{0} \u00a76\u0437\u0430\u0431\u0430\u043d\u0435\u043d.
|
||||
internalError=\u00a7cAn internal error occurred while attempting to perform this command.
|
||||
itemCannotBeSold=\u00a74\u042d\u0442\u043e\u0442 \u043f\u0440\u0435\u0434\u043c\u0435\u0442 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u0440\u043e\u0434\u0430\u043d.
|
||||
itemId=\u00a76ID\:\u00a7c {0}
|
||||
itemMustBeStacked=\u00a74\u041f\u0440\u0435\u0434\u043c\u0435\u0442\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u0432 \u0441\u0442\u0430\u043a\u0435. A quantity of 2s would be two stacks, etc.
|
||||
itemNames=\u00a76\u041c\u0430\u043b\u0435\u043d\u044c\u043a\u0438\u0435 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u043f\u0440\u0435\u0434\u043c\u0435\u0442\u0430\:\u00a7r {0}
|
||||
itemNotEnough1=\u00a74\u0423 \u0412\u0430\u0441 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0440\u0435\u0434\u043c\u0435\u0442\u043e\u0432 \u0434\u043b\u044f \u043f\u0440\u043e\u0434\u0430\u0436\u0438.
|
||||
|
||||
@@ -210,6 +210,7 @@ inventoryClearingStack=\u00a76Tog bort \u00a7c {0} \u00a76av\u00a7c {1} \u00a76f
|
||||
is=\u00e4r
|
||||
isIpBanned=\u00a76IP \u00a7c {0} \u00a76\u00e4r bannad.
|
||||
itemCannotBeSold=Det objektet kan inte s\u00e4ljas till servern.
|
||||
itemId=\u00a76ID\:\u00a7c {0}
|
||||
internalError=\u00a7cAn internal error occurred while attempting to perform this command.
|
||||
itemMustBeStacked=Objektet m\u00e5ste k\u00f6pas i staplar. En m\u00e4ngd av 2s kommer bli 2 staplar, etc.
|
||||
itemNames=F\u00f6rkortning p\u00e5 objekt\: {0}
|
||||
|
||||
@@ -210,6 +210,7 @@ inventoryClearingStack=\u00a76Silindi\u00a7c {0} \u00a76of\u00a7c {1} \u00a76Tar
|
||||
is=olan
|
||||
isIpBanned=\u00a76IP \u00a7c{0} \u00a76yasaklandi.
|
||||
itemCannotBeSold=\u00a74Bu Esyayi Sunucuya Satamazsiniz\!
|
||||
itemId=\u00a76ID\:\u00a7c {0}
|
||||
internalError=\u00a7cAn internal error occurred while attempting to perform this command.
|
||||
itemMustBeStacked=\u00a74Esya Takasi Icin Elindeki Esyanin Bir Stack(Dolu 64) Olmasi Gerekir.
|
||||
itemNames=\u00a76Esya Kisaltmalari\:\u00a7r {0}
|
||||
|
||||
@@ -188,6 +188,7 @@ invalidWarpName=\u00a74\u0054\u00ea\u006e \u006b\u0068\u0075 \u0076\u1ef1\u0063
|
||||
invalidWorld=\u00a74\u0054\u0068\u1ebf \u0067\u0069\u1edb\u0069 \u006b\u0068\u00f4\u006e\u0067 \u0068\u1ee3\u0070 \u006c\u1ec7.
|
||||
is=\u006c\u01b0\u0075 \u0067\u0069\u1eef
|
||||
itemCannotBeSold=\u00a74\u0056\u1ead\u0074 \u0070\u0068\u1ea9\u006d \u006e\u00e0\u0079 \u006b\u0068\u00f4\u006e\u0067 \u0074\u0068\u1ec3 \u0062\u00e1\u006e \u0074\u0072\u00ea\u006e \u006d\u00e1\u0079 \u0063\u0068\u1ee7.
|
||||
itemId=\u00a76ID\:\u00a7c {0}
|
||||
itemMustBeStacked=\u00a74\u0056\u1ead\u0074 \u0070\u0068\u1ea9\u006d \u0111\u1ed5\u0069 \u0111\u01b0\u1ee3\u0063 \u0070\u0068\u1ea3\u0069 \u0111\u1ea7\u0079\u002e \u004d\u1ed9\u0074 \u0073\u1ed1 \u006c\u01b0\u1ee3\u006e\u0067 \u0111\u1ea7\u0079 \u0068\u01a1\u006e \u006e\u00f3 \u0073\u1ebd \u0074\u0068\u00e0\u006e\u0068 \u0068\u0061\u0069\u002c \u0076\u002e\u0076\u002e\u002e\u002e.
|
||||
itemNames=\u00a76\u0054\u00ea\u006e \u0074\u0068\u0075 \u0067\u1ecd\u006e\:\u00a7r {0}
|
||||
itemNotEnough1=\u00a74\u0042\u1ea1\u006e \u006b\u0068\u00f4\u006e\u0067 \u0063\u00f3 \u0111\u1ee7 \u0076\u1ead\u0074 \u0070\u0068\u1ea9\u006d \u0111\u1ec3 \u0062\u00e1\u006e.
|
||||
|
||||
@@ -210,6 +210,7 @@ inventoryClearingStack=\u00a76\u79fb\u9664\u00a7c {0} \u00a76\u4e2a\u00a7c {1} \
|
||||
is=\u662f
|
||||
isIpBanned=\u00a76IP\u5730\u5740 \u00a7c{0} \u00a76\u5df2\u88ab\u5c01\u7981.
|
||||
itemCannotBeSold=\u00a74\u8be5\u7269\u54c1\u65e0\u6cd5\u5356\u7ed9\u670d\u52a1\u5668
|
||||
itemId=\u00a76ID\:\u00a7c {0}
|
||||
internalError=\u00a7cAn internal error occurred while attempting to perform this command.
|
||||
itemMustBeStacked=\u00a74\u7269\u54c1\u5fc5\u987b\u6210\u7ec4\u7684\u8fdb\u884c\u4ea4\u6613,2s\u4ee3\u8868\u7684\u6570\u91cf\u662f2\u7ec4\u7269\u54c1,\u4ee5\u6b64\u7c7b\u63a8
|
||||
itemNames=\u00a76\u7269\u54c1\u7b80\u6613\u540d\u79f0\:\u00a7r {0}
|
||||
|
||||
@@ -211,6 +211,7 @@ is=\u662f
|
||||
isIpBanned=\u00a76IP \u00a7c{0} \u00a76\u5df2\u88ab\u5c01\u9396\u3002
|
||||
internalError=\u00a7cAn internal error occurred while attempting to perform this command.
|
||||
itemCannotBeSold=\u00a74\u8a72\u7269\u54c1\u7121\u6cd5\u8ce3\u7d66\u670d\u52d9\u5668
|
||||
itemId=\u00a76ID\:\u00a7c {0}
|
||||
itemMustBeStacked=\u00a74\u7269\u54c1\u5fc5\u9808\u6210\u7d44\u4ea4\u6613,2s\u7684\u6578\u91cf\u662f2\u7d44,\u4ee5\u6b64\u985e\u63a8
|
||||
itemNames=\u00a76\u7269\u54c1\u7c21\u6613\u540d\u7a31\:\u00a7r {0}
|
||||
itemNotEnough1=\u00a74\u4f60\u6c92\u6709\u8db3\u5920\u7684\u8a72\u7269\u54c1\u4f86\u8ce3\u51fa
|
||||
|
||||
@@ -211,6 +211,7 @@ is=\u662f
|
||||
isIpBanned=\u00a76IP \u00a7c{0} \u00a76\u5df2\u88ab\u5c01\u9396\u3002
|
||||
internalError=\u00a7cAn internal error occurred while attempting to perform this command.
|
||||
itemCannotBeSold=\u00a74\u8a72\u7269\u54c1\u7121\u6cd5\u8ce3\u7d66\u4f3a\u670d\u5668
|
||||
itemId=\u00a76ID\:\u00a7c {0}
|
||||
itemMustBeStacked=\u00a74\u7269\u54c1\u5fc5\u9808\u6210\u7d44\u4ea4\u6613,2s\u7684\u6578\u91cf\u662f2\u7d44,\u4ee5\u6b64\u985e\u63a8
|
||||
itemNames=\u00a76\u7269\u54c1\u7c21\u6613\u540d\u7a31\:\u00a7r {0}
|
||||
itemNotEnough1=\u00a74\u4f60\u6c92\u6709\u8db3\u5920\u7684\u8a72\u7269\u54c1\u4f86\u8ce3\u51fa
|
||||
|
||||
@@ -5,34 +5,33 @@ import com.earth2me.essentials.api.UserDoesNotExistException;
|
||||
import com.earth2me.essentials.commands.IEssentialsCommand;
|
||||
import com.earth2me.essentials.commands.NoChargeException;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import net.ess3.api.Economy;
|
||||
import org.bukkit.World.Environment;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.plugin.InvalidDescriptionException;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
|
||||
public class EconomyTest extends TestCase {
|
||||
public class EconomyTest {
|
||||
private final transient Essentials ess;
|
||||
private static final String NPCNAME = "npc1";
|
||||
private static final String PLAYERNAME = "testPlayer1";
|
||||
private static final String PLAYERNAME2 = "testPlayer2";
|
||||
private final FakeServer server;
|
||||
|
||||
public EconomyTest(final String testName) {
|
||||
super(testName);
|
||||
public EconomyTest() {
|
||||
this.server = new FakeServer();
|
||||
server.createWorld("testWorld", Environment.NORMAL);
|
||||
ess = new Essentials(server);
|
||||
try {
|
||||
ess.setupForTesting(server);
|
||||
} catch (InvalidDescriptionException ex) {
|
||||
fail("InvalidDescriptionException");
|
||||
Assert.fail("InvalidDescriptionException");
|
||||
} catch (IOException ex) {
|
||||
fail("IOException");
|
||||
Assert.fail("IOException");
|
||||
}
|
||||
server.addPlayer(new OfflinePlayer(PLAYERNAME, ess.getServer()));
|
||||
server.addPlayer(new OfflinePlayer(PLAYERNAME2, ess.getServer()));
|
||||
@@ -42,66 +41,63 @@ public class EconomyTest extends TestCase {
|
||||
@Test
|
||||
public void testEconomy() {
|
||||
// test NPC
|
||||
assertFalse("NPC does not exists", Economy.playerExists(NPCNAME));
|
||||
assertTrue("Create NPC", Economy.createNPC(NPCNAME));
|
||||
assertTrue("NPC exists", Economy.playerExists(NPCNAME));
|
||||
assertNotNull("NPC can be accessed", ess.getOfflineUser(NPCNAME));
|
||||
Assert.assertFalse("NPC does not exists", Economy.playerExists(NPCNAME));
|
||||
Assert.assertTrue("Create NPC", Economy.createNPC(NPCNAME));
|
||||
Assert.assertTrue("NPC exists", Economy.playerExists(NPCNAME));
|
||||
Assert.assertNotNull("NPC can be accessed", ess.getOfflineUser(NPCNAME));
|
||||
try {
|
||||
Economy.removeNPC(NPCNAME);
|
||||
} catch (UserDoesNotExistException ex) {
|
||||
fail(ex.getMessage());
|
||||
Assert.fail(ex.getMessage());
|
||||
}
|
||||
assertFalse("NPC can be removed", Economy.playerExists(NPCNAME));
|
||||
Assert.assertFalse("NPC can be removed", Economy.playerExists(NPCNAME));
|
||||
|
||||
//test Math
|
||||
try {
|
||||
|
||||
assertTrue("Player exists", Economy.playerExists(PLAYERNAME));
|
||||
Assert.assertTrue("Player exists", Economy.playerExists(PLAYERNAME));
|
||||
Economy.resetBalance(PLAYERNAME);
|
||||
assertEquals("Player has no money", 0.0, Economy.getMoney(PLAYERNAME));
|
||||
Assert.assertEquals("Player has no money", 0.0, Economy.getMoney(PLAYERNAME), 0);
|
||||
Economy.add(PLAYERNAME, 10.0);
|
||||
assertEquals("Add money", 10.0, Economy.getMoney(PLAYERNAME));
|
||||
Assert.assertEquals("Add money", 10.0, Economy.getMoney(PLAYERNAME),0);
|
||||
Economy.subtract(PLAYERNAME, 5.0);
|
||||
assertEquals("Subtract money", 5.0, Economy.getMoney(PLAYERNAME));
|
||||
Assert.assertEquals("Subtract money", 5.0, Economy.getMoney(PLAYERNAME),0);
|
||||
Economy.multiply(PLAYERNAME, 2.0);
|
||||
assertEquals("Multiply money", 10.0, Economy.getMoney(PLAYERNAME));
|
||||
Assert.assertEquals("Multiply money", 10.0, Economy.getMoney(PLAYERNAME),0);
|
||||
Economy.divide(PLAYERNAME, 2.0);
|
||||
assertEquals("Divide money", 5.0, Economy.getMoney(PLAYERNAME));
|
||||
Assert.assertEquals("Divide money", 5.0, Economy.getMoney(PLAYERNAME),0);
|
||||
Economy.setMoney(PLAYERNAME, 10.0);
|
||||
assertEquals("Set money", 10.0, Economy.getMoney(PLAYERNAME));
|
||||
} catch (NoLoanPermittedException ex) {
|
||||
fail(ex.getMessage());
|
||||
} catch (UserDoesNotExistException ex) {
|
||||
fail(ex.getMessage());
|
||||
Assert.assertEquals("Set money", 10.0, Economy.getMoney(PLAYERNAME),0);
|
||||
} catch (NoLoanPermittedException | UserDoesNotExistException ex) {
|
||||
Assert.fail(ex.getMessage());
|
||||
}
|
||||
|
||||
//test Format
|
||||
assertEquals("Format $1,000", "$1,000", Economy.format(1000.0));
|
||||
assertEquals("Format $10", "$10", Economy.format(10.0));
|
||||
assertEquals("Format $10.10", "$10.10", Economy.format(10.10));
|
||||
assertEquals("Format $10.10", "$10.10", Economy.format(10.1000001));
|
||||
assertEquals("Format $10.10", "$10.10", Economy.format(10.1099999));
|
||||
Assert.assertEquals("Format $1,000", "$1,000", Economy.format(1000.0));
|
||||
Assert.assertEquals("Format $10", "$10", Economy.format(10.0));
|
||||
Assert.assertEquals("Format $10.10", "$10.10", Economy.format(10.10));
|
||||
Assert.assertEquals("Format $10.10", "$10.10", Economy.format(10.1000001));
|
||||
Assert.assertEquals("Format $10.10", "$10.10", Economy.format(10.1099999));
|
||||
|
||||
|
||||
//test Exceptions
|
||||
try {
|
||||
assertTrue("Player exists", Economy.playerExists(PLAYERNAME));
|
||||
Assert.assertTrue("Player exists", Economy.playerExists(PLAYERNAME));
|
||||
Economy.resetBalance(PLAYERNAME);
|
||||
assertEquals("Reset balance", 0.0, Economy.getMoney(PLAYERNAME));
|
||||
Assert.assertEquals("Reset balance", 0.0, Economy.getMoney(PLAYERNAME),0);
|
||||
Economy.subtract(PLAYERNAME, 5.0);
|
||||
fail("Did not throw exception");
|
||||
} catch (NoLoanPermittedException ex) {
|
||||
Assert.fail("Did not throw exception");
|
||||
} catch (NoLoanPermittedException ignored) {
|
||||
} catch (UserDoesNotExistException ex) {
|
||||
fail(ex.getMessage());
|
||||
Assert.fail(ex.getMessage());
|
||||
}
|
||||
|
||||
try {
|
||||
Economy.resetBalance("UnknownPlayer");
|
||||
fail("Did not throw exception");
|
||||
Assert.fail("Did not throw exception");
|
||||
} catch (NoLoanPermittedException ex) {
|
||||
fail(ex.getMessage());
|
||||
} catch (UserDoesNotExistException ex) {
|
||||
}
|
||||
Assert.fail(ex.getMessage());
|
||||
} catch (UserDoesNotExistException ignored) {}
|
||||
}
|
||||
|
||||
private void runCommand(String command, User user, String args) throws Exception {
|
||||
@@ -116,8 +112,7 @@ public class EconomyTest extends TestCase {
|
||||
.loadClass("com.earth2me.essentials.commands.Command" + command).newInstance();
|
||||
cmd.setEssentials(ess);
|
||||
cmd.run(server, user, command, null, args);
|
||||
} catch (NoChargeException ex) {
|
||||
}
|
||||
} catch (NoChargeException ignored) {}
|
||||
|
||||
}
|
||||
|
||||
@@ -135,16 +130,16 @@ public class EconomyTest extends TestCase {
|
||||
.loadClass("com.earth2me.essentials.commands.Command" + command).newInstance();
|
||||
cmd.setEssentials(ess);
|
||||
cmd.run(server, new CommandSource(sender), command, null, args);
|
||||
} catch (NoChargeException ex) {
|
||||
}
|
||||
} catch (NoChargeException ignored) {}
|
||||
}
|
||||
|
||||
public void testNegativePayCommand() throws Exception {
|
||||
@Test
|
||||
public void testNegativePayCommand() {
|
||||
User user1 = ess.getUser(PLAYERNAME);
|
||||
try {
|
||||
runCommand("pay", user1, PLAYERNAME2 + " -123");
|
||||
} catch (Exception e) {
|
||||
assertEquals(I18n.tl("payMustBePositive"), e.getMessage());
|
||||
Assert.assertEquals(I18n.tl("payMustBePositive"), e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -39,7 +39,6 @@ import org.bukkit.util.CachedServerIcon;
|
||||
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.File;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.Callable;
|
||||
import java.util.concurrent.Future;
|
||||
@@ -48,11 +47,11 @@ import java.util.logging.Logger;
|
||||
|
||||
|
||||
public class FakeServer implements Server {
|
||||
private List<Player> players = new ArrayList<Player>();
|
||||
private final List<World> worlds = new ArrayList<World>();
|
||||
PluginManager pluginManager = new FakePluginManager();
|
||||
private List<Player> players = new ArrayList<>();
|
||||
private final List<World> worlds = new ArrayList<>();
|
||||
private PluginManager pluginManager = new FakePluginManager();
|
||||
|
||||
public FakeServer() {
|
||||
FakeServer() {
|
||||
if (Bukkit.getServer() == null) {
|
||||
Bukkit.setServer(this);
|
||||
}
|
||||
@@ -139,7 +138,7 @@ public class FakeServer implements Server {
|
||||
|
||||
@Override
|
||||
public List<Player> matchPlayer(String string) {
|
||||
List<Player> matches = new ArrayList<Player>();
|
||||
List<Player> matches = new ArrayList<>();
|
||||
for (Player player : players) {
|
||||
if (player.getName().substring(0, Math.min(player.getName().length(), string.length())).equalsIgnoreCase(string)) {
|
||||
matches.add(player);
|
||||
@@ -390,12 +389,12 @@ public class FakeServer implements Server {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
public void addPlayer(Player base1) {
|
||||
void addPlayer(Player base1) {
|
||||
players.add(base1);
|
||||
pluginManager.callEvent(new PlayerJoinEvent(base1, null));
|
||||
}
|
||||
|
||||
public OfflinePlayer createPlayer(String name) {
|
||||
OfflinePlayer createPlayer(String name) {
|
||||
OfflinePlayer player = new OfflinePlayer(name, this);
|
||||
player.setLocation(new Location(worlds.get(0), 0, 0, 0, 0, 0));
|
||||
return player;
|
||||
@@ -445,6 +444,10 @@ public class FakeServer implements Server {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
public MapView getMap(int id) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getViewDistance() {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
@@ -460,11 +463,6 @@ public class FakeServer implements Server {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public MapView getMap(short s) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public MapView createMap(World world) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
@@ -502,7 +500,12 @@ public class FakeServer implements Server {
|
||||
|
||||
@Override
|
||||
public Player getPlayerExact(String string) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
for (Player player : players) {
|
||||
if (player.getName().equals(string)) {
|
||||
return player;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -589,14 +592,15 @@ public class FakeServer implements Server {
|
||||
|
||||
@Override
|
||||
public UUID getUniqueId() {
|
||||
if (string == "testPlayer1") {
|
||||
return UUID.fromString("3c9ebe1a-9098-43fd-bc0c-a369b76817ba");
|
||||
} else if (string == "testPlayer2") {
|
||||
return UUID.fromString("2c9ebe1a-9098-43fd-bc0c-a369b76817ba");
|
||||
} else if (string == "npc1") {
|
||||
return null;
|
||||
switch (string) {
|
||||
case "testPlayer1":
|
||||
return UUID.fromString("3c9ebe1a-9098-43fd-bc0c-a369b76817ba");
|
||||
case "testPlayer2":
|
||||
return UUID.fromString("2c9ebe1a-9098-43fd-bc0c-a369b76817ba");
|
||||
case "npc1":
|
||||
return null;
|
||||
}
|
||||
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -754,7 +758,7 @@ public class FakeServer implements Server {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set getOperators() {
|
||||
public Set<org.bukkit.OfflinePlayer> getOperators() {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@@ -919,12 +923,12 @@ public class FakeServer implements Server {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CachedServerIcon loadServerIcon(File file) throws Exception {
|
||||
public CachedServerIcon loadServerIcon(File file) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public CachedServerIcon loadServerIcon(BufferedImage bufferedImage) throws Exception {
|
||||
public CachedServerIcon loadServerIcon(BufferedImage bufferedImage) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@@ -969,6 +973,7 @@ public class FakeServer implements Server {
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public UnsafeValues getUnsafe() {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
@@ -1049,8 +1054,12 @@ public class FakeServer implements Server {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
public <T extends Keyed> Iterable<Tag<T>> getTags(String registry, Class<T> clazz) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
class FakePluginManager implements PluginManager {
|
||||
ArrayList<RegisteredListener> listeners = new ArrayList<RegisteredListener>();
|
||||
ArrayList<RegisteredListener> listeners = new ArrayList<>();
|
||||
|
||||
@Override
|
||||
public void registerInterface(Class<? extends PluginLoader> loader) throws IllegalArgumentException {
|
||||
@@ -1078,7 +1087,7 @@ public class FakeServer implements Server {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Plugin loadPlugin(File file) throws InvalidPluginException, InvalidDescriptionException, UnknownDependencyException {
|
||||
public Plugin loadPlugin(File file) throws UnknownDependencyException {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@@ -1210,9 +1219,14 @@ public class FakeServer implements Server {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Override
|
||||
public LootTable getLootTable(NamespacedKey arg0) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Entity> selectEntities(CommandSender sender, String selector) throws IllegalArgumentException {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -49,8 +49,7 @@ public class MessagingTest {
|
||||
.loadClass("com.earth2me.essentials.commands.Command" + command).newInstance();
|
||||
cmd.setEssentials(ess);
|
||||
cmd.run(server, user, command, null, args);
|
||||
} catch (NoChargeException ex) {
|
||||
}
|
||||
} catch (NoChargeException ignored) {}
|
||||
|
||||
}
|
||||
|
||||
@@ -68,8 +67,7 @@ public class MessagingTest {
|
||||
.loadClass("com.earth2me.essentials.commands.Command" + command).newInstance();
|
||||
cmd.setEssentials(ess);
|
||||
cmd.run(server, new CommandSource(sender), command, null, args);
|
||||
} catch (NoChargeException ex) {
|
||||
}
|
||||
} catch (NoChargeException ignored) {}
|
||||
}
|
||||
|
||||
@Test(expected = Exception.class) // I really don't like this, but see note below about console reply
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
package com.earth2me.essentials;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.World.Environment;
|
||||
import org.bukkit.plugin.InvalidDescriptionException;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
|
||||
public class StorageTest extends TestCase {
|
||||
Essentials ess;
|
||||
FakeServer server;
|
||||
World world;
|
||||
public class StorageTest {
|
||||
private Essentials ess;
|
||||
private FakeServer server;
|
||||
private World world;
|
||||
|
||||
public StorageTest() {
|
||||
server = new FakeServer();
|
||||
@@ -22,9 +22,9 @@ public class StorageTest extends TestCase {
|
||||
try {
|
||||
ess.setupForTesting(server);
|
||||
} catch (InvalidDescriptionException ex) {
|
||||
fail("InvalidDescriptionException");
|
||||
Assert.fail("InvalidDescriptionException");
|
||||
} catch (IOException ex) {
|
||||
fail("IOException");
|
||||
Assert.fail("IOException");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -39,8 +39,7 @@ public class ToggleTest extends TestCase {
|
||||
cmd = (IEssentialsCommand) Essentials.class.getClassLoader().loadClass("com.earth2me.essentials.commands.Command" + command).newInstance();
|
||||
cmd.setEssentials(ess);
|
||||
cmd.run(server, user, command, null, args);
|
||||
} catch (NoChargeException ex) {
|
||||
}
|
||||
} catch (NoChargeException ignored) {}
|
||||
|
||||
}
|
||||
|
||||
@@ -53,8 +52,7 @@ public class ToggleTest extends TestCase {
|
||||
cmd = (IEssentialsCommand) Essentials.class.getClassLoader().loadClass("com.earth2me.essentials.commands.Command" + command).newInstance();
|
||||
cmd.setEssentials(ess);
|
||||
cmd.run(server, new CommandSource(sender), command, null, args);
|
||||
} catch (NoChargeException ex) {
|
||||
}
|
||||
} catch (NoChargeException ignored) {}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.earth2me.essentials;
|
||||
|
||||
import com.earth2me.essentials.utils.DateUtil;
|
||||
import com.earth2me.essentials.utils.LocationUtil;
|
||||
import com.earth2me.essentials.utils.VersionUtil;
|
||||
import junit.framework.TestCase;
|
||||
import org.bukkit.World.Environment;
|
||||
import org.bukkit.plugin.InvalidDescriptionException;
|
||||
@@ -14,13 +15,11 @@ import java.util.Set;
|
||||
|
||||
|
||||
public class UtilTest extends TestCase {
|
||||
private final Essentials ess;
|
||||
private final FakeServer server;
|
||||
|
||||
public UtilTest() {
|
||||
server = new FakeServer();
|
||||
FakeServer server = new FakeServer();
|
||||
server.createWorld("testWorld", Environment.NORMAL);
|
||||
ess = new Essentials(server);
|
||||
Essentials ess = new Essentials(server);
|
||||
try {
|
||||
ess.setupForTesting(server);
|
||||
} catch (InvalidDescriptionException ex) {
|
||||
@@ -31,7 +30,7 @@ public class UtilTest extends TestCase {
|
||||
}
|
||||
|
||||
public void testSafeLocation() {
|
||||
Set<String> testSet = new HashSet<String>();
|
||||
Set<String> testSet = new HashSet<>();
|
||||
int count = 0;
|
||||
int x, y, z, origX, origY, origZ;
|
||||
x = y = z = origX = origY = origZ = 0;
|
||||
@@ -62,132 +61,146 @@ public class UtilTest extends TestCase {
|
||||
|
||||
public void testFDDfuture() {
|
||||
Calendar a, b;
|
||||
a = new GregorianCalendar(2010, 1, 1, 10, 0, 0);
|
||||
b = new GregorianCalendar(2010, 1, 1, 10, 0, 1);
|
||||
a = new GregorianCalendar(2010, Calendar.FEBRUARY, 1, 10, 0, 0);
|
||||
b = new GregorianCalendar(2010, Calendar.FEBRUARY, 1, 10, 0, 1);
|
||||
assertEquals("1 second", DateUtil.formatDateDiff(a, b));
|
||||
a = new GregorianCalendar(2010, 1, 1, 10, 0, 0);
|
||||
b = new GregorianCalendar(2010, 1, 1, 10, 0, 2);
|
||||
a = new GregorianCalendar(2010, Calendar.FEBRUARY, 1, 10, 0, 0);
|
||||
b = new GregorianCalendar(2010, Calendar.FEBRUARY, 1, 10, 0, 2);
|
||||
assertEquals("2 seconds", DateUtil.formatDateDiff(a, b));
|
||||
a = new GregorianCalendar(2010, 1, 1, 10, 0, 0);
|
||||
b = new GregorianCalendar(2010, 1, 1, 10, 0, 3);
|
||||
a = new GregorianCalendar(2010, Calendar.FEBRUARY, 1, 10, 0, 0);
|
||||
b = new GregorianCalendar(2010, Calendar.FEBRUARY, 1, 10, 0, 3);
|
||||
assertEquals("3 seconds", DateUtil.formatDateDiff(a, b));
|
||||
a = new GregorianCalendar(2010, 1, 1, 10, 0, 0);
|
||||
b = new GregorianCalendar(2010, 1, 1, 10, 1, 0);
|
||||
a = new GregorianCalendar(2010, Calendar.FEBRUARY, 1, 10, 0, 0);
|
||||
b = new GregorianCalendar(2010, Calendar.FEBRUARY, 1, 10, 1, 0);
|
||||
assertEquals("1 minute", DateUtil.formatDateDiff(a, b));
|
||||
a = new GregorianCalendar(2010, 1, 1, 10, 0, 0);
|
||||
b = new GregorianCalendar(2010, 1, 1, 10, 2, 0);
|
||||
a = new GregorianCalendar(2010, Calendar.FEBRUARY, 1, 10, 0, 0);
|
||||
b = new GregorianCalendar(2010, Calendar.FEBRUARY, 1, 10, 2, 0);
|
||||
assertEquals("2 minutes", DateUtil.formatDateDiff(a, b));
|
||||
a = new GregorianCalendar(2010, 1, 1, 10, 0, 0);
|
||||
b = new GregorianCalendar(2010, 1, 1, 10, 3, 0);
|
||||
a = new GregorianCalendar(2010, Calendar.FEBRUARY, 1, 10, 0, 0);
|
||||
b = new GregorianCalendar(2010, Calendar.FEBRUARY, 1, 10, 3, 0);
|
||||
assertEquals("3 minutes", DateUtil.formatDateDiff(a, b));
|
||||
a = new GregorianCalendar(2010, 1, 1, 10, 0, 0);
|
||||
b = new GregorianCalendar(2010, 1, 1, 11, 0, 0);
|
||||
a = new GregorianCalendar(2010, Calendar.FEBRUARY, 1, 10, 0, 0);
|
||||
b = new GregorianCalendar(2010, Calendar.FEBRUARY, 1, 11, 0, 0);
|
||||
assertEquals("1 hour", DateUtil.formatDateDiff(a, b));
|
||||
a = new GregorianCalendar(2010, 1, 1, 10, 0, 0);
|
||||
b = new GregorianCalendar(2010, 1, 1, 12, 0, 0);
|
||||
a = new GregorianCalendar(2010, Calendar.FEBRUARY, 1, 10, 0, 0);
|
||||
b = new GregorianCalendar(2010, Calendar.FEBRUARY, 1, 12, 0, 0);
|
||||
assertEquals("2 hours", DateUtil.formatDateDiff(a, b));
|
||||
a = new GregorianCalendar(2010, 1, 1, 10, 0, 0);
|
||||
b = new GregorianCalendar(2010, 1, 1, 13, 0, 0);
|
||||
a = new GregorianCalendar(2010, Calendar.FEBRUARY, 1, 10, 0, 0);
|
||||
b = new GregorianCalendar(2010, Calendar.FEBRUARY, 1, 13, 0, 0);
|
||||
assertEquals("3 hours", DateUtil.formatDateDiff(a, b));
|
||||
a = new GregorianCalendar(2010, 1, 1, 10, 0, 0);
|
||||
b = new GregorianCalendar(2010, 1, 2, 10, 0, 0);
|
||||
a = new GregorianCalendar(2010, Calendar.FEBRUARY, 1, 10, 0, 0);
|
||||
b = new GregorianCalendar(2010, Calendar.FEBRUARY, 2, 10, 0, 0);
|
||||
assertEquals("1 day", DateUtil.formatDateDiff(a, b));
|
||||
a = new GregorianCalendar(2010, 1, 1, 10, 0, 0);
|
||||
b = new GregorianCalendar(2010, 1, 3, 10, 0, 0);
|
||||
a = new GregorianCalendar(2010, Calendar.FEBRUARY, 1, 10, 0, 0);
|
||||
b = new GregorianCalendar(2010, Calendar.FEBRUARY, 3, 10, 0, 0);
|
||||
assertEquals("2 days", DateUtil.formatDateDiff(a, b));
|
||||
a = new GregorianCalendar(2010, 1, 1, 10, 0, 0);
|
||||
b = new GregorianCalendar(2010, 1, 4, 10, 0, 0);
|
||||
a = new GregorianCalendar(2010, Calendar.FEBRUARY, 1, 10, 0, 0);
|
||||
b = new GregorianCalendar(2010, Calendar.FEBRUARY, 4, 10, 0, 0);
|
||||
assertEquals("3 days", DateUtil.formatDateDiff(a, b));
|
||||
a = new GregorianCalendar(2010, 1, 1, 10, 0, 0);
|
||||
b = new GregorianCalendar(2010, 2, 1, 10, 0, 0);
|
||||
a = new GregorianCalendar(2010, Calendar.FEBRUARY, 1, 10, 0, 0);
|
||||
b = new GregorianCalendar(2010, Calendar.MARCH, 1, 10, 0, 0);
|
||||
assertEquals("1 month", DateUtil.formatDateDiff(a, b));
|
||||
a = new GregorianCalendar(2010, 1, 1, 10, 0, 0);
|
||||
b = new GregorianCalendar(2010, 3, 1, 10, 0, 0);
|
||||
a = new GregorianCalendar(2010, Calendar.FEBRUARY, 1, 10, 0, 0);
|
||||
b = new GregorianCalendar(2010, Calendar.APRIL, 1, 10, 0, 0);
|
||||
assertEquals("2 months", DateUtil.formatDateDiff(a, b));
|
||||
a = new GregorianCalendar(2010, 1, 1, 10, 0, 0);
|
||||
b = new GregorianCalendar(2010, 4, 1, 10, 0, 0);
|
||||
a = new GregorianCalendar(2010, Calendar.FEBRUARY, 1, 10, 0, 0);
|
||||
b = new GregorianCalendar(2010, Calendar.MAY, 1, 10, 0, 0);
|
||||
assertEquals("3 months", DateUtil.formatDateDiff(a, b));
|
||||
a = new GregorianCalendar(2010, 1, 1, 10, 0, 0);
|
||||
b = new GregorianCalendar(2011, 1, 1, 10, 0, 0);
|
||||
a = new GregorianCalendar(2010, Calendar.FEBRUARY, 1, 10, 0, 0);
|
||||
b = new GregorianCalendar(2011, Calendar.FEBRUARY, 1, 10, 0, 0);
|
||||
assertEquals("1 year", DateUtil.formatDateDiff(a, b));
|
||||
a = new GregorianCalendar(2010, 1, 1, 10, 0, 0);
|
||||
b = new GregorianCalendar(2012, 1, 1, 10, 0, 0);
|
||||
a = new GregorianCalendar(2010, Calendar.FEBRUARY, 1, 10, 0, 0);
|
||||
b = new GregorianCalendar(2012, Calendar.FEBRUARY, 1, 10, 0, 0);
|
||||
assertEquals("2 years", DateUtil.formatDateDiff(a, b));
|
||||
a = new GregorianCalendar(2010, 1, 1, 10, 0, 0);
|
||||
b = new GregorianCalendar(2013, 1, 1, 10, 0, 0);
|
||||
a = new GregorianCalendar(2010, Calendar.FEBRUARY, 1, 10, 0, 0);
|
||||
b = new GregorianCalendar(2013, Calendar.FEBRUARY, 1, 10, 0, 0);
|
||||
assertEquals("3 years", DateUtil.formatDateDiff(a, b));
|
||||
a = new GregorianCalendar(2010, 1, 1, 10, 0, 0);
|
||||
b = new GregorianCalendar(2011, 4, 5, 23, 38, 12);
|
||||
a = new GregorianCalendar(2010, Calendar.FEBRUARY, 1, 10, 0, 0);
|
||||
b = new GregorianCalendar(2011, Calendar.MAY, 5, 23, 38, 12);
|
||||
assertEquals("1 year 3 months 4 days", DateUtil.formatDateDiff(a, b));
|
||||
a = new GregorianCalendar(2010, 9, 17, 23, 45, 45);
|
||||
b = new GregorianCalendar(2015, 3, 7, 10, 0, 0);
|
||||
a = new GregorianCalendar(2010, Calendar.OCTOBER, 17, 23, 45, 45);
|
||||
b = new GregorianCalendar(2015, Calendar.APRIL, 7, 10, 0, 0);
|
||||
assertEquals("4 years 5 months 20 days", DateUtil.formatDateDiff(a, b));
|
||||
a = new GregorianCalendar(2011, 4, 31, 10, 0, 0);
|
||||
b = new GregorianCalendar(2011, 4, 31, 10, 5, 0);
|
||||
a = new GregorianCalendar(2011, Calendar.MAY, 31, 10, 0, 0);
|
||||
b = new GregorianCalendar(2011, Calendar.MAY, 31, 10, 5, 0);
|
||||
assertEquals("5 minutes", DateUtil.formatDateDiff(a, b));
|
||||
}
|
||||
|
||||
public void testFDDpast() {
|
||||
Calendar a, b;
|
||||
a = new GregorianCalendar(2010, 1, 1, 10, 0, 0);
|
||||
b = new GregorianCalendar(2010, 1, 1, 9, 59, 59);
|
||||
a = new GregorianCalendar(2010, Calendar.FEBRUARY, 1, 10, 0, 0);
|
||||
b = new GregorianCalendar(2010, Calendar.FEBRUARY, 1, 9, 59, 59);
|
||||
assertEquals("1 second", DateUtil.formatDateDiff(a, b));
|
||||
a = new GregorianCalendar(2010, 1, 1, 10, 0, 0);
|
||||
b = new GregorianCalendar(2010, 1, 1, 9, 59, 58);
|
||||
a = new GregorianCalendar(2010, Calendar.FEBRUARY, 1, 10, 0, 0);
|
||||
b = new GregorianCalendar(2010, Calendar.FEBRUARY, 1, 9, 59, 58);
|
||||
assertEquals("2 seconds", DateUtil.formatDateDiff(a, b));
|
||||
a = new GregorianCalendar(2010, 1, 1, 10, 0, 0);
|
||||
b = new GregorianCalendar(2010, 1, 1, 9, 59, 57);
|
||||
a = new GregorianCalendar(2010, Calendar.FEBRUARY, 1, 10, 0, 0);
|
||||
b = new GregorianCalendar(2010, Calendar.FEBRUARY, 1, 9, 59, 57);
|
||||
assertEquals("3 seconds", DateUtil.formatDateDiff(a, b));
|
||||
a = new GregorianCalendar(2010, 1, 1, 10, 0, 0);
|
||||
b = new GregorianCalendar(2010, 1, 1, 9, 59, 0);
|
||||
a = new GregorianCalendar(2010, Calendar.FEBRUARY, 1, 10, 0, 0);
|
||||
b = new GregorianCalendar(2010, Calendar.FEBRUARY, 1, 9, 59, 0);
|
||||
assertEquals("1 minute", DateUtil.formatDateDiff(a, b));
|
||||
a = new GregorianCalendar(2010, 1, 1, 10, 0, 0);
|
||||
b = new GregorianCalendar(2010, 1, 1, 9, 58, 0);
|
||||
a = new GregorianCalendar(2010, Calendar.FEBRUARY, 1, 10, 0, 0);
|
||||
b = new GregorianCalendar(2010, Calendar.FEBRUARY, 1, 9, 58, 0);
|
||||
assertEquals("2 minutes", DateUtil.formatDateDiff(a, b));
|
||||
a = new GregorianCalendar(2010, 1, 1, 10, 0, 0);
|
||||
b = new GregorianCalendar(2010, 1, 1, 9, 57, 0);
|
||||
a = new GregorianCalendar(2010, Calendar.FEBRUARY, 1, 10, 0, 0);
|
||||
b = new GregorianCalendar(2010, Calendar.FEBRUARY, 1, 9, 57, 0);
|
||||
assertEquals("3 minutes", DateUtil.formatDateDiff(a, b));
|
||||
a = new GregorianCalendar(2010, 1, 1, 10, 0, 0);
|
||||
b = new GregorianCalendar(2010, 1, 1, 9, 0, 0);
|
||||
a = new GregorianCalendar(2010, Calendar.FEBRUARY, 1, 10, 0, 0);
|
||||
b = new GregorianCalendar(2010, Calendar.FEBRUARY, 1, 9, 0, 0);
|
||||
assertEquals("1 hour", DateUtil.formatDateDiff(a, b));
|
||||
a = new GregorianCalendar(2010, 1, 1, 10, 0, 0);
|
||||
b = new GregorianCalendar(2010, 1, 1, 8, 0, 0);
|
||||
a = new GregorianCalendar(2010, Calendar.FEBRUARY, 1, 10, 0, 0);
|
||||
b = new GregorianCalendar(2010, Calendar.FEBRUARY, 1, 8, 0, 0);
|
||||
assertEquals("2 hours", DateUtil.formatDateDiff(a, b));
|
||||
a = new GregorianCalendar(2010, 1, 1, 10, 0, 0);
|
||||
b = new GregorianCalendar(2010, 1, 1, 7, 0, 0);
|
||||
a = new GregorianCalendar(2010, Calendar.FEBRUARY, 1, 10, 0, 0);
|
||||
b = new GregorianCalendar(2010, Calendar.FEBRUARY, 1, 7, 0, 0);
|
||||
assertEquals("3 hours", DateUtil.formatDateDiff(a, b));
|
||||
a = new GregorianCalendar(2010, 1, 5, 10, 0, 0);
|
||||
b = new GregorianCalendar(2010, 1, 4, 10, 0, 0);
|
||||
a = new GregorianCalendar(2010, Calendar.FEBRUARY, 5, 10, 0, 0);
|
||||
b = new GregorianCalendar(2010, Calendar.FEBRUARY, 4, 10, 0, 0);
|
||||
assertEquals("1 day", DateUtil.formatDateDiff(a, b));
|
||||
a = new GregorianCalendar(2010, 1, 5, 10, 0, 0);
|
||||
b = new GregorianCalendar(2010, 1, 3, 10, 0, 0);
|
||||
a = new GregorianCalendar(2010, Calendar.FEBRUARY, 5, 10, 0, 0);
|
||||
b = new GregorianCalendar(2010, Calendar.FEBRUARY, 3, 10, 0, 0);
|
||||
assertEquals("2 days", DateUtil.formatDateDiff(a, b));
|
||||
a = new GregorianCalendar(2010, 1, 5, 10, 0, 0);
|
||||
b = new GregorianCalendar(2010, 1, 2, 10, 0, 0);
|
||||
a = new GregorianCalendar(2010, Calendar.FEBRUARY, 5, 10, 0, 0);
|
||||
b = new GregorianCalendar(2010, Calendar.FEBRUARY, 2, 10, 0, 0);
|
||||
assertEquals("3 days", DateUtil.formatDateDiff(a, b));
|
||||
a = new GregorianCalendar(2010, 5, 1, 10, 0, 0);
|
||||
b = new GregorianCalendar(2010, 4, 1, 10, 0, 0);
|
||||
a = new GregorianCalendar(2010, Calendar.JUNE, 1, 10, 0, 0);
|
||||
b = new GregorianCalendar(2010, Calendar.MAY, 1, 10, 0, 0);
|
||||
assertEquals("1 month", DateUtil.formatDateDiff(a, b));
|
||||
a = new GregorianCalendar(2010, 5, 1, 10, 0, 0);
|
||||
b = new GregorianCalendar(2010, 3, 1, 10, 0, 0);
|
||||
a = new GregorianCalendar(2010, Calendar.JUNE, 1, 10, 0, 0);
|
||||
b = new GregorianCalendar(2010, Calendar.APRIL, 1, 10, 0, 0);
|
||||
assertEquals("2 months", DateUtil.formatDateDiff(a, b));
|
||||
a = new GregorianCalendar(2010, 5, 1, 10, 0, 0);
|
||||
b = new GregorianCalendar(2010, 2, 1, 10, 0, 0);
|
||||
a = new GregorianCalendar(2010, Calendar.JUNE, 1, 10, 0, 0);
|
||||
b = new GregorianCalendar(2010, Calendar.MARCH, 1, 10, 0, 0);
|
||||
assertEquals("3 months", DateUtil.formatDateDiff(a, b));
|
||||
a = new GregorianCalendar(2010, 1, 1, 10, 0, 0);
|
||||
b = new GregorianCalendar(2009, 1, 1, 10, 0, 0);
|
||||
a = new GregorianCalendar(2010, Calendar.FEBRUARY, 1, 10, 0, 0);
|
||||
b = new GregorianCalendar(2009, Calendar.FEBRUARY, 1, 10, 0, 0);
|
||||
assertEquals("1 year", DateUtil.formatDateDiff(a, b));
|
||||
a = new GregorianCalendar(2010, 1, 1, 10, 0, 0);
|
||||
b = new GregorianCalendar(2008, 1, 1, 10, 0, 0);
|
||||
a = new GregorianCalendar(2010, Calendar.FEBRUARY, 1, 10, 0, 0);
|
||||
b = new GregorianCalendar(2008, Calendar.FEBRUARY, 1, 10, 0, 0);
|
||||
assertEquals("2 years", DateUtil.formatDateDiff(a, b));
|
||||
a = new GregorianCalendar(2010, 1, 1, 10, 0, 0);
|
||||
b = new GregorianCalendar(2007, 1, 1, 10, 0, 0);
|
||||
a = new GregorianCalendar(2010, Calendar.FEBRUARY, 1, 10, 0, 0);
|
||||
b = new GregorianCalendar(2007, Calendar.FEBRUARY, 1, 10, 0, 0);
|
||||
assertEquals("3 years", DateUtil.formatDateDiff(a, b));
|
||||
a = new GregorianCalendar(2010, 1, 1, 10, 0, 0);
|
||||
b = new GregorianCalendar(2009, 4, 5, 23, 38, 12);
|
||||
a = new GregorianCalendar(2010, Calendar.FEBRUARY, 1, 10, 0, 0);
|
||||
b = new GregorianCalendar(2009, Calendar.MAY, 5, 23, 38, 12);
|
||||
assertEquals("8 months 26 days 10 hours", DateUtil.formatDateDiff(a, b));
|
||||
a = new GregorianCalendar(2010, 9, 17, 23, 45, 45);
|
||||
b = new GregorianCalendar(2000, 3, 7, 10, 0, 0);
|
||||
a = new GregorianCalendar(2010, Calendar.OCTOBER, 17, 23, 45, 45);
|
||||
b = new GregorianCalendar(2000, Calendar.APRIL, 7, 10, 0, 0);
|
||||
assertEquals("10 years 6 months 10 days", DateUtil.formatDateDiff(a, b));
|
||||
}
|
||||
|
||||
public void testVer() {
|
||||
VersionUtil.BukkitVersion v;
|
||||
v = VersionUtil.BukkitVersion.fromString("1.13.2-R0.1");
|
||||
assertEquals(v.getMajor(), 1);
|
||||
assertEquals(v.getMinor(), 13);
|
||||
assertEquals(v.getPatch(), 2);
|
||||
assertEquals(v.getRevision(), 0.1);
|
||||
v = VersionUtil.BukkitVersion.fromString("1.9-R1.4");
|
||||
assertEquals(v.getMajor(), 1);
|
||||
assertEquals(v.getMinor(), 9);
|
||||
assertEquals(v.getPatch(), 0);
|
||||
assertEquals(v.getRevision(), 1.4);
|
||||
}
|
||||
}
|
||||
@@ -6,18 +6,11 @@
|
||||
<parent>
|
||||
<groupId>net.ess3</groupId>
|
||||
<artifactId>EssentialsXParent</artifactId>
|
||||
<version>2.16.0</version>
|
||||
<version>2.16.1</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>EssentialsXAntiBuild</artifactId>
|
||||
|
||||
<licenses>
|
||||
<license>
|
||||
<name>GPLv3</name>
|
||||
<url>http://www.gnu.org/copyleft/gpl.html</url>
|
||||
</license>
|
||||
</licenses>
|
||||
|
||||
<build>
|
||||
<finalName>EssentialsXAntiBuild-${full.version}</finalName>
|
||||
</build>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.earth2me.essentials.antibuild;
|
||||
|
||||
import com.earth2me.essentials.metrics.Metrics;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
@@ -14,6 +15,7 @@ public class EssentialsAntiBuild extends JavaPlugin implements IAntiBuild {
|
||||
private final transient Map<AntiBuildConfig, Boolean> settingsBoolean = new EnumMap<>(AntiBuildConfig.class);
|
||||
private final transient Map<AntiBuildConfig, List<Material>> settingsList = new EnumMap<>(AntiBuildConfig.class);
|
||||
private transient EssentialsConnect ess = null;
|
||||
private transient Metrics metrics = null;
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
@@ -26,6 +28,10 @@ public class EssentialsAntiBuild extends JavaPlugin implements IAntiBuild {
|
||||
|
||||
final EssentialsAntiBuildListener blockListener = new EssentialsAntiBuildListener(this);
|
||||
pm.registerEvents(blockListener, this);
|
||||
|
||||
if (metrics == null) {
|
||||
metrics = new Metrics(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+31
-9
@@ -1,6 +1,7 @@
|
||||
package com.earth2me.essentials.antibuild;
|
||||
|
||||
import com.earth2me.essentials.User;
|
||||
import com.earth2me.essentials.utils.VersionUtil;
|
||||
import net.ess3.api.IEssentials;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
@@ -21,15 +22,18 @@ import org.bukkit.event.player.PlayerPickupItemEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
|
||||
import static com.earth2me.essentials.I18n.tl;
|
||||
|
||||
|
||||
public class EssentialsAntiBuildListener implements Listener {
|
||||
private static final Logger logger = Logger.getLogger("EssentialsAntiBuild");
|
||||
final private transient IAntiBuild prot;
|
||||
final private transient IEssentials ess;
|
||||
|
||||
public EssentialsAntiBuildListener(final IAntiBuild parent) {
|
||||
EssentialsAntiBuildListener(final IAntiBuild parent) {
|
||||
this.prot = parent;
|
||||
this.ess = prot.getEssentialsConnect().getEssentials();
|
||||
|
||||
@@ -52,18 +56,36 @@ public class EssentialsAntiBuildListener implements Listener {
|
||||
private boolean metaPermCheck(final User user, final String action, final Block block) {
|
||||
if (block == null) {
|
||||
if (ess.getSettings().isDebug()) {
|
||||
ess.getLogger().log(Level.INFO, "AntiBuild permission check failed, invalid block.");
|
||||
logger.log(Level.INFO, "AntiBuild permission check failed, invalid block.");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return metaPermCheck(user, action, block.getType());
|
||||
return metaPermCheck(user, action, block.getType(), block.getData());
|
||||
}
|
||||
|
||||
private boolean metaPermCheck(final User user, final String action, final Material material) {
|
||||
public boolean metaPermCheck(final User user, final String action, final Material material) {
|
||||
final String blockPerm = "essentials.build." + action + "." + material;
|
||||
return user.isAuthorized(blockPerm);
|
||||
}
|
||||
|
||||
private boolean metaPermCheck(final User user, final String action, final Material material, final short data) {
|
||||
final String blockPerm = "essentials.build." + action + "." + material;
|
||||
final String dataPerm = blockPerm + ":" + data;
|
||||
|
||||
if (VersionUtil.getServerBukkitVersion().isLowerThan(VersionUtil.v1_13_0_R01)) {
|
||||
if (user.getBase().isPermissionSet(dataPerm)) {
|
||||
return user.isAuthorized(dataPerm);
|
||||
} else {
|
||||
if (ess.getSettings().isDebug()) {
|
||||
logger.log(Level.INFO, "DataValue perm on " + user.getName() + " is not directly set: " + dataPerm);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return user.isAuthorized(blockPerm);
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onBlockPlace(final BlockPlaceEvent event) {
|
||||
final User user = ess.getUser(event.getPlayer());
|
||||
@@ -181,7 +203,7 @@ public class EssentialsAntiBuildListener implements Listener {
|
||||
}
|
||||
|
||||
if (prot.getSettingBool(AntiBuildConfig.disable_use) && !user.canBuild() && !user.isAuthorized("essentials.build")) {
|
||||
if (event.hasItem() && !metaPermCheck(user, "interact", item.getType())) {
|
||||
if (event.hasItem() && !metaPermCheck(user, "interact", item.getType(), item.getDurability())) {
|
||||
event.setCancelled(true);
|
||||
if (ess.getSettings().warnOnBuildDisallow()) {
|
||||
user.sendMessage(tl("antiBuildUse", item.getType().toString()));
|
||||
@@ -206,7 +228,7 @@ public class EssentialsAntiBuildListener implements Listener {
|
||||
final ItemStack item = event.getRecipe().getResult();
|
||||
|
||||
if (prot.getSettingBool(AntiBuildConfig.disable_use) && !user.canBuild() && !user.isAuthorized("essentials.build")) {
|
||||
if (!metaPermCheck(user, "craft", item.getType())) {
|
||||
if (!metaPermCheck(user, "craft", item.getType(), item.getDurability())) {
|
||||
event.setCancelled(true);
|
||||
if (ess.getSettings().warnOnBuildDisallow()) {
|
||||
user.sendMessage(tl("antiBuildCraft", item.getType().toString()));
|
||||
@@ -223,7 +245,7 @@ public class EssentialsAntiBuildListener implements Listener {
|
||||
final ItemStack item = event.getItemDrop().getItemStack();
|
||||
|
||||
if (prot.getSettingBool(AntiBuildConfig.disable_use) && !user.canBuild() && !user.isAuthorized("essentials.build")) {
|
||||
if (!metaPermCheck(user, "drop", item.getType())) {
|
||||
if (!metaPermCheck(user, "drop", item.getType(), item.getDurability())) {
|
||||
event.setCancelled(true);
|
||||
user.getBase().updateInventory();
|
||||
if (ess.getSettings().warnOnBuildDisallow()) {
|
||||
@@ -250,7 +272,7 @@ public class EssentialsAntiBuildListener implements Listener {
|
||||
final ItemStack item = event.getItem().getItemStack();
|
||||
|
||||
if (prot.getSettingBool(AntiBuildConfig.disable_use) && !user.canBuild() && !user.isAuthorized("essentials.build")) {
|
||||
if (!metaPermCheck(user, "pickup", item.getType())) {
|
||||
if (!metaPermCheck(user, "pickup", item.getType(), item.getDurability())) {
|
||||
event.setCancelled(true);
|
||||
event.getItem().setPickupDelay(50);
|
||||
}
|
||||
@@ -266,7 +288,7 @@ public class EssentialsAntiBuildListener implements Listener {
|
||||
final ItemStack item = event.getItem().getItemStack();
|
||||
|
||||
if (prot.getSettingBool(AntiBuildConfig.disable_use) && !user.canBuild() && !user.isAuthorized("essentials.build")) {
|
||||
if (!metaPermCheck(user, "pickup", item.getType())) {
|
||||
if (!metaPermCheck(user, "pickup", item.getType(), item.getDurability())) {
|
||||
event.setCancelled(true);
|
||||
event.getItem().setPickupDelay(50);
|
||||
}
|
||||
|
||||
@@ -13,14 +13,14 @@ import java.util.logging.Logger;
|
||||
import static com.earth2me.essentials.I18n.tl;
|
||||
|
||||
|
||||
public class EssentialsConnect {
|
||||
private static final Logger LOGGER = Logger.getLogger("Minecraft");
|
||||
class EssentialsConnect {
|
||||
private static final Logger logger = Logger.getLogger("EssentialsAntiBuild");
|
||||
private final transient IEssentials ess;
|
||||
private final transient IAntiBuild protect;
|
||||
|
||||
public EssentialsConnect(Plugin essPlugin, Plugin essProtect) {
|
||||
EssentialsConnect(Plugin essPlugin, Plugin essProtect) {
|
||||
if (!essProtect.getDescription().getVersion().equals(essPlugin.getDescription().getVersion())) {
|
||||
LOGGER.log(Level.WARNING, tl("versionMismatchAll"));
|
||||
logger.log(Level.WARNING, tl("versionMismatchAll"));
|
||||
}
|
||||
ess = (IEssentials) essPlugin;
|
||||
protect = (IAntiBuild) essProtect;
|
||||
@@ -29,17 +29,14 @@ public class EssentialsConnect {
|
||||
ess.addReloadListener(pr);
|
||||
}
|
||||
|
||||
public void onDisable() {
|
||||
}
|
||||
|
||||
public IEssentials getEssentials() {
|
||||
IEssentials getEssentials() {
|
||||
return ess;
|
||||
}
|
||||
|
||||
public void alert(final User user, final String item, final String type) {
|
||||
void alert(final User user, final String item, final String type) {
|
||||
final Location loc = user.getLocation();
|
||||
final String warnMessage = tl("alertFormat", user.getName(), type, item, loc.getWorld().getName() + "," + loc.getBlockX() + "," + loc.getBlockY() + "," + loc.getBlockZ());
|
||||
LOGGER.log(Level.WARNING, warnMessage);
|
||||
logger.log(Level.WARNING, warnMessage);
|
||||
for (Player p : ess.getServer().getOnlinePlayers()) {
|
||||
final User alertUser = ess.getUser(p);
|
||||
if (alertUser.isAuthorized("essentials.protect.alerts")) {
|
||||
@@ -48,7 +45,6 @@ public class EssentialsConnect {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private class AntiBuildReloader implements IConf {
|
||||
@Override
|
||||
public void reloadConfig() {
|
||||
|
||||
@@ -6,5 +6,5 @@ version: ${full.version}
|
||||
website: http://tiny.cc/EssentialsCommands
|
||||
description: Provides build protection.
|
||||
authors: [Zenexer, ementalo, Aelux, Brettflan, KimKandor, snowleo, ceulemans, Xeology, KHobbits, Iaccidentally]
|
||||
api-version: 1.13
|
||||
depend: [Essentials]
|
||||
api-version: 1.13
|
||||
@@ -6,18 +6,11 @@
|
||||
<parent>
|
||||
<groupId>net.ess3</groupId>
|
||||
<artifactId>EssentialsXParent</artifactId>
|
||||
<version>2.16.0</version>
|
||||
<version>2.16.1</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>EssentialsXChat</artifactId>
|
||||
|
||||
<licenses>
|
||||
<license>
|
||||
<name>GPLv3</name>
|
||||
<url>http://www.gnu.org/copyleft/gpl.html</url>
|
||||
</license>
|
||||
</licenses>
|
||||
|
||||
<build>
|
||||
<finalName>EssentialsXChat-${full.version}</finalName>
|
||||
</build>
|
||||
|
||||
@@ -5,7 +5,7 @@ import com.earth2me.essentials.User;
|
||||
import net.ess3.api.IEssentials;
|
||||
|
||||
|
||||
public class ChatStore {
|
||||
class ChatStore {
|
||||
private final User user;
|
||||
private final String type;
|
||||
private final Trade charge;
|
||||
@@ -17,27 +17,27 @@ public class ChatStore {
|
||||
this.charge = new Trade(getLongType(), ess);
|
||||
}
|
||||
|
||||
public User getUser() {
|
||||
User getUser() {
|
||||
return user;
|
||||
}
|
||||
|
||||
public Trade getCharge() {
|
||||
Trade getCharge() {
|
||||
return charge;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public final String getLongType() {
|
||||
final String getLongType() {
|
||||
return type.length() == 0 ? "chat" : "chat-" + type;
|
||||
}
|
||||
|
||||
public long getRadius() {
|
||||
long getRadius() {
|
||||
return radius;
|
||||
}
|
||||
|
||||
public void setRadius(long radius) {
|
||||
void setRadius(long radius) {
|
||||
this.radius = radius;
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.earth2me.essentials.chat;
|
||||
|
||||
import com.earth2me.essentials.metrics.Metrics;
|
||||
import net.ess3.api.IEssentials;
|
||||
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
@@ -9,27 +10,27 @@ import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import static com.earth2me.essentials.I18n.tl;
|
||||
|
||||
|
||||
public class EssentialsChat extends JavaPlugin {
|
||||
private static final Logger LOGGER = Logger.getLogger("Minecraft");
|
||||
|
||||
private transient Metrics metrics = null;
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
final PluginManager pluginManager = getServer().getPluginManager();
|
||||
final IEssentials ess = (IEssentials) pluginManager.getPlugin("Essentials");
|
||||
if (!this.getDescription().getVersion().equals(ess.getDescription().getVersion())) {
|
||||
LOGGER.log(Level.WARNING, tl("versionMismatchAll"));
|
||||
getLogger().log(Level.WARNING, tl("versionMismatchAll"));
|
||||
}
|
||||
if (!ess.isEnabled()) {
|
||||
this.setEnabled(false);
|
||||
return;
|
||||
}
|
||||
|
||||
final Map<AsyncPlayerChatEvent, ChatStore> chatStore = Collections.synchronizedMap(new HashMap<AsyncPlayerChatEvent, ChatStore>());
|
||||
final Map<AsyncPlayerChatEvent, ChatStore> chatStore = Collections.synchronizedMap(new HashMap<>());
|
||||
|
||||
final EssentialsChatPlayerListenerLowest playerListenerLowest = new EssentialsChatPlayerListenerLowest(getServer(), ess, chatStore);
|
||||
final EssentialsChatPlayerListenerNormal playerListenerNormal = new EssentialsChatPlayerListenerNormal(getServer(), ess, chatStore);
|
||||
@@ -38,5 +39,9 @@ public class EssentialsChat extends JavaPlugin {
|
||||
pluginManager.registerEvents(playerListenerNormal, this);
|
||||
pluginManager.registerEvents(playerListenerHighest, this);
|
||||
|
||||
if (metrics == null) {
|
||||
metrics = new Metrics(this);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -13,12 +13,12 @@ import java.util.logging.Logger;
|
||||
|
||||
|
||||
public abstract class EssentialsChatPlayer implements Listener {
|
||||
protected static final Logger logger = Logger.getLogger("Minecraft");
|
||||
protected transient IEssentials ess;
|
||||
protected final transient Server server;
|
||||
protected final transient Map<AsyncPlayerChatEvent, ChatStore> chatStorage;
|
||||
static final Logger logger = Logger.getLogger("EssentialsChat");
|
||||
transient IEssentials ess;
|
||||
final transient Server server;
|
||||
private final transient Map<AsyncPlayerChatEvent, ChatStore> chatStorage;
|
||||
|
||||
public EssentialsChatPlayer(final Server server, final IEssentials ess, final Map<AsyncPlayerChatEvent, ChatStore> chatStorage) {
|
||||
EssentialsChatPlayer(final Server server, final IEssentials ess, final Map<AsyncPlayerChatEvent, ChatStore> chatStorage) {
|
||||
this.ess = ess;
|
||||
this.server = server;
|
||||
this.chatStorage = chatStorage;
|
||||
@@ -26,11 +26,11 @@ public abstract class EssentialsChatPlayer implements Listener {
|
||||
|
||||
public abstract void onPlayerChat(final AsyncPlayerChatEvent event);
|
||||
|
||||
public boolean isAborted(final AsyncPlayerChatEvent event) {
|
||||
boolean isAborted(final AsyncPlayerChatEvent event) {
|
||||
return event.isCancelled();
|
||||
}
|
||||
|
||||
public String getChatType(final String message) {
|
||||
String getChatType(final String message) {
|
||||
if (message.length() == 0) {
|
||||
//Ignore empty chat events generated by plugins
|
||||
return "";
|
||||
@@ -46,23 +46,23 @@ public abstract class EssentialsChatPlayer implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
public ChatStore getChatStore(final AsyncPlayerChatEvent event) {
|
||||
ChatStore getChatStore(final AsyncPlayerChatEvent event) {
|
||||
return chatStorage.get(event);
|
||||
}
|
||||
|
||||
public void setChatStore(final AsyncPlayerChatEvent event, final ChatStore chatStore) {
|
||||
void setChatStore(final AsyncPlayerChatEvent event, final ChatStore chatStore) {
|
||||
chatStorage.put(event, chatStore);
|
||||
}
|
||||
|
||||
public ChatStore delChatStore(final AsyncPlayerChatEvent event) {
|
||||
ChatStore delChatStore(final AsyncPlayerChatEvent event) {
|
||||
return chatStorage.remove(event);
|
||||
}
|
||||
|
||||
protected void charge(final User user, final Trade charge) throws ChargeException {
|
||||
private void charge(final User user, final Trade charge) throws ChargeException {
|
||||
charge.charge(user);
|
||||
}
|
||||
|
||||
protected boolean charge(final AsyncPlayerChatEvent event, final ChatStore chatStore) {
|
||||
boolean charge(final AsyncPlayerChatEvent event, final ChatStore chatStore) {
|
||||
try {
|
||||
charge(chatStore.getUser(), chatStore.getCharge());
|
||||
} catch (ChargeException e) {
|
||||
|
||||
+2
-4
@@ -10,7 +10,7 @@ import java.util.Map;
|
||||
|
||||
|
||||
public class EssentialsChatPlayerListenerHighest extends EssentialsChatPlayer {
|
||||
public EssentialsChatPlayerListenerHighest(final Server server, final IEssentials ess, final Map<AsyncPlayerChatEvent, ChatStore> chatStorage) {
|
||||
EssentialsChatPlayerListenerHighest(final Server server, final IEssentials ess, final Map<AsyncPlayerChatEvent, ChatStore> chatStorage) {
|
||||
super(server, ess, chatStorage);
|
||||
}
|
||||
|
||||
@@ -22,9 +22,7 @@ public class EssentialsChatPlayerListenerHighest extends EssentialsChatPlayer {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* This file should handle charging the user for the action before returning control back
|
||||
*/
|
||||
// This file should handle charging the user for the action before returning control back
|
||||
charge(event, chatStore);
|
||||
}
|
||||
}
|
||||
+2
-4
@@ -15,7 +15,7 @@ import java.util.Map;
|
||||
|
||||
|
||||
public class EssentialsChatPlayerListenerLowest extends EssentialsChatPlayer {
|
||||
public EssentialsChatPlayerListenerLowest(final Server server, final IEssentials ess, final Map<AsyncPlayerChatEvent, ChatStore> chatStorage) {
|
||||
EssentialsChatPlayerListenerLowest(final Server server, final IEssentials ess, final Map<AsyncPlayerChatEvent, ChatStore> chatStorage) {
|
||||
super(server, ess, chatStorage);
|
||||
}
|
||||
|
||||
@@ -36,9 +36,7 @@ public class EssentialsChatPlayerListenerLowest extends EssentialsChatPlayer {
|
||||
final ChatStore chatStore = new ChatStore(ess, user, getChatType(event.getMessage()));
|
||||
setChatStore(event, chatStore);
|
||||
|
||||
/**
|
||||
* This listener should apply the general chat formatting only...then return control back the event handler
|
||||
*/
|
||||
// This listener should apply the general chat formatting only...then return control back the event handler
|
||||
event.setMessage(FormatUtil.formatMessage(user, "essentials.chat", event.getMessage()));
|
||||
String group = user.getGroup();
|
||||
String world = user.getWorld().getName();
|
||||
|
||||
Loaded 100 of 154 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user