mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-08-06 04:23:02 +00:00
Merge branch '2.x' into custom-currency-formatting.
This commit is contained in:
commit
0237d485bf
5 changed files with 40 additions and 7 deletions
|
@ -3,6 +3,7 @@ package com.earth2me.essentials;
|
||||||
import com.earth2me.essentials.commands.IEssentialsCommand;
|
import com.earth2me.essentials.commands.IEssentialsCommand;
|
||||||
import com.earth2me.essentials.signs.EssentialsSign;
|
import com.earth2me.essentials.signs.EssentialsSign;
|
||||||
import com.earth2me.essentials.textreader.IText;
|
import com.earth2me.essentials.textreader.IText;
|
||||||
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.configuration.ConfigurationSection;
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
|
@ -242,8 +243,10 @@ public interface ISettings extends IConf {
|
||||||
boolean isMilkBucketEasterEggEnabled();
|
boolean isMilkBucketEasterEggEnabled();
|
||||||
|
|
||||||
boolean isSendFlyEnableOnJoin();
|
boolean isSendFlyEnableOnJoin();
|
||||||
|
|
||||||
boolean isWorldTimePermissions();
|
boolean isWorldTimePermissions();
|
||||||
|
|
||||||
|
boolean isSpawnOnJoin();
|
||||||
|
|
||||||
NumberFormat getCurrencyFormat();
|
NumberFormat getCurrencyFormat();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1176,12 +1176,17 @@ public class Settings implements net.ess3.api.ISettings {
|
||||||
public boolean isWorldTimePermissions() {
|
public boolean isWorldTimePermissions() {
|
||||||
return config.getBoolean("world-time-permissions", false);
|
return config.getBoolean("world-time-permissions", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isSpawnOnJoin() {
|
||||||
|
return config.getBoolean("spawn-on-join", false);
|
||||||
|
}
|
||||||
|
|
||||||
private NumberFormat currencyFormat;
|
private NumberFormat currencyFormat;
|
||||||
|
|
||||||
private NumberFormat _getCurrencyFormat() {
|
private NumberFormat _getCurrencyFormat() {
|
||||||
String currencyFormatString = config.getString("currency-format", "#,##0.00");
|
String currencyFormatString = config.getString("currency-format", "#,##0.00");
|
||||||
|
|
||||||
String symbolLocaleString = config.getString("currency-symbol-format-locale");
|
String symbolLocaleString = config.getString("currency-symbol-format-locale");
|
||||||
DecimalFormatSymbols decimalFormatSymbols;
|
DecimalFormatSymbols decimalFormatSymbols;
|
||||||
if (symbolLocaleString != null) {
|
if (symbolLocaleString != null) {
|
||||||
|
@ -1193,7 +1198,7 @@ public class Settings implements net.ess3.api.ISettings {
|
||||||
|
|
||||||
DecimalFormat currencyFormat = new DecimalFormat(currencyFormatString, decimalFormatSymbols);
|
DecimalFormat currencyFormat = new DecimalFormat(currencyFormatString, decimalFormatSymbols);
|
||||||
currencyFormat.setRoundingMode(RoundingMode.FLOOR);
|
currencyFormat.setRoundingMode(RoundingMode.FLOOR);
|
||||||
|
|
||||||
// Updates NumberUtil#PRETTY_FORMAT field so that all of Essentials
|
// Updates NumberUtil#PRETTY_FORMAT field so that all of Essentials
|
||||||
// can follow a single format.
|
// can follow a single format.
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -814,4 +814,7 @@ respawn-listener-priority: high
|
||||||
# When users die, should they respawn at their first home or bed, instead of the spawnpoint?
|
# When users die, should they respawn at their first home or bed, instead of the spawnpoint?
|
||||||
respawn-at-home: false
|
respawn-at-home: false
|
||||||
|
|
||||||
|
# Teleport all joining players to the spawnpoint
|
||||||
|
spawn-on-join: false
|
||||||
|
|
||||||
# End of file <-- No seriously, you're done with configuration.
|
# End of file <-- No seriously, you're done with configuration.
|
||||||
|
|
|
@ -68,9 +68,27 @@ public class EssentialsSpawnPlayerListener implements Listener {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void delayedJoin(Player player) {
|
public void delayedJoin(final Player player) {
|
||||||
if (player.hasPlayedBefore()) {
|
if (player.hasPlayedBefore()) {
|
||||||
LOGGER.log(Level.FINE, "Old player join");
|
LOGGER.log(Level.FINE, "Old player join");
|
||||||
|
|
||||||
|
if (ess.getSettings().isSpawnOnJoin()) {
|
||||||
|
final User user = ess.getUser(player);
|
||||||
|
if (!user.isAuthorized("essentials.spawn-on-join.exempt")) {
|
||||||
|
ess.scheduleSyncDelayedTask(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
Location spawn = spawns.getSpawn(user.getGroup());
|
||||||
|
try {
|
||||||
|
user.getTeleport().now(spawn, false, TeleportCause.PLUGIN);
|
||||||
|
} catch (Exception e) {
|
||||||
|
ess.showError(user.getSource(), e, "spawn-on-join");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,4 +15,8 @@ commands:
|
||||||
spawn:
|
spawn:
|
||||||
description: Teleport to the spawnpoint.
|
description: Teleport to the spawnpoint.
|
||||||
usage: /<command> [player]
|
usage: /<command> [player]
|
||||||
aliases: [espawn]
|
aliases: [espawn]
|
||||||
|
permissions:
|
||||||
|
essentials.spawn-on-join.exempt:
|
||||||
|
default: false
|
||||||
|
description: "Bypass spawn teleportation on join when spawn-on-join is true."
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue