Lots of little fixes in the Essentials modules (#2337) @DoNotSpamPls
Look at changed files for the changes
This commit is contained in:
parent
e8ab2db8e8
commit
82ede4530a
|
@ -1,54 +1,18 @@
|
||||||
.DS_Store
|
# IDE files
|
||||||
/BuildAll/nbproject/private/
|
*.classpath
|
||||||
/EssentialsProtect/nbproject/private/
|
*.project
|
||||||
/EssentialsChat/nbproject/private/
|
*.settings/
|
||||||
/EssentialsGroupBridge/nbproject/private/
|
.idea/
|
||||||
/EssentialsGeoIP/nbproject/private/
|
*.iml
|
||||||
/EssentialsSpawn/nbproject/private/
|
.DS_Store
|
||||||
/EssentialsXMPP/nbproject/private/
|
|
||||||
/BuildAll/build/
|
# Essentials files
|
||||||
/EssentialsGroupBridge/dist/
|
/Essentials/userdata
|
||||||
/EssentialsGroupBridge/build/
|
/Essentials/config.yml
|
||||||
/EssentialsGeoIP/dist/
|
/Essentials/kits.yml
|
||||||
/EssentialsGeoIP/build/
|
/Essentials/userdata/testplayer1.yml
|
||||||
/BuildAll/dist/
|
/Essentials/usermap.csv
|
||||||
/EssentialsChat/build/
|
|
||||||
/EssentialsChat/dist/
|
# Build files
|
||||||
/EssentialsSpawn/build/
|
target/
|
||||||
/EssentialsSpawn/dist/
|
jars/
|
||||||
/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/
|
|
||||||
.buildtools/
|
|
||||||
*.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/
|
|
|
@ -11,20 +11,13 @@
|
||||||
|
|
||||||
<artifactId>EssentialsX</artifactId>
|
<artifactId>EssentialsX</artifactId>
|
||||||
|
|
||||||
<licenses>
|
|
||||||
<license>
|
|
||||||
<name>GPLv3</name>
|
|
||||||
<url>http://www.gnu.org/copyleft/gpl.html</url>
|
|
||||||
</license>
|
|
||||||
</licenses>
|
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
<finalName>EssentialsX-${full.version}</finalName>
|
<finalName>EssentialsX-${full.version}</finalName>
|
||||||
<plugins>
|
<plugins>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
<version>3.7.0</version>
|
<version>3.8.0</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<showDeprecation>false</showDeprecation>
|
<showDeprecation>false</showDeprecation>
|
||||||
</configuration>
|
</configuration>
|
||||||
|
@ -32,7 +25,7 @@
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-shade-plugin</artifactId>
|
<artifactId>maven-shade-plugin</artifactId>
|
||||||
<version>3.1.0</version>
|
<version>3.2.1</version>
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
<phase>package</phase>
|
<phase>package</phase>
|
||||||
|
@ -41,6 +34,9 @@
|
||||||
</goals>
|
</goals>
|
||||||
</execution>
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
|
<configuration>
|
||||||
|
<createDependencyReducedPom>false</createDependencyReducedPom>
|
||||||
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
|
@ -113,6 +109,7 @@
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<repositories>
|
<repositories>
|
||||||
<repository>
|
<repository>
|
||||||
<id>vault-repo</id>
|
<id>vault-repo</id>
|
||||||
|
|
|
@ -11,13 +11,6 @@
|
||||||
|
|
||||||
<artifactId>EssentialsXAntiBuild</artifactId>
|
<artifactId>EssentialsXAntiBuild</artifactId>
|
||||||
|
|
||||||
<licenses>
|
|
||||||
<license>
|
|
||||||
<name>GPLv3</name>
|
|
||||||
<url>http://www.gnu.org/copyleft/gpl.html</url>
|
|
||||||
</license>
|
|
||||||
</licenses>
|
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
<finalName>EssentialsXAntiBuild-${full.version}</finalName>
|
<finalName>EssentialsXAntiBuild-${full.version}</finalName>
|
||||||
</build>
|
</build>
|
||||||
|
|
|
@ -22,15 +22,18 @@ import org.bukkit.event.player.PlayerPickupItemEvent;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
|
|
||||||
import static com.earth2me.essentials.I18n.tl;
|
import static com.earth2me.essentials.I18n.tl;
|
||||||
|
|
||||||
|
|
||||||
public class EssentialsAntiBuildListener implements Listener {
|
public class EssentialsAntiBuildListener implements Listener {
|
||||||
|
private static final Logger logger = Logger.getLogger("EssentialsAntiBuild");
|
||||||
final private transient IAntiBuild prot;
|
final private transient IAntiBuild prot;
|
||||||
final private transient IEssentials ess;
|
final private transient IEssentials ess;
|
||||||
|
|
||||||
public EssentialsAntiBuildListener(final IAntiBuild parent) {
|
EssentialsAntiBuildListener(final IAntiBuild parent) {
|
||||||
this.prot = parent;
|
this.prot = parent;
|
||||||
this.ess = prot.getEssentialsConnect().getEssentials();
|
this.ess = prot.getEssentialsConnect().getEssentials();
|
||||||
|
|
||||||
|
@ -53,14 +56,14 @@ public class EssentialsAntiBuildListener implements Listener {
|
||||||
private boolean metaPermCheck(final User user, final String action, final Block block) {
|
private boolean metaPermCheck(final User user, final String action, final Block block) {
|
||||||
if (block == null) {
|
if (block == null) {
|
||||||
if (ess.getSettings().isDebug()) {
|
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 false;
|
||||||
}
|
}
|
||||||
return metaPermCheck(user, action, block.getType(), block.getData());
|
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;
|
final String blockPerm = "essentials.build." + action + "." + material;
|
||||||
return user.isAuthorized(blockPerm);
|
return user.isAuthorized(blockPerm);
|
||||||
}
|
}
|
||||||
|
@ -74,7 +77,7 @@ public class EssentialsAntiBuildListener implements Listener {
|
||||||
return user.isAuthorized(dataPerm);
|
return user.isAuthorized(dataPerm);
|
||||||
} else {
|
} else {
|
||||||
if (ess.getSettings().isDebug()) {
|
if (ess.getSettings().isDebug()) {
|
||||||
ess.getLogger().log(Level.INFO, "DataValue perm on " + user.getName() + " is not directly set: " + dataPerm);
|
logger.log(Level.INFO, "DataValue perm on " + user.getName() + " is not directly set: " + dataPerm);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,14 +13,14 @@ import java.util.logging.Logger;
|
||||||
import static com.earth2me.essentials.I18n.tl;
|
import static com.earth2me.essentials.I18n.tl;
|
||||||
|
|
||||||
|
|
||||||
public class EssentialsConnect {
|
class EssentialsConnect {
|
||||||
private static final Logger LOGGER = Logger.getLogger("Minecraft");
|
private static final Logger logger = Logger.getLogger("EssentialsAntiBuild");
|
||||||
private final transient IEssentials ess;
|
private final transient IEssentials ess;
|
||||||
private final transient IAntiBuild protect;
|
private final transient IAntiBuild protect;
|
||||||
|
|
||||||
public EssentialsConnect(Plugin essPlugin, Plugin essProtect) {
|
EssentialsConnect(Plugin essPlugin, Plugin essProtect) {
|
||||||
if (!essProtect.getDescription().getVersion().equals(essPlugin.getDescription().getVersion())) {
|
if (!essProtect.getDescription().getVersion().equals(essPlugin.getDescription().getVersion())) {
|
||||||
LOGGER.log(Level.WARNING, tl("versionMismatchAll"));
|
logger.log(Level.WARNING, tl("versionMismatchAll"));
|
||||||
}
|
}
|
||||||
ess = (IEssentials) essPlugin;
|
ess = (IEssentials) essPlugin;
|
||||||
protect = (IAntiBuild) essProtect;
|
protect = (IAntiBuild) essProtect;
|
||||||
|
@ -29,17 +29,14 @@ public class EssentialsConnect {
|
||||||
ess.addReloadListener(pr);
|
ess.addReloadListener(pr);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onDisable() {
|
IEssentials getEssentials() {
|
||||||
}
|
|
||||||
|
|
||||||
public IEssentials getEssentials() {
|
|
||||||
return ess;
|
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 Location loc = user.getLocation();
|
||||||
final String warnMessage = tl("alertFormat", user.getName(), type, item, loc.getWorld().getName() + "," + loc.getBlockX() + "," + loc.getBlockY() + "," + loc.getBlockZ());
|
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()) {
|
for (Player p : ess.getServer().getOnlinePlayers()) {
|
||||||
final User alertUser = ess.getUser(p);
|
final User alertUser = ess.getUser(p);
|
||||||
if (alertUser.isAuthorized("essentials.protect.alerts")) {
|
if (alertUser.isAuthorized("essentials.protect.alerts")) {
|
||||||
|
@ -48,7 +45,6 @@ public class EssentialsConnect {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private class AntiBuildReloader implements IConf {
|
private class AntiBuildReloader implements IConf {
|
||||||
@Override
|
@Override
|
||||||
public void reloadConfig() {
|
public void reloadConfig() {
|
||||||
|
|
|
@ -6,5 +6,5 @@ version: ${full.version}
|
||||||
website: http://tiny.cc/EssentialsCommands
|
website: http://tiny.cc/EssentialsCommands
|
||||||
description: Provides build protection.
|
description: Provides build protection.
|
||||||
authors: [Zenexer, ementalo, Aelux, Brettflan, KimKandor, snowleo, ceulemans, Xeology, KHobbits, Iaccidentally]
|
authors: [Zenexer, ementalo, Aelux, Brettflan, KimKandor, snowleo, ceulemans, Xeology, KHobbits, Iaccidentally]
|
||||||
api-version: 1.13
|
|
||||||
depend: [Essentials]
|
depend: [Essentials]
|
||||||
|
api-version: 1.13
|
||||||
|
|
|
@ -11,13 +11,6 @@
|
||||||
|
|
||||||
<artifactId>EssentialsXChat</artifactId>
|
<artifactId>EssentialsXChat</artifactId>
|
||||||
|
|
||||||
<licenses>
|
|
||||||
<license>
|
|
||||||
<name>GPLv3</name>
|
|
||||||
<url>http://www.gnu.org/copyleft/gpl.html</url>
|
|
||||||
</license>
|
|
||||||
</licenses>
|
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
<finalName>EssentialsXChat-${full.version}</finalName>
|
<finalName>EssentialsXChat-${full.version}</finalName>
|
||||||
</build>
|
</build>
|
||||||
|
|
|
@ -5,7 +5,7 @@ import com.earth2me.essentials.User;
|
||||||
import net.ess3.api.IEssentials;
|
import net.ess3.api.IEssentials;
|
||||||
|
|
||||||
|
|
||||||
public class ChatStore {
|
class ChatStore {
|
||||||
private final User user;
|
private final User user;
|
||||||
private final String type;
|
private final String type;
|
||||||
private final Trade charge;
|
private final Trade charge;
|
||||||
|
@ -17,27 +17,27 @@ public class ChatStore {
|
||||||
this.charge = new Trade(getLongType(), ess);
|
this.charge = new Trade(getLongType(), ess);
|
||||||
}
|
}
|
||||||
|
|
||||||
public User getUser() {
|
User getUser() {
|
||||||
return user;
|
return user;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Trade getCharge() {
|
Trade getCharge() {
|
||||||
return charge;
|
return charge;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getType() {
|
String getType() {
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
public final String getLongType() {
|
final String getLongType() {
|
||||||
return type.length() == 0 ? "chat" : "chat-" + type;
|
return type.length() == 0 ? "chat" : "chat-" + type;
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getRadius() {
|
long getRadius() {
|
||||||
return radius;
|
return radius;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRadius(long radius) {
|
void setRadius(long radius) {
|
||||||
this.radius = radius;
|
this.radius = radius;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,13 +10,12 @@ import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
|
||||||
|
|
||||||
import static com.earth2me.essentials.I18n.tl;
|
import static com.earth2me.essentials.I18n.tl;
|
||||||
|
|
||||||
|
|
||||||
public class EssentialsChat extends JavaPlugin {
|
public class EssentialsChat extends JavaPlugin {
|
||||||
private static final Logger LOGGER = Logger.getLogger("Minecraft");
|
|
||||||
private transient Metrics metrics = null;
|
private transient Metrics metrics = null;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -24,14 +23,14 @@ public class EssentialsChat extends JavaPlugin {
|
||||||
final PluginManager pluginManager = getServer().getPluginManager();
|
final PluginManager pluginManager = getServer().getPluginManager();
|
||||||
final IEssentials ess = (IEssentials) pluginManager.getPlugin("Essentials");
|
final IEssentials ess = (IEssentials) pluginManager.getPlugin("Essentials");
|
||||||
if (!this.getDescription().getVersion().equals(ess.getDescription().getVersion())) {
|
if (!this.getDescription().getVersion().equals(ess.getDescription().getVersion())) {
|
||||||
LOGGER.log(Level.WARNING, tl("versionMismatchAll"));
|
getLogger().log(Level.WARNING, tl("versionMismatchAll"));
|
||||||
}
|
}
|
||||||
if (!ess.isEnabled()) {
|
if (!ess.isEnabled()) {
|
||||||
this.setEnabled(false);
|
this.setEnabled(false);
|
||||||
return;
|
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 EssentialsChatPlayerListenerLowest playerListenerLowest = new EssentialsChatPlayerListenerLowest(getServer(), ess, chatStore);
|
||||||
final EssentialsChatPlayerListenerNormal playerListenerNormal = new EssentialsChatPlayerListenerNormal(getServer(), ess, chatStore);
|
final EssentialsChatPlayerListenerNormal playerListenerNormal = new EssentialsChatPlayerListenerNormal(getServer(), ess, chatStore);
|
||||||
|
@ -43,6 +42,6 @@ public class EssentialsChat extends JavaPlugin {
|
||||||
if (metrics == null) {
|
if (metrics == null) {
|
||||||
metrics = new Metrics(this);
|
metrics = new Metrics(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,12 +13,12 @@ import java.util.logging.Logger;
|
||||||
|
|
||||||
|
|
||||||
public abstract class EssentialsChatPlayer implements Listener {
|
public abstract class EssentialsChatPlayer implements Listener {
|
||||||
protected static final Logger logger = Logger.getLogger("Minecraft");
|
static final Logger logger = Logger.getLogger("EssentialsChat");
|
||||||
protected transient IEssentials ess;
|
transient IEssentials ess;
|
||||||
protected final transient Server server;
|
final transient Server server;
|
||||||
protected final transient Map<AsyncPlayerChatEvent, ChatStore> chatStorage;
|
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.ess = ess;
|
||||||
this.server = server;
|
this.server = server;
|
||||||
this.chatStorage = chatStorage;
|
this.chatStorage = chatStorage;
|
||||||
|
@ -26,11 +26,11 @@ public abstract class EssentialsChatPlayer implements Listener {
|
||||||
|
|
||||||
public abstract void onPlayerChat(final AsyncPlayerChatEvent event);
|
public abstract void onPlayerChat(final AsyncPlayerChatEvent event);
|
||||||
|
|
||||||
public boolean isAborted(final AsyncPlayerChatEvent event) {
|
boolean isAborted(final AsyncPlayerChatEvent event) {
|
||||||
return event.isCancelled();
|
return event.isCancelled();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getChatType(final String message) {
|
String getChatType(final String message) {
|
||||||
if (message.length() == 0) {
|
if (message.length() == 0) {
|
||||||
//Ignore empty chat events generated by plugins
|
//Ignore empty chat events generated by plugins
|
||||||
return "";
|
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);
|
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);
|
chatStorage.put(event, chatStore);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ChatStore delChatStore(final AsyncPlayerChatEvent event) {
|
ChatStore delChatStore(final AsyncPlayerChatEvent event) {
|
||||||
return chatStorage.remove(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);
|
charge.charge(user);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean charge(final AsyncPlayerChatEvent event, final ChatStore chatStore) {
|
boolean charge(final AsyncPlayerChatEvent event, final ChatStore chatStore) {
|
||||||
try {
|
try {
|
||||||
charge(chatStore.getUser(), chatStore.getCharge());
|
charge(chatStore.getUser(), chatStore.getCharge());
|
||||||
} catch (ChargeException e) {
|
} catch (ChargeException e) {
|
||||||
|
|
|
@ -10,7 +10,7 @@ import java.util.Map;
|
||||||
|
|
||||||
|
|
||||||
public class EssentialsChatPlayerListenerHighest extends EssentialsChatPlayer {
|
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);
|
super(server, ess, chatStorage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,9 +22,7 @@ public class EssentialsChatPlayerListenerHighest extends EssentialsChatPlayer {
|
||||||
return;
|
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);
|
charge(event, chatStore);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@ import java.util.Map;
|
||||||
|
|
||||||
|
|
||||||
public class EssentialsChatPlayerListenerLowest extends EssentialsChatPlayer {
|
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);
|
super(server, ess, chatStorage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,9 +36,7 @@ public class EssentialsChatPlayerListenerLowest extends EssentialsChatPlayer {
|
||||||
final ChatStore chatStore = new ChatStore(ess, user, getChatType(event.getMessage()));
|
final ChatStore chatStore = new ChatStore(ess, user, getChatType(event.getMessage()));
|
||||||
setChatStore(event, chatStore);
|
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()));
|
event.setMessage(FormatUtil.formatMessage(user, "essentials.chat", event.getMessage()));
|
||||||
String group = user.getGroup();
|
String group = user.getGroup();
|
||||||
String world = user.getWorld().getName();
|
String world = user.getWorld().getName();
|
||||||
|
|
|
@ -18,7 +18,7 @@ import static com.earth2me.essentials.I18n.tl;
|
||||||
|
|
||||||
|
|
||||||
public class EssentialsChatPlayerListenerNormal extends EssentialsChatPlayer {
|
public class EssentialsChatPlayerListenerNormal extends EssentialsChatPlayer {
|
||||||
public EssentialsChatPlayerListenerNormal(final Server server, final IEssentials ess, final Map<AsyncPlayerChatEvent, ChatStore> chatStorage) {
|
EssentialsChatPlayerListenerNormal(final Server server, final IEssentials ess, final Map<AsyncPlayerChatEvent, ChatStore> chatStorage) {
|
||||||
super(server, ess, chatStorage);
|
super(server, ess, chatStorage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,10 +29,7 @@ public class EssentialsChatPlayerListenerNormal extends EssentialsChatPlayer {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
// This file should handle detection of the local chat features; if local chat is enabled, we need to handle it here
|
||||||
* This file should handle detection of the local chat features... if local chat is enabled, we need to handle
|
|
||||||
* it here
|
|
||||||
*/
|
|
||||||
long radius = ess.getSettings().getChatRadius();
|
long radius = ess.getSettings().getChatRadius();
|
||||||
if (radius < 1) {
|
if (radius < 1) {
|
||||||
return;
|
return;
|
||||||
|
@ -66,13 +63,13 @@ public class EssentialsChatPlayerListenerNormal extends EssentialsChatPlayer {
|
||||||
}
|
}
|
||||||
|
|
||||||
Set<Player> outList = event.getRecipients();
|
Set<Player> outList = event.getRecipients();
|
||||||
Set<Player> spyList = new HashSet<Player>();
|
Set<Player> spyList = new HashSet<>();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
outList.add(event.getPlayer());
|
outList.add(event.getPlayer());
|
||||||
} catch (UnsupportedOperationException ex) {
|
} catch (UnsupportedOperationException ex) {
|
||||||
if (ess.getSettings().isDebug()) {
|
if (ess.getSettings().isDebug()) {
|
||||||
ess.getLogger().log(Level.INFO, "Plugin triggered custom chat event, local chat handling aborted.", ex);
|
logger.log(Level.INFO, "Plugin triggered custom chat event, local chat handling aborted.", ex);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,4 +7,4 @@ website: http://tiny.cc/EssentialsCommands
|
||||||
description: Provides chat control features for Essentials. Requires Permissions.
|
description: Provides chat control features for Essentials. Requires Permissions.
|
||||||
authors: [Zenexer, ementalo, Aelux, Brettflan, KimKandor, snowleo, ceulemans, Xeology, KHobbits, md_5, Okamosy, Iaccidentally]
|
authors: [Zenexer, ementalo, Aelux, Brettflan, KimKandor, snowleo, ceulemans, Xeology, KHobbits, md_5, Okamosy, Iaccidentally]
|
||||||
depend: [Essentials]
|
depend: [Essentials]
|
||||||
#softdepend: [Factions]
|
api-version: 1.13
|
||||||
|
|
|
@ -11,38 +11,13 @@
|
||||||
|
|
||||||
<artifactId>EssentialsXGeoIP</artifactId>
|
<artifactId>EssentialsXGeoIP</artifactId>
|
||||||
|
|
||||||
<licenses>
|
|
||||||
<license>
|
|
||||||
<name>GPLv3</name>
|
|
||||||
<url>http://www.gnu.org/copyleft/gpl.html</url>
|
|
||||||
</license>
|
|
||||||
</licenses>
|
|
||||||
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>net.ess3</groupId>
|
|
||||||
<artifactId>EssentialsX</artifactId>
|
|
||||||
<version>${project.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.maxmind.geoip2</groupId>
|
|
||||||
<artifactId>geoip2</artifactId>
|
|
||||||
<version>0.7.2</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>javatar</groupId>
|
|
||||||
<artifactId>javatar</artifactId>
|
|
||||||
<version>2.5</version>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
<finalName>EssentialsXGeoIP-${full.version}</finalName>
|
<finalName>EssentialsXGeoIP-${full.version}</finalName>
|
||||||
<plugins>
|
<plugins>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-shade-plugin</artifactId>
|
<artifactId>maven-shade-plugin</artifactId>
|
||||||
<version>3.1.0</version>
|
<version>3.2.1</version>
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
<phase>package</phase>
|
<phase>package</phase>
|
||||||
|
@ -52,6 +27,7 @@
|
||||||
</execution>
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
<configuration>
|
<configuration>
|
||||||
|
<createDependencyReducedPom>false</createDependencyReducedPom>
|
||||||
<minimizeJar>true</minimizeJar>
|
<minimizeJar>true</minimizeJar>
|
||||||
<artifactSet>
|
<artifactSet>
|
||||||
<includes>
|
<includes>
|
||||||
|
@ -65,4 +41,22 @@
|
||||||
</plugin>
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>net.ess3</groupId>
|
||||||
|
<artifactId>EssentialsX</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.maxmind.geoip2</groupId>
|
||||||
|
<artifactId>geoip2</artifactId>
|
||||||
|
<version>2.12.0</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>javatar</groupId>
|
||||||
|
<artifactId>javatar</artifactId>
|
||||||
|
<version>2.5</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
</project>
|
</project>
|
|
@ -11,15 +11,9 @@ import static com.earth2me.essentials.I18n.tl;
|
||||||
|
|
||||||
|
|
||||||
public class EssentialsGeoIP extends JavaPlugin {
|
public class EssentialsGeoIP extends JavaPlugin {
|
||||||
|
|
||||||
private transient Metrics metrics = null;
|
private transient Metrics metrics = null;
|
||||||
|
|
||||||
public EssentialsGeoIP() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onDisable() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
final PluginManager pm = getServer().getPluginManager();
|
final PluginManager pm = getServer().getPluginManager();
|
||||||
|
@ -41,4 +35,5 @@ public class EssentialsGeoIP extends JavaPlugin {
|
||||||
metrics = new Metrics(this);
|
metrics = new Metrics(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,11 +20,10 @@ import java.net.MalformedURLException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.net.URLConnection;
|
import java.net.URLConnection;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.logging.Logger;
|
||||||
import java.util.zip.GZIPInputStream;
|
import java.util.zip.GZIPInputStream;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
|
||||||
import com.ice.tar.TarInputStream;
|
import com.ice.tar.TarInputStream;
|
||||||
import com.ice.tar.TarEntry;
|
import com.ice.tar.TarEntry;
|
||||||
|
|
||||||
|
@ -32,14 +31,14 @@ import static com.earth2me.essentials.I18n.tl;
|
||||||
|
|
||||||
|
|
||||||
public class EssentialsGeoIPPlayerListener implements Listener, IConf {
|
public class EssentialsGeoIPPlayerListener implements Listener, IConf {
|
||||||
DatabaseReader mmreader = null; // initialize maxmind geoip2 reader
|
private DatabaseReader mmreader = null; // initialize maxmind geoip2 reader
|
||||||
private static final Logger logger = Logger.getLogger("Minecraft");
|
private static final Logger logger = Logger.getLogger("EssentialsGeoIP");
|
||||||
File databaseFile;
|
private File databaseFile;
|
||||||
File dataFolder;
|
private File dataFolder;
|
||||||
final EssentialsConf config;
|
private final EssentialsConf config;
|
||||||
private final transient IEssentials ess;
|
private final transient IEssentials ess;
|
||||||
|
|
||||||
public EssentialsGeoIPPlayerListener(File dataFolder, IEssentials ess) {
|
EssentialsGeoIPPlayerListener(File dataFolder, IEssentials ess) {
|
||||||
this.ess = ess;
|
this.ess = ess;
|
||||||
this.dataFolder = dataFolder;
|
this.dataFolder = dataFolder;
|
||||||
this.config = new EssentialsConf(new File(dataFolder, "config.yml"));
|
this.config = new EssentialsConf(new File(dataFolder, "config.yml"));
|
||||||
|
@ -49,15 +48,10 @@ public class EssentialsGeoIPPlayerListener implements Listener, IConf {
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR)
|
@EventHandler(priority = EventPriority.MONITOR)
|
||||||
public void onPlayerJoin(final PlayerJoinEvent event) {
|
public void onPlayerJoin(final PlayerJoinEvent event) {
|
||||||
ess.runTaskAsynchronously(new Runnable() {
|
ess.runTaskAsynchronously(() -> delayedJoin(event.getPlayer()));
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
delayedJoin(event.getPlayer());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void delayedJoin(Player player) {
|
private void delayedJoin(Player player) {
|
||||||
User u = ess.getUser(player);
|
User u = ess.getUser(player);
|
||||||
if (u.isAuthorized("essentials.geoip.hide") || player.getAddress() == null) {
|
if (u.isAuthorized("essentials.geoip.hide") || player.getAddress() == null) {
|
||||||
return;
|
return;
|
||||||
|
@ -114,8 +108,8 @@ public class EssentialsGeoIPPlayerListener implements Listener, IConf {
|
||||||
|
|
||||||
// detect and update the old config.yml. migrate from legacy GeoIP to GeoIP2.
|
// detect and update the old config.yml. migrate from legacy GeoIP to GeoIP2.
|
||||||
if (!config.isSet("enable-locale")) {
|
if (!config.isSet("enable-locale")) {
|
||||||
config.set("database.download-url", "http://geolite.maxmind.com/download/geoip/database/GeoLite2-Country.tar.gz");
|
config.set("database.download-url", "https://geolite.maxmind.com/download/geoip/database/GeoLite2-Country.tar.gz");
|
||||||
config.set("database.download-url-city", "http://geolite.maxmind.com/download/geoip/database/GeoLite2-City.tar.gz");
|
config.set("database.download-url-city", "https://geolite.maxmind.com/download/geoip/database/GeoLite2-City.tar.gz");
|
||||||
config.set("database.update.enable", true);
|
config.set("database.update.enable", true);
|
||||||
config.set("database.update.by-every-x-days", 30);
|
config.set("database.update.by-every-x-days", 30);
|
||||||
config.set("enable-locale", true);
|
config.set("enable-locale", true);
|
||||||
|
@ -187,7 +181,7 @@ public class EssentialsGeoIPPlayerListener implements Listener, IConf {
|
||||||
String filename;
|
String filename;
|
||||||
TarInputStream tarInputStream = new TarInputStream(input);
|
TarInputStream tarInputStream = new TarInputStream(input);
|
||||||
TarEntry entry;
|
TarEntry entry;
|
||||||
while ((entry = (TarEntry) tarInputStream.getNextEntry()) != null) {
|
while ((entry = tarInputStream.getNextEntry()) != null) {
|
||||||
if (!entry.isDirectory()) {
|
if (!entry.isDirectory()) {
|
||||||
filename = entry.getName();
|
filename = entry.getName();
|
||||||
if (filename.substring(filename.length() - 5).equalsIgnoreCase(".mmdb")) {
|
if (filename.substring(filename.length() - 5).equalsIgnoreCase(".mmdb")) {
|
||||||
|
@ -207,7 +201,6 @@ public class EssentialsGeoIPPlayerListener implements Listener, IConf {
|
||||||
input.close();
|
input.close();
|
||||||
} catch (MalformedURLException ex) {
|
} catch (MalformedURLException ex) {
|
||||||
logger.log(Level.SEVERE, tl("geoIpUrlInvalid"), ex);
|
logger.log(Level.SEVERE, tl("geoIpUrlInvalid"), ex);
|
||||||
return;
|
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
logger.log(Level.SEVERE, tl("connectionFailed"), ex);
|
logger.log(Level.SEVERE, tl("connectionFailed"), ex);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,9 +2,9 @@ database:
|
||||||
show-cities: false
|
show-cities: false
|
||||||
download-if-missing: true
|
download-if-missing: true
|
||||||
# Url for country
|
# Url for country
|
||||||
download-url: "http://geolite.maxmind.com/download/geoip/database/GeoLite2-Country.tar.gz"
|
download-url: "https://geolite.maxmind.com/download/geoip/database/GeoLite2-Country.tar.gz"
|
||||||
# Url for cities
|
# Url for cities
|
||||||
download-url-city: "http://geolite.maxmind.com/download/geoip/database/GeoLite2-City.tar.gz"
|
download-url-city: "https://geolite.maxmind.com/download/geoip/database/GeoLite2-City.tar.gz"
|
||||||
update:
|
update:
|
||||||
enable: true
|
enable: true
|
||||||
by-every-x-days: 30
|
by-every-x-days: 30
|
||||||
|
|
|
@ -7,3 +7,4 @@ website: http://tiny.cc/EssentialsCommands
|
||||||
description: Shows the country or city of a user on login and /whois.
|
description: Shows the country or city of a user on login and /whois.
|
||||||
authors: [Zenexer, ementalo, Aelux, Brettflan, KimKandor, snowleo, ceulemans, Xeology, kjiang]
|
authors: [Zenexer, ementalo, Aelux, Brettflan, KimKandor, snowleo, ceulemans, Xeology, kjiang]
|
||||||
depend: [Essentials]
|
depend: [Essentials]
|
||||||
|
api-version: 1.13
|
||||||
|
|
|
@ -11,13 +11,6 @@
|
||||||
|
|
||||||
<artifactId>EssentialsXProtect</artifactId>
|
<artifactId>EssentialsXProtect</artifactId>
|
||||||
|
|
||||||
<licenses>
|
|
||||||
<license>
|
|
||||||
<name>GPLv3</name>
|
|
||||||
<url>http://www.gnu.org/copyleft/gpl.html</url>
|
|
||||||
</license>
|
|
||||||
</licenses>
|
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
<finalName>EssentialsXProtect-${full.version}</finalName>
|
<finalName>EssentialsXProtect-${full.version}</finalName>
|
||||||
</build>
|
</build>
|
||||||
|
|
|
@ -14,7 +14,7 @@ import org.bukkit.event.server.PluginEnableEvent;
|
||||||
|
|
||||||
|
|
||||||
public class EmergencyListener implements Listener {
|
public class EmergencyListener implements Listener {
|
||||||
EssentialsProtect plugin;
|
private EssentialsProtect plugin;
|
||||||
|
|
||||||
EmergencyListener(final EssentialsProtect essProtPlugin) {
|
EmergencyListener(final EssentialsProtect essProtPlugin) {
|
||||||
plugin = essProtPlugin;
|
plugin = essProtPlugin;
|
||||||
|
|
|
@ -10,14 +10,14 @@ import java.util.logging.Logger;
|
||||||
import static com.earth2me.essentials.I18n.tl;
|
import static com.earth2me.essentials.I18n.tl;
|
||||||
|
|
||||||
|
|
||||||
public class EssentialsConnect {
|
class EssentialsConnect {
|
||||||
private static final Logger LOGGER = Logger.getLogger("Minecraft");
|
private static final Logger logger = Logger.getLogger("EssentialsProtect");
|
||||||
private final IEssentials ess;
|
private final IEssentials ess;
|
||||||
private final IProtect protect;
|
private final IProtect protect;
|
||||||
|
|
||||||
public EssentialsConnect(Plugin essPlugin, Plugin essProtect) {
|
EssentialsConnect(Plugin essPlugin, Plugin essProtect) {
|
||||||
if (!essProtect.getDescription().getVersion().equals(essPlugin.getDescription().getVersion())) {
|
if (!essProtect.getDescription().getVersion().equals(essPlugin.getDescription().getVersion())) {
|
||||||
LOGGER.log(Level.WARNING, tl("versionMismatchAll"));
|
logger.log(Level.WARNING, tl("versionMismatchAll"));
|
||||||
}
|
}
|
||||||
ess = (IEssentials) essPlugin;
|
ess = (IEssentials) essPlugin;
|
||||||
protect = (IProtect) essProtect;
|
protect = (IProtect) essProtect;
|
||||||
|
@ -26,7 +26,7 @@ public class EssentialsConnect {
|
||||||
ess.addReloadListener(pr);
|
ess.addReloadListener(pr);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEssentials getEssentials() {
|
IEssentials getEssentials() {
|
||||||
return ess;
|
return ess;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,11 +12,9 @@ import java.util.EnumMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
|
||||||
|
|
||||||
|
|
||||||
public class EssentialsProtect extends JavaPlugin implements IProtect {
|
public class EssentialsProtect extends JavaPlugin implements IProtect {
|
||||||
private static final Logger LOGGER = Logger.getLogger("Minecraft");
|
|
||||||
private final Map<ProtectConfig, Boolean> settingsBoolean = new EnumMap<>(ProtectConfig.class);
|
private final Map<ProtectConfig, Boolean> settingsBoolean = new EnumMap<>(ProtectConfig.class);
|
||||||
private final Map<ProtectConfig, String> settingsString = new EnumMap<>(ProtectConfig.class);
|
private final Map<ProtectConfig, String> settingsString = new EnumMap<>(ProtectConfig.class);
|
||||||
private final Map<ProtectConfig, List<Material>> settingsList = new EnumMap<>(ProtectConfig.class);
|
private final Map<ProtectConfig, List<Material>> settingsList = new EnumMap<>(ProtectConfig.class);
|
||||||
|
@ -42,7 +40,7 @@ public class EssentialsProtect extends JavaPlugin implements IProtect {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initialize(final PluginManager pm, final Plugin essPlugin) {
|
private void initialize(final PluginManager pm, final Plugin essPlugin) {
|
||||||
LOGGER.log(Level.INFO, "Continuing to enable Protect.");
|
getLogger().log(Level.INFO, "Continuing to enable Protect.");
|
||||||
ess = new EssentialsConnect(essPlugin, this);
|
ess = new EssentialsConnect(essPlugin, this);
|
||||||
|
|
||||||
final EssentialsProtectBlockListener blockListener = new EssentialsProtectBlockListener(this);
|
final EssentialsProtectBlockListener blockListener = new EssentialsProtectBlockListener(this);
|
||||||
|
@ -61,14 +59,14 @@ public class EssentialsProtect extends JavaPlugin implements IProtect {
|
||||||
for (Player player : getServer().getOnlinePlayers()) {
|
for (Player player : getServer().getOnlinePlayers()) {
|
||||||
player.sendMessage("Essentials Protect is in emergency mode. Check your log for errors.");
|
player.sendMessage("Essentials Protect is in emergency mode. Check your log for errors.");
|
||||||
}
|
}
|
||||||
LOGGER.log(Level.SEVERE, "Essentials not installed or failed to load. Essentials Protect is in emergency mode now.");
|
getLogger().log(Level.SEVERE, "Essentials not installed or failed to load. Essentials Protect is in emergency mode now.");
|
||||||
}
|
}
|
||||||
|
|
||||||
void disableEmergencyMode() {
|
void disableEmergencyMode() {
|
||||||
final PluginManager pm = this.getServer().getPluginManager();
|
final PluginManager pm = this.getServer().getPluginManager();
|
||||||
final Plugin essPlugin = pm.getPlugin("Essentials");
|
final Plugin essPlugin = pm.getPlugin("Essentials");
|
||||||
if (essPlugin == null || !essPlugin.isEnabled()) {
|
if (essPlugin == null || !essPlugin.isEnabled()) {
|
||||||
LOGGER.log(Level.SEVERE, "Tried to disable emergency mode, but Essentials still isn't enabled!");
|
getLogger().log(Level.SEVERE, "Tried to disable emergency mode, but Essentials still isn't enabled!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,7 +75,7 @@ public class EssentialsProtect extends JavaPlugin implements IProtect {
|
||||||
for (Player player : getServer().getOnlinePlayers()) {
|
for (Player player : getServer().getOnlinePlayers()) {
|
||||||
player.sendMessage("Essentials Protect is no longer in emergency mode.");
|
player.sendMessage("Essentials Protect is no longer in emergency mode.");
|
||||||
}
|
}
|
||||||
LOGGER.log(Level.SEVERE, "Essentials was loaded late! Essentials Protect is no longer in emergency mode.");
|
getLogger().log(Level.SEVERE, "Essentials was loaded late! Essentials Protect is no longer in emergency mode.");
|
||||||
|
|
||||||
initialize(pm, essPlugin);
|
initialize(pm, essPlugin);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package com.earth2me.essentials.protect;
|
package com.earth2me.essentials.protect;
|
||||||
|
|
||||||
import com.earth2me.essentials.utils.EnumUtil;
|
import com.earth2me.essentials.utils.EnumUtil;
|
||||||
import net.ess3.api.IEssentials;
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.BlockFace;
|
import org.bukkit.block.BlockFace;
|
||||||
|
@ -22,11 +22,9 @@ public class EssentialsProtectBlockListener implements Listener {
|
||||||
private static final Set<Material> LAVA_TYPES = EnumUtil.getAllMatching(Material.class, "LAVA", "STATIONARY_LAVA");
|
private static final Set<Material> LAVA_TYPES = EnumUtil.getAllMatching(Material.class, "LAVA", "STATIONARY_LAVA");
|
||||||
|
|
||||||
final private IProtect prot;
|
final private IProtect prot;
|
||||||
final private IEssentials ess;
|
|
||||||
|
|
||||||
public EssentialsProtectBlockListener(final IProtect parent) {
|
EssentialsProtectBlockListener(final IProtect parent) {
|
||||||
this.prot = parent;
|
this.prot = parent;
|
||||||
this.ess = prot.getEssentialsConnect().getEssentials();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||||
|
|
|
@ -20,7 +20,7 @@ public class EssentialsProtectEntityListener implements Listener {
|
||||||
private final IProtect prot;
|
private final IProtect prot;
|
||||||
private final IEssentials ess;
|
private final IEssentials ess;
|
||||||
|
|
||||||
public EssentialsProtectEntityListener(final IProtect prot) {
|
EssentialsProtectEntityListener(final IProtect prot) {
|
||||||
this.prot = prot;
|
this.prot = prot;
|
||||||
this.ess = prot.getEssentialsConnect().getEssentials();
|
this.ess = prot.getEssentialsConnect().getEssentials();
|
||||||
}
|
}
|
||||||
|
@ -159,7 +159,7 @@ public class EssentialsProtectEntityListener implements Listener {
|
||||||
} else if (entity instanceof TNTPrimed && prot.getSettingBool(ProtectConfig.prevent_tnt_explosion)) {
|
} else if (entity instanceof TNTPrimed && prot.getSettingBool(ProtectConfig.prevent_tnt_explosion)) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
|
||||||
} else if ((entity instanceof Fireball || entity instanceof SmallFireball) && prot.getSettingBool(ProtectConfig.prevent_fireball_explosion)) {
|
} else if (entity instanceof Fireball && prot.getSettingBool(ProtectConfig.prevent_fireball_explosion)) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
|
||||||
} else if ((entity instanceof WitherSkull) && prot.getSettingBool(ProtectConfig.prevent_witherskull_explosion)) {
|
} else if ((entity instanceof WitherSkull) && prot.getSettingBool(ProtectConfig.prevent_witherskull_explosion)) {
|
||||||
|
@ -180,7 +180,7 @@ public class EssentialsProtectEntityListener implements Listener {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final String creatureName = creature.toString().toLowerCase(Locale.ENGLISH);
|
final String creatureName = creature.toString().toLowerCase(Locale.ENGLISH);
|
||||||
if (creatureName == null || creatureName.isEmpty()) {
|
if (creatureName.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (ess.getSettings().getProtectPreventSpawn(creatureName)) {
|
if (ess.getSettings().getProtectPreventSpawn(creatureName)) {
|
||||||
|
@ -194,7 +194,7 @@ public class EssentialsProtectEntityListener implements Listener {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final User user = ess.getUser((Player) event.getTarget());
|
final User user = ess.getUser((Player) event.getTarget());
|
||||||
if ((event.getReason() == TargetReason.CLOSEST_PLAYER || event.getReason() == TargetReason.TARGET_ATTACKED_ENTITY || event.getReason() == TargetReason.PIG_ZOMBIE_TARGET || event.getReason() == TargetReason.RANDOM_TARGET || event.getReason() == TargetReason.DEFEND_VILLAGE || event.getReason() == TargetReason.TARGET_ATTACKED_OWNER || event.getReason() == TargetReason.OWNER_ATTACKED_TARGET) && prot.getSettingBool(ProtectConfig.prevent_entitytarget) && !user.isAuthorized("essentials.protect.entitytarget.bypass")) {
|
if ((event.getReason() == TargetReason.CLOSEST_PLAYER || event.getReason() == TargetReason.TARGET_ATTACKED_ENTITY || event.getReason() == TargetReason.TARGET_ATTACKED_NEARBY_ENTITY || event.getReason() == TargetReason.RANDOM_TARGET || event.getReason() == TargetReason.DEFEND_VILLAGE || event.getReason() == TargetReason.TARGET_ATTACKED_OWNER || event.getReason() == TargetReason.OWNER_ATTACKED_TARGET) && prot.getSettingBool(ProtectConfig.prevent_entitytarget) && !user.isAuthorized("essentials.protect.entitytarget.bypass")) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@ import org.bukkit.event.weather.WeatherChangeEvent;
|
||||||
public class EssentialsProtectWeatherListener implements Listener {
|
public class EssentialsProtectWeatherListener implements Listener {
|
||||||
private final IProtect prot;
|
private final IProtect prot;
|
||||||
|
|
||||||
public EssentialsProtectWeatherListener(final IProtect prot) {
|
EssentialsProtectWeatherListener(final IProtect prot) {
|
||||||
this.prot = prot;
|
this.prot = prot;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -49,19 +49,11 @@ public enum ProtectConfig {
|
||||||
private final boolean isList;
|
private final boolean isList;
|
||||||
private final boolean isString;
|
private final boolean isString;
|
||||||
|
|
||||||
private ProtectConfig(final String configName) {
|
ProtectConfig(final String configName, final boolean defValueBoolean) {
|
||||||
this(configName, null, false, true, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
private ProtectConfig(final String configName, final String defValueString) {
|
|
||||||
this(configName, defValueString, false, false, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
private ProtectConfig(final String configName, final boolean defValueBoolean) {
|
|
||||||
this(configName, null, defValueBoolean, false, false);
|
this(configName, null, defValueBoolean, false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private ProtectConfig(final String configName, final String defValueString, final boolean defValueBoolean, final boolean isList, final boolean isString) {
|
ProtectConfig(final String configName, final String defValueString, final boolean defValueBoolean, final boolean isList, final boolean isString) {
|
||||||
this.configName = configName;
|
this.configName = configName;
|
||||||
this.defValueString = defValueString;
|
this.defValueString = defValueString;
|
||||||
this.defValueBoolean = defValueBoolean;
|
this.defValueBoolean = defValueBoolean;
|
||||||
|
|
|
@ -6,5 +6,5 @@ version: ${full.version}
|
||||||
website: http://tiny.cc/EssentialsCommands
|
website: http://tiny.cc/EssentialsCommands
|
||||||
description: Provides protection for various parts of the world.
|
description: Provides protection for various parts of the world.
|
||||||
authors: [Zenexer, ementalo, Aelux, Brettflan, KimKandor, snowleo, ceulemans, Xeology, KHobbits]
|
authors: [Zenexer, ementalo, Aelux, Brettflan, KimKandor, snowleo, ceulemans, Xeology, KHobbits]
|
||||||
api-version: 1.13
|
|
||||||
softdepend: [Essentials]
|
softdepend: [Essentials]
|
||||||
|
api-version: 1.13
|
||||||
|
|
|
@ -11,13 +11,6 @@
|
||||||
|
|
||||||
<artifactId>EssentialsXSpawn</artifactId>
|
<artifactId>EssentialsXSpawn</artifactId>
|
||||||
|
|
||||||
<licenses>
|
|
||||||
<license>
|
|
||||||
<name>GPLv3</name>
|
|
||||||
<url>http://www.gnu.org/copyleft/gpl.html</url>
|
|
||||||
</license>
|
|
||||||
</licenses>
|
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
<finalName>EssentialsXSpawn-${full.version}</finalName>
|
<finalName>EssentialsXSpawn-${full.version}</finalName>
|
||||||
</build>
|
</build>
|
||||||
|
|
|
@ -13,7 +13,7 @@ public class Commandsetspawn extends EssentialsCommand {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception {
|
public void run(final Server server, final User user, final String commandLabel, final String[] args) {
|
||||||
final String group = args.length > 0 ? getFinalArg(args, 0) : "default";
|
final String group = args.length > 0 ? getFinalArg(args, 0) : "default";
|
||||||
((SpawnStorage) module).setSpawn(user.getLocation(), group);
|
((SpawnStorage) module).setSpawn(user.getLocation(), group);
|
||||||
user.sendMessage(tl("spawnSet", group));
|
user.sendMessage(tl("spawnSet", group));
|
||||||
|
|
|
@ -2,28 +2,21 @@ package com.earth2me.essentials.spawn;
|
||||||
|
|
||||||
import com.earth2me.essentials.metrics.Metrics;
|
import com.earth2me.essentials.metrics.Metrics;
|
||||||
import net.ess3.api.IEssentials;
|
import net.ess3.api.IEssentials;
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.event.Event;
|
|
||||||
import org.bukkit.event.EventException;
|
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
import org.bukkit.event.Listener;
|
|
||||||
import org.bukkit.event.player.PlayerJoinEvent;
|
import org.bukkit.event.player.PlayerJoinEvent;
|
||||||
import org.bukkit.event.player.PlayerRespawnEvent;
|
import org.bukkit.event.player.PlayerRespawnEvent;
|
||||||
import org.bukkit.plugin.EventExecutor;
|
|
||||||
import org.bukkit.plugin.PluginManager;
|
import org.bukkit.plugin.PluginManager;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
|
||||||
|
|
||||||
import static com.earth2me.essentials.I18n.tl;
|
import static com.earth2me.essentials.I18n.tl;
|
||||||
|
|
||||||
|
|
||||||
public class EssentialsSpawn extends JavaPlugin implements IEssentialsSpawn {
|
public class EssentialsSpawn extends JavaPlugin implements IEssentialsSpawn {
|
||||||
private static final Logger LOGGER = Bukkit.getLogger();
|
|
||||||
private transient IEssentials ess;
|
private transient IEssentials ess;
|
||||||
private transient SpawnStorage spawns;
|
private transient SpawnStorage spawns;
|
||||||
private transient Metrics metrics = null;
|
private transient Metrics metrics = null;
|
||||||
|
@ -33,7 +26,7 @@ public class EssentialsSpawn extends JavaPlugin implements IEssentialsSpawn {
|
||||||
final PluginManager pluginManager = getServer().getPluginManager();
|
final PluginManager pluginManager = getServer().getPluginManager();
|
||||||
ess = (IEssentials) pluginManager.getPlugin("Essentials");
|
ess = (IEssentials) pluginManager.getPlugin("Essentials");
|
||||||
if (!this.getDescription().getVersion().equals(ess.getDescription().getVersion())) {
|
if (!this.getDescription().getVersion().equals(ess.getDescription().getVersion())) {
|
||||||
LOGGER.log(Level.WARNING, tl("versionMismatchAll"));
|
getLogger().log(Level.WARNING, tl("versionMismatchAll"));
|
||||||
}
|
}
|
||||||
if (!ess.isEnabled()) {
|
if (!ess.isEnabled()) {
|
||||||
this.setEnabled(false);
|
this.setEnabled(false);
|
||||||
|
@ -47,22 +40,14 @@ public class EssentialsSpawn extends JavaPlugin implements IEssentialsSpawn {
|
||||||
|
|
||||||
EventPriority respawnPriority = ess.getSettings().getRespawnPriority();
|
EventPriority respawnPriority = ess.getSettings().getRespawnPriority();
|
||||||
if (respawnPriority != null) {
|
if (respawnPriority != null) {
|
||||||
pluginManager.registerEvent(PlayerRespawnEvent.class, playerListener, respawnPriority, new EventExecutor() {
|
pluginManager.registerEvent(PlayerRespawnEvent.class, playerListener, respawnPriority, (ll, event) ->
|
||||||
@Override
|
((EssentialsSpawnPlayerListener) ll).onPlayerRespawn((PlayerRespawnEvent) event), this);
|
||||||
public void execute(final Listener ll, final Event event) throws EventException {
|
|
||||||
((EssentialsSpawnPlayerListener) ll).onPlayerRespawn((PlayerRespawnEvent) event);
|
|
||||||
}
|
|
||||||
}, this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
EventPriority joinPriority = ess.getSettings().getSpawnJoinPriority();
|
EventPriority joinPriority = ess.getSettings().getSpawnJoinPriority();
|
||||||
if (joinPriority != null) {
|
if (joinPriority != null) {
|
||||||
pluginManager.registerEvent(PlayerJoinEvent.class, playerListener, joinPriority, new EventExecutor() {
|
pluginManager.registerEvent(PlayerJoinEvent.class, playerListener, joinPriority, (ll, event) ->
|
||||||
@Override
|
((EssentialsSpawnPlayerListener) ll).onPlayerJoin((PlayerJoinEvent) event), this);
|
||||||
public void execute(final Listener ll, final Event event) throws EventException {
|
|
||||||
((EssentialsSpawnPlayerListener) ll).onPlayerJoin((PlayerJoinEvent) event);
|
|
||||||
}
|
|
||||||
}, this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (metrics == null) {
|
if (metrics == null) {
|
||||||
|
|
|
@ -7,7 +7,6 @@ import com.earth2me.essentials.textreader.IText;
|
||||||
import com.earth2me.essentials.textreader.KeywordReplacer;
|
import com.earth2me.essentials.textreader.KeywordReplacer;
|
||||||
import com.earth2me.essentials.textreader.SimpleTextPager;
|
import com.earth2me.essentials.textreader.SimpleTextPager;
|
||||||
import net.ess3.api.IEssentials;
|
import net.ess3.api.IEssentials;
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
|
@ -23,18 +22,18 @@ import java.util.logging.Logger;
|
||||||
import static com.earth2me.essentials.I18n.tl;
|
import static com.earth2me.essentials.I18n.tl;
|
||||||
|
|
||||||
|
|
||||||
public class EssentialsSpawnPlayerListener implements Listener {
|
class EssentialsSpawnPlayerListener implements Listener {
|
||||||
private static final Logger LOGGER = Bukkit.getLogger();
|
private static final Logger logger = Logger.getLogger("EssentialsSpawn");
|
||||||
private final transient IEssentials ess;
|
private final transient IEssentials ess;
|
||||||
private final transient SpawnStorage spawns;
|
private final transient SpawnStorage spawns;
|
||||||
|
|
||||||
public EssentialsSpawnPlayerListener(final IEssentials ess, final SpawnStorage spawns) {
|
EssentialsSpawnPlayerListener(final IEssentials ess, final SpawnStorage spawns) {
|
||||||
super();
|
super();
|
||||||
this.ess = ess;
|
this.ess = ess;
|
||||||
this.spawns = spawns;
|
this.spawns = spawns;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onPlayerRespawn(final PlayerRespawnEvent event) {
|
void onPlayerRespawn(final PlayerRespawnEvent event) {
|
||||||
final User user = ess.getUser(event.getPlayer());
|
final User user = ess.getUser(event.getPlayer());
|
||||||
|
|
||||||
if (user.isJailed() && user.getJail() != null && !user.getJail().isEmpty()) {
|
if (user.isJailed() && user.getJail() != null && !user.getJail().isEmpty()) {
|
||||||
|
@ -60,33 +59,25 @@ public class EssentialsSpawnPlayerListener implements Listener {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onPlayerJoin(final PlayerJoinEvent event) {
|
void onPlayerJoin(final PlayerJoinEvent event) {
|
||||||
ess.runTaskAsynchronously(new Runnable() {
|
ess.runTaskAsynchronously(() -> delayedJoin(event.getPlayer()));
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
delayedJoin(event.getPlayer());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void delayedJoin(final Player player) {
|
private void delayedJoin(final Player player) {
|
||||||
if (player.hasPlayedBefore()) {
|
if (player.hasPlayedBefore()) {
|
||||||
LOGGER.log(Level.FINE, "Old player join");
|
logger.log(Level.FINE, "Old player join");
|
||||||
List<String> spawnOnJoinGroups = ess.getSettings().getSpawnOnJoinGroups();
|
List<String> spawnOnJoinGroups = ess.getSettings().getSpawnOnJoinGroups();
|
||||||
if (!spawnOnJoinGroups.isEmpty()) {
|
if (!spawnOnJoinGroups.isEmpty()) {
|
||||||
final User user = ess.getUser(player);
|
final User user = ess.getUser(player);
|
||||||
|
|
||||||
if (ess.getSettings().isUserInSpawnOnJoinGroup(user) && !user.isAuthorized("essentials.spawn-on-join.exempt")) {
|
if (ess.getSettings().isUserInSpawnOnJoinGroup(user) && !user.isAuthorized("essentials.spawn-on-join.exempt")) {
|
||||||
ess.scheduleSyncDelayedTask(new Runnable() {
|
ess.scheduleSyncDelayedTask(() -> {
|
||||||
@Override
|
Location spawn = spawns.getSpawn(user.getGroup());
|
||||||
public void run() {
|
try {
|
||||||
Location spawn = spawns.getSpawn(user.getGroup());
|
// We don't use user.getTeleport() because it stores last location, which is unwanted in this case.
|
||||||
try {
|
user.getBase().teleport(spawn, TeleportCause.PLUGIN);
|
||||||
// We don't use user.getTeleport() because it stores last location, which is unwanted in this case.
|
} catch (Exception e) {
|
||||||
user.getBase().teleport(spawn, TeleportCause.PLUGIN);
|
ess.showError(user.getSource(), e, "spawn-on-join");
|
||||||
} catch (Exception e) {
|
|
||||||
ess.showError(user.getSource(), e, "spawn-on-join");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -101,35 +92,32 @@ public class EssentialsSpawnPlayerListener implements Listener {
|
||||||
ess.scheduleSyncDelayedTask(new NewPlayerTeleport(user), 1L);
|
ess.scheduleSyncDelayedTask(new NewPlayerTeleport(user), 1L);
|
||||||
}
|
}
|
||||||
|
|
||||||
ess.scheduleSyncDelayedTask(new Runnable() {
|
ess.scheduleSyncDelayedTask(() -> {
|
||||||
@Override
|
if (!user.getBase().isOnline()) {
|
||||||
public void run() {
|
return;
|
||||||
if (!user.getBase().isOnline()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//This method allows for multiple line player announce messages using multiline yaml syntax #EasterEgg
|
|
||||||
if (ess.getSettings().getAnnounceNewPlayers()) {
|
|
||||||
final IText output = new KeywordReplacer(ess.getSettings().getAnnounceNewPlayerFormat(), user.getSource(), ess);
|
|
||||||
final SimpleTextPager pager = new SimpleTextPager(output);
|
|
||||||
|
|
||||||
for (String line : pager.getLines()) {
|
|
||||||
ess.broadcastMessage(user, line);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
final String kitName = ess.getSettings().getNewPlayerKit();
|
|
||||||
if (!kitName.isEmpty()) {
|
|
||||||
try {
|
|
||||||
final Kit kit = new Kit(kitName.toLowerCase(Locale.ENGLISH), ess);
|
|
||||||
kit.expandItems(user);
|
|
||||||
} catch (Exception ex) {
|
|
||||||
LOGGER.log(Level.WARNING, ex.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
LOGGER.log(Level.FINE, "New player join");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//This method allows for multiple line player announce messages using multiline yaml syntax #EasterEgg
|
||||||
|
if (ess.getSettings().getAnnounceNewPlayers()) {
|
||||||
|
final IText output = new KeywordReplacer(ess.getSettings().getAnnounceNewPlayerFormat(), user.getSource(), ess);
|
||||||
|
final SimpleTextPager pager = new SimpleTextPager(output);
|
||||||
|
|
||||||
|
for (String line : pager.getLines()) {
|
||||||
|
ess.broadcastMessage(user, line);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
final String kitName = ess.getSettings().getNewPlayerKit();
|
||||||
|
if (!kitName.isEmpty()) {
|
||||||
|
try {
|
||||||
|
final Kit kit = new Kit(kitName.toLowerCase(Locale.ENGLISH), ess);
|
||||||
|
kit.expandItems(user);
|
||||||
|
} catch (Exception ex) {
|
||||||
|
logger.log(Level.WARNING, ex.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
logger.log(Level.FINE, "New player join");
|
||||||
}, 2L);
|
}, 2L);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -137,7 +125,7 @@ public class EssentialsSpawnPlayerListener implements Listener {
|
||||||
private class NewPlayerTeleport implements Runnable {
|
private class NewPlayerTeleport implements Runnable {
|
||||||
private final transient User user;
|
private final transient User user;
|
||||||
|
|
||||||
public NewPlayerTeleport(final User user) {
|
NewPlayerTeleport(final User user) {
|
||||||
this.user = user;
|
this.user = user;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -153,7 +141,7 @@ public class EssentialsSpawnPlayerListener implements Listener {
|
||||||
user.getTeleport().now(spawn, false, TeleportCause.PLUGIN);
|
user.getTeleport().now(spawn, false, TeleportCause.PLUGIN);
|
||||||
}
|
}
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
Bukkit.getLogger().log(Level.WARNING, tl("teleportNewPlayerError"), ex);
|
logger.log(Level.WARNING, tl("teleportNewPlayerError"), ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@ public interface IEssentialsSpawn extends Plugin {
|
||||||
*
|
*
|
||||||
* @throws IllegalArgumentException If group is null
|
* @throws IllegalArgumentException If group is null
|
||||||
*/
|
*/
|
||||||
public void setSpawn(Location loc, String group);
|
void setSpawn(Location loc, String group);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the spawn location for a given group.
|
* Gets the spawn location for a given group.
|
||||||
|
@ -25,5 +25,5 @@ public interface IEssentialsSpawn extends Plugin {
|
||||||
*
|
*
|
||||||
* @throws IllegalArgumentException If group is null
|
* @throws IllegalArgumentException If group is null
|
||||||
*/
|
*/
|
||||||
public Location getSpawn(String group);
|
Location getSpawn(String group);
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@ import java.util.Map;
|
||||||
|
|
||||||
|
|
||||||
public class SpawnStorage extends AsyncStorageObjectHolder<Spawns> implements IEssentialsModule {
|
public class SpawnStorage extends AsyncStorageObjectHolder<Spawns> implements IEssentialsModule {
|
||||||
public SpawnStorage(final IEssentials ess) {
|
SpawnStorage(final IEssentials ess) {
|
||||||
super(ess, Spawns.class);
|
super(ess, Spawns.class);
|
||||||
reloadConfig();
|
reloadConfig();
|
||||||
}
|
}
|
||||||
|
@ -25,18 +25,16 @@ public class SpawnStorage extends AsyncStorageObjectHolder<Spawns> implements IE
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void finishRead() {
|
public void finishRead() { }
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void finishWrite() {
|
public void finishWrite() { }
|
||||||
}
|
|
||||||
|
|
||||||
public void setSpawn(final Location loc, final String group) {
|
void setSpawn(final Location loc, final String group) {
|
||||||
acquireWriteLock();
|
acquireWriteLock();
|
||||||
try {
|
try {
|
||||||
if (getData().getSpawns() == null) {
|
if (getData().getSpawns() == null) {
|
||||||
getData().setSpawns(new HashMap<String, Location>());
|
getData().setSpawns(new HashMap<>());
|
||||||
}
|
}
|
||||||
getData().getSpawns().put(group.toLowerCase(Locale.ENGLISH), loc);
|
getData().getSpawns().put(group.toLowerCase(Locale.ENGLISH), loc);
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -48,7 +46,7 @@ public class SpawnStorage extends AsyncStorageObjectHolder<Spawns> implements IE
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Location getSpawn(final String group) {
|
Location getSpawn(final String group) {
|
||||||
acquireReadLock();
|
acquireReadLock();
|
||||||
try {
|
try {
|
||||||
if (getData().getSpawns() == null || group == null) {
|
if (getData().getSpawns() == null || group == null) {
|
||||||
|
|
|
@ -7,13 +7,14 @@ website: http://tiny.cc/EssentialsCommands
|
||||||
description: Provides spawn control commands, utilizing Essentials.
|
description: Provides spawn control commands, utilizing Essentials.
|
||||||
authors: [Zenexer, ementalo, Aelux, Brettflan, KimKandor, snowleo, ceulemans, Xeology, KHobbits]
|
authors: [Zenexer, ementalo, Aelux, Brettflan, KimKandor, snowleo, ceulemans, Xeology, KHobbits]
|
||||||
depend: [Essentials]
|
depend: [Essentials]
|
||||||
|
api-version: 1.13
|
||||||
commands:
|
commands:
|
||||||
setspawn:
|
setspawn:
|
||||||
description: Set the spawnpoint to your current position.
|
description: Sets the spawn point to your current position.
|
||||||
usage: /<command> <group>
|
usage: /<command> <group>
|
||||||
aliases: [esetspawn]
|
aliases: [esetspawn]
|
||||||
spawn:
|
spawn:
|
||||||
description: Teleport to the spawnpoint.
|
description: Teleports to the spawn point.
|
||||||
usage: /<command> [player]
|
usage: /<command> [player]
|
||||||
aliases: [espawn]
|
aliases: [espawn]
|
||||||
permissions:
|
permissions:
|
||||||
|
|
|
@ -11,12 +11,27 @@
|
||||||
|
|
||||||
<artifactId>EssentialsXXMPP</artifactId>
|
<artifactId>EssentialsXXMPP</artifactId>
|
||||||
|
|
||||||
<licenses>
|
<build>
|
||||||
<license>
|
<finalName>EssentialsXXMPP-${full.version}</finalName>
|
||||||
<name>GPLv3</name>
|
<plugins>
|
||||||
<url>http://www.gnu.org/copyleft/gpl.html</url>
|
<plugin>
|
||||||
</license>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
</licenses>
|
<artifactId>maven-shade-plugin</artifactId>
|
||||||
|
<version>3.2.1</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<phase>package</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>shade</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
<configuration>
|
||||||
|
<createDependencyReducedPom>false</createDependencyReducedPom>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -32,26 +47,4 @@
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<build>
|
|
||||||
<finalName>EssentialsXXMPP-${full.version}</finalName>
|
|
||||||
<plugins>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-shade-plugin</artifactId>
|
|
||||||
<version>3.1.0</version>
|
|
||||||
<executions>
|
|
||||||
<execution>
|
|
||||||
<phase>package</phase>
|
|
||||||
<goals>
|
|
||||||
<goal>shade</goal>
|
|
||||||
</goals>
|
|
||||||
</execution>
|
|
||||||
</executions>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
|
||||||
</build>
|
|
||||||
|
|
||||||
</project>
|
</project>
|
|
@ -12,20 +12,18 @@ import org.bukkit.plugin.java.JavaPlugin;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
|
||||||
|
|
||||||
import static com.earth2me.essentials.I18n.tl;
|
import static com.earth2me.essentials.I18n.tl;
|
||||||
|
|
||||||
|
|
||||||
public class EssentialsXMPP extends JavaPlugin implements IEssentialsXMPP {
|
public class EssentialsXMPP extends JavaPlugin implements IEssentialsXMPP {
|
||||||
private static final Logger LOGGER = Logger.getLogger("Minecraft");
|
|
||||||
private static EssentialsXMPP instance = null;
|
private static EssentialsXMPP instance = null;
|
||||||
private transient UserManager users;
|
private transient UserManager users;
|
||||||
private transient XMPPManager xmpp;
|
private transient XMPPManager xmpp;
|
||||||
private transient IEssentials ess;
|
private transient IEssentials ess;
|
||||||
private transient Metrics metrics = null;
|
private transient Metrics metrics = null;
|
||||||
|
|
||||||
public static IEssentialsXMPP getInstance() {
|
static IEssentialsXMPP getInstance() {
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,7 +34,7 @@ public class EssentialsXMPP extends JavaPlugin implements IEssentialsXMPP {
|
||||||
final PluginManager pluginManager = getServer().getPluginManager();
|
final PluginManager pluginManager = getServer().getPluginManager();
|
||||||
ess = (IEssentials) pluginManager.getPlugin("Essentials");
|
ess = (IEssentials) pluginManager.getPlugin("Essentials");
|
||||||
if (!this.getDescription().getVersion().equals(ess.getDescription().getVersion())) {
|
if (!this.getDescription().getVersion().equals(ess.getDescription().getVersion())) {
|
||||||
LOGGER.log(Level.WARNING, tl("versionMismatchAll"));
|
getLogger().log(Level.WARNING, tl("versionMismatchAll"));
|
||||||
}
|
}
|
||||||
if (!ess.isEnabled()) {
|
if (!ess.isEnabled()) {
|
||||||
this.setEnabled(false);
|
this.setEnabled(false);
|
||||||
|
@ -111,10 +109,8 @@ public class EssentialsXMPP extends JavaPlugin implements IEssentialsXMPP {
|
||||||
return instance.xmpp.sendMessage(address, message);
|
return instance.xmpp.sendMessage(address, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Override
|
static void updatePresence() {
|
||||||
public static boolean updatePresence() {
|
|
||||||
instance.xmpp.updatePresence();
|
instance.xmpp.updatePresence();
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -131,9 +127,7 @@ public class EssentialsXMPP extends JavaPlugin implements IEssentialsXMPP {
|
||||||
sendMessage(address, message);
|
sendMessage(address, message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception ex) {
|
} catch (Exception ignored) {}
|
||||||
// Ignore exceptions
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -25,12 +25,7 @@ class EssentialsXMPPPlayerListener implements Listener {
|
||||||
public void onPlayerJoin(final PlayerJoinEvent event) {
|
public void onPlayerJoin(final PlayerJoinEvent event) {
|
||||||
final User user = ess.getUser(event.getPlayer());
|
final User user = ess.getUser(event.getPlayer());
|
||||||
|
|
||||||
Bukkit.getScheduler().scheduleSyncDelayedTask(ess, new Runnable() {
|
Bukkit.getScheduler().scheduleSyncDelayedTask(ess, EssentialsXMPP::updatePresence);
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
EssentialsXMPP.updatePresence();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
sendMessageToSpyUsers("Player " + user.getDisplayName() + " joined the game");
|
sendMessageToSpyUsers("Player " + user.getDisplayName() + " joined the game");
|
||||||
}
|
}
|
||||||
|
@ -45,12 +40,7 @@ class EssentialsXMPPPlayerListener implements Listener {
|
||||||
public void onPlayerQuit(final PlayerQuitEvent event) {
|
public void onPlayerQuit(final PlayerQuitEvent event) {
|
||||||
final User user = ess.getUser(event.getPlayer());
|
final User user = ess.getUser(event.getPlayer());
|
||||||
|
|
||||||
Bukkit.getScheduler().scheduleSyncDelayedTask(ess, new Runnable() {
|
Bukkit.getScheduler().scheduleSyncDelayedTask(ess, EssentialsXMPP::updatePresence);
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
EssentialsXMPP.updatePresence();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
sendMessageToSpyUsers("Player " + user.getDisplayName() + " left the game");
|
sendMessageToSpyUsers("Player " + user.getDisplayName() + " left the game");
|
||||||
|
@ -61,17 +51,9 @@ class EssentialsXMPPPlayerListener implements Listener {
|
||||||
List<String> users = EssentialsXMPP.getInstance().getSpyUsers();
|
List<String> users = EssentialsXMPP.getInstance().getSpyUsers();
|
||||||
synchronized (users) {
|
synchronized (users) {
|
||||||
for (final String address : users) {
|
for (final String address : users) {
|
||||||
Bukkit.getScheduler().scheduleSyncDelayedTask(ess, new Runnable() {
|
Bukkit.getScheduler().scheduleSyncDelayedTask(ess, () -> EssentialsXMPP.getInstance().sendMessage(address, message));
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
EssentialsXMPP.getInstance().sendMessage(address, message);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception ex) {
|
} catch (Exception ignored) {}
|
||||||
// Ignore exceptions
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,48 +9,48 @@ import java.util.*;
|
||||||
|
|
||||||
public class UserManager implements IConf {
|
public class UserManager implements IConf {
|
||||||
private final transient EssentialsConf users;
|
private final transient EssentialsConf users;
|
||||||
private final transient List<String> spyusers = Collections.synchronizedList(new ArrayList<String>());
|
private final transient List<String> spyusers = Collections.synchronizedList(new ArrayList<>());
|
||||||
private static final String ADDRESS = "address";
|
private static final String ADDRESS = "address";
|
||||||
private static final String SPY = "spy";
|
private static final String SPY = "spy";
|
||||||
|
|
||||||
public UserManager(final File folder) {
|
UserManager(final File folder) {
|
||||||
users = new EssentialsConf(new File(folder, "users.yml"));
|
users = new EssentialsConf(new File(folder, "users.yml"));
|
||||||
reloadConfig();
|
reloadConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
public final boolean isSpy(final String username) {
|
final boolean isSpy(final String username) {
|
||||||
return users.getBoolean(username.toLowerCase(Locale.ENGLISH) + "." + SPY, false);
|
return users.getBoolean(username.toLowerCase(Locale.ENGLISH) + "." + SPY, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSpy(final String username, final boolean spy) {
|
void setSpy(final String username, final boolean spy) {
|
||||||
setUser(username.toLowerCase(Locale.ENGLISH), getAddress(username), spy);
|
setUser(username.toLowerCase(Locale.ENGLISH), getAddress(username), spy);
|
||||||
}
|
}
|
||||||
|
|
||||||
public final String getAddress(final String username) {
|
final String getAddress(final String username) {
|
||||||
return users.getString(username.toLowerCase(Locale.ENGLISH) + "." + ADDRESS, null);
|
return users.getString(username.toLowerCase(Locale.ENGLISH) + "." + ADDRESS, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public final String getUserByAddress(final String search) {
|
final String getUserByAddress(final String search) {
|
||||||
final Set<String> usernames = users.getKeys(false);
|
final Set<String> usernames = users.getKeys(false);
|
||||||
for (String username : usernames) {
|
for (String username : usernames) {
|
||||||
final String address = users.getString(username + "." + ADDRESS, null);
|
final String address = users.getString(username + "." + ADDRESS, null);
|
||||||
if (address != null && search.equalsIgnoreCase(address)) {
|
if (search.equalsIgnoreCase(address)) {
|
||||||
return username;
|
return username;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAddress(final String username, final String address) {
|
void setAddress(final String username, final String address) {
|
||||||
setUser(username.toLowerCase(Locale.ENGLISH), address, isSpy(username));
|
setUser(username.toLowerCase(Locale.ENGLISH), address, isSpy(username));
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<String> getSpyUsers() {
|
List<String> getSpyUsers() {
|
||||||
return spyusers;
|
return spyusers;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setUser(final String username, final String address, final boolean spy) {
|
private void setUser(final String username, final String address, final boolean spy) {
|
||||||
final Map<String, Object> userdata = new HashMap<String, Object>();
|
final Map<String, Object> userdata = new HashMap<>();
|
||||||
userdata.put(ADDRESS, address);
|
userdata.put(ADDRESS, address);
|
||||||
userdata.put(SPY, spy);
|
userdata.put(SPY, spy);
|
||||||
users.setProperty(username, userdata);
|
users.setProperty(username, userdata);
|
||||||
|
|
|
@ -18,13 +18,13 @@ import java.util.logging.*;
|
||||||
|
|
||||||
|
|
||||||
public class XMPPManager extends Handler implements MessageListener, ChatManagerListener, IConf {
|
public class XMPPManager extends Handler implements MessageListener, ChatManagerListener, IConf {
|
||||||
private static final Logger LOGGER = Logger.getLogger("Minecraft");
|
private static final Logger logger = Logger.getLogger("EssentialsXMPP");
|
||||||
private static final SimpleFormatter formatter = new SimpleFormatter();
|
private static final SimpleFormatter formatter = new SimpleFormatter();
|
||||||
private final transient EssentialsConf config;
|
private final transient EssentialsConf config;
|
||||||
private transient XMPPConnection connection;
|
private transient XMPPConnection connection;
|
||||||
private transient ChatManager chatManager;
|
private transient ChatManager chatManager;
|
||||||
private final transient Map<String, Chat> chats = Collections.synchronizedMap(new HashMap<String, Chat>());
|
private final transient Map<String, Chat> chats = Collections.synchronizedMap(new HashMap<>());
|
||||||
private final transient Set<LogRecord> logrecords = Collections.synchronizedSet(new HashSet<LogRecord>());
|
private final transient Set<LogRecord> logrecords = Collections.synchronizedSet(new HashSet<>());
|
||||||
private final transient IEssentialsXMPP parent;
|
private final transient IEssentialsXMPP parent;
|
||||||
private transient List<String> logUsers;
|
private transient List<String> logUsers;
|
||||||
private transient Level logLevel;
|
private transient Level logLevel;
|
||||||
|
@ -32,7 +32,7 @@ public class XMPPManager extends Handler implements MessageListener, ChatManager
|
||||||
private transient Thread loggerThread;
|
private transient Thread loggerThread;
|
||||||
private transient boolean threadrunning = true;
|
private transient boolean threadrunning = true;
|
||||||
|
|
||||||
public XMPPManager(final IEssentialsXMPP parent) {
|
XMPPManager(final IEssentialsXMPP parent) {
|
||||||
super();
|
super();
|
||||||
this.parent = parent;
|
this.parent = parent;
|
||||||
config = new EssentialsConf(new File(parent.getDataFolder(), "config.yml"));
|
config = new EssentialsConf(new File(parent.getDataFolder(), "config.yml"));
|
||||||
|
@ -40,7 +40,7 @@ public class XMPPManager extends Handler implements MessageListener, ChatManager
|
||||||
reloadConfig();
|
reloadConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean sendMessage(final String address, final String message) {
|
boolean sendMessage(final String address, final String message) {
|
||||||
if (address != null && !address.isEmpty()) {
|
if (address != null && !address.isEmpty()) {
|
||||||
try {
|
try {
|
||||||
startChat(address);
|
startChat(address);
|
||||||
|
@ -86,7 +86,7 @@ public class XMPPManager extends Handler implements MessageListener, ChatManager
|
||||||
private boolean connect() {
|
private boolean connect() {
|
||||||
final String server = config.getString("xmpp.server");
|
final String server = config.getString("xmpp.server");
|
||||||
if (server == null || server.equals("example.com")) {
|
if (server == null || server.equals("example.com")) {
|
||||||
LOGGER.log(Level.WARNING, "config broken for xmpp");
|
logger.log(Level.WARNING, "config broken for xmpp");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final int port = config.getInt("xmpp.port", 5222);
|
final int port = config.getInt("xmpp.port", 5222);
|
||||||
|
@ -94,10 +94,8 @@ public class XMPPManager extends Handler implements MessageListener, ChatManager
|
||||||
final String xmppuser = config.getString("xmpp.user");
|
final String xmppuser = config.getString("xmpp.user");
|
||||||
final String password = config.getString("xmpp.password");
|
final String password = config.getString("xmpp.password");
|
||||||
final ConnectionConfiguration connConf = new ConnectionConfiguration(server, port, serviceName);
|
final ConnectionConfiguration connConf = new ConnectionConfiguration(server, port, serviceName);
|
||||||
final StringBuilder stringBuilder = new StringBuilder();
|
String stringBuilder = "Connecting to xmpp server " + server + ":" + port + " as user " + xmppuser + ".";
|
||||||
stringBuilder.append("Connecting to xmpp server ").append(server).append(":").append(port);
|
logger.log(Level.INFO, stringBuilder);
|
||||||
stringBuilder.append(" as user ").append(xmppuser).append(".");
|
|
||||||
LOGGER.log(Level.INFO, stringBuilder.toString());
|
|
||||||
connConf.setSASLAuthenticationEnabled(config.getBoolean("xmpp.sasl-enabled", false));
|
connConf.setSASLAuthenticationEnabled(config.getBoolean("xmpp.sasl-enabled", false));
|
||||||
connConf.setSendPresence(true);
|
connConf.setSendPresence(true);
|
||||||
connConf.setReconnectionAllowed(true);
|
connConf.setReconnectionAllowed(true);
|
||||||
|
@ -114,12 +112,12 @@ public class XMPPManager extends Handler implements MessageListener, ChatManager
|
||||||
chatManager.addChatListener(this);
|
chatManager.addChatListener(this);
|
||||||
return true;
|
return true;
|
||||||
} catch (XMPPException ex) {
|
} catch (XMPPException ex) {
|
||||||
LOGGER.log(Level.WARNING, "Failed to connect to server: " + server, ex);
|
logger.log(Level.WARNING, "Failed to connect to server: " + server, ex);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public final void disconnect() {
|
final void disconnect() {
|
||||||
if (loggerThread != null) {
|
if (loggerThread != null) {
|
||||||
loggerThread.interrupt();
|
loggerThread.interrupt();
|
||||||
}
|
}
|
||||||
|
@ -133,7 +131,7 @@ public class XMPPManager extends Handler implements MessageListener, ChatManager
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public final void updatePresence() {
|
final void updatePresence() {
|
||||||
final int usercount;
|
final int usercount;
|
||||||
final StringBuilder stringBuilder = new StringBuilder();
|
final StringBuilder stringBuilder = new StringBuilder();
|
||||||
|
|
||||||
|
@ -166,7 +164,7 @@ public class XMPPManager extends Handler implements MessageListener, ChatManager
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final void reloadConfig() {
|
public final void reloadConfig() {
|
||||||
LOGGER.removeHandler(this);
|
logger.removeHandler(this);
|
||||||
config.load();
|
config.load();
|
||||||
synchronized (chats) {
|
synchronized (chats) {
|
||||||
disconnect();
|
disconnect();
|
||||||
|
@ -177,7 +175,7 @@ public class XMPPManager extends Handler implements MessageListener, ChatManager
|
||||||
startLoggerThread();
|
startLoggerThread();
|
||||||
}
|
}
|
||||||
if (config.getBoolean("log-enabled", false)) {
|
if (config.getBoolean("log-enabled", false)) {
|
||||||
LOGGER.addHandler(this);
|
logger.addHandler(this);
|
||||||
logUsers = config.getStringList("log-users");
|
logUsers = config.getStringList("log-users");
|
||||||
final String level = config.getString("log-level", "info");
|
final String level = config.getString("log-level", "info");
|
||||||
try {
|
try {
|
||||||
|
@ -200,7 +198,7 @@ public class XMPPManager extends Handler implements MessageListener, ChatManager
|
||||||
logrecords.add(logRecord);
|
logrecords.add(logRecord);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception ignored) {
|
||||||
// Ignore all exceptions
|
// Ignore all exceptions
|
||||||
// Otherwise we create a loop.
|
// Otherwise we create a loop.
|
||||||
}
|
}
|
||||||
|
@ -217,51 +215,48 @@ public class XMPPManager extends Handler implements MessageListener, ChatManager
|
||||||
}
|
}
|
||||||
|
|
||||||
private void startLoggerThread() {
|
private void startLoggerThread() {
|
||||||
loggerThread = new Thread(new Runnable() {
|
loggerThread = new Thread(() -> {
|
||||||
@Override
|
final Set<LogRecord> copy = new HashSet<>();
|
||||||
public void run() {
|
final Set<String> failedUsers = new HashSet<>();
|
||||||
final Set<LogRecord> copy = new HashSet<LogRecord>();
|
while (threadrunning) {
|
||||||
final Set<String> failedUsers = new HashSet<String>();
|
synchronized (logrecords) {
|
||||||
while (threadrunning) {
|
if (!logrecords.isEmpty()) {
|
||||||
synchronized (logrecords) {
|
copy.addAll(logrecords);
|
||||||
if (!logrecords.isEmpty()) {
|
logrecords.clear();
|
||||||
copy.addAll(logrecords);
|
|
||||||
logrecords.clear();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!copy.isEmpty()) {
|
|
||||||
for (String user : logUsers) {
|
|
||||||
try {
|
|
||||||
XMPPManager.this.startChat(user);
|
|
||||||
for (LogRecord logRecord : copy) {
|
|
||||||
final String message = formatter.format(logRecord);
|
|
||||||
if (!XMPPManager.this.sendMessage(user, FormatUtil.stripLogColorFormat(message))) {
|
|
||||||
failedUsers.add(user);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
} catch (XMPPException ex) {
|
|
||||||
failedUsers.add(user);
|
|
||||||
LOGGER.removeHandler(XMPPManager.this);
|
|
||||||
LOGGER.log(Level.SEVERE, "Failed to deliver log message! Disabling logging to XMPP.", ex);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
logUsers.removeAll(failedUsers);
|
|
||||||
if (logUsers.isEmpty()) {
|
|
||||||
LOGGER.removeHandler(XMPPManager.this);
|
|
||||||
threadrunning = false;
|
|
||||||
}
|
|
||||||
copy.clear();
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
Thread.sleep(2000);
|
|
||||||
} catch (InterruptedException ex) {
|
|
||||||
threadrunning = false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
LOGGER.removeHandler(XMPPManager.this);
|
if (!copy.isEmpty()) {
|
||||||
|
for (String user : logUsers) {
|
||||||
|
try {
|
||||||
|
XMPPManager.this.startChat(user);
|
||||||
|
for (LogRecord logRecord : copy) {
|
||||||
|
final String message = formatter.format(logRecord);
|
||||||
|
if (!XMPPManager.this.sendMessage(user, FormatUtil.stripLogColorFormat(message))) {
|
||||||
|
failedUsers.add(user);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
} catch (XMPPException ex) {
|
||||||
|
failedUsers.add(user);
|
||||||
|
logger.removeHandler(XMPPManager.this);
|
||||||
|
logger.log(Level.SEVERE, "Failed to deliver log message! Disabling logging to XMPP.", ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
logUsers.removeAll(failedUsers);
|
||||||
|
if (logUsers.isEmpty()) {
|
||||||
|
logger.removeHandler(XMPPManager.this);
|
||||||
|
threadrunning = false;
|
||||||
|
}
|
||||||
|
copy.clear();
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
Thread.sleep(2000);
|
||||||
|
} catch (InterruptedException ex) {
|
||||||
|
threadrunning = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
logger.removeHandler(XMPPManager.this);
|
||||||
});
|
});
|
||||||
loggerThread.start();
|
loggerThread.start();
|
||||||
}
|
}
|
||||||
|
@ -290,7 +285,7 @@ public class XMPPManager extends Handler implements MessageListener, ChatManager
|
||||||
try {
|
try {
|
||||||
chat.sendMessage("User " + parts[0] + " not found");
|
chat.sendMessage("User " + parts[0] + " not found");
|
||||||
} catch (XMPPException ex) {
|
} catch (XMPPException ex) {
|
||||||
LOGGER.log(Level.WARNING, "Failed to send xmpp message.", ex);
|
logger.log(Level.WARNING, "Failed to send xmpp message.", ex);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
final String from = "[" + parent.getUserByAddress(StringUtils.parseBareAddress(chat.getParticipant())) + ">";
|
final String from = "[" + parent.getUserByAddress(StringUtils.parseBareAddress(chat.getParticipant())) + ">";
|
||||||
|
@ -306,7 +301,7 @@ public class XMPPManager extends Handler implements MessageListener, ChatManager
|
||||||
try {
|
try {
|
||||||
parent.getServer().dispatchCommand(Console.getInstance().getCommandSender(), message.substring(1));
|
parent.getServer().dispatchCommand(Console.getInstance().getCommandSender(), message.substring(1));
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
LOGGER.log(Level.SEVERE, ex.getMessage(), ex);
|
logger.log(Level.SEVERE, ex.getMessage(), ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,12 +6,10 @@ xmpp:
|
||||||
# port: 5222
|
# port: 5222
|
||||||
# sasl-enabled: false
|
# sasl-enabled: false
|
||||||
|
|
||||||
debug: false
|
|
||||||
|
|
||||||
op-users:
|
op-users:
|
||||||
# - 'name@example.com'
|
# - 'name@example.com'
|
||||||
|
|
||||||
|
debug: false
|
||||||
log-enabled: false
|
log-enabled: false
|
||||||
# Level is minimum level that should be send: info, warning, severe
|
# Level is minimum level that should be send: info, warning, severe
|
||||||
log-level: warning
|
log-level: warning
|
||||||
|
|
|
@ -4,17 +4,17 @@ main: com.earth2me.essentials.xmpp.EssentialsXMPP
|
||||||
# Note to developers: This next line cannot change, or the automatic versioning system will break.
|
# Note to developers: This next line cannot change, or the automatic versioning system will break.
|
||||||
version: ${full.version}
|
version: ${full.version}
|
||||||
website: http://ess.khhq.net/wiki/XMPP
|
website: http://ess.khhq.net/wiki/XMPP
|
||||||
description: Provides xmpp communication.
|
description: Provides XMPP communication.
|
||||||
authors:
|
authors: [snowleo]
|
||||||
- snowleo
|
|
||||||
depend: [Essentials]
|
depend: [Essentials]
|
||||||
|
api-version: 1.13
|
||||||
commands:
|
commands:
|
||||||
setxmpp:
|
setxmpp:
|
||||||
description: set your xmpp address
|
description: Sets your XMPP address.
|
||||||
usage: /<command> <address>
|
usage: /<command> <address>
|
||||||
xmpp:
|
xmpp:
|
||||||
description: send a message to a player
|
description: Sends a message to a player.
|
||||||
usage: /<command> <player> <message>
|
usage: /<command> <player> <message>
|
||||||
xmppspy:
|
xmppspy:
|
||||||
description: toggle xmpp spy for all messages
|
description: Toggles XMPP spy for all messages.
|
||||||
usage: /<command> <player>
|
usage: /<command> <player>
|
||||||
|
|
|
@ -1,134 +0,0 @@
|
||||||
default: Default
|
|
||||||
groups:
|
|
||||||
Default:
|
|
||||||
permissions:
|
|
||||||
- essentials.spawn
|
|
||||||
- essentials.rules
|
|
||||||
- essentials.motd
|
|
||||||
- essentials.list
|
|
||||||
- essentials.helpop
|
|
||||||
- essentials.help
|
|
||||||
groups: []
|
|
||||||
meta: []
|
|
||||||
Builder:
|
|
||||||
permissions:
|
|
||||||
- essentials.build
|
|
||||||
- essentials.afk
|
|
||||||
- essentials.back
|
|
||||||
- essentials.back.ondeath
|
|
||||||
- essentials.balance
|
|
||||||
- essentials.balance.others
|
|
||||||
- essentials.balancetop
|
|
||||||
- essentials.chat.color
|
|
||||||
- essentials.chat.shout
|
|
||||||
- essentials.chat.question
|
|
||||||
- essentials.compass
|
|
||||||
- essentials.depth
|
|
||||||
- essentials.home
|
|
||||||
- essentials.ignore
|
|
||||||
- essentials.kit
|
|
||||||
- essentials.kits.tools
|
|
||||||
- essentials.mail
|
|
||||||
- essentials.mail.send
|
|
||||||
- essentials.me
|
|
||||||
- essentials.msg
|
|
||||||
- essentials.nick
|
|
||||||
- essentials.pay
|
|
||||||
- essentials.ping
|
|
||||||
- essentials.powertool
|
|
||||||
- essentials.protect
|
|
||||||
- essentials.sethome
|
|
||||||
- essentials.signs.use.*
|
|
||||||
- essentials.signs.create.disposal
|
|
||||||
- essentials.signs.create.mail
|
|
||||||
- essentials.signs.create.protection
|
|
||||||
- essentials.signs.create.trade
|
|
||||||
- essentials.signs.break.disposal
|
|
||||||
- essentials.signs.break.mail
|
|
||||||
- essentials.signs.break.protection
|
|
||||||
- essentials.signs.break.trade
|
|
||||||
- essentials.suicide
|
|
||||||
- essentials.time
|
|
||||||
- essentials.tpa
|
|
||||||
- essentials.tpaccept
|
|
||||||
- essentials.tpahere
|
|
||||||
- essentials.tpdeny
|
|
||||||
- essentials.warp
|
|
||||||
- essentials.warp.list
|
|
||||||
- essentials.worth
|
|
||||||
groups:
|
|
||||||
- Default
|
|
||||||
meta:
|
|
||||||
priority: '20'
|
|
||||||
Moderator:
|
|
||||||
permissions:
|
|
||||||
- essentials.ban
|
|
||||||
- essentials.ban.notify
|
|
||||||
- essentials.banip
|
|
||||||
- essentials.broadcast
|
|
||||||
- essentials.clearinventory
|
|
||||||
- essentials.delwarp
|
|
||||||
- essentials.eco.loan
|
|
||||||
- essentials.ext
|
|
||||||
- essentials.getpos
|
|
||||||
- essentials.helpop.recieve
|
|
||||||
- essentials.home.others
|
|
||||||
- essentials.invsee
|
|
||||||
- essentials.jails
|
|
||||||
- essentials.jump
|
|
||||||
- essentials.kick
|
|
||||||
- essentials.kick.notify
|
|
||||||
- essentials.kits.*
|
|
||||||
- essentials.kill
|
|
||||||
- essentials.mute
|
|
||||||
- essentials.nick.others
|
|
||||||
- essentials.realname
|
|
||||||
- essentials.setwarp
|
|
||||||
- essentials.signs.create.*
|
|
||||||
- essentials.signs.break.*
|
|
||||||
- essentials.spawner
|
|
||||||
- essentials.thunder
|
|
||||||
- essentials.time
|
|
||||||
- essentials.time.set
|
|
||||||
- essentials.protect.alerts
|
|
||||||
- essentials.protect.admin
|
|
||||||
- essentials.protect.ownerinfo
|
|
||||||
- essentials.ptime
|
|
||||||
- essentials.ptime.others
|
|
||||||
- essentials.togglejail
|
|
||||||
- essentials.top
|
|
||||||
- essentials.tp
|
|
||||||
- essentials.tphere
|
|
||||||
- essentials.tppos
|
|
||||||
- essentials.tptoggle
|
|
||||||
- essentials.unban
|
|
||||||
- essentials.unbanip
|
|
||||||
- essentials.warps.*
|
|
||||||
- essentials.weather
|
|
||||||
- essentials.whois
|
|
||||||
- essentials.world
|
|
||||||
- essentials.worlds.*
|
|
||||||
groups:
|
|
||||||
- Builder
|
|
||||||
meta:
|
|
||||||
priority: '40'
|
|
||||||
Admin:
|
|
||||||
permissions:
|
|
||||||
# Since we use essentials.* permission here, we can still disable commands like this
|
|
||||||
# This can be done with any pemission nodes
|
|
||||||
- ^essentials.backup
|
|
||||||
- ^essentials.essentials
|
|
||||||
- ^essentials.setspawn
|
|
||||||
- ^essentials.reloadall
|
|
||||||
- essentials.*
|
|
||||||
groups:
|
|
||||||
- Moderator
|
|
||||||
meta:
|
|
||||||
priority: '80'
|
|
||||||
Owner:
|
|
||||||
permissions:
|
|
||||||
- essentials.*
|
|
||||||
groups:
|
|
||||||
- Admin
|
|
||||||
meta:
|
|
||||||
priority: '100'
|
|
|
@ -1,133 +0,0 @@
|
||||||
users:
|
|
||||||
snowleo:
|
|
||||||
groups:
|
|
||||||
- Admin
|
|
||||||
groups:
|
|
||||||
Default:
|
|
||||||
permissions:
|
|
||||||
permissions.build: false
|
|
||||||
essentials.spawn: true
|
|
||||||
essentials.rules: true
|
|
||||||
essentials.motd: true
|
|
||||||
essentials.list: true
|
|
||||||
essentials.helpop: true
|
|
||||||
essentials.help: true
|
|
||||||
Builder:
|
|
||||||
permissions:
|
|
||||||
permissions.build: true
|
|
||||||
essentials.afk: true
|
|
||||||
essentials.back: true
|
|
||||||
essentials.back.ondeath: true
|
|
||||||
essentials.balance: true
|
|
||||||
essentials.balance.others: true
|
|
||||||
essentials.balancetop: true
|
|
||||||
essentials.chat.color: true
|
|
||||||
essentials.chat.shout: true
|
|
||||||
essentials.chat.question: true
|
|
||||||
essentials.compass: true
|
|
||||||
essentials.depth: true
|
|
||||||
essentials.home: true
|
|
||||||
essentials.ignore: true
|
|
||||||
essentials.kit: true
|
|
||||||
essentials.kits.tools: true
|
|
||||||
essentials.mail: true
|
|
||||||
essentials.mail.send: true
|
|
||||||
essentials.me: true
|
|
||||||
essentials.msg: true
|
|
||||||
essentials.nick: true
|
|
||||||
essentials.pay: true
|
|
||||||
essentials.ping: true
|
|
||||||
essentials.powertool: true
|
|
||||||
essentials.protect: true
|
|
||||||
essentials.sethome: true
|
|
||||||
essentials.signs.use.*: true
|
|
||||||
essentials.signs.create.disposal: true
|
|
||||||
essentials.signs.create.mail: true
|
|
||||||
essentials.signs.create.protection: true
|
|
||||||
essentials.signs.create.trade: true
|
|
||||||
essentials.signs.break.disposal: true
|
|
||||||
essentials.signs.break.mail: true
|
|
||||||
essentials.signs.break.protection: true
|
|
||||||
essentials.signs.break.trade: true
|
|
||||||
essentials.suicide: true
|
|
||||||
essentials.time: true
|
|
||||||
essentials.tpa: true
|
|
||||||
essentials.tpaccept: true
|
|
||||||
essentials.tpahere: true
|
|
||||||
essentials.tpdeny: true
|
|
||||||
essentials.warp: true
|
|
||||||
essentials.warp.list: true
|
|
||||||
essentials.worth: true
|
|
||||||
inheritance:
|
|
||||||
- Default
|
|
||||||
Moderator:
|
|
||||||
permissions:
|
|
||||||
essentials.ban: true
|
|
||||||
essentials.ban.notify: true
|
|
||||||
essentials.banip: true
|
|
||||||
essentials.broadcast: true
|
|
||||||
essentials.clearinventory: true
|
|
||||||
essentials.delwarp: true
|
|
||||||
essentials.eco.loan: true
|
|
||||||
essentials.ext: true
|
|
||||||
essentials.getpos: true
|
|
||||||
essentials.helpop.recieve: true
|
|
||||||
essentials.home.others: true
|
|
||||||
essentials.invsee: true
|
|
||||||
essentials.jails: true
|
|
||||||
essentials.jump: true
|
|
||||||
essentials.kick: true
|
|
||||||
essentials.kick.notify: true
|
|
||||||
essentials.kill: true
|
|
||||||
essentials.mute: true
|
|
||||||
essentials.nick.others: true
|
|
||||||
essentials.realname: true
|
|
||||||
essentials.setwarp: true
|
|
||||||
essentials.signs.create.*: true
|
|
||||||
essentials.signs.break.*: true
|
|
||||||
essentials.spawner: true
|
|
||||||
essentials.thunder: true
|
|
||||||
essentials.time: true
|
|
||||||
essentials.time.set: true
|
|
||||||
essentials.protect.alerts: true
|
|
||||||
essentials.protect.admin: true
|
|
||||||
essentials.protect.ownerinfo: true
|
|
||||||
essentials.ptime: true
|
|
||||||
essentials.ptime.others: true
|
|
||||||
essentials.togglejail: true
|
|
||||||
essentials.top: true
|
|
||||||
essentials.tp: true
|
|
||||||
essentials.tphere: true
|
|
||||||
essentials.tppos: true
|
|
||||||
essentials.tptoggle: true
|
|
||||||
essentials.unban: true
|
|
||||||
essentials.unbanip: true
|
|
||||||
essentials.weather: true
|
|
||||||
essentials.whois: true
|
|
||||||
essentials.world: true
|
|
||||||
essentials.worlds.*: true
|
|
||||||
inheritance:
|
|
||||||
- Builder
|
|
||||||
Admin:
|
|
||||||
permissions:
|
|
||||||
permissions.*: true
|
|
||||||
# Since we use essentials.* permission here, we can still disable commands like this
|
|
||||||
# This is only available for essentials permissions
|
|
||||||
-essentials.backup: true
|
|
||||||
-essentials.essentials: true
|
|
||||||
-essentials.setspawn: true
|
|
||||||
-essentials.reloadall: true
|
|
||||||
essentials.*: true
|
|
||||||
inheritance:
|
|
||||||
- Moderator
|
|
||||||
Owner:
|
|
||||||
permissions:
|
|
||||||
# Double negation
|
|
||||||
-essentials.backup: false
|
|
||||||
-essentials.essentials: false
|
|
||||||
-essentials.setspawn: false
|
|
||||||
-essentials.reloadall: false
|
|
||||||
inheritance:
|
|
||||||
- Admin
|
|
||||||
messages:
|
|
||||||
build: '&cYou do not have permission to build here.'
|
|
|
@ -1,150 +0,0 @@
|
||||||
groups:
|
|
||||||
Default:
|
|
||||||
default: true
|
|
||||||
permissions:
|
|
||||||
- essentials.spawn
|
|
||||||
- essentials.rules
|
|
||||||
- essentials.motd
|
|
||||||
- essentials.list
|
|
||||||
- essentials.helpop
|
|
||||||
- essentials.help
|
|
||||||
- modifyworld.*
|
|
||||||
prefix: '&e'
|
|
||||||
options:
|
|
||||||
build: false
|
|
||||||
rank: '1000'
|
|
||||||
Builder:
|
|
||||||
permissions:
|
|
||||||
- essentials.afk
|
|
||||||
- essentials.back
|
|
||||||
- essentials.back.ondeath
|
|
||||||
- essentials.balance
|
|
||||||
- essentials.balance.others
|
|
||||||
- essentials.balancetop
|
|
||||||
- essentials.chat.color
|
|
||||||
- essentials.chat.shout
|
|
||||||
- essentials.chat.question
|
|
||||||
- essentials.compass
|
|
||||||
- essentials.depth
|
|
||||||
- essentials.home
|
|
||||||
- essentials.ignore
|
|
||||||
- essentials.kit
|
|
||||||
- essentials.kits.tools
|
|
||||||
- essentials.mail
|
|
||||||
- essentials.mail.send
|
|
||||||
- essentials.me
|
|
||||||
- essentials.msg
|
|
||||||
- essentials.nick
|
|
||||||
- essentials.pay
|
|
||||||
- essentials.ping
|
|
||||||
- essentials.powertool
|
|
||||||
- essentials.protect
|
|
||||||
- essentials.sethome
|
|
||||||
- essentials.signs.use.*
|
|
||||||
- essentials.signs.create.disposal
|
|
||||||
- essentials.signs.create.mail
|
|
||||||
- essentials.signs.create.protection
|
|
||||||
- essentials.signs.create.trade
|
|
||||||
- essentials.signs.break.disposal
|
|
||||||
- essentials.signs.break.mail
|
|
||||||
- essentials.signs.break.protection
|
|
||||||
- essentials.signs.break.trade
|
|
||||||
- essentials.suicide
|
|
||||||
- essentials.time
|
|
||||||
- essentials.tpa
|
|
||||||
- essentials.tpaccept
|
|
||||||
- essentials.tpahere
|
|
||||||
- essentials.tpdeny
|
|
||||||
- essentials.warp
|
|
||||||
- essentials.warp.list
|
|
||||||
- essentials.worth
|
|
||||||
inheritance:
|
|
||||||
- default
|
|
||||||
prefix: '&2'
|
|
||||||
options:
|
|
||||||
build: true
|
|
||||||
rank: '500'
|
|
||||||
Moderator:
|
|
||||||
permissions:
|
|
||||||
- essentials.ban
|
|
||||||
- essentials.ban.notify
|
|
||||||
- essentials.banip
|
|
||||||
- essentials.broadcast
|
|
||||||
- essentials.clearinventory
|
|
||||||
- essentials.delwarp
|
|
||||||
- essentials.eco.loan
|
|
||||||
- essentials.ext
|
|
||||||
- essentials.getpos
|
|
||||||
- essentials.helpop.recieve
|
|
||||||
- essentials.home.others
|
|
||||||
- essentials.invsee
|
|
||||||
- essentials.jails
|
|
||||||
- essentials.jump
|
|
||||||
- essentials.kick
|
|
||||||
- essentials.kick.notify
|
|
||||||
- essentials.kill
|
|
||||||
- essentials.mute
|
|
||||||
- essentials.nick.others
|
|
||||||
- essentials.realname
|
|
||||||
- essentials.setwarp
|
|
||||||
- essentials.signs.create.*
|
|
||||||
- essentials.signs.break.*
|
|
||||||
- essentials.spawner
|
|
||||||
- essentials.thunder
|
|
||||||
- essentials.time
|
|
||||||
- essentials.time.set
|
|
||||||
- essentials.protect.alerts
|
|
||||||
- essentials.protect.admin
|
|
||||||
- essentials.protect.ownerinfo
|
|
||||||
- essentials.ptime
|
|
||||||
- essentials.ptime.others
|
|
||||||
- essentials.togglejail
|
|
||||||
- essentials.top
|
|
||||||
- essentials.tp
|
|
||||||
- essentials.tphere
|
|
||||||
- essentials.tppos
|
|
||||||
- essentials.tptoggle
|
|
||||||
- essentials.unban
|
|
||||||
- essentials.unbanip
|
|
||||||
- essentials.weather
|
|
||||||
- essentials.whois
|
|
||||||
- essentials.world
|
|
||||||
- essentials.worlds.*
|
|
||||||
- permissions.user.promote.default
|
|
||||||
- permissions.user.demote.default
|
|
||||||
- permissions.manage.membership
|
|
||||||
inheritance:
|
|
||||||
- builder
|
|
||||||
prefix: '&5'
|
|
||||||
options:
|
|
||||||
build: true
|
|
||||||
rank: '200'
|
|
||||||
Admin:
|
|
||||||
permissions:
|
|
||||||
- -essentials.backup
|
|
||||||
- -essentials.essentials
|
|
||||||
- -essentials.setspawn
|
|
||||||
- -essentials.reloadall
|
|
||||||
- essentials.*
|
|
||||||
- permissions.manage.users
|
|
||||||
- permissions.manage.users.permissions
|
|
||||||
- permissions.manage.users.permissions.timed
|
|
||||||
inheritance:
|
|
||||||
- moderator
|
|
||||||
prefix: '&c'
|
|
||||||
options:
|
|
||||||
build: true
|
|
||||||
rank: '100'
|
|
||||||
Owner:
|
|
||||||
permissions:
|
|
||||||
- '*'
|
|
||||||
inheritance:
|
|
||||||
- admin
|
|
||||||
prefix: '&4'
|
|
||||||
options:
|
|
||||||
build: true
|
|
||||||
rank: '0'
|
|
||||||
users:
|
|
||||||
snowleo:
|
|
||||||
group:
|
|
||||||
- Builder
|
|
|
@ -1 +0,0 @@
|
||||||
Put a 1.8 Spigot/CraftBukkit JAR with filename `craftbukkit-1.8-R0.1-SNAPSHOT.jar` in `lib/org/bukkit/craftbukkit/1.8-R0.1-SNAPSHOT`.
|
|
|
@ -12,14 +12,6 @@
|
||||||
|
|
||||||
<artifactId>1_8_R1Provider</artifactId>
|
<artifactId>1_8_R1Provider</artifactId>
|
||||||
|
|
||||||
<repositories>
|
|
||||||
<repository>
|
|
||||||
<id>project.local</id>
|
|
||||||
<name>local repo</name>
|
|
||||||
<url>file:${project.basedir}/lib</url>
|
|
||||||
</repository>
|
|
||||||
</repositories>
|
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.bukkit</groupId>
|
<groupId>org.bukkit</groupId>
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
Put a 1.8.3 Spigot/CraftBukkit JAR with filename `craftbukkit-1.8.3-R0.1-SNAPSHOT.jar` in `lib/org/bukkit/craftbukkit/1.8.3-R0.1-SNAPSHOT`.
|
|
|
@ -12,14 +12,6 @@
|
||||||
|
|
||||||
<artifactId>1_8_R2Provider</artifactId>
|
<artifactId>1_8_R2Provider</artifactId>
|
||||||
|
|
||||||
<repositories>
|
|
||||||
<repository>
|
|
||||||
<id>project.local</id>
|
|
||||||
<name>local repo</name>
|
|
||||||
<url>file:${project.basedir}/lib</url>
|
|
||||||
</repository>
|
|
||||||
</repositories>
|
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.bukkit</groupId>
|
<groupId>org.bukkit</groupId>
|
||||||
|
|
|
@ -4,6 +4,7 @@ import net.ess3.nms.PotionMetaProvider;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public class LegacyPotionMetaProvider extends PotionMetaProvider {
|
public class LegacyPotionMetaProvider extends PotionMetaProvider {
|
||||||
@Override
|
@Override
|
||||||
public ItemStack createPotionItem(Material initial, int effectId) {
|
public ItemStack createPotionItem(Material initial, int effectId) {
|
||||||
|
|
|
@ -6,6 +6,7 @@ import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.material.MaterialData;
|
import org.bukkit.material.MaterialData;
|
||||||
import org.bukkit.material.SpawnEgg;
|
import org.bukkit.material.SpawnEgg;
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public class LegacySpawnEggProvider extends SpawnEggProvider {
|
public class LegacySpawnEggProvider extends SpawnEggProvider {
|
||||||
@Override
|
@Override
|
||||||
public ItemStack createEggItem(EntityType type) throws IllegalArgumentException {
|
public ItemStack createEggItem(EntityType type) throws IllegalArgumentException {
|
||||||
|
@ -13,7 +14,6 @@ public class LegacySpawnEggProvider extends SpawnEggProvider {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
public EntityType getSpawnedType(ItemStack eggItem) throws IllegalArgumentException {
|
public EntityType getSpawnedType(ItemStack eggItem) throws IllegalArgumentException {
|
||||||
MaterialData data = eggItem.getData();
|
MaterialData data = eggItem.getData();
|
||||||
if (data instanceof SpawnEgg) {
|
if (data instanceof SpawnEgg) {
|
||||||
|
|
|
@ -4,6 +4,7 @@ import net.ess3.nms.SpawnerProvider;
|
||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.entity.EntityType;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public class LegacySpawnerProvider extends SpawnerProvider {
|
public class LegacySpawnerProvider extends SpawnerProvider {
|
||||||
@Override
|
@Override
|
||||||
public ItemStack setEntityType(ItemStack is, EntityType type) {
|
public ItemStack setEntityType(ItemStack is, EntityType type) {
|
||||||
|
|
|
@ -11,7 +11,7 @@ import org.bukkit.inventory.meta.ItemMeta;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public abstract class SpawnerProvider implements Provider {
|
public abstract class SpawnerProvider implements Provider {
|
||||||
protected Map<EntityType, String> entityToDisplayName = ImmutableMap.<EntityType, String>builder()
|
private Map<EntityType, String> entityToDisplayName = ImmutableMap.<EntityType, String>builder()
|
||||||
.put(EntityType.CAVE_SPIDER, "Cave Spider")
|
.put(EntityType.CAVE_SPIDER, "Cave Spider")
|
||||||
.put(EntityType.PIG_ZOMBIE, "Zombie Pigman")
|
.put(EntityType.PIG_ZOMBIE, "Zombie Pigman")
|
||||||
.put(EntityType.MAGMA_CUBE, "Magma Cube")
|
.put(EntityType.MAGMA_CUBE, "Magma Cube")
|
||||||
|
@ -45,6 +45,7 @@ public abstract class SpawnerProvider implements Provider {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
protected ItemStack setDisplayName(ItemStack is, EntityType type) {
|
protected ItemStack setDisplayName(ItemStack is, EntityType type) {
|
||||||
ItemMeta meta = is.getItemMeta();
|
ItemMeta meta = is.getItemMeta();
|
||||||
String displayName;
|
String displayName;
|
||||||
|
|
|
@ -28,7 +28,7 @@ public class ProviderFactory<T extends Provider> {
|
||||||
|
|
||||||
private T loadProvider(Class<? extends T> providerClass) {
|
private T loadProvider(Class<? extends T> providerClass) {
|
||||||
try {
|
try {
|
||||||
return providerClass.newInstance();
|
return providerClass.getConstructor().newInstance();
|
||||||
} catch (Throwable ignored) {
|
} catch (Throwable ignored) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -154,7 +154,7 @@ public class ReflUtil {
|
||||||
private final String name;
|
private final String name;
|
||||||
private final Class<?>[] params;
|
private final Class<?>[] params;
|
||||||
|
|
||||||
public MethodParams(final String name, final Class<?>[] params) {
|
MethodParams(final String name, final Class<?>[] params) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.params = params;
|
this.params = params;
|
||||||
}
|
}
|
||||||
|
@ -202,7 +202,7 @@ public class ReflUtil {
|
||||||
private static class ConstructorParams {
|
private static class ConstructorParams {
|
||||||
private final Class<?>[] params;
|
private final Class<?>[] params;
|
||||||
|
|
||||||
public ConstructorParams(Class<?>[] params) {
|
ConstructorParams(Class<?>[] params) {
|
||||||
this.params = params;
|
this.params = params;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -315,14 +315,8 @@ public class ReflUtil {
|
||||||
return -1;
|
return -1;
|
||||||
} else if (minor > o.minor) {
|
} else if (minor > o.minor) {
|
||||||
return 1;
|
return 1;
|
||||||
} else { // equal minor
|
} else {
|
||||||
if (release < o.release) {
|
return Integer.compare(release, o.release);
|
||||||
return -1;
|
|
||||||
} else if (release > o.release) {
|
|
||||||
return 1;
|
|
||||||
} else {
|
|
||||||
return 0; // o is the same version as this.
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
/*******************************************************************************
|
/*
|
||||||
|
******************************************************************************
|
||||||
* This file is part of ASkyBlock.
|
* This file is part of ASkyBlock.
|
||||||
* <p>
|
* <p>
|
||||||
* ASkyBlock is free software: you can redistribute it and/or modify
|
* ASkyBlock is free software: you can redistribute it and/or modify
|
||||||
|
@ -13,11 +14,10 @@
|
||||||
* <p>
|
* <p>
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with ASkyBlock. If not, see <http://www.gnu.org/licenses/>.
|
* along with ASkyBlock. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*******************************************************************************/
|
******************************************************************************
|
||||||
|
*/
|
||||||
package net.ess3.nms.refl;
|
package net.ess3.nms.refl;
|
||||||
|
|
||||||
import net.ess3.nms.refl.ReflUtil.NMSVersion;
|
|
||||||
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.entity.EntityType;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
@ -33,7 +33,7 @@ import java.lang.reflect.Method;
|
||||||
public class SpawnEggRefl {
|
public class SpawnEggRefl {
|
||||||
private EntityType type;
|
private EntityType type;
|
||||||
|
|
||||||
public SpawnEggRefl(EntityType type) {
|
SpawnEggRefl(EntityType type) {
|
||||||
this.type = type;
|
this.type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ public class SpawnEggRefl {
|
||||||
*
|
*
|
||||||
* @return The entity type.
|
* @return The entity type.
|
||||||
*/
|
*/
|
||||||
public EntityType getSpawnedType() {
|
EntityType getSpawnedType() {
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ public class SpawnEggRefl {
|
||||||
*
|
*
|
||||||
* @return ItemStack
|
* @return ItemStack
|
||||||
*/
|
*/
|
||||||
public ItemStack toItemStack() throws Exception {
|
ItemStack toItemStack() throws Exception {
|
||||||
return toItemStack(1);
|
return toItemStack(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -119,7 +119,7 @@ public class SpawnEggRefl {
|
||||||
* @param item - ItemStack, quantity is disregarded
|
* @param item - ItemStack, quantity is disregarded
|
||||||
* @return SpawnEgg
|
* @return SpawnEgg
|
||||||
*/
|
*/
|
||||||
public static SpawnEggRefl fromItemStack(ItemStack item) throws Exception {
|
static SpawnEggRefl fromItemStack(ItemStack item) throws Exception {
|
||||||
if (item == null)
|
if (item == null)
|
||||||
throw new IllegalArgumentException("Item cannot be null");
|
throw new IllegalArgumentException("Item cannot be null");
|
||||||
if (item.getType() != Material.MONSTER_EGG)
|
if (item.getType() != Material.MONSTER_EGG)
|
||||||
|
|
|
@ -8,7 +8,7 @@ import org.junit.Test;
|
||||||
public class NMSVersionTest {
|
public class NMSVersionTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testMajor() throws Exception {
|
public void testMajor() {
|
||||||
NMSVersion v2_9_R1 = NMSVersion.fromString("v2_9_R1");
|
NMSVersion v2_9_R1 = NMSVersion.fromString("v2_9_R1");
|
||||||
|
|
||||||
Assert.assertEquals(2, v2_9_R1.getMajor());
|
Assert.assertEquals(2, v2_9_R1.getMajor());
|
||||||
|
@ -22,7 +22,7 @@ public class NMSVersionTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testMinor() throws Exception {
|
public void testMinor() {
|
||||||
NMSVersion v1_10_R1 = NMSVersion.fromString("v1_10_R1");
|
NMSVersion v1_10_R1 = NMSVersion.fromString("v1_10_R1");
|
||||||
|
|
||||||
Assert.assertEquals(1, v1_10_R1.getMajor());
|
Assert.assertEquals(1, v1_10_R1.getMajor());
|
||||||
|
@ -36,7 +36,7 @@ public class NMSVersionTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testRelease() throws Exception {
|
public void testRelease() {
|
||||||
NMSVersion v1_9_R2 = NMSVersion.fromString("v1_9_R2");
|
NMSVersion v1_9_R2 = NMSVersion.fromString("v1_9_R2");
|
||||||
|
|
||||||
Assert.assertEquals(1, v1_9_R2.getMajor());
|
Assert.assertEquals(1, v1_9_R2.getMajor());
|
||||||
|
|
13
pom.xml
13
pom.xml
|
@ -72,13 +72,14 @@
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
<defaultGoal>clean install</defaultGoal>
|
||||||
<sourceDirectory>src</sourceDirectory>
|
<sourceDirectory>src</sourceDirectory>
|
||||||
<testSourceDirectory>test</testSourceDirectory>
|
<testSourceDirectory>test</testSourceDirectory>
|
||||||
<plugins>
|
<plugins>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
<version>3.7.0</version>
|
<version>3.8.0</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<source>1.8</source>
|
<source>1.8</source>
|
||||||
<target>1.8</target>
|
<target>1.8</target>
|
||||||
|
@ -87,7 +88,7 @@
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-dependency-plugin</artifactId>
|
<artifactId>maven-dependency-plugin</artifactId>
|
||||||
<version>3.0.2</version>
|
<version>3.1.1</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<outputDirectory>jars</outputDirectory>
|
<outputDirectory>jars</outputDirectory>
|
||||||
<stripVersion>true</stripVersion>
|
<stripVersion>true</stripVersion>
|
||||||
|
@ -133,7 +134,7 @@
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
<artifactId>maven-resources-plugin</artifactId>
|
<artifactId>maven-resources-plugin</artifactId>
|
||||||
<version>3.0.2</version>
|
<version>3.1.0</version>
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
<phase>package</phase>
|
<phase>package</phase>
|
||||||
|
@ -192,7 +193,7 @@
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-clean-plugin</artifactId>
|
<artifactId>maven-clean-plugin</artifactId>
|
||||||
<version>2.5</version>
|
<version>3.1.0</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<filesets>
|
<filesets>
|
||||||
<fileset>
|
<fileset>
|
||||||
|
@ -211,7 +212,7 @@
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-javadoc-plugin</artifactId>
|
<artifactId>maven-javadoc-plugin</artifactId>
|
||||||
<version>3.0.0</version>
|
<version>3.0.1</version>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
@ -224,7 +225,7 @@
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>pl.project13.maven</groupId>
|
<groupId>pl.project13.maven</groupId>
|
||||||
<artifactId>git-commit-id-plugin</artifactId>
|
<artifactId>git-commit-id-plugin</artifactId>
|
||||||
<version>2.2.4</version>
|
<version>2.2.5</version>
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
<goals>
|
<goals>
|
||||||
|
|
Loading…
Reference in New Issue