mirror of
https://github.com/EssentialsX/Essentials.git
synced 2026-11-05 01:00:13 -05:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f176893940 | ||
|
|
af18afad7a | ||
|
|
bdc5f4c830 | ||
|
|
0be056b9c2 | ||
|
|
5f5d65c463 | ||
|
|
ca4077b204 | ||
|
|
4ab3e20a0c | ||
|
|
576866540e | ||
|
|
dfcb9a1c52 | ||
|
|
a7a9cbc034 | ||
|
|
2f4f555923 | ||
|
|
1c22edbb1b | ||
|
|
b71fb520aa |
No files matched your search
Generated
+22
-14
@@ -1,19 +1,27 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CheckStyle-IDEA">
|
||||
<option name="configuration">
|
||||
<map>
|
||||
<entry key="active-configuration" value="PROJECT_RELATIVE:$PROJECT_DIR$/.checkstyle/checkstyle.xml:EssentialsX" />
|
||||
<entry key="checkstyle-version" value="8.36.2" />
|
||||
<entry key="copy-libs" value="true" />
|
||||
<entry key="location-0" value="BUNDLED:(bundled):Sun Checks" />
|
||||
<entry key="location-1" value="BUNDLED:(bundled):Google Checks" />
|
||||
<entry key="location-2" value="PROJECT_RELATIVE:$PROJECT_DIR$/.checkstyle/checkstyle.xml:EssentialsX" />
|
||||
<entry key="property-2.configDirectory" value=".checkstyle/" />
|
||||
<entry key="scan-before-checkin" value="true" />
|
||||
<entry key="scanscope" value="JavaOnly" />
|
||||
<entry key="suppress-errors" value="false" />
|
||||
</map>
|
||||
<component name="CheckStyle-IDEA" serialisationVersion="2">
|
||||
<checkstyleVersion>8.36.2</checkstyleVersion>
|
||||
<scanScope>JavaOnly</scanScope>
|
||||
<copyLibs>true</copyLibs>
|
||||
<scanBeforeCheckin>true</scanBeforeCheckin>
|
||||
<option name="thirdPartyClasspath" />
|
||||
<option name="activeLocationIds">
|
||||
<option value="321e5753-4201-4d2c-bf31-6232011122fd" />
|
||||
</option>
|
||||
<option name="locations">
|
||||
<list>
|
||||
<ConfigurationLocation id="bundled-sun-checks" type="BUNDLED" scope="All" description="Sun Checks">(bundled)</ConfigurationLocation>
|
||||
<ConfigurationLocation id="bundled-google-checks" type="BUNDLED" scope="All" description="Google Checks">(bundled)</ConfigurationLocation>
|
||||
<ConfigurationLocation id="321e5753-4201-4d2c-bf31-6232011122fd" type="PROJECT_RELATIVE" scope="All" description="EssentialsX">
|
||||
$PROJECT_DIR$/.checkstyle/checkstyle.xml
|
||||
<option name="properties">
|
||||
<map>
|
||||
<entry key="configDirectory" value=".checkstyle/" />
|
||||
</map>
|
||||
</option>
|
||||
</ConfigurationLocation>
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
||||
@@ -29,6 +29,10 @@ dependencies {
|
||||
}
|
||||
}
|
||||
|
||||
test {
|
||||
testLogging.showStandardStreams = true
|
||||
}
|
||||
|
||||
shadowJar {
|
||||
dependencies {
|
||||
include (dependency('io.papermc:paperlib'))
|
||||
|
||||
@@ -102,12 +102,12 @@ public class Backup implements Runnable {
|
||||
} while (line != null);
|
||||
}
|
||||
} catch (final IOException ex) {
|
||||
ess.getLogger().log(Level.SEVERE, null, ex);
|
||||
ess.getLogger().log(Level.SEVERE, "An error occurred while reading backup child process", ex);
|
||||
}
|
||||
});
|
||||
child.waitFor();
|
||||
} catch (final InterruptedException | IOException ex) {
|
||||
ess.getLogger().log(Level.SEVERE, null, ex);
|
||||
ess.getLogger().log(Level.SEVERE, "An error occurred while building the backup child process", ex);
|
||||
} finally {
|
||||
class BackupEnableSaveTask implements Runnable {
|
||||
@Override
|
||||
|
||||
@@ -7,6 +7,7 @@ import com.earth2me.essentials.utils.NumberUtil;
|
||||
import com.google.common.collect.Lists;
|
||||
import net.essentialsx.api.v2.services.BalanceTop;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.command.BlockCommandSender;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.text.DateFormat;
|
||||
@@ -32,8 +33,15 @@ public class Commandbalancetop extends EssentialsCommand {
|
||||
final Calendar cal = Calendar.getInstance();
|
||||
cal.setTimeInMillis(ess.getBalanceTop().getCacheAge());
|
||||
final DateFormat format = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT);
|
||||
sender.sendMessage(tl("balanceTop", format.format(cal.getTime())));
|
||||
new TextPager(cache).showPage(Integer.toString(page), null, "balancetop", sender);
|
||||
final Runnable runnable = () -> {
|
||||
sender.sendMessage(tl("balanceTop", format.format(cal.getTime())));
|
||||
new TextPager(cache).showPage(Integer.toString(page), null, "balancetop", sender);
|
||||
};
|
||||
if (sender.getSender() instanceof BlockCommandSender) {
|
||||
ess.scheduleSyncDelayedTask(runnable);
|
||||
} else {
|
||||
runnable.run();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -54,7 +54,7 @@ public class Commandban extends EssentialsCommand {
|
||||
final String banDisplay = tl("banFormat", banReason, senderDisplayName);
|
||||
|
||||
user.getBase().kickPlayer(banDisplay);
|
||||
server.getLogger().log(Level.INFO, tl("playerBanned", senderDisplayName, user.getName(), banDisplay));
|
||||
ess.getLogger().log(Level.INFO, tl("playerBanned", senderDisplayName, user.getName(), banDisplay));
|
||||
|
||||
if (nomatch) {
|
||||
sender.sendMessage(tl("userUnknown", user.getName()));
|
||||
|
||||
@@ -54,7 +54,7 @@ public class Commandbanip extends EssentialsCommand {
|
||||
final String banDisplay = tl("banFormat", banReason, senderDisplayName);
|
||||
|
||||
ess.getServer().getBanList(BanList.Type.IP).addBan(ipAddress, banReason, null, senderName);
|
||||
server.getLogger().log(Level.INFO, tl("playerBanIpAddress", senderDisplayName, ipAddress, banReason));
|
||||
ess.getLogger().log(Level.INFO, tl("playerBanIpAddress", senderDisplayName, ipAddress, banReason));
|
||||
|
||||
for (final Player player : ess.getServer().getOnlinePlayers()) {
|
||||
if (player.getAddress().getAddress().getHostAddress().equalsIgnoreCase(ipAddress)) {
|
||||
|
||||
@@ -36,7 +36,7 @@ public class Commandhelpop extends EssentialsCommand {
|
||||
throw new NotEnoughArgumentsException();
|
||||
}
|
||||
final String message = tl("helpOp", from, FormatUtil.stripFormat(getFinalArg(args, 0)));
|
||||
server.getLogger().log(Level.INFO, message);
|
||||
ess.getLogger().log(Level.INFO, message);
|
||||
ess.broadcastMessage("essentials.helpop.receive", message);
|
||||
return message;
|
||||
}
|
||||
|
||||
@@ -8,6 +8,8 @@ import org.bukkit.inventory.Inventory;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import static com.earth2me.essentials.I18n.tl;
|
||||
|
||||
public class Commandinvsee extends EssentialsCommand {
|
||||
public Commandinvsee() {
|
||||
super("invsee");
|
||||
@@ -21,6 +23,11 @@ public class Commandinvsee extends EssentialsCommand {
|
||||
}
|
||||
|
||||
final User invUser = getPlayer(server, user, args, 0);
|
||||
if (user == invUser) {
|
||||
user.sendMessage(tl("invseeNoSelf"));
|
||||
throw new NoChargeException();
|
||||
}
|
||||
|
||||
final Inventory inv;
|
||||
|
||||
if (args.length > 1 && user.isAuthorized("essentials.invsee.equip")) {
|
||||
@@ -40,7 +47,9 @@ public class Commandinvsee extends EssentialsCommand {
|
||||
@Override
|
||||
protected List<String> getTabCompleteOptions(final Server server, final User user, final String commandLabel, final String[] args) {
|
||||
if (args.length == 1) {
|
||||
return getPlayers(server, user);
|
||||
final List<String> suggestions = getPlayers(server, user);
|
||||
suggestions.remove(user.getName());
|
||||
return suggestions;
|
||||
} else {
|
||||
//if (args.length == 2) {
|
||||
// return Lists.newArrayList("equipped");
|
||||
|
||||
@@ -51,7 +51,7 @@ public class Commandkick extends EssentialsCommand {
|
||||
target.getBase().kickPlayer(kickReason);
|
||||
final String senderDisplayName = sender.isPlayer() ? sender.getPlayer().getDisplayName() : Console.DISPLAY_NAME;
|
||||
|
||||
server.getLogger().log(Level.INFO, tl("playerKicked", senderDisplayName, target.getName(), kickReason));
|
||||
ess.getLogger().log(Level.INFO, tl("playerKicked", senderDisplayName, target.getName(), kickReason));
|
||||
ess.broadcastMessage("essentials.kick.notify", tl("playerKicked", senderDisplayName, target.getName(), kickReason));
|
||||
}
|
||||
|
||||
|
||||
@@ -113,7 +113,7 @@ public class Commandmute extends EssentialsCommand {
|
||||
message = tl("muteNotifyReason", sender.getSender().getName(), user.getName(), user.getMuteReason());
|
||||
}
|
||||
}
|
||||
server.getLogger().log(Level.INFO, message);
|
||||
ess.getLogger().log(Level.INFO, message);
|
||||
ess.broadcastMessage("essentials.mute.notify", message);
|
||||
} else {
|
||||
sender.sendMessage(tl("unmutedPlayer", user.getDisplayName()));
|
||||
|
||||
@@ -54,7 +54,7 @@ public class Commandtempban extends EssentialsCommand {
|
||||
user.getBase().kickPlayer(tl("tempBanned", expiry, senderDisplayName, banReason));
|
||||
|
||||
final String message = tl("playerTempBanned", senderDisplayName, user.getName(), expiry, banReason);
|
||||
server.getLogger().log(Level.INFO, message);
|
||||
ess.getLogger().log(Level.INFO, message);
|
||||
ess.broadcastMessage("essentials.ban.notify", message);
|
||||
}
|
||||
|
||||
|
||||
@@ -71,7 +71,7 @@ public class Commandtempbanip extends EssentialsCommand {
|
||||
|
||||
final String message = tl("playerTempBanIpAddress", senderDisplayName, ipAddress,
|
||||
DateUtil.formatDateDiff(banTimestamp), banReason);
|
||||
server.getLogger().log(Level.INFO, message);
|
||||
ess.getLogger().log(Level.INFO, message);
|
||||
ess.broadcastMessage("essentials.banip.notify", message);
|
||||
}
|
||||
|
||||
|
||||
@@ -87,7 +87,7 @@ public class Commandtogglejail extends EssentialsCommand {
|
||||
sender.sendMessage(timeDiff > 0 ? tl("playerJailedFor", player.getName(), DateUtil.formatDateDiff(finalDisplayTime)) : tl("playerJailed", player.getName()));
|
||||
|
||||
final String notifyMessage = timeDiff > 0 ? tl("jailNotifyJailedFor", player.getName(), DateUtil.formatDateDiff(finalDisplayTime), sender.getSender().getName()) : tl("jailNotifyJailed", player.getName(), sender.getSender().getName());
|
||||
server.getLogger().log(Level.INFO, notifyMessage);
|
||||
ess.getLogger().log(Level.INFO, notifyMessage);
|
||||
ess.broadcastMessage("essentials.jail.notify", notifyMessage);
|
||||
}
|
||||
});
|
||||
@@ -114,7 +114,7 @@ public class Commandtogglejail extends EssentialsCommand {
|
||||
sender.sendMessage(tl("jailSentenceExtended", DateUtil.formatDateDiff(displayTimeDiff)));
|
||||
|
||||
final String notifyMessage = tl("jailNotifySentenceExtended", player.getName(), DateUtil.formatDateDiff(displayTimeDiff), sender.getSender().getName());
|
||||
server.getLogger().log(Level.INFO, notifyMessage);
|
||||
ess.getLogger().log(Level.INFO, notifyMessage);
|
||||
ess.broadcastMessage("essentials.jail.notify", notifyMessage);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ public class Commandunban extends EssentialsCommand {
|
||||
}
|
||||
|
||||
final String senderDisplayName = sender.isPlayer() ? sender.getPlayer().getDisplayName() : Console.DISPLAY_NAME;
|
||||
server.getLogger().log(Level.INFO, tl("playerUnbanned", senderDisplayName, name));
|
||||
ess.getLogger().log(Level.INFO, tl("playerUnbanned", senderDisplayName, name));
|
||||
|
||||
ess.broadcastMessage("essentials.ban.notify", tl("playerUnbanned", senderDisplayName, name));
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ public class Commandunbanip extends EssentialsCommand {
|
||||
|
||||
ess.getServer().getBanList(BanList.Type.IP).pardon(ipAddress);
|
||||
final String senderDisplayName = sender.isPlayer() ? sender.getPlayer().getDisplayName() : Console.DISPLAY_NAME;
|
||||
server.getLogger().log(Level.INFO, tl("playerUnbanIpAddress", senderDisplayName, ipAddress));
|
||||
ess.getLogger().log(Level.INFO, tl("playerUnbanIpAddress", senderDisplayName, ipAddress));
|
||||
|
||||
ess.broadcastMessage("essentials.banip.notify", tl("playerUnbanIpAddress", senderDisplayName, ipAddress));
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonPrimitive;
|
||||
import net.ess3.api.IEssentials;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.FormattedCommandAlias;
|
||||
@@ -59,8 +60,8 @@ public final class CommandMapUtil {
|
||||
} else if (value instanceof FormattedCommandAlias) {
|
||||
json.addProperty("source", "commands.yml");
|
||||
final JsonArray formatStrings = new JsonArray();
|
||||
for (String entry : ess.getFormattedCommandAliasProvider().getFormatStrings((FormattedCommandAlias) value)) {
|
||||
formatStrings.add(entry);
|
||||
for (final String entry : ess.getFormattedCommandAliasProvider().getFormatStrings((FormattedCommandAlias) value)) {
|
||||
formatStrings.add(new JsonPrimitive(entry));
|
||||
}
|
||||
json.add("bukkit_aliases", formatStrings);
|
||||
}
|
||||
|
||||
@@ -226,12 +226,12 @@ public final class FormatUtil {
|
||||
final EnumSet<ChatColor> strip = EnumSet.complementOf(supported);
|
||||
|
||||
final boolean rgb = user.isAuthorized(permBase + ".rgb");
|
||||
if (!supported.isEmpty() || rgb) {
|
||||
message = replaceColor(message, supported, rgb);
|
||||
}
|
||||
if (!strip.isEmpty()) {
|
||||
message = stripColor(message, strip);
|
||||
}
|
||||
if (!supported.isEmpty() || rgb) {
|
||||
message = replaceColor(message, supported, rgb);
|
||||
}
|
||||
return message;
|
||||
}
|
||||
|
||||
|
||||
@@ -192,7 +192,7 @@ public final class VersionUtil {
|
||||
if (!Bukkit.getName().equals("Essentials Fake Server")) {
|
||||
throw new IllegalArgumentException(string + " is not in valid version format. e.g. 1.8.8-R0.1");
|
||||
}
|
||||
matcher = VERSION_PATTERN.matcher(v1_14_R01.toString());
|
||||
matcher = VERSION_PATTERN.matcher(v1_16_1_R01.toString());
|
||||
Preconditions.checkArgument(matcher.matches(), string + " is not in valid version format. e.g. 1.8.8-R0.1");
|
||||
}
|
||||
|
||||
|
||||
@@ -253,7 +253,7 @@ discordCommandListArgumentGroup=A specific group to limit your search by
|
||||
discordCommandMessageDescription=Messages a player on the Minecraft server.
|
||||
discordCommandMessageArgumentUsername=The player to send the message to
|
||||
discordCommandMessageArgumentMessage=The message to send to the player
|
||||
discordErrorCommand=You added your bot to your server incorrectly. Please follow the tutorial in the config and add your bot using https://essentialsx.net/discord.html!
|
||||
discordErrorCommand=You added your bot to your server incorrectly! Please follow the tutorial in the config and add your bot using https://essentialsx.net/discord.html
|
||||
discordErrorCommandDisabled=That command is disabled!
|
||||
discordErrorLogin=An error occurred while logging into Discord, which has caused the plugin to disable itself: \n{0}
|
||||
discordErrorLoggerInvalidChannel=Discord console logging has been disabled due to an invalid channel definition! If you intend to disable it, set the channel ID to "none"; otherwise check that your channel ID is correct.
|
||||
@@ -534,6 +534,7 @@ invseeCommandDescription=See the inventory of other players.
|
||||
invseeCommandUsage=/<command> <player>
|
||||
invseeCommandUsage1=/<command> <player>
|
||||
invseeCommandUsage1Description=Opens the inventory of the specified player
|
||||
invseeNoSelf=\u00a7cYou can only view other players' inventories.
|
||||
is=is
|
||||
isIpBanned=\u00a76IP \u00a7c{0} \u00a76is banned.
|
||||
internalError=\u00a7cAn internal error occurred while attempting to perform this command.
|
||||
|
||||
@@ -18,6 +18,17 @@ public class FormatUtilTest {
|
||||
checkFormatPerms("§aT§Aest", "§aT§Aest", "color");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFormatHexColors() {
|
||||
checkFormatPerms("&#ffffff", "&#ffffff");
|
||||
checkFormatPerms("&#ffffff", "§x§f§f§f§f§f§f", "color", "rgb");
|
||||
checkFormatPerms("&#ff0000test", "§x§f§f§0§0§0§0test", "rgb");
|
||||
checkFormatPerms("&#ff0000test", "§x§f§f§0§0§0§0test", "rgb", "color");
|
||||
checkFormatPerms("&#ff0000test", "§x§f§f§0§0§0§0test", "rgb", "white");
|
||||
checkFormatPerms("&#ff0000test", "§x§f§f§0§0§0§0test", "rgb", "black");
|
||||
checkFormatPerms("&#ff0000test", "§x§f§f§0§0§0§0test", "rgb", "black", "white");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFormatCategoryPerms() {
|
||||
checkFormatPerms("Test", "Test");
|
||||
|
||||
+5
@@ -260,6 +260,11 @@ public abstract class AbstractChatHandler {
|
||||
return event.isCancelled();
|
||||
}
|
||||
|
||||
boolean isPlayerChat(final AsyncPlayerChatEvent event) {
|
||||
// Used to distinguish chats from Player#chat (sync) from chats sent by the player (async)
|
||||
return event.isAsynchronous();
|
||||
}
|
||||
|
||||
String getChatType(final User user, final String message) {
|
||||
if (message.length() == 0) {
|
||||
//Ignore empty chat events generated by plugins
|
||||
|
||||
+2
-1
@@ -54,7 +54,7 @@ public class ChatProcessingCache {
|
||||
return getProcessedChat(player);
|
||||
}
|
||||
|
||||
public static abstract class Chat {
|
||||
public abstract static class Chat {
|
||||
private final User user;
|
||||
private final String type;
|
||||
private final String originalMessage;
|
||||
@@ -96,6 +96,7 @@ public class ChatProcessingCache {
|
||||
super(sourceChat.getUser(), sourceChat.getType(), sourceChat.getOriginalMessage());
|
||||
this.message = sourceChat.messageResult;
|
||||
this.format = sourceChat.formatResult;
|
||||
this.radius = sourceChat.radius;
|
||||
this.charge = new Trade(getLongType(), ess);
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -44,7 +44,7 @@ public class SignedChatHandler extends AbstractChatHandler {
|
||||
|
||||
private void handleChatApplyPreview(AsyncPlayerChatEvent event) {
|
||||
final ChatProcessingCache.ProcessedChat chat = cache.getProcessedChat(event.getPlayer());
|
||||
if (chat == null) {
|
||||
if (!isPlayerChat(event) || chat == null) {
|
||||
handleChatFormat(event);
|
||||
handleChatPostFormat(event);
|
||||
} else {
|
||||
|
||||
@@ -76,8 +76,8 @@ To add EssentialsX to your build system, you should use the following artifacts:
|
||||
|
||||
| Type | Group ID | Artifact ID | Version |
|
||||
|:---------------|:------------------|:--------------|:------------------|
|
||||
| Latest release | `net.essentialsx` | `EssentialsX` | `2.19.6` |
|
||||
| Snapshots | `net.essentialsx` | `EssentialsX` | `2.19.6-SNAPSHOT` |
|
||||
| Latest release | `net.essentialsx` | `EssentialsX` | `2.19.7` |
|
||||
| Snapshots | `net.essentialsx` | `EssentialsX` | `2.19.7-SNAPSHOT` |
|
||||
| Older releases | `net.ess3` | `EssentialsX` | `2.18.2` |
|
||||
|
||||
Note: until version `2.18.2`, EssentialsX used the `net.ess3` group ID.
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@ plugins {
|
||||
}
|
||||
|
||||
group = "net.essentialsx"
|
||||
version = "2.19.6"
|
||||
version = "2.19.7"
|
||||
|
||||
project.ext {
|
||||
GIT_COMMIT = !indraGit.isPresent() ? "unknown" : indraGit.commit().abbreviate(7).name()
|
||||
|
||||
+6
@@ -18,6 +18,9 @@ public class PaperLoggerProvider extends LoggerProvider {
|
||||
|
||||
@Override
|
||||
protected void doTheLog(Level level, String message, Throwable throwable) {
|
||||
if (message == null) {
|
||||
return;
|
||||
}
|
||||
final Component component = LegacyComponentSerializer.legacySection().deserialize(message);
|
||||
if (level == Level.SEVERE) {
|
||||
logger.error(component, throwable);
|
||||
@@ -34,6 +37,9 @@ public class PaperLoggerProvider extends LoggerProvider {
|
||||
|
||||
@Override
|
||||
protected void doTheLog(Level level, String message) {
|
||||
if (message == null) {
|
||||
return;
|
||||
}
|
||||
final Component component = LegacyComponentSerializer.legacySection().deserialize(message);
|
||||
if (level == Level.SEVERE) {
|
||||
logger.error(component);
|
||||
|
||||
Reference in new issue
Block a user