1.5r3 p2
This commit is contained in:
parent
45678728e6
commit
bb2beec3c4
5 changed files with 43 additions and 4 deletions
|
|
@ -11,7 +11,7 @@ public class GLevelBaseCommand implements CommandExecutor {
|
||||||
|
|
||||||
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
|
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
|
||||||
if (args.length == 0) {
|
if (args.length == 0) {
|
||||||
sender.sendMessage(ChatColor.RED + "Usage: /gLevel <prestige>");
|
sender.sendMessage(ChatColor.RED + "Usage: /gLevel <prestige|shop>");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -22,8 +22,16 @@ public class GLevelBaseCommand implements CommandExecutor {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return Prestige.subCommand((Player) sender);
|
return Prestige.subCommand((Player) sender);
|
||||||
|
case "shop":
|
||||||
|
if (!(sender instanceof Player)) {
|
||||||
|
sender.sendMessage(ChatColor.RED + "This command can only be used by players.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
PrestigeShop shop = new PrestigeShop((Player) sender);
|
||||||
|
shop.open();
|
||||||
|
return true;
|
||||||
default:
|
default:
|
||||||
sender.sendMessage(ChatColor.RED + "Unknown subcommand. Usage: /gLevel <prestige>");
|
sender.sendMessage(ChatColor.RED + "Unknown subcommand. Usage: /gLevel <prestige|shop>");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ public class GLevelTabCompleter implements TabCompleter {
|
||||||
@Nullable
|
@Nullable
|
||||||
public List<String> onTabComplete(@NotNull CommandSender commandSender, @NotNull Command command, @NotNull String s, @NotNull String[] strings) {
|
public List<String> onTabComplete(@NotNull CommandSender commandSender, @NotNull Command command, @NotNull String s, @NotNull String[] strings) {
|
||||||
if (strings.length == 1) {
|
if (strings.length == 1) {
|
||||||
return List.of("prestige");
|
return List.of("prestige", "shop");
|
||||||
}
|
}
|
||||||
return List.of();
|
return List.of();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,9 @@ public enum ConfigKey {
|
||||||
MARKET_RIPOFF_MULTIPLIER("market_ripoff_multiplier", 10.0),
|
MARKET_RIPOFF_MULTIPLIER("market_ripoff_multiplier", 10.0),
|
||||||
MARKET_MIN_PRICE("market_min_price", 0.25),
|
MARKET_MIN_PRICE("market_min_price", 0.25),
|
||||||
MARKET_PRICE_REFRESH_INTERVAL("market_price_refresh_interval", 300),
|
MARKET_PRICE_REFRESH_INTERVAL("market_price_refresh_interval", 300),
|
||||||
LOG_LEVEL("log_level", "Info");
|
LOG_LEVEL("log_level", "Info"),
|
||||||
|
PRESTIGE_CAPABILITY_AUTOSELL_PRICE("prestige_capability_autosell_price", 5),
|
||||||
|
PRESTIGE_CAPABILITY_MAGNET_PRICE("prestige_capability_magnet_price", 10);
|
||||||
|
|
||||||
private final String key;
|
private final String key;
|
||||||
private final Object defaultValue;
|
private final Object defaultValue;
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,9 @@
|
||||||
package org.gsdistance.grimmsServer.Events.Listeners;
|
package org.gsdistance.grimmsServer.Events.Listeners;
|
||||||
|
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.inventory.InventoryHolder;
|
import org.bukkit.inventory.InventoryHolder;
|
||||||
|
import org.gsdistance.grimmsServer.Commands.GLevelCommand.PrestigeShop;
|
||||||
|
import org.gsdistance.grimmsServer.Commands.GUtilCommand.SettingGUI;
|
||||||
import org.gsdistance.grimmsServer.Shared;
|
import org.gsdistance.grimmsServer.Shared;
|
||||||
|
|
||||||
public class InventoryClickEvent {
|
public class InventoryClickEvent {
|
||||||
|
|
@ -13,6 +16,26 @@ public class InventoryClickEvent {
|
||||||
if (!Shared.checkContainerAuth(player, holder, "modify")) {
|
if (!Shared.checkContainerAuth(player, holder, "modify")) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Handle PrestigeShop GUI
|
||||||
|
if (event.getView().getTitle().equals(PrestigeShop.GUI_TITLE)) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
PrestigeShop shop = PrestigeShop.getGUI(player);
|
||||||
|
if (shop != null) {
|
||||||
|
shop.handleClick(event.getSlot());
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Handle SettingGUI
|
||||||
|
if (event.getView().getTitle().equals(SettingGUI.GUI_TITLE)) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
SettingGUI settingGUI = SettingGUI.getGUI(player);
|
||||||
|
if (settingGUI != null) {
|
||||||
|
settingGUI.handleClick(event.getSlot());
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
package org.gsdistance.grimmsServer.Events.Listeners;
|
package org.gsdistance.grimmsServer.Events.Listeners;
|
||||||
|
|
||||||
|
import org.gsdistance.grimmsServer.Commands.GLevelCommand.PrestigeShop;
|
||||||
|
import org.gsdistance.grimmsServer.Commands.GUtilCommand.SettingGUI;
|
||||||
import org.gsdistance.grimmsServer.Constructable.Location;
|
import org.gsdistance.grimmsServer.Constructable.Location;
|
||||||
import org.gsdistance.grimmsServer.Constructable.Player.PlayerMetadata;
|
import org.gsdistance.grimmsServer.Constructable.Player.PlayerMetadata;
|
||||||
|
|
||||||
|
|
@ -14,5 +16,9 @@ public class PlayerQuitEvent {
|
||||||
metadata.exitLocation = new Location(event.getPlayer().getLocation());
|
metadata.exitLocation = new Location(event.getPlayer().getLocation());
|
||||||
metadata.lastExitTime = LocalDateTime.now().toString();
|
metadata.lastExitTime = LocalDateTime.now().toString();
|
||||||
metadata.saveToPDS();
|
metadata.saveToPDS();
|
||||||
|
|
||||||
|
// Clean up GUIs
|
||||||
|
PrestigeShop.closeGUI(event.getPlayer());
|
||||||
|
SettingGUI.closeGUI(event.getPlayer());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue