mirror of
https://github.com/Artillex-Studios/AxTrade.git
synced 2025-01-04 18:47:51 +01:00
1.10.0
This commit is contained in:
parent
2e38ba67c9
commit
f71a500f01
2
pom.xml
2
pom.xml
@ -6,7 +6,7 @@
|
||||
|
||||
<groupId>com.artillexstudios</groupId>
|
||||
<artifactId>AxTrade</artifactId>
|
||||
<version>1.9.0</version>
|
||||
<version>1.10.0</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>AxTrade</name>
|
||||
|
@ -31,6 +31,7 @@ public final class AxTrade extends AxPlugin {
|
||||
public static Config LANG;
|
||||
public static Config GUIS;
|
||||
public static Config HOOKS;
|
||||
public static Config TOGGLED;
|
||||
public static MessageUtils MESSAGEUTILS;
|
||||
private static AxPlugin instance;
|
||||
private static ThreadedQueue<Runnable> threadedQueue;
|
||||
@ -55,6 +56,7 @@ public final class AxTrade extends AxPlugin {
|
||||
LANG = new Config(new File(getDataFolder(), "lang.yml"), getResource("lang.yml"), GeneralSettings.builder().setUseDefaults(false).build(), LoaderSettings.builder().setAutoUpdate(true).build(), DumperSettings.DEFAULT, UpdaterSettings.builder().setKeepAll(true).setVersioning(new BasicVersioning("version")).build());
|
||||
new CurrencyConverter(new Config(new File(getDataFolder(), "currencies.yml")));
|
||||
HOOKS = new Config(new File(getDataFolder(), "currencies.yml"), getResource("currencies.yml"), GeneralSettings.builder().setUseDefaults(false).build(), LoaderSettings.builder().setAutoUpdate(true).build(), DumperSettings.DEFAULT, UpdaterSettings.builder().setKeepAll(true).setVersioning(new BasicVersioning("version")).build());
|
||||
TOGGLED = new Config(new File(getDataFolder(), "toggled.yml"), getResource("toggled.yml"), GeneralSettings.builder().setUseDefaults(false).build(), LoaderSettings.DEFAULT, DumperSettings.DEFAULT, UpdaterSettings.DEFAULT);
|
||||
|
||||
LanguageManager.reload();
|
||||
|
||||
|
@ -35,6 +35,7 @@ import static com.artillexstudios.axtrade.AxTrade.GUIS;
|
||||
import static com.artillexstudios.axtrade.AxTrade.HOOKS;
|
||||
import static com.artillexstudios.axtrade.AxTrade.LANG;
|
||||
import static com.artillexstudios.axtrade.AxTrade.MESSAGEUTILS;
|
||||
import static com.artillexstudios.axtrade.AxTrade.TOGGLED;
|
||||
|
||||
@CommandPermission(value = "axtrade.trade")
|
||||
public class Commands implements OrphanCommand {
|
||||
@ -87,6 +88,20 @@ public class Commands implements OrphanCommand {
|
||||
SoundUtils.playSound(request.getReceiver(), "deny");
|
||||
}
|
||||
|
||||
@CommandPermission("axtrade.toggle")
|
||||
@Subcommand("toggle")
|
||||
public void toggle(@NotNull Player sender) {
|
||||
boolean toggled = TOGGLED.getBoolean("toggled." + sender.getUniqueId(), false);
|
||||
if (toggled) {
|
||||
TOGGLED.getBackingDocument().remove("toggled." + sender.getUniqueId());
|
||||
MESSAGEUTILS.sendLang(sender, "toggle.enabled");
|
||||
} else {
|
||||
TOGGLED.set("toggled." + sender.getUniqueId(), true);
|
||||
MESSAGEUTILS.sendLang(sender, "toggle.disabled");
|
||||
}
|
||||
TOGGLED.save();
|
||||
}
|
||||
|
||||
@Subcommand("reload")
|
||||
@CommandPermission(value = "axtrade.admin")
|
||||
public void reload(@NotNull CommandSender sender) {
|
||||
|
@ -22,7 +22,7 @@ public class CoinsEngineHook implements CurrencyHook {
|
||||
public void setup() {
|
||||
currency = CoinsEngineAPI.getCurrency(internal);
|
||||
if (currency == null) {
|
||||
Bukkit.getConsoleSender().sendMessage(StringUtils.formatToString("&#FF0000[AxAuctions] CoinsEngine currency named &#DD0000" + internal + " &#FF0000not found! Change the currency-name or disable the hook to get rid of this warning!"));
|
||||
Bukkit.getConsoleSender().sendMessage(StringUtils.formatToString("&#FF0000[AxTrade] CoinsEngine currency named &#DD0000" + internal + " &#FF0000not found! Change the currency-name or disable the hook to get rid of this warning!"));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -24,7 +24,7 @@ public class EcoBitsHook implements CurrencyHook {
|
||||
public void setup() {
|
||||
currency = Currencies.getByID(internal);
|
||||
if (currency == null) {
|
||||
Bukkit.getConsoleSender().sendMessage(StringUtils.formatToString("&#FF0000[AxAuctions] EcoBits currency named &#DD0000" + internal + " &#FF0000not found! Change the currency-name or disable the hook to get rid of this warning!"));
|
||||
Bukkit.getConsoleSender().sendMessage(StringUtils.formatToString("&#FF0000[AxTrade] EcoBits currency named &#DD0000" + internal + " &#FF0000not found! Change the currency-name or disable the hook to get rid of this warning!"));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -23,7 +23,7 @@ public class RedisEconomyHook implements CurrencyHook {
|
||||
RedisEconomyAPI api = RedisEconomyAPI.getAPI();
|
||||
currency = api.getCurrencyByName(internal);
|
||||
if (currency == null) {
|
||||
Bukkit.getConsoleSender().sendMessage(StringUtils.formatToString("&#FF0000[AxAuctions] RedisEconomy currency named &#DD0000" + internal + " &#FF0000not found! Change the currency-name or disable the hook to get rid of this warning!"));
|
||||
Bukkit.getConsoleSender().sendMessage(StringUtils.formatToString("&#FF0000[AxTrade] RedisEconomy currency named &#DD0000" + internal + " &#FF0000not found! Change the currency-name or disable the hook to get rid of this warning!"));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -24,7 +24,7 @@ public class UltraEconomyHook implements CurrencyHook {
|
||||
public void setup() {
|
||||
final Optional<Currency> currencyOptional = UltraEconomy.getAPI().getCurrencies().name(internal);
|
||||
if (currencyOptional.isEmpty()) {
|
||||
Bukkit.getConsoleSender().sendMessage(StringUtils.formatToString("&#FF0000[AxAuctions] UltraEconomy currency named &#DD0000" + internal + " &#FF0000not found! Change the currency-name or disable the hook to get rid of this warning!"));
|
||||
Bukkit.getConsoleSender().sendMessage(StringUtils.formatToString("&#FF0000[AxTrade] UltraEconomy currency named &#DD0000" + internal + " &#FF0000not found! Change the currency-name or disable the hook to get rid of this warning!"));
|
||||
return;
|
||||
}
|
||||
currency = currencyOptional.get();
|
||||
|
@ -18,6 +18,7 @@ import java.util.Map;
|
||||
import static com.artillexstudios.axtrade.AxTrade.CONFIG;
|
||||
import static com.artillexstudios.axtrade.AxTrade.LANG;
|
||||
import static com.artillexstudios.axtrade.AxTrade.MESSAGEUTILS;
|
||||
import static com.artillexstudios.axtrade.AxTrade.TOGGLED;
|
||||
|
||||
public class Requests {
|
||||
private static final ArrayList<Request> requests = new ArrayList<>();
|
||||
@ -42,6 +43,16 @@ public class Requests {
|
||||
return;
|
||||
}
|
||||
|
||||
if (TOGGLED.getBoolean("toggled." + receiver.getUniqueId())) {
|
||||
MESSAGEUTILS.sendLang(sender, "request.not-accepting", replacements);
|
||||
return;
|
||||
}
|
||||
|
||||
if (TOGGLED.getBoolean("toggled." + sender.getUniqueId())) {
|
||||
MESSAGEUTILS.sendLang(sender, "request.disabled-trading", replacements);
|
||||
return;
|
||||
}
|
||||
|
||||
if (sender.equals(receiver)) {
|
||||
MESSAGEUTILS.sendLang(sender, "request.cant-trade-self", replacements);
|
||||
return;
|
||||
|
@ -4,7 +4,6 @@ import com.artillexstudios.axapi.gui.SignInput;
|
||||
import com.artillexstudios.axapi.nms.NMSHandlers;
|
||||
import com.artillexstudios.axapi.scheduler.ScheduledTask;
|
||||
import com.artillexstudios.axapi.scheduler.Scheduler;
|
||||
import com.artillexstudios.axapi.utils.Pair;
|
||||
import com.artillexstudios.axapi.utils.StringUtils;
|
||||
import com.artillexstudios.axtrade.utils.BlackListUtils;
|
||||
import com.artillexstudios.axtrade.utils.NumberUtils;
|
||||
@ -151,6 +150,8 @@ public class TradeGui extends GuiFrame {
|
||||
trade.abort();
|
||||
});
|
||||
|
||||
if (trade.ended) return;
|
||||
|
||||
update();
|
||||
gui.open(player.getPlayer());
|
||||
updateTitle();
|
||||
|
@ -28,6 +28,10 @@ trade:
|
||||
aborted: "&#CCFFEEYour trade with �FFDD%player% &#CCFFEEwas aborted!"
|
||||
blacklisted-item: "&#CCFFEEThis item is blacklisted!"
|
||||
|
||||
toggle:
|
||||
enabled: "&#CCFFEEYou have enabled trade requests!"
|
||||
disabled: "&#CCFFEEYou have disabled trade requests!"
|
||||
|
||||
# summary after a successful trade
|
||||
summary:
|
||||
get:
|
||||
@ -59,10 +63,11 @@ request:
|
||||
already-in-trade: "&#CCFFEEThe player is already trading with someone!"
|
||||
already-sent: "&#CCFFEEYou have already sent a trade request to �FFDD%player% &#CCFFEErecently!"
|
||||
too-far: "&#CCFFEEYou are too far from �FFDD%player% &#CCFFEEto send a trade request!"
|
||||
not-accepting: "&#CCFFEEThis player is not accepting trades right now!"
|
||||
not-accepting: "&#CCFFEEThis player is not accepting trades!"
|
||||
disallowed-gamemode: "&#CCFFEEEither you or the other player is in a disallowed gamemode!"
|
||||
blacklisted-world: "&#CCFFEETrades are disabled in this world!"
|
||||
expired: "&#CCFFEEYour trade request to �FFDD%player% &#CCFFEEhas expired!"
|
||||
disabled-trading: "&#CCFFEEYou have disabled trades! Use �FFDD/trade toggle &#CCFFEEto enable."
|
||||
|
||||
# this must be 4 lines
|
||||
# note: currently the first line must be left empty
|
||||
@ -105,4 +110,4 @@ commands:
|
||||
update-notifier: "&#AAFFCCThere is a new version of the plugin available! &#DDDDDD(&#FFFFFFcurrent: &#FF0000%current% &#DDDDDD| &#FFFFFFlatest: �FF00%latest%&#DDDDDD)"
|
||||
|
||||
# do not change this
|
||||
version: 5
|
||||
version: 6
|
@ -9,6 +9,8 @@ permissions:
|
||||
default: op
|
||||
axtrade.trade:
|
||||
default: true
|
||||
axtrade.toggle:
|
||||
default: true
|
||||
|
||||
softdepend:
|
||||
- AxQuestBoard
|
||||
|
1
src/main/resources/toggled.yml
Normal file
1
src/main/resources/toggled.yml
Normal file
@ -0,0 +1 @@
|
||||
toggled: []
|
Loading…
Reference in New Issue
Block a user