mirror of
https://github.com/EssentialsX/Essentials.git
synced 2026-11-05 01:00:13 -05:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
279d6f16e1 | ||
|
|
a747eccaa3 | ||
|
|
0bafbc3184 | ||
|
|
8069370b8c | ||
|
|
46f4b92ff7 | ||
|
|
d92f5ce71c | ||
|
|
2314bf8bd4 | ||
|
|
7808b21496 | ||
|
|
18ef412211 | ||
|
|
0678328253 | ||
|
|
5503e1e14c | ||
|
|
9e89cfa4ed | ||
|
|
13f454a022 | ||
|
|
129650dade | ||
|
|
6fa5b80c0a | ||
|
|
04dfcd0965 | ||
|
|
2e818ac709 | ||
|
|
32ef61197f | ||
|
|
fa06cd8253 | ||
|
|
5020983af5 | ||
|
|
f4496b6977 | ||
|
|
552dcb56a1 | ||
|
|
e158a65603 | ||
|
|
b694e8aaa2 | ||
|
|
a2e09121ba | ||
|
|
4ce7dfa8f0 | ||
|
|
1c4ce7b4bd | ||
|
|
8a04c1e232 | ||
|
|
6e5d378324 | ||
|
|
8e1f3617fd | ||
|
|
2549ed830f | ||
|
|
0ebd64d314 | ||
|
|
843ecb4a42 | ||
|
|
a1a0d34940 | ||
|
|
15bb978dab | ||
|
|
6a7cf39548 | ||
|
|
8ccb70d07d | ||
|
|
45461a93b0 | ||
|
|
b3a54a78bc | ||
|
|
a4182b5ff9 | ||
|
|
215dcde4b9 | ||
|
|
67b2a9a4f4 | ||
|
|
3b51b23ac2 | ||
|
|
e0f19f8121 | ||
|
|
e720fb528a | ||
|
|
518a5454c6 | ||
|
|
2d9c846084 | ||
|
|
59e30f05fc | ||
|
|
0f1085a02d | ||
|
|
882699919e | ||
|
|
f6a70a542e | ||
|
|
bae909ba10 | ||
|
|
dbb9757a9f | ||
|
|
deaeb46ce9 | ||
|
|
219012bc35 | ||
|
|
5f9eb22d23 | ||
|
|
2c33fb6834 | ||
|
|
8bcef6022b | ||
|
|
93d36779f0 | ||
|
|
2502f5e6f2 | ||
|
|
95f2852cf3 | ||
|
|
ff9f712d65 | ||
|
|
60c4e75a1c | ||
|
|
ccf7c48bf1 | ||
|
|
65d81eb31e | ||
|
|
b97eb12dfc | ||
|
|
d2724d77df | ||
|
|
119b21ac67 | ||
|
|
1ff73b3837 | ||
|
|
d98f8b3467 | ||
|
|
ac8b8861cb | ||
|
|
22dc5dcebd | ||
|
|
3c09e72ce4 | ||
|
|
fffc3fcac7 | ||
|
|
bcdbbe9546 | ||
|
|
19f03cd70e | ||
|
|
9b7858b830 |
No files matched your search
+1
-1
@@ -1,10 +1,10 @@
|
||||
# Currently used
|
||||
patreon: EssentialsX
|
||||
ko_fi: essentialsx
|
||||
|
||||
# Currently not used
|
||||
#github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
|
||||
#open_collective: # Replace with a single Open Collective username
|
||||
#ko_fi: # Replace with a single Ko-fi username
|
||||
#tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
|
||||
#community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
|
||||
#liberapay: # Replace with a single Liberapay username
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
name: Build EssentialsX
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- 2.x
|
||||
- mc/*
|
||||
pull_request:
|
||||
branches:
|
||||
- 2.x
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout Git repo
|
||||
uses: actions/checkout@v1
|
||||
- name: Restore Maven cache
|
||||
uses: actions/cache@v1
|
||||
with:
|
||||
path: ~/.m2/repository
|
||||
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-maven-
|
||||
- name: Set up JDK 1.8
|
||||
uses: actions/setup-java@v1
|
||||
with:
|
||||
java-version: 1.8
|
||||
- name: Run BuildTools
|
||||
if: steps.cache.outputs.cache-hit != 'true'
|
||||
run: chmod +x scripts/buildtools.sh && ./scripts/buildtools.sh
|
||||
- name: Build with Maven
|
||||
run: mvn package --file pom.xml
|
||||
- name: Copy artifacts
|
||||
run: mkdir -p ./out/ && cp -t ./out/ **/target/Essentials*.jar
|
||||
- uses: actions/upload-artifact@master
|
||||
with:
|
||||
name: Plugin jars
|
||||
path: out/
|
||||
-13
@@ -1,13 +0,0 @@
|
||||
language: java
|
||||
|
||||
jdk:
|
||||
- openjdk8
|
||||
|
||||
cache:
|
||||
directories:
|
||||
- .buildtools
|
||||
- $HOME/.m2
|
||||
|
||||
before_install:
|
||||
- chmod +x scripts/buildtools.sh
|
||||
- scripts/buildtools.sh
|
||||
+9
-9
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>net.ess3</groupId>
|
||||
<artifactId>EssentialsXParent</artifactId>
|
||||
<version>2.17.0</version>
|
||||
<version>2.17.2</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>EssentialsX</artifactId>
|
||||
@@ -49,7 +49,7 @@
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>net.milkbowl.vault</groupId>
|
||||
<groupId>com.github.milkbowl</groupId>
|
||||
<artifactId>VaultAPI</artifactId>
|
||||
<version>1.7</version>
|
||||
<scope>provided</scope>
|
||||
@@ -63,19 +63,19 @@
|
||||
<dependency>
|
||||
<groupId>net.ess3</groupId>
|
||||
<artifactId>NMSProvider</artifactId>
|
||||
<version>2.17.0</version>
|
||||
<version>2.17.2</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.ess3</groupId>
|
||||
<artifactId>UpdatedMetaProvider</artifactId>
|
||||
<version>2.17.0</version>
|
||||
<version>2.17.2</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.ess3</groupId>
|
||||
<artifactId>1_8_R1Provider</artifactId>
|
||||
<version>2.17.0</version>
|
||||
<version>2.17.2</version>
|
||||
<scope>compile</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
@@ -87,7 +87,7 @@
|
||||
<dependency>
|
||||
<groupId>net.ess3</groupId>
|
||||
<artifactId>1_8_R2Provider</artifactId>
|
||||
<version>2.17.0</version>
|
||||
<version>2.17.2</version>
|
||||
<scope>compile</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
@@ -99,19 +99,19 @@
|
||||
<dependency>
|
||||
<groupId>net.ess3</groupId>
|
||||
<artifactId>LegacyProvider</artifactId>
|
||||
<version>2.17.0</version>
|
||||
<version>2.17.2</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.ess3</groupId>
|
||||
<artifactId>ReflectionProvider</artifactId>
|
||||
<version>2.17.0</version>
|
||||
<version>2.17.2</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.ess3</groupId>
|
||||
<artifactId>FlattenedProvider</artifactId>
|
||||
<version>2.17.0</version>
|
||||
<version>2.17.2</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
@@ -25,12 +25,7 @@ public class Backup implements Runnable {
|
||||
this.ess = ess;
|
||||
server = ess.getServer();
|
||||
if (!ess.getOnlinePlayers().isEmpty()) {
|
||||
ess.runTaskAsynchronously(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
startTask();
|
||||
}
|
||||
});
|
||||
ess.runTaskAsynchronously(this::startTask);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ package com.earth2me.essentials;
|
||||
|
||||
import com.earth2me.essentials.commands.*;
|
||||
import com.earth2me.essentials.items.AbstractItemDb;
|
||||
import com.earth2me.essentials.items.CustomItemResolver;
|
||||
import com.earth2me.essentials.items.FlatItemDb;
|
||||
import com.earth2me.essentials.items.LegacyItemDb;
|
||||
import com.earth2me.essentials.metrics.Metrics;
|
||||
@@ -32,12 +33,18 @@ import com.earth2me.essentials.textreader.KeywordReplacer;
|
||||
import com.earth2me.essentials.textreader.SimpleTextInput;
|
||||
import com.earth2me.essentials.utils.DateUtil;
|
||||
import com.earth2me.essentials.utils.VersionUtil;
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.base.Throwables;
|
||||
import com.google.common.collect.Iterables;
|
||||
import net.ess3.api.*;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.*;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import java.util.stream.Collectors;
|
||||
import net.ess3.api.IEssentials;
|
||||
import net.ess3.api.ISettings;
|
||||
import net.ess3.api.*;
|
||||
import net.ess3.nms.PotionMetaProvider;
|
||||
import net.ess3.nms.SpawnEggProvider;
|
||||
import net.ess3.nms.SpawnerProvider;
|
||||
@@ -76,14 +83,6 @@ import org.bukkit.scheduler.BukkitScheduler;
|
||||
import org.bukkit.scheduler.BukkitTask;
|
||||
import org.yaml.snakeyaml.error.YAMLException;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.*;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import static com.earth2me.essentials.I18n.tl;
|
||||
|
||||
|
||||
@@ -97,6 +96,7 @@ public class Essentials extends JavaPlugin implements net.ess3.api.IEssentials {
|
||||
private transient List<IConf> confList;
|
||||
private transient Backup backup;
|
||||
private transient AbstractItemDb itemDb;
|
||||
private transient CustomItemResolver customItemResolver;
|
||||
private transient final Methods paymentMethod = new Methods();
|
||||
private transient PermissionsHandler permissionsHandler;
|
||||
private transient AlternativeCommandsHandler alternativeCommandsHandler;
|
||||
@@ -216,13 +216,25 @@ public class Essentials extends JavaPlugin implements net.ess3.api.IEssentials {
|
||||
|
||||
warps = new Warps(getServer(), this.getDataFolder());
|
||||
confList.add(warps);
|
||||
execTimer.mark("Init(Spawn/Warp)");
|
||||
execTimer.mark("Init(Warp)");
|
||||
|
||||
worth = new Worth(this.getDataFolder());
|
||||
confList.add(worth);
|
||||
execTimer.mark("Init(Worth)");
|
||||
|
||||
itemDb = getItemDbFromConfig();
|
||||
confList.add(itemDb);
|
||||
execTimer.mark("Init(Worth/ItemDB)");
|
||||
execTimer.mark("Init(ItemDB)");
|
||||
|
||||
customItemResolver = new CustomItemResolver(this);
|
||||
try {
|
||||
itemDb.registerResolver(this, "custom_items", customItemResolver);
|
||||
confList.add(customItemResolver);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
customItemResolver = null;
|
||||
}
|
||||
execTimer.mark("Init(CustomItemResolver)");
|
||||
|
||||
jails = new Jails(this);
|
||||
confList.add(jails);
|
||||
@@ -487,7 +499,9 @@ public class Essentials extends JavaPlugin implements net.ess3.api.IEssentials {
|
||||
}
|
||||
|
||||
if (bSenderBlock != null) {
|
||||
Bukkit.getLogger().log(Level.INFO, "CommandBlock at {0},{1},{2} issued server command: /{3} {4}", new Object[]{bSenderBlock.getX(), bSenderBlock.getY(), bSenderBlock.getZ(), commandLabel, EssentialsCommand.getFinalArg(args, 0)});
|
||||
if (getSettings().logCommandBlockCommands()) {
|
||||
Bukkit.getLogger().log(Level.INFO, "CommandBlock at {0},{1},{2} issued server command: /{3} {4}", new Object[]{bSenderBlock.getX(), bSenderBlock.getY(), bSenderBlock.getZ(), commandLabel, EssentialsCommand.getFinalArg(args, 0)});
|
||||
}
|
||||
} else if (user == null) {
|
||||
Bukkit.getLogger().log(Level.INFO, "{0} issued server command: /{1} {2}", new Object[]{cSender.getName(), commandLabel, EssentialsCommand.getFinalArg(args, 0)});
|
||||
}
|
||||
@@ -871,13 +885,7 @@ public class Essentials extends JavaPlugin implements net.ess3.api.IEssentials {
|
||||
|
||||
@Override
|
||||
public Iterable<User> getOnlineUsers() {
|
||||
return Iterables.transform(getOnlinePlayers(), new Function<Player, User>() {
|
||||
|
||||
@Override
|
||||
public User apply(Player player) {
|
||||
return getUser(player);
|
||||
}
|
||||
});
|
||||
return getOnlinePlayers().stream().map(this::getUser).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -895,6 +903,11 @@ public class Essentials extends JavaPlugin implements net.ess3.api.IEssentials {
|
||||
return potionMetaProvider;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CustomItemResolver getCustomItemResolver() {
|
||||
return customItemResolver;
|
||||
}
|
||||
|
||||
private static void addDefaultBackPermissionsToWorld(World w) {
|
||||
String permName = "essentials.back.into." + w.getName();
|
||||
|
||||
|
||||
@@ -1,25 +1,31 @@
|
||||
package com.earth2me.essentials;
|
||||
|
||||
import com.google.common.io.Files;
|
||||
import net.ess3.api.InvalidWorldException;
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.configuration.InvalidConfigurationException;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.util.Vector;
|
||||
import static com.earth2me.essentials.I18n.tl;
|
||||
|
||||
import java.io.*;
|
||||
import com.google.common.io.Files;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.MathContext;
|
||||
import java.nio.Buffer;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.CharBuffer;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CoderResult;
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
@@ -28,8 +34,18 @@ import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import static com.earth2me.essentials.I18n.tl;
|
||||
import net.ess3.api.InvalidWorldException;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.configuration.InvalidConfigurationException;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
|
||||
public class EssentialsConf extends YamlConfiguration {
|
||||
@@ -108,20 +124,21 @@ public class EssentialsConf extends YamlConfiguration {
|
||||
if (length > buffer.remaining()) {
|
||||
ByteBuffer resize = ByteBuffer.allocate(buffer.capacity() + length - buffer.remaining());
|
||||
int resizePosition = buffer.position();
|
||||
buffer.rewind();
|
||||
// Fix builds compiled against Java 9+ breaking on Java 8
|
||||
((Buffer) buffer).rewind();
|
||||
resize.put(buffer);
|
||||
resize.position(resizePosition);
|
||||
buffer = resize;
|
||||
}
|
||||
buffer.put(bytebuffer, 0, length);
|
||||
}
|
||||
buffer.rewind();
|
||||
((Buffer) buffer).rewind();
|
||||
final CharBuffer data = CharBuffer.allocate(buffer.capacity());
|
||||
CharsetDecoder decoder = UTF8.newDecoder();
|
||||
CoderResult result = decoder.decode(buffer, data, true);
|
||||
if (result.isError()) {
|
||||
buffer.rewind();
|
||||
data.clear();
|
||||
((Buffer) buffer).rewind();
|
||||
((Buffer) data).clear();
|
||||
LOGGER.log(Level.INFO, "File " + configFile.getAbsolutePath() + " is not utf-8 encoded, trying " + Charset.defaultCharset().displayName());
|
||||
decoder = Charset.defaultCharset().newDecoder();
|
||||
result = decoder.decode(buffer, data, true);
|
||||
@@ -134,7 +151,7 @@ public class EssentialsConf extends YamlConfiguration {
|
||||
decoder.flush(data);
|
||||
}
|
||||
final int end = data.position();
|
||||
data.rewind();
|
||||
((Buffer) data).rewind();
|
||||
super.loadFromString(data.subSequence(0, end).toString());
|
||||
}
|
||||
} catch (IOException ex) {
|
||||
|
||||
@@ -164,6 +164,7 @@ public class EssentialsEntityListener implements Listener {
|
||||
final User user = ess.getUser(event.getEntity());
|
||||
if (user.isAuthorized("essentials.keepinv")) {
|
||||
event.setKeepInventory(true);
|
||||
event.getDrops().clear();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ import com.earth2me.essentials.textreader.TextPager;
|
||||
import com.earth2me.essentials.utils.DateUtil;
|
||||
import com.earth2me.essentials.utils.LocationUtil;
|
||||
import com.earth2me.essentials.utils.MaterialUtil;
|
||||
import com.earth2me.essentials.utils.VersionUtil;
|
||||
import io.papermc.lib.PaperLib;
|
||||
import net.ess3.api.IEssentials;
|
||||
import org.bukkit.*;
|
||||
@@ -47,6 +48,24 @@ public class EssentialsPlayerListener implements Listener {
|
||||
this.ess = parent;
|
||||
}
|
||||
|
||||
private static boolean isEntityPickupEvent() {
|
||||
try {
|
||||
Class.forName("org.bukkit.event.entity.EntityPickupItemEvent");
|
||||
return true;
|
||||
} catch (ClassNotFoundException ignored) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean isCommandSendEvent() {
|
||||
try {
|
||||
Class.forName("org.bukkit.event.player.PlayerCommandSendEvent");
|
||||
return true;
|
||||
} catch (ClassNotFoundException ignored) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public void registerEvents() {
|
||||
ess.getServer().getPluginManager().registerEvents(this, ess);
|
||||
|
||||
@@ -155,7 +174,7 @@ public class EssentialsPlayerListener implements Listener {
|
||||
.replace("{PLAYER}", player.getDisplayName())
|
||||
.replace("{USERNAME}", player.getName())
|
||||
.replace("{ONLINE}", NumberFormat.getInstance().format(ess.getOnlinePlayers().size()));
|
||||
|
||||
|
||||
event.setQuitMessage(msg.isEmpty() ? null : msg);
|
||||
}
|
||||
|
||||
@@ -192,12 +211,8 @@ public class EssentialsPlayerListener implements Listener {
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void onPlayerJoin(final PlayerJoinEvent event) {
|
||||
final String joinMessage = event.getJoinMessage();
|
||||
ess.runTaskAsynchronously(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
delayedJoin(event.getPlayer(), joinMessage);
|
||||
}
|
||||
});
|
||||
ess.runTaskAsynchronously(() -> delayedJoin(event.getPlayer(), joinMessage));
|
||||
|
||||
if (ess.getSettings().allowSilentJoinQuit() || ess.getSettings().isCustomJoinMessage()) {
|
||||
event.setJoinMessage(null);
|
||||
}
|
||||
@@ -261,9 +276,9 @@ public class EssentialsPlayerListener implements Listener {
|
||||
//NOOP
|
||||
} else if (ess.getSettings().isCustomJoinMessage()) {
|
||||
String msg = ess.getSettings().getCustomJoinMessage()
|
||||
.replace("{PLAYER}", player.getDisplayName()).replace("{USERNAME}", player.getName())
|
||||
.replace("{UNIQUE}", NumberFormat.getInstance().format(ess.getUserMap().getUniqueUsers()))
|
||||
.replace("{ONLINE}", NumberFormat.getInstance().format(ess.getOnlinePlayers().size()));
|
||||
.replace("{PLAYER}", player.getDisplayName()).replace("{USERNAME}", player.getName())
|
||||
.replace("{UNIQUE}", NumberFormat.getInstance().format(ess.getUserMap().getUniqueUsers()))
|
||||
.replace("{ONLINE}", NumberFormat.getInstance().format(ess.getOnlinePlayers().size()));
|
||||
if (!msg.isEmpty()) {
|
||||
ess.getServer().broadcastMessage(msg);
|
||||
}
|
||||
@@ -315,7 +330,7 @@ public class EssentialsPlayerListener implements Listener {
|
||||
user.setGodModeEnabled(false);
|
||||
ess.getLogger().log(Level.INFO, "Set god mode to false for {0} because they had it enabled without permission.", user.getName());
|
||||
}
|
||||
|
||||
|
||||
user.setConfirmingClearCommand(null);
|
||||
user.getConfirmingPayments().clear();
|
||||
|
||||
@@ -445,12 +460,7 @@ public class EssentialsPlayerListener implements Listener {
|
||||
final User user = ess.getUser(event.getPlayer());
|
||||
if (user.hasUnlimited(new ItemStack(event.getBucket()))) {
|
||||
event.getItemStack().setType(event.getBucket());
|
||||
ess.scheduleSyncDelayedTask(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
user.getBase().updateInventory();
|
||||
}
|
||||
});
|
||||
ess.scheduleSyncDelayedTask(user.getBase()::updateInventory);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -485,7 +495,7 @@ public class EssentialsPlayerListener implements Listener {
|
||||
LOGGER.info(tl("mutedUserSpeaks", player.getName(), event.getMessage()));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
boolean broadcast = true; // whether to broadcast the updated activity
|
||||
boolean update = true; // Only modified when the command is afk
|
||||
|
||||
@@ -504,16 +514,16 @@ public class EssentialsPlayerListener implements Listener {
|
||||
}
|
||||
|
||||
if (ess.getSettings().isCommandCooldownsEnabled() && pluginCommand != null
|
||||
&& !user.isAuthorized("essentials.commandcooldowns.bypass")) {
|
||||
&& !user.isAuthorized("essentials.commandcooldowns.bypass")) {
|
||||
int argStartIndex = event.getMessage().indexOf(" ");
|
||||
String args = argStartIndex == -1 ? "" // No arguments present
|
||||
: " " + event.getMessage().substring(argStartIndex); // arguments start at argStartIndex; substring from there.
|
||||
String args = argStartIndex == -1 ? "" // No arguments present
|
||||
: " " + event.getMessage().substring(argStartIndex); // arguments start at argStartIndex; substring from there.
|
||||
String fullCommand = pluginCommand.getName() + args;
|
||||
|
||||
// Used to determine whether a user already has an existing cooldown
|
||||
// If so, no need to check for (and write) new ones.
|
||||
boolean cooldownFound = false;
|
||||
|
||||
|
||||
// Iterate over a copy of getCommandCooldowns in case of concurrent modifications
|
||||
for (Entry<Pattern, Long> entry : new HashMap<>(user.getCommandCooldowns()).entrySet()) {
|
||||
// Remove any expired cooldowns
|
||||
@@ -551,8 +561,8 @@ public class EssentialsPlayerListener implements Listener {
|
||||
final User user = ess.getUser(event.getPlayer());
|
||||
if (user.getBase().getGameMode() != GameMode.CREATIVE
|
||||
// COMPAT: String compare for 1.7.10
|
||||
&& !user.getBase().getGameMode().name().equals("SPECTATOR")
|
||||
&& !user.isAuthorized("essentials.fly")) {
|
||||
&& !user.getBase().getGameMode().name().equals("SPECTATOR")
|
||||
&& !user.isAuthorized("essentials.fly")) {
|
||||
user.getBase().setFallDistance(0f);
|
||||
user.getBase().setAllowFlight(false);
|
||||
}
|
||||
@@ -604,7 +614,10 @@ public class EssentialsPlayerListener implements Listener {
|
||||
User player = ess.getUser(event.getPlayer());
|
||||
if (player.isAuthorized("essentials.sethome.bed") && player.getWorld().getEnvironment().equals(World.Environment.NORMAL)) {
|
||||
player.getBase().setBedSpawnLocation(event.getClickedBlock().getLocation());
|
||||
player.sendMessage(tl("bedSet", player.getLocation().getWorld().getName(), player.getLocation().getBlockX(), player.getLocation().getBlockY(), player.getLocation().getBlockZ()));
|
||||
// In 1.15 and above, vanilla sends its own bed spawn message.
|
||||
if (VersionUtil.getServerBukkitVersion().isLowerThan(VersionUtil.v1_15_R01)) {
|
||||
player.sendMessage(tl("bedSet", player.getLocation().getWorld().getName(), player.getLocation().getBlockX(), player.getLocation().getBlockY(), player.getLocation().getBlockZ()));
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -627,6 +640,8 @@ public class EssentialsPlayerListener implements Listener {
|
||||
case PHYSICAL:
|
||||
updateActivity = false;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (updateActivity) {
|
||||
@@ -733,9 +748,9 @@ public class EssentialsPlayerListener implements Listener {
|
||||
}
|
||||
} else if (clickedInventory != null && clickedInventory.getType() == InventoryType.PLAYER) {
|
||||
if (ess.getSettings().isDirectHatAllowed() && event.getClick() == ClickType.LEFT && event.getSlot() == 39
|
||||
&& event.getCursor().getType() != Material.AIR && event.getCursor().getType().getMaxDurability() == 0
|
||||
&& !MaterialUtil.isSkull(event.getCursor().getType())
|
||||
&& ess.getUser(event.getWhoClicked()).isAuthorized("essentials.hat")) {
|
||||
&& event.getCursor().getType() != Material.AIR && event.getCursor().getType().getMaxDurability() == 0
|
||||
&& !MaterialUtil.isSkull(event.getCursor().getType())
|
||||
&& ess.getUser(event.getWhoClicked()).isAuthorized("essentials.hat") && !ess.getUser(event.getWhoClicked()).isAuthorized("essentials.hat.prevent-type." + event.getCursor().getType().name().toLowerCase())) {
|
||||
event.setCancelled(true);
|
||||
final PlayerInventory inv = (PlayerInventory) clickedInventory;
|
||||
final ItemStack head = inv.getHelmet();
|
||||
@@ -746,12 +761,7 @@ public class EssentialsPlayerListener implements Listener {
|
||||
|
||||
if (refreshPlayer != null) {
|
||||
final Player player = refreshPlayer;
|
||||
ess.scheduleSyncDelayedTask(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
player.updateInventory();
|
||||
}
|
||||
}, 1);
|
||||
ess.scheduleSyncDelayedTask(player::updateInventory, 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -786,37 +796,14 @@ public class EssentialsPlayerListener implements Listener {
|
||||
|
||||
if (refreshPlayer != null) {
|
||||
final Player player = refreshPlayer;
|
||||
ess.scheduleSyncDelayedTask(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
player.updateInventory();
|
||||
}
|
||||
}, 1);
|
||||
ess.scheduleSyncDelayedTask(player::updateInventory, 1);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
||||
public void onPlayerFishEvent(final PlayerFishEvent event) {
|
||||
final User user = ess.getUser(event.getPlayer());
|
||||
user.updateActivityOnInteract(true);
|
||||
}
|
||||
|
||||
private static boolean isEntityPickupEvent() {
|
||||
try {
|
||||
Class.forName("org.bukkit.event.entity.EntityPickupItemEvent");
|
||||
return true;
|
||||
} catch (ClassNotFoundException ignored) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean isCommandSendEvent() {
|
||||
try {
|
||||
Class.forName("org.bukkit.event.player.PlayerCommandSendEvent");
|
||||
return true;
|
||||
} catch (ClassNotFoundException ignored) {
|
||||
return false;
|
||||
}
|
||||
user.updateActivityOnInteract(true);
|
||||
}
|
||||
|
||||
private final class PickupListenerPre1_12 implements Listener {
|
||||
@@ -846,30 +833,40 @@ public class EssentialsPlayerListener implements Listener {
|
||||
public void onCommandSend(final PlayerCommandSendEvent event) {
|
||||
User user = ess.getUser(event.getPlayer());
|
||||
|
||||
ArrayList<String> removedCmds = new ArrayList<>(event.getCommands());
|
||||
Set<PluginCommand> checked = new HashSet<>();
|
||||
Set<PluginCommand> toRemove = new HashSet<>();
|
||||
|
||||
event.getCommands().removeIf(str -> shouldHideFromUser(str, user));
|
||||
event.getCommands().removeIf(label -> {
|
||||
if (isEssentialsCommand(label)) {
|
||||
PluginCommand command = ess.getServer().getPluginCommand(label);
|
||||
if (!checked.contains(command)) {
|
||||
checked.add(command);
|
||||
if (!user.isAuthorized(command.getName().equals("r") ? "essentials.msg" : "essentials." + command.getName())) {
|
||||
toRemove.add(command);
|
||||
}
|
||||
}
|
||||
return toRemove.contains(command);
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
if (ess.getSettings().isDebug()) {
|
||||
removedCmds.removeAll(event.getCommands());
|
||||
ess.getLogger().info("Removed commands: " + removedCmds.toString());
|
||||
ess.getLogger().info("Removed commands: " + toRemove.toString());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if all of the following are true:
|
||||
* - The command is a plugin command
|
||||
* - The plugin command is from Essentials
|
||||
* - There is no known alternative OR the alternative is overridden by Essentials
|
||||
* - The user is not allowed to perform the given Essentials command
|
||||
* - The command is a plugin command
|
||||
* - The plugin command is from Essentials
|
||||
* - There is no known alternative OR the alternative is overridden by Essentials
|
||||
*/
|
||||
private boolean shouldHideFromUser(String commandLabel, User user) {
|
||||
PluginCommand command = ess.getServer().getPluginCommand(commandLabel);
|
||||
private boolean isEssentialsCommand(String label) {
|
||||
PluginCommand command = ess.getServer().getPluginCommand(label);
|
||||
|
||||
return command != null
|
||||
&& command.getPlugin().getName().equals("Essentials")
|
||||
&& (ess.getSettings().isCommandOverridden(commandLabel) || (ess.getAlternativeCommandsHandler().getAlternative(commandLabel) == null))
|
||||
&& !user.isAuthorized("essentials." + command.getName());
|
||||
&& command.getPlugin() == ess
|
||||
&& (ess.getSettings().isCommandOverridden(label) || (ess.getAlternativeCommandsHandler().getAlternative(label) == null));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -15,6 +15,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
|
||||
@@ -330,4 +331,12 @@ public interface ISettings extends IConf {
|
||||
boolean isWaterSafe();
|
||||
|
||||
boolean isSafeUsermap();
|
||||
|
||||
boolean logCommandBlockCommands();
|
||||
|
||||
Set<Predicate<String>> getNickBlacklist();
|
||||
|
||||
double getMaxProjectileSpeed();
|
||||
|
||||
boolean isSpawnIfNoHome();
|
||||
}
|
||||
@@ -16,10 +16,7 @@ import org.bukkit.event.block.BlockDamageEvent;
|
||||
import org.bukkit.event.block.BlockPlaceEvent;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerRespawnEvent;
|
||||
import org.bukkit.event.player.PlayerTeleportEvent;
|
||||
import org.bukkit.event.player.*;
|
||||
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
|
||||
@@ -203,6 +200,14 @@ public class Jails extends AsyncStorageObjectHolder<com.earth2me.essentials.sett
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
||||
public void onJailPlayerGameModeChange(PlayerGameModeChangeEvent event) {
|
||||
final User user = ess.getUser(event.getPlayer());
|
||||
if (user.isJailed()) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void onJailPlayerRespawn(final PlayerRespawnEvent event) {
|
||||
final User user = ess.getUser(event.getPlayer());
|
||||
|
||||
@@ -79,6 +79,12 @@ public class Kits implements IConf {
|
||||
config.save();
|
||||
}
|
||||
|
||||
public void removeKit(String name) {
|
||||
config.set("kits." + name, null);
|
||||
kits = _getKits();
|
||||
config.save();
|
||||
}
|
||||
|
||||
public String listKits(final net.ess3.api.IEssentials ess, final User user) throws Exception {
|
||||
try {
|
||||
final ConfigurationSection kits = config.getConfigurationSection("kits");
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
package com.earth2me.essentials;
|
||||
|
||||
import net.ess3.api.IEssentials;
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
import java.io.*;
|
||||
import java.math.BigInteger;
|
||||
import java.security.DigestInputStream;
|
||||
@@ -13,6 +10,9 @@ import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
import java.util.stream.Collectors;
|
||||
import net.ess3.api.IEssentials;
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
import static com.earth2me.essentials.I18n.tl;
|
||||
|
||||
@@ -38,7 +38,7 @@ public class ManagedFile {
|
||||
try {
|
||||
copyResourceAscii("/" + filename, file);
|
||||
} catch (IOException ex) {
|
||||
Bukkit.getLogger().log(Level.SEVERE, tl("itemsCsvNotLoaded"), ex);
|
||||
Bukkit.getLogger().log(Level.SEVERE, tl("itemsCsvNotLoaded", filename), ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,10 +8,12 @@ import com.earth2me.essentials.utils.FormatUtil;
|
||||
import com.earth2me.essentials.utils.MaterialUtil;
|
||||
import com.earth2me.essentials.utils.NumberUtil;
|
||||
import com.google.common.base.Joiner;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.*;
|
||||
import java.util.logging.Level;
|
||||
import java.util.regex.Pattern;
|
||||
import net.ess3.api.IEssentials;
|
||||
import net.ess3.nms.refl.ReflUtil;
|
||||
|
||||
import org.apache.commons.lang.ArrayUtils;
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.DyeColor;
|
||||
import org.bukkit.FireworkEffect;
|
||||
@@ -26,11 +28,6 @@ import org.bukkit.potion.Potion;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.*;
|
||||
import java.util.logging.Level;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import static com.earth2me.essentials.I18n.tl;
|
||||
|
||||
|
||||
@@ -165,8 +162,8 @@ public class MetaItemStack {
|
||||
stack.setItemMeta(meta);
|
||||
} else if (split.length > 1 && (split[0].equalsIgnoreCase("lore") || split[0].equalsIgnoreCase("desc")) && hasMetaPermission(sender, "lore", false, true, ess)) {
|
||||
final List<String> lore = new ArrayList<String>();
|
||||
for (String line : split[1].split("\\|")) {
|
||||
lore.add(FormatUtil.replaceFormat(line.replace('_', ' ')));
|
||||
for (String line : split[1].split("(?<!\\\\)\\|")) {
|
||||
lore.add(FormatUtil.replaceFormat(line.replace('_', ' ').replace("\\|", "|")));
|
||||
}
|
||||
final ItemMeta meta = stack.getItemMeta();
|
||||
meta.setLore(lore);
|
||||
@@ -177,9 +174,7 @@ public class MetaItemStack {
|
||||
} else if (split.length > 1 && (split[0].equalsIgnoreCase("player") || split[0].equalsIgnoreCase("owner")) && hasMetaPermission(sender, "head", false, true, ess)) {
|
||||
if (MaterialUtil.isPlayerHead(stack.getType(), stack.getDurability())) {
|
||||
final String owner = split[1];
|
||||
final SkullMeta meta = (SkullMeta) stack.getItemMeta();
|
||||
meta.setOwningPlayer(ess.getServer().getOfflinePlayer(owner));
|
||||
stack.setItemMeta(meta);
|
||||
setSkullOwner(ess, stack, owner);
|
||||
} else {
|
||||
throw new Exception(tl("onlyPlayerSkulls"));
|
||||
}
|
||||
@@ -584,4 +579,24 @@ public class MetaItemStack {
|
||||
t.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean useNewSkullMethod = true;
|
||||
|
||||
private static void setSkullOwner(final IEssentials ess, final ItemStack stack, final String owner) {
|
||||
if (!(stack.getItemMeta() instanceof SkullMeta)) return;
|
||||
|
||||
SkullMeta meta = (SkullMeta) stack.getItemMeta();
|
||||
if (useNewSkullMethod) {
|
||||
try {
|
||||
meta.setOwningPlayer(ess.getServer().getOfflinePlayer(owner));
|
||||
stack.setItemMeta(meta);
|
||||
return;
|
||||
} catch (NoSuchMethodError e) {
|
||||
useNewSkullMethod = false;
|
||||
}
|
||||
}
|
||||
|
||||
meta.setOwner(owner);
|
||||
stack.setItemMeta(meta);
|
||||
}
|
||||
}
|
||||
@@ -89,7 +89,8 @@ public enum Mob {
|
||||
PILLAGER("Pillager", Enemies.ENEMY, "PILLAGER"),
|
||||
RAVAGER("Ravager", Enemies.ENEMY, "RAVAGER"),
|
||||
TRADER_LLAMA("TraderLlama", Enemies.FRIENDLY, "TRADER_LLAMA"),
|
||||
WANDERING_TRADER("WanderingTrader", Enemies.FRIENDLY, "WANDERING_TRADER")
|
||||
WANDERING_TRADER("WanderingTrader", Enemies.FRIENDLY, "WANDERING_TRADER"),
|
||||
BEE("Bee", Enemies.NEUTRAL, "BEE")
|
||||
;
|
||||
|
||||
public static final Logger logger = Logger.getLogger("Essentials");
|
||||
|
||||
@@ -110,6 +110,15 @@ public class OfflinePlayer implements Player {
|
||||
public void setHealth(double d) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getAbsorptionAmount() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAbsorptionAmount(double v) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInsideVehicle() {
|
||||
return false;
|
||||
@@ -427,19 +436,6 @@ public class OfflinePlayer implements Player {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void awardAchievement(Achievement a) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeAchievement(Achievement achievement) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasAchievement(Achievement achievement) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void incrementStatistic(Statistic ststc) {
|
||||
}
|
||||
@@ -657,6 +653,14 @@ public class OfflinePlayer implements Player {
|
||||
public void setTotalExperience(int i) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendExperienceChange(float v) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendExperienceChange(float v, int i) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getExhaustion() {
|
||||
return 0F;
|
||||
|
||||
@@ -35,6 +35,7 @@ import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import java.util.regex.Pattern;
|
||||
@@ -438,6 +439,7 @@ public class Settings implements net.ess3.api.ISettings {
|
||||
mFormat = mFormat.replace("{TEAMNAME}", "{5}");
|
||||
mFormat = mFormat.replace("{PREFIX}", "{6}");
|
||||
mFormat = mFormat.replace("{SUFFIX}", "{7}");
|
||||
mFormat = mFormat.replace("{USERNAME}", "{8}");
|
||||
mFormat = "§r".concat(mFormat);
|
||||
chatFormats.put(group, mFormat);
|
||||
}
|
||||
@@ -554,6 +556,9 @@ public class Settings implements net.ess3.api.ISettings {
|
||||
allowOldIdSigns = _allowOldIdSigns();
|
||||
isWaterSafe = _isWaterSafe();
|
||||
isSafeUsermap = _isSafeUsermap();
|
||||
logCommandBlockCommands = _logCommandBlockCommands();
|
||||
nickBlacklist = _getNickBlacklist();
|
||||
maxProjectileSpeed = _getMaxProjectileSpeed();
|
||||
}
|
||||
|
||||
void _lateLoadItemSpawnBlacklist() {
|
||||
@@ -1576,4 +1581,52 @@ public class Settings implements net.ess3.api.ISettings {
|
||||
public boolean isSafeUsermap() {
|
||||
return isSafeUsermap;
|
||||
}
|
||||
|
||||
private boolean logCommandBlockCommands;
|
||||
|
||||
private boolean _logCommandBlockCommands() {
|
||||
return config.getBoolean("log-command-block-commands", true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean logCommandBlockCommands() {
|
||||
return logCommandBlockCommands;
|
||||
}
|
||||
|
||||
private Set<Predicate<String>> nickBlacklist;
|
||||
|
||||
private Set<Predicate<String>> _getNickBlacklist() {
|
||||
Set<Predicate<String>> blacklist = new HashSet<>();
|
||||
|
||||
config.getStringList("nick-blacklist").forEach(entry -> {
|
||||
try {
|
||||
blacklist.add(Pattern.compile(entry).asPredicate());
|
||||
} catch (PatternSyntaxException e) {
|
||||
logger.warning("Invalid nickname blacklist regex: " + entry);
|
||||
}
|
||||
});
|
||||
|
||||
return blacklist;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<Predicate<String>> getNickBlacklist() {
|
||||
return nickBlacklist;
|
||||
}
|
||||
|
||||
private double maxProjectileSpeed;
|
||||
|
||||
private double _getMaxProjectileSpeed() {
|
||||
return config.getDouble("max-projectile-speed", 8);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxProjectileSpeed() {
|
||||
return maxProjectileSpeed;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSpawnIfNoHome() {
|
||||
return config.getBoolean("spawn-if-no-home", true);
|
||||
}
|
||||
}
|
||||
@@ -162,10 +162,14 @@ public class User extends UserData implements Comparable<User>, IMessageRecipien
|
||||
|
||||
@Override
|
||||
public void giveMoney(final BigDecimal value, final CommandSource initiator) throws MaxMoneyException {
|
||||
giveMoney(value, initiator, UserBalanceUpdateEvent.Cause.UNKNOWN);
|
||||
}
|
||||
|
||||
public void giveMoney(final BigDecimal value, final CommandSource initiator, UserBalanceUpdateEvent.Cause cause) throws MaxMoneyException {
|
||||
if (value.signum() == 0) {
|
||||
return;
|
||||
}
|
||||
setMoney(getMoney().add(value));
|
||||
setMoney(getMoney().add(value), cause);
|
||||
sendMessage(tl("addedToAccount", NumberUtil.displayCurrency(value, ess)));
|
||||
if (initiator != null) {
|
||||
initiator.sendMessage(tl("addedToOthersAccount", NumberUtil.displayCurrency(value, ess), this.getDisplayName(), NumberUtil.displayCurrency(getMoney(), ess)));
|
||||
@@ -174,6 +178,10 @@ public class User extends UserData implements Comparable<User>, IMessageRecipien
|
||||
|
||||
@Override
|
||||
public void payUser(final User reciever, final BigDecimal value) throws Exception {
|
||||
payUser(reciever, value, UserBalanceUpdateEvent.Cause.UNKNOWN);
|
||||
}
|
||||
|
||||
public void payUser(final User reciever, final BigDecimal value, UserBalanceUpdateEvent.Cause cause) throws Exception {
|
||||
if (value.compareTo(BigDecimal.ZERO) < 1) {
|
||||
throw new Exception(tl("payMustBePositive"));
|
||||
}
|
||||
@@ -195,11 +203,15 @@ public class User extends UserData implements Comparable<User>, IMessageRecipien
|
||||
|
||||
@Override
|
||||
public void takeMoney(final BigDecimal value, final CommandSource initiator) {
|
||||
takeMoney(value, initiator, UserBalanceUpdateEvent.Cause.UNKNOWN);
|
||||
}
|
||||
|
||||
public void takeMoney(final BigDecimal value, final CommandSource initiator, UserBalanceUpdateEvent.Cause cause) {
|
||||
if (value.signum() == 0) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
setMoney(getMoney().subtract(value));
|
||||
setMoney(getMoney().subtract(value), cause);
|
||||
} catch (MaxMoneyException ex) {
|
||||
ess.getLogger().log(Level.WARNING, "Invalid call to takeMoney, total balance can't be more than the max-money limit.", ex);
|
||||
}
|
||||
@@ -440,6 +452,10 @@ public class User extends UserData implements Comparable<User>, IMessageRecipien
|
||||
|
||||
@Override
|
||||
public void setMoney(final BigDecimal value) throws MaxMoneyException {
|
||||
setMoney(value, UserBalanceUpdateEvent.Cause.UNKNOWN);
|
||||
}
|
||||
|
||||
public void setMoney(final BigDecimal value, UserBalanceUpdateEvent.Cause cause) throws MaxMoneyException {
|
||||
if (ess.getSettings().isEcoDisabled()) {
|
||||
if (ess.getSettings().isDebug()) {
|
||||
ess.getLogger().info("Internal economy functions disabled, aborting balance change.");
|
||||
@@ -447,11 +463,11 @@ public class User extends UserData implements Comparable<User>, IMessageRecipien
|
||||
return;
|
||||
}
|
||||
final BigDecimal oldBalance = _getMoney();
|
||||
|
||||
UserBalanceUpdateEvent updateEvent = new UserBalanceUpdateEvent(this.getBase(), oldBalance, value);
|
||||
|
||||
UserBalanceUpdateEvent updateEvent = new UserBalanceUpdateEvent(this.getBase(), oldBalance, value, cause);
|
||||
ess.getServer().getPluginManager().callEvent(updateEvent);
|
||||
BigDecimal newBalance = updateEvent.getNewBalance();
|
||||
|
||||
|
||||
if (Methods.hasMethod()) {
|
||||
try {
|
||||
final Method method = Methods.getMethod();
|
||||
|
||||
@@ -17,6 +17,7 @@ import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.earth2me.essentials.I18n.tl;
|
||||
|
||||
@@ -234,10 +235,10 @@ public abstract class UserData extends PlayerExtension implements IConf {
|
||||
config.save();
|
||||
}
|
||||
|
||||
private List<Material> unlimited;
|
||||
private Set<Material> unlimited;
|
||||
|
||||
private List<Material> _getUnlimited() {
|
||||
List<Material> retlist = new ArrayList<>();
|
||||
private Set<Material> _getUnlimited() {
|
||||
Set<Material> retlist = new HashSet<>();
|
||||
List<String> configList = config.getStringList("unlimited");
|
||||
for(String s : configList) {
|
||||
Material mat = Material.matchMaterial(s);
|
||||
@@ -249,7 +250,7 @@ public abstract class UserData extends PlayerExtension implements IConf {
|
||||
return retlist;
|
||||
}
|
||||
|
||||
public List<Material> getUnlimited() {
|
||||
public Set<Material> getUnlimited() {
|
||||
return unlimited;
|
||||
}
|
||||
|
||||
@@ -258,13 +259,20 @@ public abstract class UserData extends PlayerExtension implements IConf {
|
||||
}
|
||||
|
||||
public void setUnlimited(ItemStack stack, boolean state) {
|
||||
if (unlimited.contains(stack.getType())) {
|
||||
unlimited.remove(stack.getType());
|
||||
}
|
||||
boolean wasUpdated;
|
||||
if (state) {
|
||||
unlimited.add(stack.getType());
|
||||
wasUpdated = unlimited.add(stack.getType());
|
||||
} else {
|
||||
wasUpdated = unlimited.remove(stack.getType());
|
||||
}
|
||||
config.setProperty("unlimited", unlimited);
|
||||
|
||||
if (wasUpdated) {
|
||||
applyUnlimited();
|
||||
}
|
||||
}
|
||||
|
||||
private void applyUnlimited() {
|
||||
config.setProperty("unlimited", unlimited.stream().map(Enum::name).collect(Collectors.toList()));
|
||||
config.save();
|
||||
}
|
||||
|
||||
@@ -857,7 +865,7 @@ public abstract class UserData extends PlayerExtension implements IConf {
|
||||
private Map<Pattern, Long> commandCooldowns;
|
||||
|
||||
private Map<Pattern, Long> _getCommandCooldowns() {
|
||||
if (!config.isConfigurationSection("timestamps.command-cooldowns")) {
|
||||
if (!config.contains("timestamps.command-cooldowns")) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ import com.earth2me.essentials.utils.StringUtil;
|
||||
import com.google.common.base.Charsets;
|
||||
import net.ess3.api.IEssentials;
|
||||
import net.ess3.api.MaxMoneyException;
|
||||
import net.ess3.api.events.UserBalanceUpdateEvent;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.io.File;
|
||||
@@ -144,7 +145,7 @@ public class Economy {
|
||||
throw new NoLoanPermittedException();
|
||||
}
|
||||
try {
|
||||
user.setMoney(balance);
|
||||
user.setMoney(balance, UserBalanceUpdateEvent.Cause.API);
|
||||
} catch (MaxMoneyException ex) {
|
||||
//TODO: Update API to show max balance errors
|
||||
}
|
||||
|
||||
@@ -130,11 +130,13 @@ public interface IItemDb {
|
||||
* item IDs to modern names.
|
||||
*
|
||||
* @param item Legacy ID in colon syntax.
|
||||
* @return
|
||||
* @return Material if an appropriate material exists, else null.
|
||||
*/
|
||||
default Material getFromLegacy(String item) {
|
||||
final String[] split = item.split(":");
|
||||
|
||||
if (!NumberUtil.isInt(split[0])) return null;
|
||||
|
||||
final int id = Integer.parseInt(split[0]);
|
||||
byte damage = 0;
|
||||
|
||||
|
||||
@@ -24,10 +24,6 @@ public class Commandafk extends EssentialsCommand {
|
||||
afkUser = getPlayer(server, user, args, 0);
|
||||
message = args.length > 1 ? getFinalArg(args, 1) : null;
|
||||
} catch (PlayerNotFoundException e) {
|
||||
// If only one arg is passed, assume the command executor is targeting another player.
|
||||
if (args.length == 1) {
|
||||
throw e;
|
||||
}
|
||||
message = getFinalArg(args, 0);
|
||||
}
|
||||
toggleAfk(user, afkUser, message);
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.earth2me.essentials.commands;
|
||||
|
||||
import com.earth2me.essentials.Mob;
|
||||
import com.earth2me.essentials.User;
|
||||
import com.earth2me.essentials.utils.VersionUtil;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.entity.Entity;
|
||||
|
||||
import static com.earth2me.essentials.I18n.tl;
|
||||
|
||||
public class Commandbeezooka extends EssentialsCommand {
|
||||
|
||||
public Commandbeezooka() {
|
||||
super("beezooka");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception {
|
||||
if (VersionUtil.getServerBukkitVersion().isLowerThan(VersionUtil.v1_15_R01)) {
|
||||
user.sendMessage(tl("unsupportedFeature"));
|
||||
return;
|
||||
}
|
||||
|
||||
final Entity bee = Mob.BEE.spawn(user.getWorld(), server, user.getBase().getEyeLocation());
|
||||
bee.setVelocity(user.getBase().getEyeLocation().getDirection().multiply(2));
|
||||
|
||||
ess.scheduleSyncDelayedTask(() -> {
|
||||
final Location loc = bee.getLocation();
|
||||
bee.remove();
|
||||
loc.getWorld().createExplosion(loc, 0F);
|
||||
}, 20);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package com.earth2me.essentials.commands;
|
||||
|
||||
import com.earth2me.essentials.CommandSource;
|
||||
import com.earth2me.essentials.Kit;
|
||||
import com.google.common.collect.Lists;
|
||||
import org.bukkit.Server;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import static com.earth2me.essentials.I18n.tl;
|
||||
|
||||
|
||||
public class Commanddelkit extends EssentialsCommand {
|
||||
public Commanddelkit() {
|
||||
super("delkit");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception {
|
||||
if (args.length < 1) {
|
||||
final String kitList = ess.getKits().listKits(ess, null);
|
||||
sender.sendMessage(kitList.length() > 0 ? tl("kits", kitList) : tl("noKits"));
|
||||
throw new NoChargeException();
|
||||
} else {
|
||||
final String kitName = args[0];
|
||||
final Kit kit = new Kit(kitName, ess);
|
||||
|
||||
if (sender.getPlayer() != null) {
|
||||
kit.checkPerms(ess.getUser(sender.getPlayer()));
|
||||
}
|
||||
|
||||
ess.getKits().removeKit(kitName);
|
||||
sender.sendMessage(tl("deleteKit", kitName));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<String> getTabCompleteOptions(final Server server, final CommandSource sender, final String commandLabel, final String[] args) {
|
||||
if (args.length == 1) {
|
||||
return Lists.newArrayList(ess.getKits().getKits().getKeys(false));
|
||||
}
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@ import com.earth2me.essentials.User;
|
||||
import com.earth2me.essentials.utils.NumberUtil;
|
||||
import com.google.common.collect.Lists;
|
||||
import net.ess3.api.MaxMoneyException;
|
||||
import net.ess3.api.events.UserBalanceUpdateEvent;
|
||||
import org.bukkit.Server;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
@@ -54,7 +55,7 @@ public class Commandeco extends EssentialsLoopCommand {
|
||||
protected void updatePlayer(final Server server, final CommandSource sender, final User player, final String[] args) throws NotEnoughArgumentsException, ChargeException, MaxMoneyException {
|
||||
switch (cmd) {
|
||||
case GIVE:
|
||||
player.giveMoney(amount, sender);
|
||||
player.giveMoney(amount, sender, UserBalanceUpdateEvent.Cause.COMMAND_ECO);
|
||||
break;
|
||||
|
||||
case TAKE:
|
||||
@@ -72,10 +73,10 @@ public class Commandeco extends EssentialsLoopCommand {
|
||||
BigDecimal money = player.getMoney();
|
||||
BigDecimal minBalance = ess.getSettings().getMinMoney();
|
||||
if (money.subtract(amount).compareTo(minBalance) >= 0) {
|
||||
player.takeMoney(amount, sender);
|
||||
player.takeMoney(amount, sender, UserBalanceUpdateEvent.Cause.COMMAND_ECO);
|
||||
} else if (sender == null) {
|
||||
try {
|
||||
player.setMoney(minBalance);
|
||||
player.setMoney(minBalance, UserBalanceUpdateEvent.Cause.COMMAND_ECO);
|
||||
} catch (MaxMoneyException ex) {
|
||||
// Take shouldn't be able to throw a max money exception
|
||||
}
|
||||
@@ -90,7 +91,7 @@ public class Commandeco extends EssentialsLoopCommand {
|
||||
BigDecimal maxBalance = ess.getSettings().getMaxMoney();
|
||||
boolean underMinimum = (amount.compareTo(minBalance) < 0);
|
||||
boolean aboveMax = (amount.compareTo(maxBalance) > 0);
|
||||
player.setMoney(underMinimum ? minBalance : aboveMax ? maxBalance : amount);
|
||||
player.setMoney(underMinimum ? minBalance : aboveMax ? maxBalance : amount, UserBalanceUpdateEvent.Cause.COMMAND_ECO);
|
||||
player.sendMessage(tl("setBal", NumberUtil.displayCurrency(player.getMoney(), ess)));
|
||||
if (sender != null) {
|
||||
sender.sendMessage(tl("setBalOthers", player.getDisplayName(), NumberUtil.displayCurrency(player.getMoney(), ess)));
|
||||
|
||||
@@ -6,96 +6,144 @@ import com.earth2me.essentials.User;
|
||||
import com.earth2me.essentials.UserMap;
|
||||
import com.earth2me.essentials.utils.*;
|
||||
import com.google.common.base.Charsets;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.Lists;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.PluginDescriptionFile;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import static com.earth2me.essentials.I18n.tl;
|
||||
|
||||
// This command has 4 undocumented behaviours #EasterEgg
|
||||
public class Commandessentials extends EssentialsCommand {
|
||||
|
||||
private final Sound NOTE_HARP = EnumUtil.valueOf(Sound.class, "BLOCK_NOTE_BLOCK_HARP", "BLOCK_NOTE_HARP", "NOTE_PIANO");
|
||||
private static final Sound NOTE_HARP = EnumUtil.valueOf(Sound.class, "BLOCK_NOTE_BLOCK_HARP", "BLOCK_NOTE_HARP", "NOTE_PIANO");
|
||||
private static final Sound MOO_SOUND = EnumUtil.valueOf(Sound.class, "COW_IDLE", "ENTITY_COW_MILK");
|
||||
|
||||
private static final String NYAN_TUNE = "1D#,1E,2F#,,2A#,1E,1D#,1E,2F#,2B,2D#,2E,2D#,2A#,2B,,2F#,,1D#,1E,2F#,2B,2C#,2A#,2B,2C#,2E,2D#,2E,2C#,,2F#,,2G#,,1D,1D#,,1C#,1D,1C#,1B,,1B,,1C#,,1D,,1D,1C#,1B,1C#,1D#,2F#,2G#,1D#,2F#,1C#,1D#,1B,1C#,1B,1D#,,2F#,,2G#,1D#,2F#,1C#,1D#,1B,1D,1D#,1D,1C#,1B,1C#,1D,,1B,1C#,1D#,2F#,1C#,1D,1C#,1B,1C#,,1B,,1C#,,2F#,,2G#,,1D,1D#,,1C#,1D,1C#,1B,,1B,,1C#,,1D,,1D,1C#,1B,1C#,1D#,2F#,2G#,1D#,2F#,1C#,1D#,1B,1C#,1B,1D#,,2F#,,2G#,1D#,2F#,1C#,1D#,1B,1D,1D#,1D,1C#,1B,1C#,1D,,1B,1C#,1D#,2F#,1C#,1D,1C#,1B,1C#,,1B,,1B,,1B,,1F#,1G#,1B,,1F#,1G#,1B,1C#,1D#,1B,1E,1D#,1E,2F#,1B,,1B,,1F#,1G#,1B,1E,1D#,1C#,1B,,,,1F#,1B,,1F#,1G#,1B,,1F#,1G#,1B,1B,1C#,1D#,1B,1F#,1G#,1F#,1B,,1B,1A#,1B,1F#,1G#,1B,1E,1D#,1E,2F#,1B,,1A#,,1B,,1F#,1G#,1B,,1F#,1G#,1B,1C#,1D#,1B,1E,1D#,1E,2F#,1B,,1B,,1F#,1G#,1B,1F#,1E,1D#,1C#,1B,,,,1F#,1B,,1F#,1G#,1B,,1F#,1G#,1B,1B,1C#,1D#,1B,1F#,1G#,1F#,1B,,1B,1A#,1B,1F#,1G#,1B,1E,1D#,1E,2F#,1B,,1A#,,1B,,1F#,1G#,1B,,1F#,1G#,1B,1C#,1D#,1B,1E,1D#,1E,2F#,1B,,1B,,1F#,1G#,1B,1F#,1E,1D#,1C#,1B,,,,1F#,1B,,1F#,1G#,1B,,1F#,1G#,1B,1B,1C#,1D#,1B,1F#,1G#,1F#,1B,,1B,1A#,1B,1F#,1G#,1B,1E,1D#,1E,2F#,1B,,1A#,,1B,,1F#,1G#,1B,,1F#,1G#,1B,1C#,1D#,1B,1E,1D#,1E,2F#,1B,,1B,,1F#,1G#,1B,1F#,1E,1D#,1C#,1B,,,,1F#,1B,,1F#,1G#,1B,,1F#,1G#,1B,1B,1C#,1D#,1B,1F#,1G#,1F#,1B,,1B,1A#,1B,1F#,1G#,1B,1E,1D#,1E,2F#,1B,,1A#,,1B,,1F#,1G#,1B,,1F#,1G#,1B,1C#,1D#,1B,1E,1D#,1E,2F#,1B,,1B,,1F#,1G#,1B,1F#,1E,1D#,1C#,1B,,,,1F#,1B,,1F#,1G#,1B,,1F#,1G#,1B,1B,1C#,1D#,1B,1F#,1G#,1F#,1B,,1B,1A#,1B,1F#,1G#,1B,1E,1D#,1E,2F#,1B,,1B,,";
|
||||
private static final String[] CONSOLE_MOO = new String[]{" (__)", " (oo)", " /------\\/", " / | ||", " * /\\---/\\", " ~~ ~~", "....\"Have you mooed today?\"..."};
|
||||
private static final String[] PLAYER_MOO = new String[]{" (__)", " (oo)", " /------\\/", " / | | |", " * /\\---/\\", " ~~ ~~", "....\"Have you mooed today?\"..."};
|
||||
|
||||
public Commandessentials() {
|
||||
super("essentials");
|
||||
}
|
||||
|
||||
private transient int taskid;
|
||||
private final transient Map<Player, Block> noteBlocks = new HashMap<Player, Block>();
|
||||
private transient TuneRunnable currentTune = null;
|
||||
|
||||
private final List<String> versionPlugins = Arrays.asList(
|
||||
"Vault",
|
||||
"LuckPerms",
|
||||
"PermissionsEx",
|
||||
"GroupManager"
|
||||
private static final List<String> versionPlugins = Arrays.asList(
|
||||
"Vault", // API
|
||||
"Reserve", // API
|
||||
"PlaceholderAPI", // API
|
||||
"CMI", // potential for issues
|
||||
"Towny", // past issues; admins should ensure latest
|
||||
"ChestShop", // past issues; admins should ensure latest
|
||||
"Citizens", // fires player events
|
||||
"LuckPerms", // permissions (recommended)
|
||||
"UltraPermissions",
|
||||
"PermissionsEx", // permissions (unsupported)
|
||||
"GroupManager", // permissions (unsupported)
|
||||
"bPermissions" // permissions (unsupported)
|
||||
);
|
||||
|
||||
private final List<String> officialPlugins = Arrays.asList(
|
||||
"EssentialsAntiBuild",
|
||||
"EssentialsChat",
|
||||
"EssentialsGeoIP",
|
||||
"EssentialsProtect",
|
||||
"EssentialsSpawn",
|
||||
"EssentialsXMPP"
|
||||
private static final List<String> officialPlugins = Arrays.asList(
|
||||
"EssentialsAntiBuild",
|
||||
"EssentialsChat",
|
||||
"EssentialsGeoIP",
|
||||
"EssentialsProtect",
|
||||
"EssentialsSpawn",
|
||||
"EssentialsXMPP"
|
||||
);
|
||||
|
||||
private final List<String> warnPlugins = Arrays.asList(
|
||||
"PermissionsEx",
|
||||
"GroupManager"
|
||||
private static final List<String> warnPlugins = Arrays.asList(
|
||||
"PermissionsEx",
|
||||
"GroupManager",
|
||||
"bPremissions"
|
||||
);
|
||||
|
||||
@Override
|
||||
public void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception {
|
||||
if (args.length == 0) {
|
||||
run_disabled(server, sender, commandLabel, args);
|
||||
} else if (args[0].equalsIgnoreCase("debug")) {
|
||||
run_debug(server, sender, commandLabel, args);
|
||||
} else if (args[0].equalsIgnoreCase("nya")) {
|
||||
run_nya(server, sender, commandLabel, args);
|
||||
} else if (args[0].equalsIgnoreCase("moo")) {
|
||||
run_moo(server, sender, commandLabel, args);
|
||||
} else if (args[0].equalsIgnoreCase("reset")) {
|
||||
run_reset(server, sender, commandLabel, args);
|
||||
} else if (args[0].equalsIgnoreCase("cleanup")) {
|
||||
run_cleanup(server, sender, commandLabel, args);
|
||||
} else if (args[0].equalsIgnoreCase("uuidconvert")) {
|
||||
run_uuidconvert(server, sender, commandLabel, args);
|
||||
} else if (args[0].equalsIgnoreCase("uuidtest")) {
|
||||
run_uuidtest(server, sender, commandLabel, args);
|
||||
} else if (args[0].equalsIgnoreCase("version")) {
|
||||
run_version(server, sender, commandLabel, args);
|
||||
} else {
|
||||
run_reload(server, sender, commandLabel, args);
|
||||
showUsage(sender);
|
||||
}
|
||||
|
||||
switch(args[0]) {
|
||||
// Info commands
|
||||
case "debug":
|
||||
case "verbose":
|
||||
runDebug(server, sender, commandLabel, args);
|
||||
break;
|
||||
|
||||
case "ver":
|
||||
case "version":
|
||||
runVersion(server, sender, commandLabel, args);
|
||||
break;
|
||||
|
||||
case "cmd":
|
||||
case "commands":
|
||||
runCommands(server, sender, commandLabel, args);
|
||||
break;
|
||||
|
||||
// Data commands
|
||||
case "reload":
|
||||
runReload(server, sender, commandLabel, args);
|
||||
break;
|
||||
case "reset":
|
||||
runReset(server, sender, commandLabel, args);
|
||||
break;
|
||||
case "cleanup":
|
||||
runCleanup(server, sender, commandLabel, args);
|
||||
break;
|
||||
case "uuidconvert":
|
||||
runUUIDConvert(server, sender, commandLabel, args);
|
||||
break;
|
||||
case "uuidtest":
|
||||
runUUIDTest(server, sender, commandLabel, args);
|
||||
break;
|
||||
|
||||
// "#EasterEgg"
|
||||
case "nya":
|
||||
case "nyan":
|
||||
runNya(server, sender, commandLabel, args);
|
||||
break;
|
||||
case "moo":
|
||||
runMoo(server, sender, commandLabel, args);
|
||||
break;
|
||||
default:
|
||||
showUsage(sender);
|
||||
}
|
||||
}
|
||||
|
||||
//If you do not supply an argument this command will list 'overridden' commands.
|
||||
private void run_disabled(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception {
|
||||
sender.sendMessage("/<command> <reload/debug>");
|
||||
// Displays the command's usage.
|
||||
private void showUsage(final CommandSource sender) throws Exception {
|
||||
throw new NotEnoughArgumentsException("/<command> <reload/debug/commands>");
|
||||
}
|
||||
|
||||
// Lists commands that are being handed over to other plugins.
|
||||
private void runCommands(final Server server, final CommandSource sender, final String commandLabel, final String[] args) {
|
||||
final StringBuilder disabledCommands = new StringBuilder();
|
||||
for (Map.Entry<String, String> entry : ess.getAlternativeCommandsHandler().disabledCommands().entrySet()) {
|
||||
if (disabledCommands.length() > 0) {
|
||||
disabledCommands.append(", ");
|
||||
disabledCommands.append("\n");
|
||||
}
|
||||
disabledCommands.append(entry.getKey()).append(" => ").append(entry.getValue());
|
||||
}
|
||||
if (disabledCommands.length() > 0) {
|
||||
sender.sendMessage(tl("blockList"));
|
||||
sender.sendMessage(disabledCommands.toString());
|
||||
} else {
|
||||
sender.sendMessage(tl("blockListEmpty"));
|
||||
}
|
||||
}
|
||||
|
||||
private void run_reset(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception {
|
||||
// Resets the given player's user data.
|
||||
private void runReset(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception {
|
||||
if (args.length < 2) {
|
||||
throw new Exception("/<command> reset <player>");
|
||||
}
|
||||
@@ -104,108 +152,59 @@ public class Commandessentials extends EssentialsCommand {
|
||||
sender.sendMessage("Reset Essentials userdata for player: " + user.getDisplayName());
|
||||
}
|
||||
|
||||
private void run_debug(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception {
|
||||
// Toggles debug mode.
|
||||
private void runDebug(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception {
|
||||
ess.getSettings().setDebug(!ess.getSettings().isDebug());
|
||||
sender.sendMessage("Essentials " + ess.getDescription().getVersion() + " debug mode " + (ess.getSettings().isDebug() ? "enabled" : "disabled"));
|
||||
}
|
||||
|
||||
private void run_reload(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception {
|
||||
// Reloads all reloadable configs.
|
||||
private void runReload(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception {
|
||||
ess.reload();
|
||||
sender.sendMessage(tl("essentialsReload", ess.getDescription().getVersion()));
|
||||
}
|
||||
|
||||
private void run_nya(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception {
|
||||
final Map<String, Float> noteMap = new HashMap<String, Float>();
|
||||
noteMap.put("1F#", 0.5f);
|
||||
noteMap.put("1G", 0.53f);
|
||||
noteMap.put("1G#", 0.56f);
|
||||
noteMap.put("1A", 0.6f);
|
||||
noteMap.put("1A#", 0.63f);
|
||||
noteMap.put("1B", 0.67f);
|
||||
noteMap.put("1C", 0.7f);
|
||||
noteMap.put("1C#", 0.76f);
|
||||
noteMap.put("1D", 0.8f);
|
||||
noteMap.put("1D#", 0.84f);
|
||||
noteMap.put("1E", 0.9f);
|
||||
noteMap.put("1F", 0.94f);
|
||||
noteMap.put("2F#", 1.0f);
|
||||
noteMap.put("2G", 1.06f);
|
||||
noteMap.put("2G#", 1.12f);
|
||||
noteMap.put("2A", 1.18f);
|
||||
noteMap.put("2A#", 1.26f);
|
||||
noteMap.put("2B", 1.34f);
|
||||
noteMap.put("2C", 1.42f);
|
||||
noteMap.put("2C#", 1.5f);
|
||||
noteMap.put("2D", 1.6f);
|
||||
noteMap.put("2D#", 1.68f);
|
||||
noteMap.put("2E", 1.78f);
|
||||
noteMap.put("2F", 1.88f);
|
||||
final String tuneStr = "1D#,1E,2F#,,2A#,1E,1D#,1E,2F#,2B,2D#,2E,2D#,2A#,2B,,2F#,,1D#,1E,2F#,2B,2C#,2A#,2B,2C#,2E,2D#,2E,2C#,,2F#,,2G#,,1D,1D#,,1C#,1D,1C#,1B,,1B,,1C#,,1D,,1D,1C#,1B,1C#,1D#,2F#,2G#,1D#,2F#,1C#,1D#,1B,1C#,1B,1D#,,2F#,,2G#,1D#,2F#,1C#,1D#,1B,1D,1D#,1D,1C#,1B,1C#,1D,,1B,1C#,1D#,2F#,1C#,1D,1C#,1B,1C#,,1B,,1C#,,2F#,,2G#,,1D,1D#,,1C#,1D,1C#,1B,,1B,,1C#,,1D,,1D,1C#,1B,1C#,1D#,2F#,2G#,1D#,2F#,1C#,1D#,1B,1C#,1B,1D#,,2F#,,2G#,1D#,2F#,1C#,1D#,1B,1D,1D#,1D,1C#,1B,1C#,1D,,1B,1C#,1D#,2F#,1C#,1D,1C#,1B,1C#,,1B,,1B,,1B,,1F#,1G#,1B,,1F#,1G#,1B,1C#,1D#,1B,1E,1D#,1E,2F#,1B,,1B,,1F#,1G#,1B,1E,1D#,1C#,1B,,,,1F#,1B,,1F#,1G#,1B,,1F#,1G#,1B,1B,1C#,1D#,1B,1F#,1G#,1F#,1B,,1B,1A#,1B,1F#,1G#,1B,1E,1D#,1E,2F#,1B,,1A#,,1B,,1F#,1G#,1B,,1F#,1G#,1B,1C#,1D#,1B,1E,1D#,1E,2F#,1B,,1B,,1F#,1G#,1B,1F#,1E,1D#,1C#,1B,,,,1F#,1B,,1F#,1G#,1B,,1F#,1G#,1B,1B,1C#,1D#,1B,1F#,1G#,1F#,1B,,1B,1A#,1B,1F#,1G#,1B,1E,1D#,1E,2F#,1B,,1A#,,1B,,1F#,1G#,1B,,1F#,1G#,1B,1C#,1D#,1B,1E,1D#,1E,2F#,1B,,1B,,1F#,1G#,1B,1F#,1E,1D#,1C#,1B,,,,1F#,1B,,1F#,1G#,1B,,1F#,1G#,1B,1B,1C#,1D#,1B,1F#,1G#,1F#,1B,,1B,1A#,1B,1F#,1G#,1B,1E,1D#,1E,2F#,1B,,1A#,,1B,,1F#,1G#,1B,,1F#,1G#,1B,1C#,1D#,1B,1E,1D#,1E,2F#,1B,,1B,,1F#,1G#,1B,1F#,1E,1D#,1C#,1B,,,,1F#,1B,,1F#,1G#,1B,,1F#,1G#,1B,1B,1C#,1D#,1B,1F#,1G#,1F#,1B,,1B,1A#,1B,1F#,1G#,1B,1E,1D#,1E,2F#,1B,,1A#,,1B,,1F#,1G#,1B,,1F#,1G#,1B,1C#,1D#,1B,1E,1D#,1E,2F#,1B,,1B,,1F#,1G#,1B,1F#,1E,1D#,1C#,1B,,,,1F#,1B,,1F#,1G#,1B,,1F#,1G#,1B,1B,1C#,1D#,1B,1F#,1G#,1F#,1B,,1B,1A#,1B,1F#,1G#,1B,1E,1D#,1E,2F#,1B,,1B,,";
|
||||
final String[] tune = tuneStr.split(",");
|
||||
taskid = ess.scheduleSyncRepeatingTask(new Runnable() {
|
||||
int i = 0;
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
final String note = tune[i];
|
||||
i++;
|
||||
if (i >= tune.length) {
|
||||
Commandessentials.this.stopTune();
|
||||
}
|
||||
if (note == null || note.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (Player onlinePlayer : ess.getOnlinePlayers()) {
|
||||
onlinePlayer.playSound(onlinePlayer.getLocation(), NOTE_HARP, 1, noteMap.get(note));
|
||||
}
|
||||
}
|
||||
}, 20, 2);
|
||||
}
|
||||
|
||||
private void stopTune() {
|
||||
ess.getScheduler().cancelTask(taskid);
|
||||
for (Block block : noteBlocks.values()) {
|
||||
if (block.getType() == Material.NOTE_BLOCK) {
|
||||
block.setType(Material.AIR);
|
||||
}
|
||||
// Pop tarts.
|
||||
private void runNya(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception {
|
||||
if (currentTune != null) {
|
||||
currentTune.cancel();
|
||||
}
|
||||
noteBlocks.clear();
|
||||
|
||||
currentTune = new TuneRunnable(NYAN_TUNE, NOTE_HARP, ess::getOnlinePlayers);
|
||||
currentTune.runTaskTimer(ess, 20, 2);
|
||||
}
|
||||
|
||||
private final String[] consoleMoo = new String[]{" (__)", " (oo)", " /------\\/", " / | ||", " * /\\---/\\", " ~~ ~~", "....\"Have you mooed today?\"..."};
|
||||
private final String[] playerMoo = new String[]{" (__)", " (oo)", " /------\\/", " / | | |", " * /\\---/\\", " ~~ ~~", "....\"Have you mooed today?\"..."};
|
||||
|
||||
private void run_moo(final Server server, final CommandSource sender, final String command, final String args[]) {
|
||||
Sound moo = EnumUtil.valueOf(Sound.class, "COW_IDLE", "ENTITY_COW_MILK");
|
||||
|
||||
// Cow farts.
|
||||
private void runMoo(final Server server, final CommandSource sender, final String command, final String args[]) {
|
||||
if (args.length == 2 && args[1].equals("moo")) {
|
||||
for (String s : consoleMoo) {
|
||||
for (String s : CONSOLE_MOO) {
|
||||
logger.info(s);
|
||||
}
|
||||
for (Player player : ess.getOnlinePlayers()) {
|
||||
player.sendMessage(playerMoo);
|
||||
player.playSound(player.getLocation(), moo, 1, 1.0f);
|
||||
player.sendMessage(PLAYER_MOO);
|
||||
player.playSound(player.getLocation(), MOO_SOUND, 1, 1.0f);
|
||||
}
|
||||
} else {
|
||||
if (sender.isPlayer()) {
|
||||
sender.getSender().sendMessage(playerMoo);
|
||||
sender.getSender().sendMessage(PLAYER_MOO);
|
||||
final Player player = sender.getPlayer();
|
||||
player.playSound(player.getLocation(), moo, 1, 1.0f);
|
||||
player.playSound(player.getLocation(), MOO_SOUND, 1, 1.0f);
|
||||
|
||||
} else {
|
||||
sender.getSender().sendMessage(consoleMoo);
|
||||
sender.getSender().sendMessage(CONSOLE_MOO);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void run_cleanup(final Server server, final CommandSource sender, final String command, final String args[]) throws Exception {
|
||||
// Cleans up inactive users.
|
||||
private void runCleanup(final Server server, final CommandSource sender, final String command, final String args[]) throws Exception {
|
||||
if (args.length < 2 || !NumberUtil.isInt(args[1])) {
|
||||
sender.sendMessage("This sub-command will delete users who havent logged in in the last <days> days.");
|
||||
sender.sendMessage("Optional parameters define the minium amount required to prevent deletion.");
|
||||
sender.sendMessage("Unless you define larger default values, this command wil ignore people who have more than 0 money/homes.");
|
||||
sender.sendMessage("This sub-command will delete users who haven't logged in in the last <days> days.");
|
||||
sender.sendMessage("Optional parameters define the minimum amount required to prevent deletion.");
|
||||
sender.sendMessage("Unless you define larger default values, this command will ignore people who have more than 0 money/homes.");
|
||||
throw new Exception("/<command> cleanup <days> [money] [homes]");
|
||||
}
|
||||
|
||||
sender.sendMessage(tl("cleaning"));
|
||||
|
||||
final long daysArg = Long.parseLong(args[1]);
|
||||
@@ -213,59 +212,58 @@ public class Commandessentials extends EssentialsCommand {
|
||||
final int homesArg = args.length >= 4 && NumberUtil.isInt(args[3]) ? Integer.parseInt(args[3]) : 0;
|
||||
final UserMap userMap = ess.getUserMap();
|
||||
|
||||
ess.runTaskAsynchronously(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Long currTime = System.currentTimeMillis();
|
||||
for (UUID u : userMap.getAllUniqueUsers()) {
|
||||
final User user = ess.getUserMap().getUser(u);
|
||||
if (user == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
long lastLog = user.getLastLogout();
|
||||
if (lastLog == 0) {
|
||||
lastLog = user.getLastLogin();
|
||||
}
|
||||
if (lastLog == 0) {
|
||||
user.setLastLogin(currTime);
|
||||
}
|
||||
|
||||
if (user.isNPC()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
long timeDiff = currTime - lastLog;
|
||||
long milliDays = daysArg * 24L * 60L * 60L * 1000L;
|
||||
int homeCount = user.getHomes().size();
|
||||
double moneyCount = user.getMoney().doubleValue();
|
||||
|
||||
if ((lastLog == 0) || (timeDiff < milliDays) || (homeCount > homesArg) || (moneyCount > moneyArg)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ess.getSettings().isDebug()) {
|
||||
ess.getLogger().info("Deleting user: " + user.getName() + " Money: " + moneyCount + " Homes: " + homeCount + " Last seen: " + DateUtil.formatDateDiff(lastLog));
|
||||
}
|
||||
|
||||
user.reset();
|
||||
ess.runTaskAsynchronously(() -> {
|
||||
Long currTime = System.currentTimeMillis();
|
||||
for (UUID u : userMap.getAllUniqueUsers()) {
|
||||
final User user = ess.getUserMap().getUser(u);
|
||||
if (user == null) {
|
||||
continue;
|
||||
}
|
||||
sender.sendMessage(tl("cleaned"));
|
||||
|
||||
long lastLog = user.getLastLogout();
|
||||
if (lastLog == 0) {
|
||||
lastLog = user.getLastLogin();
|
||||
}
|
||||
if (lastLog == 0) {
|
||||
user.setLastLogin(currTime);
|
||||
}
|
||||
|
||||
if (user.isNPC()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
long timeDiff = currTime - lastLog;
|
||||
long milliDays = daysArg * 24L * 60L * 60L * 1000L;
|
||||
int homeCount = user.getHomes().size();
|
||||
double moneyCount = user.getMoney().doubleValue();
|
||||
|
||||
if ((lastLog == 0) || (timeDiff < milliDays) || (homeCount > homesArg) || (moneyCount > moneyArg)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ess.getSettings().isDebug()) {
|
||||
ess.getLogger().info("Deleting user: " + user.getName() + " Money: " + moneyCount + " Homes: " + homeCount + " Last seen: " + DateUtil.formatDateDiff(lastLog));
|
||||
}
|
||||
|
||||
user.reset();
|
||||
}
|
||||
sender.sendMessage(tl("cleaned"));
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private void run_uuidconvert(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception {
|
||||
sender.sendMessage("Starting Essentials UUID userdata conversion, this may lag the server.");
|
||||
// Forces a rerun of userdata UUID conversion.
|
||||
private void runUUIDConvert(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception {
|
||||
sender.sendMessage("Starting Essentials UUID userdata conversion; this may lag the server.");
|
||||
|
||||
Boolean ignoreUFCache = (args.length > 2 && args[1].toLowerCase(Locale.ENGLISH).contains("ignore"));
|
||||
EssentialsUpgrade.uuidFileConvert(ess, ignoreUFCache);
|
||||
|
||||
sender.sendMessage("UUID conversion complete, check your server log for more information.");
|
||||
sender.sendMessage("UUID conversion complete. Check your server log for more information.");
|
||||
}
|
||||
|
||||
private void run_uuidtest(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception {
|
||||
// Looks up various UUIDs for a user.
|
||||
private void runUUIDTest(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception {
|
||||
if (args.length < 2) {
|
||||
throw new Exception("/<command> uuidtest <name>");
|
||||
}
|
||||
@@ -302,7 +300,8 @@ public class Commandessentials extends EssentialsCommand {
|
||||
sender.sendMessage("Offline Mode UUID: " + offlineuuid.toString());
|
||||
}
|
||||
|
||||
private void run_version(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception {
|
||||
// Displays versions of EssentialsX and related plugins.
|
||||
private void runVersion(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception {
|
||||
if (sender.isPlayer() && !ess.getUser(sender.getPlayer()).isAuthorized("essentials.version")) return;
|
||||
|
||||
boolean isMismatched = false;
|
||||
@@ -369,47 +368,101 @@ public class Commandessentials extends EssentialsCommand {
|
||||
protected List<String> getTabCompleteOptions(final Server server, final CommandSource sender, final String commandLabel, final String[] args) {
|
||||
if (args.length == 1) {
|
||||
List<String> options = Lists.newArrayList();
|
||||
options.add("reload");
|
||||
options.add("debug");
|
||||
//options.add("nya");
|
||||
//options.add("moo");
|
||||
options.add("commands");
|
||||
options.add("version");
|
||||
options.add("reload");
|
||||
options.add("reset");
|
||||
options.add("cleanup");
|
||||
//options.add("uuidconvert");
|
||||
//options.add("uuidtest");
|
||||
options.add("version");
|
||||
//options.add("nya");
|
||||
//options.add("moo");
|
||||
return options;
|
||||
} else if (args[0].equalsIgnoreCase("debug")) {
|
||||
// No args
|
||||
} else if (args[0].equalsIgnoreCase("nya")) {
|
||||
// No args
|
||||
} else if (args[0].equalsIgnoreCase("moo")) {
|
||||
if (args.length == 2) {
|
||||
return Lists.newArrayList("moo");
|
||||
}
|
||||
} else if (args[0].equalsIgnoreCase("reset")) {
|
||||
if (args.length == 2) {
|
||||
return getPlayers(server, sender);
|
||||
}
|
||||
} else if (args[0].equalsIgnoreCase("cleanup")) {
|
||||
if (args.length == 2) {
|
||||
return COMMON_DURATIONS;
|
||||
} else if (args.length == 3 || args.length == 4) {
|
||||
return Lists.newArrayList("-1", "0");
|
||||
}
|
||||
} else if (args[0].equalsIgnoreCase("uuidconvert")) {
|
||||
if (args.length == 2) {
|
||||
return Lists.newArrayList("ignoreUFCache");
|
||||
}
|
||||
} else if (args[0].equalsIgnoreCase("uuidtest")) {
|
||||
if (args.length == 2) {
|
||||
return getPlayers(server, sender);
|
||||
}
|
||||
} else if (args[0].equalsIgnoreCase("version")) {
|
||||
// No args
|
||||
} else {
|
||||
// No args
|
||||
}
|
||||
|
||||
switch (args[0]) {
|
||||
case "moo":
|
||||
if (args.length == 2) {
|
||||
return Lists.newArrayList("moo");
|
||||
}
|
||||
break;
|
||||
case "reset":
|
||||
case "uuidtest":
|
||||
if (args.length == 2) {
|
||||
return getPlayers(server, sender);
|
||||
}
|
||||
break;
|
||||
case "cleanup":
|
||||
if (args.length == 2) {
|
||||
return COMMON_DURATIONS;
|
||||
} else if (args.length == 3 || args.length == 4) {
|
||||
return Lists.newArrayList("-1", "0");
|
||||
}
|
||||
break;
|
||||
case "uuidconvert":
|
||||
if (args.length == 2) {
|
||||
return Lists.newArrayList("ignoreUFCache");
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
private static class TuneRunnable extends BukkitRunnable {
|
||||
private static final Map<String, Float> noteMap = ImmutableMap.<String, Float>builder()
|
||||
.put("1F#", 0.5f)
|
||||
.put("1G", 0.53f)
|
||||
.put("1G#", 0.56f)
|
||||
.put("1A", 0.6f)
|
||||
.put("1A#", 0.63f)
|
||||
.put("1B", 0.67f)
|
||||
.put("1C", 0.7f)
|
||||
.put("1C#", 0.76f)
|
||||
.put("1D", 0.8f)
|
||||
.put("1D#", 0.84f)
|
||||
.put("1E", 0.9f)
|
||||
.put("1F", 0.94f)
|
||||
.put("2F#", 1.0f)
|
||||
.put("2G", 1.06f)
|
||||
.put("2G#", 1.12f)
|
||||
.put("2A", 1.18f)
|
||||
.put("2A#", 1.26f)
|
||||
.put("2B", 1.34f)
|
||||
.put("2C", 1.42f)
|
||||
.put("2C#", 1.5f)
|
||||
.put("2D", 1.6f)
|
||||
.put("2D#", 1.68f)
|
||||
.put("2E", 1.78f)
|
||||
.put("2F", 1.88f)
|
||||
.build();
|
||||
|
||||
private final String[] tune;
|
||||
private final Sound sound;
|
||||
private final Supplier<Collection<Player>> players;
|
||||
private int i = 0;
|
||||
|
||||
TuneRunnable(final String tuneStr, final Sound sound, final Supplier<Collection<Player>> players) {
|
||||
this.tune = tuneStr.split(",");
|
||||
this.sound = sound;
|
||||
this.players = players;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
final String note = tune[i];
|
||||
i++;
|
||||
if (i >= tune.length) {
|
||||
cancel();
|
||||
}
|
||||
if (note == null || note.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (Player onlinePlayer : players.get()) {
|
||||
onlinePlayer.playSound(onlinePlayer.getLocation(), sound, 1, noteMap.get(note));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,9 @@
|
||||
package com.earth2me.essentials.commands;
|
||||
|
||||
import com.earth2me.essentials.User;
|
||||
import com.earth2me.essentials.utils.FloatUtil;
|
||||
import com.earth2me.essentials.utils.VersionUtil;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.Lists;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.entity.*;
|
||||
@@ -8,48 +11,86 @@ import org.bukkit.util.Vector;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.earth2me.essentials.I18n.tl;
|
||||
|
||||
public class Commandfireball extends EssentialsCommand {
|
||||
private static final Map<String, Class<? extends Projectile>> types;
|
||||
|
||||
static {
|
||||
ImmutableMap.Builder<String, Class<? extends Projectile>> builder = ImmutableMap.<String, Class<? extends Projectile>>builder()
|
||||
.put("fireball", Fireball.class)
|
||||
.put("small", SmallFireball.class)
|
||||
.put("large", LargeFireball.class)
|
||||
.put("arrow", Arrow.class)
|
||||
.put("skull", WitherSkull.class)
|
||||
.put("egg", Egg.class)
|
||||
.put("snowball", Snowball.class)
|
||||
.put("expbottle", ThrownExpBottle.class)
|
||||
.put("splashpotion", SplashPotion.class)
|
||||
.put("lingeringpotion", LingeringPotion.class);
|
||||
|
||||
if (VersionUtil.getServerBukkitVersion().isHigherThanOrEqualTo(VersionUtil.v1_9_R01)) {
|
||||
builder.put("dragon", DragonFireball.class);
|
||||
}
|
||||
|
||||
if (VersionUtil.getServerBukkitVersion().isHigherThanOrEqualTo(VersionUtil.v1_13_0_R01)) {
|
||||
builder.put("trident", Trident.class);
|
||||
}
|
||||
|
||||
types = builder.build();
|
||||
}
|
||||
|
||||
public Commandfireball() {
|
||||
super("fireball");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception {
|
||||
Class<? extends Entity> type = Fireball.class;
|
||||
Projectile projectile;
|
||||
int speed = 2;
|
||||
if (args.length > 0) {
|
||||
if (args[0].equalsIgnoreCase("small")) {
|
||||
type = SmallFireball.class;
|
||||
} else if (args[0].equalsIgnoreCase("arrow")) {
|
||||
type = Arrow.class;
|
||||
} else if (args[0].equalsIgnoreCase("skull")) {
|
||||
type = WitherSkull.class;
|
||||
} else if (args[0].equalsIgnoreCase("egg")) {
|
||||
type = Egg.class;
|
||||
} else if (args[0].equalsIgnoreCase("snowball")) {
|
||||
type = Snowball.class;
|
||||
} else if (args[0].equalsIgnoreCase("expbottle")) {
|
||||
type = ThrownExpBottle.class;
|
||||
} else if (args[0].equalsIgnoreCase("large")) {
|
||||
type = LargeFireball.class;
|
||||
} else if (args[0].equalsIgnoreCase("splashpotion")) {
|
||||
type = SplashPotion.class;
|
||||
} else if (args[0].equalsIgnoreCase("lingeringpotion")) {
|
||||
type = LingeringPotion.class;
|
||||
String type = "fireball";
|
||||
double speed = 2;
|
||||
boolean ride = false;
|
||||
|
||||
if (args.length > 0 && types.containsKey(args[0])) {
|
||||
type = args[0];
|
||||
}
|
||||
|
||||
if (args.length > 1) {
|
||||
try {
|
||||
speed = FloatUtil.parseDouble(args[1]);
|
||||
speed = Double.max(0, Double.min(speed, ess.getSettings().getMaxProjectileSpeed()));
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
}
|
||||
|
||||
if (args.length > 2 && args[2].equalsIgnoreCase("ride") && user.isAuthorized("essentials.fireball.ride")) {
|
||||
ride = true;
|
||||
}
|
||||
|
||||
if (!user.isAuthorized("essentials.fireball." + type)) {
|
||||
throw new Exception(tl("noPerm", "essentials.fireball." + type));
|
||||
}
|
||||
|
||||
final Vector direction = user.getBase().getEyeLocation().getDirection().multiply(speed);
|
||||
projectile = (Projectile) user.getWorld().spawn(user.getBase().getEyeLocation().add(direction.getX(), direction.getY(), direction.getZ()), type);
|
||||
Projectile projectile = user.getWorld().spawn(user.getBase().getEyeLocation().add(direction.getX(), direction.getY(), direction.getZ()), types.get(type));
|
||||
projectile.setShooter(user.getBase());
|
||||
projectile.setVelocity(direction);
|
||||
|
||||
if (ride) {
|
||||
projectile.addPassenger(user.getBase());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<String> getTabCompleteOptions(final Server server, final User user, final String commandLabel, final String[] args) {
|
||||
if (args.length == 1) {
|
||||
return Lists.newArrayList("small", "arrow", "skull", "egg", "snowball", "expbottle", "large", "splashpotion", "lingeringpotion");
|
||||
return types.keySet().stream()
|
||||
.filter(type -> user.isAuthorized("essentials.fireball." + type))
|
||||
.collect(Collectors.toList());
|
||||
} else if (args.length == 2) {
|
||||
return Lists.newArrayList("1", "2", "3", "4", "5");
|
||||
} else {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@@ -35,6 +35,10 @@ public class Commandhat extends EssentialsCommand {
|
||||
} else {
|
||||
final ItemStack hand = user.getItemInHand();
|
||||
if (hand != null && hand.getType() != Material.AIR) {
|
||||
if (user.isAuthorized("essentials.hat.prevent-type." + hand.getType().name().toLowerCase())) {
|
||||
user.sendMessage(tl("hatFail"));
|
||||
return;
|
||||
}
|
||||
if (hand.getType().getMaxDurability() == 0) {
|
||||
final PlayerInventory inv = user.getBase().getInventory();
|
||||
final ItemStack head = inv.getHelmet();
|
||||
|
||||
@@ -53,7 +53,11 @@ public class Commandhome extends EssentialsCommand {
|
||||
Location bed = player.getBase().getBedSpawnLocation();
|
||||
final List<String> homes = player.getHomes();
|
||||
if (homes.isEmpty() && player.equals(user)) {
|
||||
user.getTeleport().respawn(charge, TeleportCause.COMMAND);
|
||||
if (ess.getSettings().isSpawnIfNoHome()) {
|
||||
user.getTeleport().respawn(charge, TeleportCause.COMMAND);
|
||||
} else {
|
||||
throw new Exception(tl("noHomeSetPlayer"));
|
||||
}
|
||||
} else if (homes.isEmpty()) {
|
||||
throw new Exception(tl("noHomeSetPlayer"));
|
||||
} else if (homes.size() == 1 && player.equals(user)) {
|
||||
|
||||
@@ -83,10 +83,17 @@ public class Commandnick extends EssentialsLoopCommand {
|
||||
throw new Exception(tl("nickNamesAlpha"));
|
||||
} else if (user != null && (user.isAuthorized("essentials.nick.changecolors") && !user.isAuthorized("essentials.nick.changecolors.bypass")) && !FormatUtil.stripFormat(newNick).equals(user.getName())) {
|
||||
throw new Exception(tl("nickNamesOnlyColorChanges"));
|
||||
} else if (user != null && !user.isAuthorized("essentials.nick.blacklist.bypass") && isNickBanned(newNick)) {
|
||||
throw new Exception(tl("nickNameBlacklist", nick));
|
||||
}
|
||||
return newNick;
|
||||
}
|
||||
|
||||
private boolean isNickBanned(String newNick) {
|
||||
return ess.getSettings().getNickBlacklist().stream()
|
||||
.anyMatch(entry -> entry.test(newNick));
|
||||
}
|
||||
|
||||
private int getNickLength(final String nick) {
|
||||
return ess.getSettings().ignoreColorsInMaxLength() ? ChatColor.stripColor(nick).length() : nick.length();
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ import com.earth2me.essentials.utils.StringUtil;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import net.ess3.api.MaxMoneyException;
|
||||
import net.ess3.api.events.UserBalanceUpdateEvent;
|
||||
import org.bukkit.Server;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
@@ -73,7 +74,7 @@ public class Commandpay extends EssentialsLoopCommand {
|
||||
user.getConfirmingPayments().put(player, amount);
|
||||
return;
|
||||
}
|
||||
user.payUser(player, amount);
|
||||
user.payUser(player, amount, UserBalanceUpdateEvent.Cause.COMMAND_PAY);
|
||||
user.getConfirmingPayments().remove(player);
|
||||
Trade.log("Command", "Pay", "Player", user.getName(), new Trade(amount, ess), player.getName(), new Trade(amount, ess), user.getLocation(), ess);
|
||||
} catch (MaxMoneyException ex) {
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.earth2me.essentials.Trade;
|
||||
import com.earth2me.essentials.User;
|
||||
import com.earth2me.essentials.utils.NumberUtil;
|
||||
import com.google.common.collect.Lists;
|
||||
import net.ess3.api.events.UserBalanceUpdateEvent;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
@@ -94,7 +95,7 @@ public class Commandsell extends EssentialsCommand {
|
||||
user.getBase().getInventory().removeItem(ris);
|
||||
user.getBase().updateInventory();
|
||||
Trade.log("Command", "Sell", "Item", user.getName(), new Trade(ris, ess), user.getName(), new Trade(result, ess), user.getLocation(), ess);
|
||||
user.giveMoney(result);
|
||||
user.giveMoney(result, null, UserBalanceUpdateEvent.Cause.COMMAND_SELL);
|
||||
user.sendMessage(tl("itemSold", NumberUtil.displayCurrency(result, ess), amount, is.getType().toString().toLowerCase(Locale.ENGLISH), NumberUtil.displayCurrency(worth, ess)));
|
||||
logger.log(Level.INFO, tl("itemSoldConsole", user.getDisplayName(), is.getType().toString().toLowerCase(Locale.ENGLISH), NumberUtil.displayCurrency(result, ess), amount, NumberUtil.displayCurrency(worth, ess)));
|
||||
return result;
|
||||
|
||||
@@ -44,6 +44,6 @@ public class Commandunbanip extends EssentialsCommand {
|
||||
final String senderName = sender.isPlayer() ? sender.getPlayer().getDisplayName() : Console.NAME;
|
||||
server.getLogger().log(Level.INFO, tl("playerUnbanIpAddress", senderName, ipAddress));
|
||||
|
||||
ess.broadcastMessage("essentials.ban.notify", tl("playerUnbanIpAddress", senderName, ipAddress));
|
||||
ess.broadcastMessage("essentials.banip.notify", tl("playerUnbanIpAddress", senderName, ipAddress));
|
||||
}
|
||||
}
|
||||
@@ -5,8 +5,10 @@ import org.bukkit.Material;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Set;
|
||||
|
||||
import static com.earth2me.essentials.I18n.tl;
|
||||
|
||||
@@ -32,14 +34,10 @@ public class Commandunlimited extends EssentialsCommand {
|
||||
final String list = getList(target);
|
||||
user.sendMessage(list);
|
||||
} else if (args[0].equalsIgnoreCase("clear")) {
|
||||
final List<Material> itemList = target.getUnlimited();
|
||||
final Set<Material> itemList = new HashSet<>(target.getUnlimited());
|
||||
|
||||
int index = 0;
|
||||
while (itemList.size() > index) {
|
||||
final Material item = itemList.get(index);
|
||||
if (!toggleUnlimited(user, target, item.toString())) {
|
||||
index++;
|
||||
}
|
||||
for (Material m : itemList) {
|
||||
toggleUnlimited(user, target, m.toString());
|
||||
}
|
||||
} else {
|
||||
toggleUnlimited(user, target, args[0]);
|
||||
@@ -50,7 +48,7 @@ public class Commandunlimited extends EssentialsCommand {
|
||||
final StringBuilder output = new StringBuilder();
|
||||
output.append(tl("unlimitedItems")).append(" ");
|
||||
boolean first = true;
|
||||
final List<Material> items = target.getUnlimited();
|
||||
final Set<Material> items = target.getUnlimited();
|
||||
if (items.isEmpty()) {
|
||||
output.append(tl("none"));
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.earth2me.essentials.ChargeException;
|
||||
import com.earth2me.essentials.CommandSource;
|
||||
import com.earth2me.essentials.User;
|
||||
import com.earth2me.essentials.utils.FormatUtil;
|
||||
import com.earth2me.essentials.utils.StringUtil;
|
||||
import net.ess3.api.MaxMoneyException;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -23,7 +24,11 @@ public abstract class EssentialsLoopCommand extends EssentialsCommand {
|
||||
throw new PlayerNotFoundException();
|
||||
}
|
||||
|
||||
if (matchWildcards && searchTerm.contentEquals("**")) {
|
||||
final UUID uuid = StringUtil.toUUID(searchTerm);
|
||||
if (uuid != null) {
|
||||
final User matchedUser = ess.getUser(uuid);
|
||||
updatePlayer(server, sender, matchedUser, commandArgs);
|
||||
} else if (matchWildcards && searchTerm.contentEquals("**")) {
|
||||
for (UUID sUser : ess.getUserMap().getAllUniqueUsers()) {
|
||||
final User matchedUser = ess.getUser(sUser);
|
||||
updatePlayer(server, sender, matchedUser, commandArgs);
|
||||
|
||||
@@ -18,6 +18,7 @@ import org.bukkit.util.Vector;
|
||||
import java.io.File;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.function.Predicate;
|
||||
@@ -152,6 +153,31 @@ public class FakeWorld implements World {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addPluginChunkTicket(int i, int i1, Plugin plugin) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removePluginChunkTicket(int i, int i1, Plugin plugin) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removePluginChunkTickets(Plugin plugin) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<Plugin> getPluginChunkTickets(int i, int i1) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<Plugin, Collection<Chunk>> getPluginChunkTickets() {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item dropItem(Location lctn, ItemStack is) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
@@ -351,6 +377,21 @@ public class FakeWorld implements World {
|
||||
public boolean createExplosion(Location lctn, float f, boolean bln) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean createExplosion(double d, double d1, double d2, float f, boolean bln, boolean bln1, Entity entity) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean createExplosion(Location lctn, float f, boolean bln, boolean bln1) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean createExplosion(Location lctn, float f, boolean bln, boolean bln1, Entity entity) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T extends Entity> T spawn(Location lctn, Class<T> type) throws IllegalArgumentException {
|
||||
@@ -407,21 +448,56 @@ public class FakeWorld implements World {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getHighestBlockYAt(int i, int i1, HeightMap heightMap) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getHighestBlockYAt(Location location, HeightMap heightMap) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Block getHighestBlockAt(int i, int i1, HeightMap heightMap) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Block getHighestBlockAt(Location location, HeightMap heightMap) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Biome getBiome(int i, int i1) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Biome getBiome(int i, int i1, int i2) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getTemperature(int i, int i1) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getTemperature(int i, int i1, int i2) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getHumidity(int i, int i1) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getHumidity(int i, int i1, int i2) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean unloadChunk(Chunk chunk) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
@@ -497,6 +573,16 @@ public class FakeWorld implements World {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isHardcore() {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setHardcore(boolean hardcore) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getTicksPerAnimalSpawns() {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
@@ -562,6 +648,11 @@ public class FakeWorld implements World {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBiome(int i, int i1, int i2, Biome biome) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMonsterSpawnLimit() {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
@@ -742,6 +833,16 @@ public class FakeWorld implements World {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Raid locateNearestRaid(Location location, int radius) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Raid> getRaids() {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Entity> getNearbyEntities(Location loc, double x, double y, double z) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
|
||||
@@ -0,0 +1,89 @@
|
||||
package com.earth2me.essentials.items;
|
||||
|
||||
import com.earth2me.essentials.Essentials;
|
||||
import com.earth2me.essentials.EssentialsConf;
|
||||
import com.earth2me.essentials.IConf;
|
||||
import java.io.File;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import net.ess3.api.IItemDb;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class CustomItemResolver implements IItemDb.ItemResolver, IConf {
|
||||
private final EssentialsConf config;
|
||||
private final Essentials ess;
|
||||
private final HashMap<String, String> map = new HashMap<>();
|
||||
|
||||
public CustomItemResolver(Essentials ess) {
|
||||
config = new EssentialsConf(new File(ess.getDataFolder(), "custom_items.yml"));
|
||||
this.ess = ess;
|
||||
config.setTemplateName("/custom_items.yml");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack apply(String item) {
|
||||
if (map.containsKey(item)) {
|
||||
try {
|
||||
return ess.getItemDb().get(map.get(item));
|
||||
} catch (Exception ignored) {}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<String> getNames() {
|
||||
return map.keySet();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reloadConfig() {
|
||||
map.clear();
|
||||
config.load();
|
||||
|
||||
ConfigurationSection section = config.getConfigurationSection("aliases");
|
||||
if (section == null || section.getKeys(false).isEmpty()) {
|
||||
ess.getLogger().warning("No aliases found in custom_items.yml.");
|
||||
return;
|
||||
}
|
||||
|
||||
for (String alias : section.getKeys(false)) {
|
||||
if (!section.isString(alias)) continue;
|
||||
String target = section.getString(alias);
|
||||
|
||||
if (target != null && !section.contains(target) && existsInItemDb(target)) {
|
||||
map.put(alias, target);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setAlias(String alias, String target) {
|
||||
if (map.containsKey(alias) && map.get(alias).equalsIgnoreCase(target)) {
|
||||
return;
|
||||
}
|
||||
|
||||
map.put(alias, target);
|
||||
save();
|
||||
}
|
||||
|
||||
public void removeAlias(String alias) {
|
||||
if (map.remove(alias) != null) {
|
||||
save();
|
||||
}
|
||||
}
|
||||
|
||||
private void save() {
|
||||
config.setProperty("aliases", map);
|
||||
config.save();
|
||||
}
|
||||
|
||||
private boolean existsInItemDb(String item) {
|
||||
try {
|
||||
ess.getItemDb().get(item);
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -249,7 +249,7 @@ public class LegacyItemDb extends AbstractItemDb {
|
||||
|
||||
@Override
|
||||
public Collection<String> listNames() {
|
||||
Collection<String> values = primaryName.values();
|
||||
Collection<String> values = new ArrayList<>(primaryName.values());
|
||||
values.addAll(getResolverNames());
|
||||
return values;
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@ public class PermissionsHandler implements IPermissionsHandler {
|
||||
public void checkPermissions() {
|
||||
// load and assign a handler
|
||||
List<Class<? extends SuperpermsHandler>> providerClazz = Arrays.asList(
|
||||
PermissionsExHandler.class,
|
||||
ModernVaultHandler.class,
|
||||
GenericVaultHandler.class,
|
||||
SuperpermsHandler.class
|
||||
);
|
||||
|
||||
@@ -46,23 +46,31 @@ public abstract class AbstractVaultHandler extends SuperpermsHandler {
|
||||
@Override
|
||||
public String getPrefix(final Player base) {
|
||||
String playerPrefix = chat.getPlayerPrefix(base);
|
||||
if (playerPrefix == null) {
|
||||
String playerGroup = perms.getPrimaryGroup(base);
|
||||
return chat.getGroupPrefix(base.getWorld().getName(), playerGroup);
|
||||
} else {
|
||||
if (playerPrefix != null) {
|
||||
return playerPrefix;
|
||||
}
|
||||
|
||||
String playerGroup = perms.getPrimaryGroup(base);
|
||||
if (playerGroup != null) {
|
||||
return chat.getGroupPrefix(base.getWorld().getName(), playerGroup);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSuffix(final Player base) {
|
||||
String playerSuffix = chat.getPlayerSuffix(base);
|
||||
if (playerSuffix == null) {
|
||||
String playerGroup = perms.getPrimaryGroup(base);
|
||||
return chat.getGroupSuffix(base.getWorld().getName(), playerGroup);
|
||||
} else {
|
||||
if (playerSuffix != null) {
|
||||
return playerSuffix;
|
||||
}
|
||||
|
||||
String playerGroup = perms.getPrimaryGroup(base);
|
||||
if (playerGroup != null) {
|
||||
return chat.getGroupSuffix(base.getWorld().getName(), playerGroup);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
boolean canLoad() {
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.earth2me.essentials.perm.impl;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class ModernVaultHandler extends AbstractVaultHandler {
|
||||
private final List<String> supportedPlugins = Arrays.asList("PermissionsEx", "LuckPerms");
|
||||
|
||||
@Override
|
||||
protected boolean emulateWildcards() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBuild(final Player base, final String group) {
|
||||
Objects.requireNonNull(base, "Can't check build override for nonexistent player!");
|
||||
return super.canBuild(base, group) || chat.getPlayerInfoBoolean(base.getWorld().getName(), base, "build", false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean tryProvider() {
|
||||
return super.canLoad() && supportedPlugins.contains(getEnabledPermsPlugin());
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
package com.earth2me.essentials.perm.impl;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class PermissionsExHandler extends AbstractVaultHandler {
|
||||
@Override
|
||||
public boolean canBuild(final Player base, final String group) {
|
||||
return base != null && chat.getPlayerInfoBoolean(base.getWorld().getName(), base, "build", false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean tryProvider() {
|
||||
return super.canLoad() && Bukkit.getPluginManager().getPlugin("PermissionsEx") != null;
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,10 @@ import java.util.List;
|
||||
|
||||
|
||||
public class SuperpermsHandler implements IPermissionsHandler {
|
||||
protected boolean emulateWildcards() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGroup(final Player base) {
|
||||
return null;
|
||||
@@ -22,7 +26,7 @@ public class SuperpermsHandler implements IPermissionsHandler {
|
||||
|
||||
@Override
|
||||
public boolean canBuild(final Player base, final String group) {
|
||||
return false;
|
||||
return hasPermission(base, "essentials.build");
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -32,6 +36,10 @@ public class SuperpermsHandler implements IPermissionsHandler {
|
||||
|
||||
@Override
|
||||
public boolean hasPermission(final Player base, String node) {
|
||||
if (!emulateWildcards()) {
|
||||
return base.hasPermission(node);
|
||||
}
|
||||
|
||||
String permCheck = node;
|
||||
int index;
|
||||
while (true) {
|
||||
|
||||
@@ -448,7 +448,7 @@ public class EssentialsSign {
|
||||
try {
|
||||
final WallSign signData = (WallSign) block.getState().getBlockData();
|
||||
return signData.getFacing();
|
||||
} catch (NoClassDefFoundError e) {
|
||||
} catch (NoClassDefFoundError | NoSuchMethodError e) {
|
||||
final org.bukkit.material.Sign signMat = (org.bukkit.material.Sign) block.getState().getData();
|
||||
return signMat.getFacing();
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.earth2me.essentials.utils;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Locale;
|
||||
import java.util.UUID;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
|
||||
@@ -73,6 +74,14 @@ public class StringUtil {
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
public static UUID toUUID(String input) {
|
||||
try {
|
||||
return UUID.fromString(input);
|
||||
} catch (IllegalArgumentException ignored) {}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private StringUtil() {
|
||||
}
|
||||
}
|
||||
@@ -21,11 +21,12 @@ public class VersionUtil {
|
||||
public static final BukkitVersion v1_13_0_R01 = BukkitVersion.fromString("1.13.0-R0.1-SNAPSHOT");
|
||||
public static final BukkitVersion v1_13_2_R01 = BukkitVersion.fromString("1.13.2-R0.1-SNAPSHOT");
|
||||
public static final BukkitVersion v1_14_R01 = BukkitVersion.fromString("1.14-R0.1-SNAPSHOT");
|
||||
public static final BukkitVersion v1_14_1_R01 = BukkitVersion.fromString("1.14.1-R0.1-SNAPSHOT");
|
||||
public static final BukkitVersion v1_14_2_R01 = BukkitVersion.fromString("1.14.2-R0.1-SNAPSHOT");
|
||||
public static final BukkitVersion v1_14_3_R01 = BukkitVersion.fromString("1.14.3-R0.1-SNAPSHOT");
|
||||
public static final BukkitVersion v1_14_4_R01 = BukkitVersion.fromString("1.14.4-R0.1-SNAPSHOT");
|
||||
public static final BukkitVersion v1_15_R01 = BukkitVersion.fromString("1.15-R0.1-SNAPSHOT");
|
||||
public static final BukkitVersion v1_15_1_R01 = BukkitVersion.fromString("1.15.1-R0.1-SNAPSHOT");
|
||||
public static final BukkitVersion v1_15_2_R01 = BukkitVersion.fromString("1.15.2-R0.1-SNAPSHOT");
|
||||
|
||||
private static final Set<BukkitVersion> supportedVersions = ImmutableSet.of(v1_8_8_R01, v1_9_4_R01, v1_10_2_R01, v1_11_2_R01, v1_12_2_R01, v1_13_2_R01, v1_14_3_R01);
|
||||
private static final Set<BukkitVersion> supportedVersions = ImmutableSet.of(v1_8_8_R01, v1_9_4_R01, v1_10_2_R01, v1_11_2_R01, v1_12_2_R01, v1_13_2_R01, v1_14_4_R01, v1_15_2_R01);
|
||||
|
||||
private static BukkitVersion serverVersion = null;
|
||||
|
||||
|
||||
@@ -32,6 +32,12 @@ nickname-prefix: '~'
|
||||
# The maximum length allowed in nicknames. The nickname prefix is included in this.
|
||||
max-nick-length: 15
|
||||
|
||||
# A list of phrases that cannot be used in nicknames. You can include regular expressions here.
|
||||
# Users with essentials.nick.blacklist.bypass will be able to bypass this filter.
|
||||
nick-blacklist:
|
||||
#- Notch
|
||||
#- '^Dinnerbone'
|
||||
|
||||
# When this option is enabled, nickname length checking will exclude color codes in player names.
|
||||
# ie: "&6Notch" has 7 characters (2 are part of a color code), a length of 5 is used when this option is set to true
|
||||
ignore-colors-in-max-nick-length: false
|
||||
@@ -497,7 +503,7 @@ last-message-reply-recipient: true
|
||||
# Default is 180 (3 minutes)
|
||||
last-message-reply-recipient-timeout: 180
|
||||
|
||||
# Toggles whether or not clicking mobs with a milk bucket turns them into a baby.
|
||||
# Toggles whether or not left clicking mobs with a milk bucket turns them into a baby.
|
||||
milk-bucket-easter-egg: true
|
||||
|
||||
# Toggles whether or not the fly status message should be sent to players on join
|
||||
@@ -568,6 +574,10 @@ is-water-safe: false
|
||||
# You should only change this to false if you use Minecraft China.
|
||||
safe-usermap-names: true
|
||||
|
||||
# Should Essentials output logs when a command block executes a command?
|
||||
# Example: CommandBlock at <x>,<y>,<z> issued server command: /<command>
|
||||
log-command-block-commands: true
|
||||
|
||||
############################################################
|
||||
# +------------------------------------------------------+ #
|
||||
# | EssentialsHome | #
|
||||
@@ -604,6 +614,9 @@ sethome-multiple:
|
||||
# change the compass' direction to point towards their first home.
|
||||
compass-towards-home-perm: false
|
||||
|
||||
# Set the maximum speed for projectiles spawned with /fireball.
|
||||
max-projectile-speed: 8
|
||||
|
||||
############################################################
|
||||
# +------------------------------------------------------+ #
|
||||
# | EssentialsEco | #
|
||||
@@ -700,10 +713,11 @@ chat:
|
||||
#format: '&7{PREFIX}&r {DISPLAYNAME}&r &7{SUFFIX}&r: {MESSAGE}'
|
||||
|
||||
group-formats:
|
||||
# Default: '{WORLDNAME} {DISPLAYNAME}&7:&r {MESSAGE}'
|
||||
# Admins: '{WORLDNAME} &c[{GROUP}]&r {DISPLAYNAME}&7:&c {MESSAGE}'
|
||||
# default: '{WORLDNAME} {DISPLAYNAME}&7:&r {MESSAGE}'
|
||||
# admins: '{WORLDNAME} &c[{GROUP}]&r {DISPLAYNAME}&7:&c {MESSAGE}'
|
||||
|
||||
# If you are using group formats make sure to remove the '#' to allow the setting to be read.
|
||||
# Note: Group names are case-sensitive so you must match them up with your permission plugin.
|
||||
|
||||
############################################################
|
||||
# +------------------------------------------------------+ #
|
||||
@@ -745,6 +759,22 @@ protect:
|
||||
# Monsters won't follow players.
|
||||
# permission essentials.protect.entitytarget.bypass disables this.
|
||||
entitytarget: false
|
||||
# Prevent certain transformations.
|
||||
transformation:
|
||||
# Prevent creepers becoming charged when struck by lightning.
|
||||
charged-creeper: false
|
||||
# Prevent villagers becoming zombie villagers.
|
||||
zombie-villager: false
|
||||
# Prevent zombie villagers being cured.
|
||||
villager: false
|
||||
# Prevent villagers becoming witches when struck by lightning.
|
||||
witch: false
|
||||
# Prevent pigs becoming zombie pigmen when struck by lightning.
|
||||
zombie-pigman: false
|
||||
# Prevent zombies turning into drowneds, and husks turning into zombies.
|
||||
drowned: false
|
||||
# Prevent mooshrooms changing colour when struck by lightning.
|
||||
mooshroom: false
|
||||
# Prevent the spawning of creatures.
|
||||
spawn:
|
||||
creeper: false
|
||||
@@ -776,6 +806,7 @@ protect:
|
||||
bat: false
|
||||
witch: false
|
||||
horse: false
|
||||
phantom: false
|
||||
|
||||
# Maximum height the creeper should explode. -1 allows them to explode everywhere.
|
||||
# Set prevent.creeper-explosion to true, if you want to disable creeper explosions.
|
||||
@@ -907,6 +938,9 @@ spawn-join-listener-priority: high
|
||||
# When users die, should they respawn at their first home or bed, instead of the spawnpoint?
|
||||
respawn-at-home: false
|
||||
|
||||
# If no home is set, would you like to send the player to spawn? (Only applies to /home)
|
||||
spawn-if-no-home: true
|
||||
|
||||
# Teleport all joining players to the spawnpoint
|
||||
spawn-on-join: false
|
||||
# The following value of `guests` states that all players in group `guests` will be teleported to spawn when joining.
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
# This file stores custom item aliases.
|
||||
# We recommend you use the `/itemdb alias` command to manage these.
|
||||
|
||||
# NOTE: If you try and alias an item to another entry in this file, the alias won't work.
|
||||
aliases:
|
||||
bluepaint: blue_dye
|
||||
snad: sand
|
||||
breakfast: cooked_porkchop
|
||||
+93
-10
@@ -114,7 +114,10 @@
|
||||
"atrunksapling": "acacia_sapling",
|
||||
"awoodsapling": "acacia_sapling",
|
||||
"acacia_sign": {
|
||||
"material": "ACACIA_SIGN"
|
||||
"material": "ACACIA_SIGN",
|
||||
"fallbacks": [
|
||||
"SIGN"
|
||||
]
|
||||
},
|
||||
"acaciasign": "acacia_sign",
|
||||
"acacia_slab": {
|
||||
@@ -633,7 +636,10 @@
|
||||
"wtrunksapling": "birch_sapling",
|
||||
"wwoodsapling": "birch_sapling",
|
||||
"birch_sign": {
|
||||
"material": "BIRCH_SIGN"
|
||||
"material": "BIRCH_SIGN",
|
||||
"fallbacks": [
|
||||
"SIGN"
|
||||
]
|
||||
},
|
||||
"birchsign": "birch_sign",
|
||||
"birch_slab": {
|
||||
@@ -2637,7 +2643,10 @@
|
||||
"dotrunksapling": "dark_oak_sapling",
|
||||
"dowoodsapling": "dark_oak_sapling",
|
||||
"dark_oak_sign": {
|
||||
"material": "DARK_OAK_SIGN"
|
||||
"material": "DARK_OAK_SIGN",
|
||||
"fallbacks": [
|
||||
"SIGN"
|
||||
]
|
||||
},
|
||||
"darkoaksign": "dark_oak_sign",
|
||||
"dark_oak_slab": {
|
||||
@@ -4120,7 +4129,10 @@
|
||||
"darkgreencdust": "green_concrete_powder",
|
||||
"darkgreencp": "green_concrete_powder",
|
||||
"green_dye": {
|
||||
"material": "GREEN_DYE"
|
||||
"material": "GREEN_DYE",
|
||||
"fallbacks": [
|
||||
"CACTUS_GREEN"
|
||||
]
|
||||
},
|
||||
"greendye": "green_dye",
|
||||
"green_glazed_terracotta": {
|
||||
@@ -5723,7 +5735,10 @@
|
||||
"ftrunksapling": "jungle_sapling",
|
||||
"fwoodsapling": "jungle_sapling",
|
||||
"jungle_sign": {
|
||||
"material": "JUNGLE_SIGN"
|
||||
"material": "JUNGLE_SIGN",
|
||||
"fallbacks": [
|
||||
"SIGN"
|
||||
]
|
||||
},
|
||||
"junglesign": "jungle_sign",
|
||||
"jungle_slab": {
|
||||
@@ -8309,7 +8324,10 @@
|
||||
"otrunksapling": "oak_sapling",
|
||||
"owoodsapling": "oak_sapling",
|
||||
"oak_sign": {
|
||||
"material": "OAK_SIGN"
|
||||
"material": "OAK_SIGN",
|
||||
"fallbacks": [
|
||||
"SIGN"
|
||||
]
|
||||
},
|
||||
"oaksign": "oak_sign",
|
||||
"oak_slab": {
|
||||
@@ -9534,7 +9552,10 @@
|
||||
"redcdust": "red_concrete_powder",
|
||||
"redcp": "red_concrete_powder",
|
||||
"red_dye": {
|
||||
"material": "RED_DYE"
|
||||
"material": "RED_DYE",
|
||||
"fallbacks": [
|
||||
"ROSE_RED"
|
||||
]
|
||||
},
|
||||
"reddye": "red_dye",
|
||||
"red_glazed_terracotta": {
|
||||
@@ -10312,7 +10333,10 @@
|
||||
"strunksapling": "spruce_sapling",
|
||||
"swoodsapling": "spruce_sapling",
|
||||
"spruce_sign": {
|
||||
"material": "SPRUCE_SIGN"
|
||||
"material": "SPRUCE_SIGN",
|
||||
"fallbacks": [
|
||||
"SIGN"
|
||||
]
|
||||
},
|
||||
"sprucesign": "spruce_sign",
|
||||
"spruce_slab": {
|
||||
@@ -11690,7 +11714,10 @@
|
||||
"yellowcdust": "yellow_concrete_powder",
|
||||
"yellowcp": "yellow_concrete_powder",
|
||||
"yellow_dye": {
|
||||
"material": "YELLOW_DYE"
|
||||
"material": "YELLOW_DYE",
|
||||
"fallbacks": [
|
||||
"DANDELION_YELLOW"
|
||||
]
|
||||
},
|
||||
"yellowdye": "yellow_dye",
|
||||
"yellow_glazed_terracotta": {
|
||||
@@ -24794,5 +24821,61 @@
|
||||
"minecraft:light_blue_dye": "light_blue_dye",
|
||||
"minecraft:zombie_villager_spawn_egg": "zombie_villager_spawn_egg",
|
||||
"minecraft:light_gray_bed": "light_gray_bed",
|
||||
"sign": "oak_sign"
|
||||
"sign": "oak_sign",
|
||||
"beehive": {
|
||||
"material": "BEEHIVE"
|
||||
},
|
||||
"minecraft:beehive": "beehive",
|
||||
"bee_nest": {
|
||||
"material": "BEE_NEST"
|
||||
},
|
||||
"beenest": "bee_nest",
|
||||
"minecraft:bee_nest": "bee_nest",
|
||||
"beesegg": "bee_spawn_egg",
|
||||
"beespawn": "bee_spawn_egg",
|
||||
"beespawnegg": "bee_spawn_egg",
|
||||
"eggbee": "bee_spawn_egg",
|
||||
"minecraft:bee_spawn_egg": "bee_spawn_egg",
|
||||
"spawnbee": "bee_spawn_egg",
|
||||
"spawneggbee": "bee_spawn_egg",
|
||||
"bee_spawner": {
|
||||
"entity": "BEE",
|
||||
"material": "SPAWNER"
|
||||
},
|
||||
"beecage": "bee_spawner",
|
||||
"beemcage": "bee_spawner",
|
||||
"beemobcage": "bee_spawner",
|
||||
"beemobspawner": "bee_spawner",
|
||||
"beemonstercage": "bee_spawner",
|
||||
"beemonsterspawner": "bee_spawner",
|
||||
"beemspawner": "bee_spawner",
|
||||
"beespawner": "bee_spawner",
|
||||
"honey_block": {
|
||||
"material": "HONEY_BLOCK"
|
||||
},
|
||||
"honeyblock": "honey_block",
|
||||
"minecraft:honey_block": "honey_block",
|
||||
"honey_bottle": {
|
||||
"material": "HONEY_BOTTLE"
|
||||
},
|
||||
"honeybottle": "honey_bottle",
|
||||
"minecraft:honey_bottle": "honey_bottle",
|
||||
"honeycomb": {
|
||||
"material": "HONEYCOMB"
|
||||
},
|
||||
"minecraft:honeycomb": "honeycomb",
|
||||
"honeycomb_block": {
|
||||
"material": "HONEYCOMB_BLOCK"
|
||||
},
|
||||
"honeycombblock": "honeycomb_block",
|
||||
"minecraft:honeycomb_block": "honeycomb_block",
|
||||
"cactusgreen": "green_dye",
|
||||
"cactus_green": "green_dye",
|
||||
"minecraft:cactus_green": "green_dye",
|
||||
"dandelionyellow": "yellow_dye",
|
||||
"dandelion_yellow": "yellow_dye",
|
||||
"minecraft:dandelion_yellow": "yellow_dye",
|
||||
"rosered": "red_dye",
|
||||
"rose_red": "red_dye",
|
||||
"minecraft:rose_red": "red_dye"
|
||||
}
|
||||
@@ -5,6 +5,7 @@
|
||||
# All kit names should be lower case, and will be treated as lower in permissions/costs.
|
||||
# Syntax: - name[:durability] amount [enchantment:level]... [itemmeta:value]...
|
||||
# For Item Meta information visit http://wiki.ess3.net/wiki/Item_Meta
|
||||
# To make the kit execute a command, add /<command> to the items list. Use {PLAYER} to specify the player receiving the kit.
|
||||
# 'delay' refers to the cooldown between how often you can use each kit, measured in seconds.
|
||||
# Set delay to -1 for a one time kit.
|
||||
# For more information, visit http://wiki.ess3.net/wiki/Kits
|
||||
@@ -23,6 +24,7 @@ kits:
|
||||
- dshovel 1 digspeed:3 name:Dwarf lore:Diggy|Diggy|Hole
|
||||
- lhelm 1 color:255,255,255 name:Top_Hat lore:Good_day,_Good_day
|
||||
- daxe:780 1
|
||||
- /broadcast {PLAYER} just got some fancy tools!
|
||||
notch:
|
||||
delay: 6000
|
||||
items:
|
||||
|
||||
@@ -18,6 +18,10 @@ antiBuildInteract=\u00a74You are not permitted to interact with\u00a7c {0}\u00a7
|
||||
antiBuildPlace=\u00a74You are not permitted to place\u00a7c {0} \u00a74here.
|
||||
antiBuildUse=\u00a74You are not permitted to use\u00a7c {0}\u00a74.
|
||||
autoAfkKickReason=You have been kicked for idling more than {0} minutes.
|
||||
autoTeleportDisabled=\u00a76You are no longer automatically approving teleport requests.
|
||||
autoTeleportDisabledFor=\u00a7c{0}\u00a76 is no longer automatically approving teleport requests.
|
||||
autoTeleportEnabled=\u00a76You are now automatically approving teleport requests.
|
||||
autoTeleportEnabledFor=\u00a7c{0}\u00a76 is now automatically approving teleport requests.
|
||||
backAfterDeath=\u00a76Use the\u00a7c /back\u00a76 command to return to your death point.
|
||||
backOther=\u00a76Returned\u00a7c {0}\u00a76 to previous location.
|
||||
backupDisabled=\u00a74An external backup script has not been configured.
|
||||
@@ -38,7 +42,8 @@ bedNull=\u00a7mbed\u00a7r
|
||||
bedSet=\u00a76Bed spawn set\!
|
||||
bigTreeFailure=\u00a74Big tree generation failure. Try again on grass or dirt.
|
||||
bigTreeSuccess=\u00a76Big tree spawned.
|
||||
blockList=\u00a76Essentials relayed the following commands to another plugin\:
|
||||
blockList=\u00a76EssentialsX is relaying the following commands to other plugins\:
|
||||
blockListEmpty=\u00a76EssentialsX is not relaying any commands to other plugins.
|
||||
bookAuthorSet=\u00a76Author of the book set to {0}.
|
||||
bookLocked=\u00a76This book is now locked.
|
||||
bookTitleSet=\u00a76Title of the book set to {0}.
|
||||
@@ -85,6 +90,7 @@ defaultBanReason=The Ban Hammer has spoken\!
|
||||
deleteFileError=Could not delete file\: {0}
|
||||
deleteHome=\u00a76Home\u00a7c {0} \u00a76has been removed.
|
||||
deleteJail=\u00a76Jail\u00a7c {0} \u00a76has been removed.
|
||||
deleteKit=\u00a76Kit\u00a7c {0} \u00a76has been removed.
|
||||
deleteWarp=\u00a76Warp\u00a7c {0} \u00a76has been removed.
|
||||
deniedAccessCommand=\u00a7c{0} \u00a74was denied access to command.
|
||||
denyBookEdit=\u00a74You cannot unlock this book.
|
||||
@@ -218,7 +224,7 @@ itemNotEnough1=\u00a74You do not have enough of that item to sell.
|
||||
itemNotEnough2=\u00a76If you meant to sell all of your items of that type, use\u00a7c /sell itemname\u00a76.
|
||||
itemNotEnough3=\u00a7c/sell itemname -1\u00a76 will sell all but one item, etc.
|
||||
itemsConverted=\u00a76Converted all items into blocks.
|
||||
itemsCsvNotLoaded=Could not load items.csv\!
|
||||
itemsCsvNotLoaded=Could not load {0}\!
|
||||
itemSellAir=You really tried to sell Air? Put an item in your hand.
|
||||
itemsNotConverted=\u00a74You have no items that can be converted into blocks.
|
||||
itemSold=\u00a7aSold for \u00a7c{0} \u00a7a({1} {2} at {3} each).
|
||||
@@ -317,6 +323,7 @@ negativeBalanceError=\u00a74User is not allowed to have a negative balance.
|
||||
nickChanged=\u00a76Nickname changed.
|
||||
nickDisplayName=\u00a74You have to enable change-displayname in Essentials config.
|
||||
nickInUse=\u00a74That name is already in use.
|
||||
nickNameBlacklist=\u00a74That nickname is not allowed.
|
||||
nickNamesAlpha=\u00a74Nicknames must be alphanumeric.
|
||||
nickNamesOnlyColorChanges=\u00a74Nicknames can only have their colors changed.
|
||||
nickNoMore=\u00a76You no longer have a nickname.
|
||||
@@ -451,7 +458,9 @@ replyLastRecipientDisabledFor=\u00a76Replying to last message recipient \u00a7cd
|
||||
replyLastRecipientEnabled=\u00a76Replying to last message recipient \u00a7cenabled\u00a76.
|
||||
replyLastRecipientEnabledFor=\u00a76Replying to last message recipient \u00a7cenabled \u00a76for \u00a7c{0}\u00a76.
|
||||
requestAccepted=\u00a76Teleport request accepted.
|
||||
requestAcceptedAuto=\u00a76Automatically accepted a teleport request from {0}.
|
||||
requestAcceptedFrom=\u00a7c{0} \u00a76accepted your teleport request.
|
||||
requestAcceptedFromAuto=\u00a7c{0} \u00a76accepted your teleport request automatically.
|
||||
requestDenied=\u00a76Teleport request denied.
|
||||
requestDeniedFrom=\u00a7c{0} \u00a76denied your teleport request.
|
||||
requestSent=\u00a76Request sent to\u00a7c {0}\u00a76.
|
||||
@@ -506,6 +515,7 @@ teleportAll=\u00a76Teleporting all players...
|
||||
teleportationCommencing=\u00a76Teleportation commencing...
|
||||
teleportationDisabled=\u00a76Teleportation \u00a7cdisabled\u00a76.
|
||||
teleportationDisabledFor=\u00a76Teleportation \u00a7cdisabled \u00a76for \u00a7c{0}\u00a76.
|
||||
teleportationDisabledWarning=\u00a76You must enable teleportation before other players can teleport to you.
|
||||
teleportationEnabled=\u00a76Teleportation \u00a7cenabled\u00a76.
|
||||
teleportationEnabledFor=\u00a76Teleportation \u00a7cenabled \u00a76for \u00a7c{0}\u00a76.
|
||||
teleportAtoB=\u00a7c{0}\u00a76 teleported you to \u00a7c{1}\u00a76.
|
||||
@@ -559,6 +569,7 @@ unlimitedItemPermission=\u00a74No permission for unlimited item \u00a7c{0}\u00a7
|
||||
unlimitedItems=\u00a76Unlimited items\:\u00a7r
|
||||
unmutedPlayer=\u00a76Player\u00a7c {0} \u00a76unmuted.
|
||||
unsafeTeleportDestination=\u00a74The teleport destination is unsafe and teleport-safety is disabled.
|
||||
unsupportedFeature=\u00a74This feature is not supported on the current server version.
|
||||
unvanishedReload=\u00a74A reload has forced you to become visible.
|
||||
upgradingFilesError=Error while upgrading the files.
|
||||
uptime=\u00a76Uptime\:\u00a7c {0}
|
||||
|
||||
@@ -142,6 +142,7 @@ gctotal=§6Allocated memory\:§c {0} MB.
|
||||
gcWorld=§6{0} "§c{1}§6"\: §c{2}§6 chunks, §c{3}§6 entities, §c{4}§6 tiles.
|
||||
geoipJoinFormat=§6Player §c{0} §6comes from §c{1}§6.
|
||||
geoipCantFind=§6Player §c{0} §6comes from §aan unknown country§6.
|
||||
geoIpLicenseMissing=No license key found! Please visit https://essentialsx.cf/geoip for first time setup instructions.
|
||||
geoIpUrlEmpty=GeoIP download url is empty.
|
||||
geoIpUrlInvalid=GeoIP download url is invalid.
|
||||
givenSkull=§6You have been given the skull of §c{0}§6.
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package net.ess3.api;
|
||||
|
||||
import com.earth2me.essentials.items.CustomItemResolver;
|
||||
import net.ess3.nms.PotionMetaProvider;
|
||||
import net.ess3.nms.SpawnEggProvider;
|
||||
|
||||
@@ -12,4 +13,6 @@ public interface IEssentials extends com.earth2me.essentials.IEssentials {
|
||||
SpawnEggProvider getSpawnEggProvider();
|
||||
|
||||
PotionMetaProvider getPotionMetaProvider();
|
||||
|
||||
CustomItemResolver getCustomItemResolver();
|
||||
}
|
||||
@@ -2,5 +2,4 @@ package net.ess3.api;
|
||||
|
||||
|
||||
public interface ISettings extends com.earth2me.essentials.ISettings {
|
||||
|
||||
}
|
||||
@@ -15,12 +15,19 @@ public class UserBalanceUpdateEvent extends Event {
|
||||
private final Player player;
|
||||
private final BigDecimal originalBalance;
|
||||
private BigDecimal balance;
|
||||
private Cause cause;
|
||||
|
||||
@Deprecated
|
||||
public UserBalanceUpdateEvent(Player player, BigDecimal originalBalance, BigDecimal balance) {
|
||||
this(player, originalBalance, balance, Cause.UNKNOWN);
|
||||
}
|
||||
|
||||
public UserBalanceUpdateEvent(Player player, BigDecimal originalBalance, BigDecimal balance, Cause cause) {
|
||||
super(!Bukkit.getServer().isPrimaryThread());
|
||||
this.player = player;
|
||||
this.originalBalance = originalBalance;
|
||||
this.balance = balance;
|
||||
this.cause = cause;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -48,4 +55,17 @@ public class UserBalanceUpdateEvent extends Event {
|
||||
public BigDecimal getOldBalance() {
|
||||
return originalBalance;
|
||||
}
|
||||
|
||||
public Cause getCause() {
|
||||
return cause;
|
||||
}
|
||||
|
||||
public enum Cause {
|
||||
COMMAND_ECO,
|
||||
COMMAND_PAY,
|
||||
COMMAND_SELL,
|
||||
API,
|
||||
SPECIAL, // Reserved for API usage
|
||||
UNKNOWN
|
||||
}
|
||||
}
|
||||
@@ -41,6 +41,10 @@ commands:
|
||||
description: Bans an IP address.
|
||||
usage: /<command> <address>
|
||||
aliases: [ebanip]
|
||||
beezooka:
|
||||
description: Throw an exploding bee at your opponent.
|
||||
usage: /<command>
|
||||
aliases: [ebeezooka,beecannon,ebeecannon]
|
||||
book:
|
||||
description: Allows reopening and editing of sealed books.
|
||||
usage: /<command> [title|author [name]]
|
||||
@@ -96,6 +100,10 @@ commands:
|
||||
description: Removes a jail.
|
||||
usage: /<command> <jailname>
|
||||
aliases: [edeljail,remjail,eremjail,rmjail,ermjail]
|
||||
delkit:
|
||||
description: Deletes the specified kit.
|
||||
usage: /<command> <kit>
|
||||
aliases: [edelkit,remkit,eremkit,rmkit,ermkit,deletekit,edeletekit]
|
||||
delwarp:
|
||||
description: Deletes the specified warp.
|
||||
usage: /<command> <warp>
|
||||
@@ -142,7 +150,7 @@ commands:
|
||||
aliases: [efly]
|
||||
fireball:
|
||||
description: Throw a fireball.
|
||||
usage: /<command> [small|skull]
|
||||
usage: /<command> [small|large|dragon|arrow|skull|egg|snowball|expbottle|splashpotion|lingeringpotion] [speed]
|
||||
aliases: [efireball,fireentity,efireentity,fireskull,efireskull]
|
||||
firework:
|
||||
description: Allows you to modify a stack of fireworks.
|
||||
|
||||
@@ -817,6 +817,11 @@ public class FakeServer implements Server {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removeRecipe(NamespacedKey key) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public HelpMap getHelpMap() {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>net.ess3</groupId>
|
||||
<artifactId>EssentialsXParent</artifactId>
|
||||
<version>2.17.0</version>
|
||||
<version>2.17.2</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>EssentialsXAntiBuild</artifactId>
|
||||
|
||||
@@ -60,4 +60,8 @@ public class EssentialsAntiBuild extends JavaPlugin implements IAntiBuild {
|
||||
final Boolean bool = settingsBoolean.get(protectConfig);
|
||||
return bool == null ? protectConfig.getDefaultValueBoolean() : bool;
|
||||
}
|
||||
|
||||
static String getNameForType(Material type) {
|
||||
return type.toString().toLowerCase().replaceAll("_", " ");
|
||||
}
|
||||
}
|
||||
+23
-21
@@ -1,7 +1,11 @@
|
||||
package com.earth2me.essentials.antibuild;
|
||||
|
||||
import static com.earth2me.essentials.I18n.tl;
|
||||
|
||||
import com.earth2me.essentials.User;
|
||||
import com.earth2me.essentials.utils.VersionUtil;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import net.ess3.api.IEssentials;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
@@ -12,7 +16,11 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.block.*;
|
||||
import org.bukkit.event.block.BlockBreakEvent;
|
||||
import org.bukkit.event.block.BlockDispenseEvent;
|
||||
import org.bukkit.event.block.BlockPistonExtendEvent;
|
||||
import org.bukkit.event.block.BlockPistonRetractEvent;
|
||||
import org.bukkit.event.block.BlockPlaceEvent;
|
||||
import org.bukkit.event.entity.EntityPickupItemEvent;
|
||||
import org.bukkit.event.hanging.HangingBreakByEntityEvent;
|
||||
import org.bukkit.event.inventory.CraftItemEvent;
|
||||
@@ -21,12 +29,6 @@ import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.player.PlayerPickupItemEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
|
||||
import static com.earth2me.essentials.I18n.tl;
|
||||
|
||||
|
||||
public class EssentialsAntiBuildListener implements Listener {
|
||||
private static final Logger logger = Logger.getLogger("EssentialsAntiBuild");
|
||||
@@ -92,9 +94,9 @@ public class EssentialsAntiBuildListener implements Listener {
|
||||
final Block block = event.getBlockPlaced();
|
||||
final Material type = block.getType();
|
||||
|
||||
if (prot.getSettingBool(AntiBuildConfig.disable_build) && !user.canBuild() && !user.isAuthorized("essentials.build") && !metaPermCheck(user, "place", block)) {
|
||||
if (prot.getSettingBool(AntiBuildConfig.disable_build) && !user.canBuild() && !metaPermCheck(user, "place", block)) {
|
||||
if (ess.getSettings().warnOnBuildDisallow()) {
|
||||
user.sendMessage(tl("antiBuildPlace", type.toString()));
|
||||
user.sendMessage(tl("antiBuildPlace", EssentialsAntiBuild.getNameForType(type)));
|
||||
}
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
@@ -102,14 +104,14 @@ public class EssentialsAntiBuildListener implements Listener {
|
||||
|
||||
if (prot.checkProtectionItems(AntiBuildConfig.blacklist_placement, type) && !user.isAuthorized("essentials.protect.exemptplacement")) {
|
||||
if (ess.getSettings().warnOnBuildDisallow()) {
|
||||
user.sendMessage(tl("antiBuildPlace", type.toString()));
|
||||
user.sendMessage(tl("antiBuildPlace", EssentialsAntiBuild.getNameForType(type)));
|
||||
}
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (prot.checkProtectionItems(AntiBuildConfig.alert_on_placement, type) && !user.isAuthorized("essentials.protect.alerts.notrigger")) {
|
||||
prot.getEssentialsConnect().alert(user, type.toString(), tl("alertPlaced"));
|
||||
prot.getEssentialsConnect().alert(user, EssentialsAntiBuild.getNameForType(type), tl("alertPlaced"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -119,9 +121,9 @@ public class EssentialsAntiBuildListener implements Listener {
|
||||
final Block block = event.getBlock();
|
||||
final Material type = block.getType();
|
||||
|
||||
if (prot.getSettingBool(AntiBuildConfig.disable_build) && !user.canBuild() && !user.isAuthorized("essentials.build") && !metaPermCheck(user, "break", block)) {
|
||||
if (prot.getSettingBool(AntiBuildConfig.disable_build) && !user.canBuild() && !metaPermCheck(user, "break", block)) {
|
||||
if (ess.getSettings().warnOnBuildDisallow()) {
|
||||
user.sendMessage(tl("antiBuildBreak", type.toString()));
|
||||
user.sendMessage(tl("antiBuildBreak", EssentialsAntiBuild.getNameForType(type)));
|
||||
}
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
@@ -129,14 +131,14 @@ public class EssentialsAntiBuildListener implements Listener {
|
||||
|
||||
if (prot.checkProtectionItems(AntiBuildConfig.blacklist_break, type) && !user.isAuthorized("essentials.protect.exemptbreak")) {
|
||||
if (ess.getSettings().warnOnBuildDisallow()) {
|
||||
user.sendMessage(tl("antiBuildBreak", type.toString()));
|
||||
user.sendMessage(tl("antiBuildBreak", EssentialsAntiBuild.getNameForType(type)));
|
||||
}
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (prot.checkProtectionItems(AntiBuildConfig.alert_on_break, type) && !user.isAuthorized("essentials.protect.alerts.notrigger")) {
|
||||
prot.getEssentialsConnect().alert(user, type.toString(), tl("alertBroke"));
|
||||
prot.getEssentialsConnect().alert(user, EssentialsAntiBuild.getNameForType(type), tl("alertBroke"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -147,7 +149,7 @@ public class EssentialsAntiBuildListener implements Listener {
|
||||
final User user = ess.getUser((Player) entity);
|
||||
final EntityType type = event.getEntity().getType();
|
||||
final boolean warn = ess.getSettings().warnOnBuildDisallow();
|
||||
if (prot.getSettingBool(AntiBuildConfig.disable_build) && !user.canBuild() && !user.isAuthorized("essentials.build")) {
|
||||
if (prot.getSettingBool(AntiBuildConfig.disable_build) && !user.canBuild()) {
|
||||
if (type == EntityType.PAINTING && !metaPermCheck(user, "break", Material.PAINTING)) {
|
||||
if (warn) {
|
||||
user.sendMessage(tl("antiBuildBreak", Material.PAINTING.toString()));
|
||||
@@ -202,7 +204,7 @@ public class EssentialsAntiBuildListener implements Listener {
|
||||
prot.getEssentialsConnect().alert(user, item.getType().toString(), tl("alertUsed"));
|
||||
}
|
||||
|
||||
if (prot.getSettingBool(AntiBuildConfig.disable_use) && !user.canBuild() && !user.isAuthorized("essentials.build")) {
|
||||
if (prot.getSettingBool(AntiBuildConfig.disable_use) && !user.canBuild()) {
|
||||
if (event.hasItem() && !metaPermCheck(user, "interact", item.getType(), item.getDurability())) {
|
||||
event.setCancelled(true);
|
||||
if (ess.getSettings().warnOnBuildDisallow()) {
|
||||
@@ -227,7 +229,7 @@ public class EssentialsAntiBuildListener implements Listener {
|
||||
final User user = ess.getUser((Player) entity);
|
||||
final ItemStack item = event.getRecipe().getResult();
|
||||
|
||||
if (prot.getSettingBool(AntiBuildConfig.disable_use) && !user.canBuild() && !user.isAuthorized("essentials.build")) {
|
||||
if (prot.getSettingBool(AntiBuildConfig.disable_use) && !user.canBuild()) {
|
||||
if (!metaPermCheck(user, "craft", item.getType(), item.getDurability())) {
|
||||
event.setCancelled(true);
|
||||
if (ess.getSettings().warnOnBuildDisallow()) {
|
||||
@@ -244,7 +246,7 @@ public class EssentialsAntiBuildListener implements Listener {
|
||||
final User user = ess.getUser(event.getPlayer());
|
||||
final ItemStack item = event.getItemDrop().getItemStack();
|
||||
|
||||
if (prot.getSettingBool(AntiBuildConfig.disable_use) && !user.canBuild() && !user.isAuthorized("essentials.build")) {
|
||||
if (prot.getSettingBool(AntiBuildConfig.disable_use) && !user.canBuild()) {
|
||||
if (!metaPermCheck(user, "drop", item.getType(), item.getDurability())) {
|
||||
event.setCancelled(true);
|
||||
user.getBase().updateInventory();
|
||||
@@ -271,7 +273,7 @@ public class EssentialsAntiBuildListener implements Listener {
|
||||
final User user = ess.getUser((Player) event.getEntity());
|
||||
final ItemStack item = event.getItem().getItemStack();
|
||||
|
||||
if (prot.getSettingBool(AntiBuildConfig.disable_use) && !user.canBuild() && !user.isAuthorized("essentials.build")) {
|
||||
if (prot.getSettingBool(AntiBuildConfig.disable_use) && !user.canBuild()) {
|
||||
if (!metaPermCheck(user, "pickup", item.getType(), item.getDurability())) {
|
||||
event.setCancelled(true);
|
||||
event.getItem().setPickupDelay(50);
|
||||
@@ -287,7 +289,7 @@ public class EssentialsAntiBuildListener implements Listener {
|
||||
final User user = ess.getUser(event.getPlayer());
|
||||
final ItemStack item = event.getItem().getItemStack();
|
||||
|
||||
if (prot.getSettingBool(AntiBuildConfig.disable_use) && !user.canBuild() && !user.isAuthorized("essentials.build")) {
|
||||
if (prot.getSettingBool(AntiBuildConfig.disable_use) && !user.canBuild()) {
|
||||
if (!metaPermCheck(user, "pickup", item.getType(), item.getDurability())) {
|
||||
event.setCancelled(true);
|
||||
event.getItem().setPickupDelay(50);
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>net.ess3</groupId>
|
||||
<artifactId>EssentialsXParent</artifactId>
|
||||
<version>2.17.0</version>
|
||||
<version>2.17.2</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>EssentialsXChat</artifactId>
|
||||
|
||||
+1
@@ -55,6 +55,7 @@ public class EssentialsChatPlayerListenerLowest extends EssentialsChatPlayer {
|
||||
format = format.replace("{5}", team == null ? "" : team.getDisplayName());
|
||||
format = format.replace("{6}", prefix);
|
||||
format = format.replace("{7}", suffix);
|
||||
format = format.replace("{8}", player.getName());
|
||||
synchronized (format) {
|
||||
event.setFormat(format);
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>net.ess3</groupId>
|
||||
<artifactId>EssentialsXParent</artifactId>
|
||||
<version>2.17.0</version>
|
||||
<version>2.17.2</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>EssentialsXGeoIP</artifactId>
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
package com.earth2me.essentials.geoip;
|
||||
|
||||
import static com.earth2me.essentials.I18n.tl;
|
||||
|
||||
import com.earth2me.essentials.metrics.Metrics;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import net.ess3.api.IEssentials;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import java.util.logging.Level;
|
||||
|
||||
import static com.earth2me.essentials.I18n.tl;
|
||||
|
||||
|
||||
public class EssentialsGeoIP extends JavaPlugin {
|
||||
|
||||
@@ -25,6 +25,9 @@ public class EssentialsGeoIP extends JavaPlugin {
|
||||
this.setEnabled(false);
|
||||
return;
|
||||
}
|
||||
|
||||
Logger.getLogger(com.fasterxml.jackson.databind.ext.Java7Support.class.getName()).setLevel(Level.SEVERE);
|
||||
|
||||
final EssentialsGeoIPPlayerListener playerListener = new EssentialsGeoIPPlayerListener(getDataFolder(), ess);
|
||||
pm.registerEvents(playerListener, this);
|
||||
|
||||
|
||||
+11
-4
@@ -117,8 +117,9 @@ public class EssentialsGeoIPPlayerListener implements Listener, IConf {
|
||||
|
||||
// detect and update the old config.yml. migrate from legacy GeoIP to GeoIP2.
|
||||
if (!config.isSet("enable-locale")) {
|
||||
config.set("database.download-url", "https://geolite.maxmind.com/download/geoip/database/GeoLite2-Country.tar.gz");
|
||||
config.set("database.download-url-city", "https://geolite.maxmind.com/download/geoip/database/GeoLite2-City.tar.gz");
|
||||
config.set("database.download-url", "https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-Country&license_key={LICENSEKEY}&suffix=tar.gz");
|
||||
config.set("database.download-url-city", "https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-City&license_key={LICENSEKEY}&suffix=tar.gz");
|
||||
config.set("database.license-key", "");
|
||||
config.set("database.update.enable", true);
|
||||
config.set("database.update.by-every-x-days", 30);
|
||||
config.set("enable-locale", true);
|
||||
@@ -175,6 +176,12 @@ public class EssentialsGeoIPPlayerListener implements Listener, IConf {
|
||||
logger.log(Level.SEVERE, tl("geoIpUrlEmpty"));
|
||||
return;
|
||||
}
|
||||
String licenseKey = config.getString("database.license-key", "");
|
||||
if (licenseKey == null || licenseKey.isEmpty()) {
|
||||
logger.log(Level.SEVERE, tl("geoIpLicenseMissing"));
|
||||
return;
|
||||
}
|
||||
url = url.replace("{LICENSEKEY}", licenseKey);
|
||||
logger.log(Level.INFO, tl("downloadingGeoIp"));
|
||||
URL downloadUrl = new URL(url);
|
||||
URLConnection conn = downloadUrl.openConnection();
|
||||
@@ -183,9 +190,9 @@ public class EssentialsGeoIPPlayerListener implements Listener, IConf {
|
||||
InputStream input = conn.getInputStream();
|
||||
OutputStream output = new FileOutputStream(databaseFile);
|
||||
byte[] buffer = new byte[2048];
|
||||
if (url.endsWith(".gz")) {
|
||||
if (url.contains("gz")) {
|
||||
input = new GZIPInputStream(input);
|
||||
if (url.endsWith(".tar.gz")) {
|
||||
if (url.contains("tar.gz")) {
|
||||
// The new GeoIP2 uses tar.gz to pack the db file along with some other txt. So it makes things a bit complicated here.
|
||||
String filename;
|
||||
TarInputStream tarInputStream = new TarInputStream(input);
|
||||
|
||||
@@ -2,9 +2,11 @@ database:
|
||||
show-cities: false
|
||||
download-if-missing: true
|
||||
# Url for country
|
||||
download-url: "https://geolite.maxmind.com/download/geoip/database/GeoLite2-Country.tar.gz"
|
||||
download-url: "https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-Country&license_key={LICENSEKEY}&suffix=tar.gz"
|
||||
# Url for cities
|
||||
download-url-city: "https://geolite.maxmind.com/download/geoip/database/GeoLite2-City.tar.gz"
|
||||
download-url-city: "https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-City&license_key={LICENSEKEY}&suffix=tar.gz"
|
||||
# License key for downloads
|
||||
license-key: ""
|
||||
update:
|
||||
enable: true
|
||||
by-every-x-days: 30
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>net.ess3</groupId>
|
||||
<artifactId>EssentialsXParent</artifactId>
|
||||
<version>2.17.0</version>
|
||||
<version>2.17.2</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>EssentialsXProtect</artifactId>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.earth2me.essentials.protect;
|
||||
|
||||
import com.earth2me.essentials.metrics.Metrics;
|
||||
import com.earth2me.essentials.utils.VersionUtil;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.HandlerList;
|
||||
@@ -49,6 +50,11 @@ public class EssentialsProtect extends JavaPlugin implements IProtect {
|
||||
final EssentialsProtectEntityListener entityListener = new EssentialsProtectEntityListener(this);
|
||||
pm.registerEvents(entityListener, this);
|
||||
|
||||
if (VersionUtil.getServerBukkitVersion().isHigherThan(VersionUtil.v1_13_2_R01)) {
|
||||
final EssentialsProtectEntityListener1_13_2_R1 entityListener1_13_2_r1 = new EssentialsProtectEntityListener1_13_2_R1(this);
|
||||
pm.registerEvents(entityListener1_13_2_r1, this);
|
||||
}
|
||||
|
||||
final EssentialsProtectWeatherListener weatherListener = new EssentialsProtectWeatherListener(this);
|
||||
pm.registerEvents(weatherListener, this);
|
||||
}
|
||||
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
package com.earth2me.essentials.protect;
|
||||
|
||||
import net.ess3.api.IEssentials;
|
||||
import org.bukkit.entity.Creeper;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.MushroomCow;
|
||||
import org.bukkit.entity.Pig;
|
||||
import org.bukkit.entity.Villager;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.entity.EntityTransformEvent;
|
||||
|
||||
public class EssentialsProtectEntityListener1_13_2_R1 implements Listener {
|
||||
private final IProtect prot;
|
||||
private final IEssentials ess;
|
||||
|
||||
EssentialsProtectEntityListener1_13_2_R1(final IProtect prot) {
|
||||
this.prot = prot;
|
||||
this.ess = prot.getEssentialsConnect().getEssentials();
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onEntityTransform(final EntityTransformEvent event) {
|
||||
final Entity entity = event.getEntity();
|
||||
final EntityTransformEvent.TransformReason reason = event.getTransformReason();
|
||||
if (reason == EntityTransformEvent.TransformReason.INFECTION && prot.getSettingBool(ProtectConfig.prevent_villager_infection)) {
|
||||
event.setCancelled(true);
|
||||
} else if (reason == EntityTransformEvent.TransformReason.CURED && prot.getSettingBool(ProtectConfig.prevent_villager_cure)) {
|
||||
event.setCancelled(true);
|
||||
} else if (reason == EntityTransformEvent.TransformReason.LIGHTNING) {
|
||||
if (entity instanceof Villager && prot.getSettingBool(ProtectConfig.prevent_villager_to_witch)) {
|
||||
event.setCancelled(true);
|
||||
} else if (entity instanceof Pig && prot.getSettingBool(ProtectConfig.prevent_pig_transformation)) {
|
||||
event.setCancelled(true);
|
||||
} else if (entity instanceof Creeper && prot.getSettingBool(ProtectConfig.prevent_creeper_charge)) {
|
||||
event.setCancelled(true);
|
||||
} else if (entity instanceof MushroomCow && prot.getSettingBool(ProtectConfig.prevent_mooshroom_switching)) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
} else if (reason == EntityTransformEvent.TransformReason.DROWNED && prot.getSettingBool(ProtectConfig.prevent_zombie_drowning)) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -42,7 +42,14 @@ public enum ProtectConfig {
|
||||
prevent_villager_death("protect.prevent.villager-death", false),
|
||||
prevent_enderdragon_blockdmg("protect.prevent.enderdragon-blockdamage", true),
|
||||
prevent_entitytarget("protect.prevent.entitytarget", false),
|
||||
enderdragon_fakeexplosions("protect.enderdragon-fakeexplosions", false);
|
||||
enderdragon_fakeexplosions("protect.enderdragon-fakeexplosions", false),
|
||||
prevent_creeper_charge("protect.prevent.transformation.charged-creeper", false),
|
||||
prevent_villager_infection("protect.prevent.transformation.zombie-villager", false),
|
||||
prevent_villager_cure("protect.prevent.transformation.villager", false),
|
||||
prevent_villager_to_witch("protect.prevent.transformation.witch", false),
|
||||
prevent_pig_transformation("protect.prevent.transformation.zombie-pigman", false),
|
||||
prevent_zombie_drowning("protect.prevent.transformation.drowned", false),
|
||||
prevent_mooshroom_switching("protect.prevent.transformation.mooshroom", false);
|
||||
private final String configName;
|
||||
private final String defValueString;
|
||||
private final boolean defValueBoolean;
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>net.ess3</groupId>
|
||||
<artifactId>EssentialsXParent</artifactId>
|
||||
<version>2.17.0</version>
|
||||
<version>2.17.2</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>EssentialsXSpawn</artifactId>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>net.ess3</groupId>
|
||||
<artifactId>EssentialsXParent</artifactId>
|
||||
<version>2.17.0</version>
|
||||
<version>2.17.2</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>EssentialsXXMPP</artifactId>
|
||||
|
||||
@@ -26,7 +26,7 @@ EssentialsX is almost a completely drop-in replacement for Essentials. However,
|
||||
|
||||
* **EssentialsX requires Java 8 or higher.** On older versions, the plugin may not work properly.
|
||||
|
||||
* **EssentialsX supports Minecraft versions 1.8.8, 1.9.4, 1.10.2, 1.11.2, 1.12.2 and 1.13.2.**
|
||||
* **EssentialsX supports Minecraft versions 1.8.8, 1.9.4, 1.10.2, 1.11.2, 1.12.2, 1.13.2 and 1.14.4.**
|
||||
|
||||
|
||||
Support
|
||||
@@ -72,6 +72,6 @@ If you can't make a donation, don't worry! There's lots of other ways to contrib
|
||||
* Do you run a server? Take a look at our ["help wanted" issues](https://github.com/EssentialsX/Essentials/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc+label%3A%22help+wanted%22),
|
||||
where you can find issues that need extra testing and investigation. You can also join the [MOSS Discord community](https://discord.gg/casfFyh)
|
||||
and provide support to others.
|
||||
* Do you speak multiple languages? If so, we always welcome pull requests to our [language files](https://essentialsx.github.io/#/Locale).
|
||||
* Do you speak multiple languages? If so, we always welcome contributions to our [Crowdin project](https://crowdin.com/project/essentialsx-official).
|
||||
* If you're a developer, you could look through our ["open to PR" issues](https://github.com/EssentialsX/Essentials/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc+label%3A%22status%3A+open+to+PR%22).
|
||||
We're always happy to receive bug fixes and feature additions as pull requests.
|
||||
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>EssentialsXParent</artifactId>
|
||||
<groupId>net.ess3</groupId>
|
||||
<version>2.17.0</version>
|
||||
<version>2.17.2</version>
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
@@ -22,7 +22,7 @@
|
||||
<dependency>
|
||||
<groupId>net.ess3</groupId>
|
||||
<artifactId>NMSProvider</artifactId>
|
||||
<version>2.17.0</version>
|
||||
<version>2.17.2</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>EssentialsXParent</artifactId>
|
||||
<groupId>net.ess3</groupId>
|
||||
<version>2.17.0</version>
|
||||
<version>2.17.2</version>
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
@@ -22,7 +22,7 @@
|
||||
<dependency>
|
||||
<groupId>net.ess3</groupId>
|
||||
<artifactId>NMSProvider</artifactId>
|
||||
<version>2.17.0</version>
|
||||
<version>2.17.2</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>EssentialsXParent</artifactId>
|
||||
<groupId>net.ess3</groupId>
|
||||
<version>2.17.0</version>
|
||||
<version>2.17.2</version>
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
@@ -16,7 +16,7 @@
|
||||
<dependency>
|
||||
<groupId>net.ess3</groupId>
|
||||
<artifactId>NMSProvider</artifactId>
|
||||
<version>2.17.0</version>
|
||||
<version>2.17.2</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>EssentialsXParent</artifactId>
|
||||
<groupId>net.ess3</groupId>
|
||||
<version>2.17.0</version>
|
||||
<version>2.17.2</version>
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
@@ -16,7 +16,7 @@
|
||||
<dependency>
|
||||
<groupId>net.ess3</groupId>
|
||||
<artifactId>NMSProvider</artifactId>
|
||||
<version>2.17.0</version>
|
||||
<version>2.17.2</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>EssentialsXParent</artifactId>
|
||||
<groupId>net.ess3</groupId>
|
||||
<version>2.17.0</version>
|
||||
<version>2.17.2</version>
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>EssentialsXParent</artifactId>
|
||||
<groupId>net.ess3</groupId>
|
||||
<version>2.17.0</version>
|
||||
<version>2.17.2</version>
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
@@ -16,7 +16,7 @@
|
||||
<dependency>
|
||||
<groupId>net.ess3</groupId>
|
||||
<artifactId>NMSProvider</artifactId>
|
||||
<version>2.17.0</version>
|
||||
<version>2.17.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>EssentialsXParent</artifactId>
|
||||
<groupId>net.ess3</groupId>
|
||||
<version>2.17.0</version>
|
||||
<version>2.17.2</version>
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
@@ -16,7 +16,7 @@
|
||||
<dependency>
|
||||
<groupId>net.ess3</groupId>
|
||||
<artifactId>NMSProvider</artifactId>
|
||||
<version>2.17.0</version>
|
||||
<version>2.17.2</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
<groupId>net.ess3</groupId>
|
||||
<artifactId>EssentialsXParent</artifactId>
|
||||
<version>2.17.0</version>
|
||||
<version>2.17.2</version>
|
||||
|
||||
<packaging>pom</packaging>
|
||||
|
||||
@@ -35,6 +35,10 @@
|
||||
<id>paper-repo</id>
|
||||
<url>https://papermc.io/repo/repository/maven-public/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>jitpack</id>
|
||||
<url>https://jitpack.io</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<modules>
|
||||
@@ -58,7 +62,7 @@
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>bukkit</artifactId>
|
||||
<version>1.14.3-R0.1-SNAPSHOT</version>
|
||||
<version>1.15.2-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
@@ -70,7 +74,7 @@
|
||||
<dependency>
|
||||
<groupId>org.mockito</groupId>
|
||||
<artifactId>mockito-core</artifactId>
|
||||
<version>2.8.47</version>
|
||||
<version>3.2.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
@@ -292,7 +296,7 @@
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
|
||||
<!-- The plugins' release version -->
|
||||
<release.version>2.17.0</release.version>
|
||||
<release.version>2.17.2</release.version>
|
||||
|
||||
<!-- The plugins' build number -->
|
||||
<build.version>${git.closest.tag.commit.count}</build.version>
|
||||
|
||||
Reference in new issue
Block a user