mirror of
https://github.com/songoda/SongodaCore.git
synced 2024-11-23 18:45:34 +01:00
Merge branch 'development'
This commit is contained in:
commit
3fdcf68f32
@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>com.songoda</groupId>
|
||||
<artifactId>SongodaCore-Modules</artifactId>
|
||||
<version>2.4.24</version>
|
||||
<version>2.4.25</version>
|
||||
<relativePath>../</relativePath>
|
||||
</parent>
|
||||
|
||||
|
@ -8,7 +8,6 @@ import com.songoda.core.core.PluginInfo;
|
||||
import com.songoda.core.core.PluginInfoModule;
|
||||
import com.songoda.core.core.SongodaCoreCommand;
|
||||
import com.songoda.core.core.SongodaCoreDiagCommand;
|
||||
import com.songoda.core.core.SongodaCoreShowGuiKeysCommand;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
@ -18,7 +17,6 @@ import org.bukkit.event.player.PlayerLoginEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.event.server.PluginDisableEvent;
|
||||
import org.bukkit.event.server.PluginEnableEvent;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
import org.bukkit.plugin.ServicePriority;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.bukkit.scheduler.BukkitTask;
|
||||
@ -55,7 +53,7 @@ public class SongodaCore {
|
||||
/**
|
||||
* This has been added as of Rev 6
|
||||
*/
|
||||
private final static String coreVersion = "2.4.24";
|
||||
private final static String coreVersion = "2.4.25";
|
||||
|
||||
/**
|
||||
* This is specific to the website api
|
||||
@ -164,8 +162,7 @@ public class SongodaCore {
|
||||
private void init() {
|
||||
shadingListener = new ShadedEventListener();
|
||||
commandManager.registerCommandDynamically(new SongodaCoreCommand())
|
||||
.addSubCommand(new SongodaCoreDiagCommand())
|
||||
.addSubCommand(new SongodaCoreShowGuiKeysCommand());
|
||||
.addSubCommand(new SongodaCoreDiagCommand());
|
||||
Bukkit.getPluginManager().registerEvents(loginListener, piggybackedPlugin);
|
||||
Bukkit.getPluginManager().registerEvents(shadingListener, piggybackedPlugin);
|
||||
// we aggressively want to own this command
|
||||
@ -178,7 +175,6 @@ public class SongodaCore {
|
||||
tasks.add(Bukkit.getScheduler().runTaskLaterAsynchronously(piggybackedPlugin, () -> {
|
||||
CommandManager.registerCommandDynamically(piggybackedPlugin, "songoda", commandManager, commandManager);
|
||||
}, 20 * 60 * 2));
|
||||
tasks.add(Bukkit.getScheduler().runTaskLaterAsynchronously(piggybackedPlugin, () -> registerAllPlugins(), 20 * 60 * 2));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -199,75 +195,6 @@ public class SongodaCore {
|
||||
|
||||
private ArrayList<BukkitTask> tasks = new ArrayList();
|
||||
|
||||
/**
|
||||
* Register plugins that may not have been updated yet
|
||||
*/
|
||||
private void registerAllPlugins() {
|
||||
PluginManager pm = Bukkit.getPluginManager();
|
||||
String p;
|
||||
if (!isRegistered(p = "EpicAnchors") && pm.isPluginEnabled(p)) {
|
||||
register((JavaPlugin) pm.getPlugin(p), 31, CompatibleMaterial.END_PORTAL_FRAME.name());
|
||||
}
|
||||
if (!isRegistered(p = "EpicBosses") && pm.isPluginEnabled(p)) {
|
||||
register((JavaPlugin) pm.getPlugin(p), 19, CompatibleMaterial.ZOMBIE_SPAWN_EGG.name());
|
||||
}
|
||||
if (!isRegistered(p = "EpicEnchants") && pm.isPluginEnabled(p)) {
|
||||
register((JavaPlugin) pm.getPlugin(p), 67, CompatibleMaterial.DIAMOND_SWORD.name());
|
||||
}
|
||||
if (!isRegistered(p = "EpicFarming") && pm.isPluginEnabled(p)) {
|
||||
register((JavaPlugin) pm.getPlugin(p), 21, CompatibleMaterial.WHEAT.name());
|
||||
}
|
||||
if (!isRegistered(p = "EpicFurnaces") && pm.isPluginEnabled(p)) {
|
||||
register((JavaPlugin) pm.getPlugin(p), 22, CompatibleMaterial.FURNACE.name());
|
||||
}
|
||||
if (!isRegistered(p = "EpicHeads") && pm.isPluginEnabled(p)) {
|
||||
register((JavaPlugin) pm.getPlugin(p), 26, CompatibleMaterial.PLAYER_HEAD.name());
|
||||
}
|
||||
if (!isRegistered(p = "EpicHoppers") && pm.isPluginEnabled(p)) {
|
||||
register((JavaPlugin) pm.getPlugin(p), 15, CompatibleMaterial.HOPPER.name());
|
||||
}
|
||||
if (!isRegistered(p = "EpicLevels") && pm.isPluginEnabled(p)) {
|
||||
register((JavaPlugin) pm.getPlugin(p), 44, CompatibleMaterial.NETHER_STAR.name());
|
||||
}
|
||||
if (!isRegistered(p = "EpicSpawners") && pm.isPluginEnabled(p)) {
|
||||
register((JavaPlugin) pm.getPlugin(p), 13, CompatibleMaterial.SPAWNER.name());
|
||||
}
|
||||
if (!isRegistered(p = "EpicVouchers") && pm.isPluginEnabled(p)) {
|
||||
register((JavaPlugin) pm.getPlugin(p), 25, CompatibleMaterial.EMERALD.name());
|
||||
}
|
||||
if (!isRegistered(p = "FabledSkyBlock") && pm.isPluginEnabled(p)) {
|
||||
register((JavaPlugin) pm.getPlugin(p), 17, CompatibleMaterial.GRASS_BLOCK.name());
|
||||
}
|
||||
if (!isRegistered(p = "UltimateCatcher") && pm.isPluginEnabled(p)) {
|
||||
register((JavaPlugin) pm.getPlugin(p), 51, CompatibleMaterial.EGG.name());
|
||||
}
|
||||
if (!isRegistered(p = "UltimateClaims") && pm.isPluginEnabled(p)) {
|
||||
register((JavaPlugin) pm.getPlugin(p), 65, CompatibleMaterial.CHEST.name());
|
||||
}
|
||||
if (!isRegistered(p = "UltimateFishing") && pm.isPluginEnabled(p)) {
|
||||
register((JavaPlugin) pm.getPlugin(p), 59, CompatibleMaterial.COD.name());
|
||||
}
|
||||
if (!isRegistered(p = "UltimateKits") && pm.isPluginEnabled(p)) {
|
||||
register((JavaPlugin) pm.getPlugin(p), 14, CompatibleMaterial.BEACON.name());
|
||||
}
|
||||
if (!isRegistered(p = "UltimateModeration") && pm.isPluginEnabled(p)) {
|
||||
register((JavaPlugin) pm.getPlugin(p), 29, CompatibleMaterial.DIAMOND_CHESTPLATE.name());
|
||||
}
|
||||
if (!isRegistered(p = "UltimateRepairing") && pm.isPluginEnabled(p)) {
|
||||
register((JavaPlugin) pm.getPlugin(p), 20, CompatibleMaterial.ANVIL.name());
|
||||
}
|
||||
if (!isRegistered(p = "UltimateStacker") && pm.isPluginEnabled(p)) {
|
||||
register((JavaPlugin) pm.getPlugin(p), 16, CompatibleMaterial.IRON_INGOT.name());
|
||||
}
|
||||
if (!isRegistered(p = "UltimateTimber") && pm.isPluginEnabled(p)) {
|
||||
register((JavaPlugin) pm.getPlugin(p), 18, CompatibleMaterial.IRON_AXE.name());
|
||||
}
|
||||
}
|
||||
|
||||
private void register(JavaPlugin plugin, int pluginID, String icon) {
|
||||
register(plugin, pluginID, icon, "?");
|
||||
}
|
||||
|
||||
private void register(JavaPlugin plugin, int pluginID, String icon, String libraryVersion) {
|
||||
System.out.println(getPrefix() + "Hooked " + plugin.getName() + ".");
|
||||
PluginInfo info = new PluginInfo(plugin, pluginID, icon, libraryVersion);
|
||||
|
@ -3,6 +3,7 @@ package com.songoda.core.commands;
|
||||
import com.songoda.core.chat.ChatMessage;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.ConsoleCommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
@ -59,9 +60,11 @@ public class MainCommand extends AbstractCommand {
|
||||
sender.sendMessage(header);
|
||||
} else {
|
||||
new ChatMessage().fromText(String.format("#ff8080&l%s &8» &7Version %s Created with <3 by #ec4e74&l&oS#fa5b65&l&oo#ff6c55&l&on#ff7f44&l&og#ff9432&l&oo#ffaa1e&l&od#f4c009&l&oa",
|
||||
plugin.getDescription().getName(), plugin.getDescription().getVersion()), true)
|
||||
plugin.getDescription().getName(), plugin.getDescription().getVersion()), sender instanceof ConsoleCommandSender)
|
||||
.sendTo(sender);
|
||||
}
|
||||
sender.sendMessage(ChatColor.DARK_GRAY + "- " + ChatColor.YELLOW + "/songoda" + ChatColor.GRAY + " - Opens the Songoda plugin GUI");
|
||||
sender.sendMessage("");
|
||||
|
||||
if (nestedCommands != null) {
|
||||
List<String> commands = nestedCommands.children.values().stream().distinct().map(c -> c.getCommands().get(0)).collect(Collectors.toList());
|
||||
|
@ -1,42 +0,0 @@
|
||||
package com.songoda.core.core;
|
||||
|
||||
import com.songoda.core.commands.AbstractCommand;
|
||||
import com.songoda.core.gui.CustomizableGui;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class SongodaCoreShowGuiKeysCommand extends AbstractCommand {
|
||||
|
||||
public SongodaCoreShowGuiKeysCommand() {
|
||||
super(false, "showguikeys");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ReturnType runCommand(CommandSender sender, String... args) {
|
||||
sender.sendMessage(CustomizableGui.toggleShowGuiKeys() ? "Now showing keys." : "No longer showing keys.");
|
||||
|
||||
return ReturnType.SUCCESS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPermissionNode() {
|
||||
return "songoda.admin";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSyntax() {
|
||||
return "/songoda showguikeys";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return "Show the keys for all items in every gui.";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<String> onTab(CommandSender sender, String... args) {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
@ -25,6 +25,7 @@ import java.util.Map;
|
||||
public class CustomizableGui extends Gui {
|
||||
|
||||
private static boolean showGuiKeys = false;
|
||||
private int activationCount = 0;
|
||||
|
||||
private static final Map<String, CustomContent> loadedGuis = new HashMap<>();
|
||||
private final CustomContent customContent;
|
||||
@ -59,6 +60,7 @@ public class CustomizableGui extends Gui {
|
||||
config.saveChanges();
|
||||
}
|
||||
|
||||
|
||||
if (!config.isConfigurationSection("disabled")) {
|
||||
config.setDefault("disabled", Arrays.asList("example3", "example4", "example5"),
|
||||
"All keys on this list will be disabled. You can add any items key here",
|
||||
@ -98,6 +100,15 @@ public class CustomizableGui extends Gui {
|
||||
} else {
|
||||
customContent = loadedGuis.get(guiKey);
|
||||
}
|
||||
setPrivateDefaultAction(event -> {
|
||||
if (event.clickType == ClickType.SHIFT_RIGHT)
|
||||
activationCount ++;
|
||||
if (activationCount >= 8 && event.player.hasPermission("songoda.admin")) {
|
||||
showGuiKeys = !showGuiKeys;
|
||||
activationCount = 0;
|
||||
event.player.sendMessage("Gui keys " + (showGuiKeys ? "enabled" : "disabled") + ".");
|
||||
}
|
||||
});
|
||||
|
||||
if (customContent.isButtonCustomized("__DEFAULT__"))
|
||||
blankItem = GuiUtils.getBorderItem(customContent.getCustomizedButton("__DEFAULT__").item);
|
||||
@ -511,11 +522,6 @@ public class CustomizableGui extends Gui {
|
||||
return newLore;
|
||||
}
|
||||
|
||||
public static boolean toggleShowGuiKeys() {
|
||||
showGuiKeys = !showGuiKeys;
|
||||
return showGuiKeys;
|
||||
}
|
||||
|
||||
private class CustomButton {
|
||||
|
||||
private final String key;
|
||||
|
@ -59,6 +59,7 @@ public class Gui {
|
||||
protected GuiManager guiManager;
|
||||
protected boolean open = false;
|
||||
protected Clickable defaultClicker = null;
|
||||
protected Clickable privateDefaultClicker = null;
|
||||
protected Openable opener = null;
|
||||
protected Closable closer = null;
|
||||
protected Droppable dropper = null;
|
||||
@ -279,6 +280,12 @@ public class Gui {
|
||||
return this;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
protected Gui setPrivateDefaultAction(@Nullable Clickable action) {
|
||||
privateDefaultClicker = action;
|
||||
return this;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public Gui setDefaultItem(@Nullable ItemStack item) {
|
||||
blankItem = item;
|
||||
@ -624,6 +631,12 @@ public class Gui {
|
||||
return this;
|
||||
}
|
||||
|
||||
public void reset() {
|
||||
if (inventory != null)
|
||||
inventory.clear();
|
||||
setActionForRange(0, 53, null);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public Gui setNextPage(int cell, @NotNull ItemStack item) {
|
||||
nextPageIndex = cell;
|
||||
@ -812,6 +825,10 @@ public class Gui {
|
||||
// this is a default action, not a triggered action
|
||||
defaultClicker.onClick(new GuiClickEvent(manager, this, player, event, cell, true));
|
||||
}
|
||||
if (privateDefaultClicker != null) {
|
||||
// this is a private default action, not a triggered action
|
||||
privateDefaultClicker.onClick(new GuiClickEvent(manager, this, player, event, cell, true));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>com.songoda</groupId>
|
||||
<artifactId>SongodaCore-Modules</artifactId>
|
||||
<version>2.4.24</version>
|
||||
<version>2.4.25</version>
|
||||
<relativePath>../../</relativePath>
|
||||
</parent>
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>com.songoda</groupId>
|
||||
<artifactId>SongodaCore-Modules</artifactId>
|
||||
<version>2.4.24</version>
|
||||
<version>2.4.25</version>
|
||||
<relativePath>../../</relativePath>
|
||||
</parent>
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>com.songoda</groupId>
|
||||
<artifactId>SongodaCore-Modules</artifactId>
|
||||
<version>2.4.24</version>
|
||||
<version>2.4.25</version>
|
||||
<relativePath>../../</relativePath>
|
||||
</parent>
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>com.songoda</groupId>
|
||||
<artifactId>SongodaCore-Modules</artifactId>
|
||||
<version>2.4.24</version>
|
||||
<version>2.4.25</version>
|
||||
<relativePath>../../</relativePath>
|
||||
</parent>
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>com.songoda</groupId>
|
||||
<artifactId>SongodaCore-Modules</artifactId>
|
||||
<version>2.4.24</version>
|
||||
<version>2.4.25</version>
|
||||
<relativePath>../../</relativePath>
|
||||
</parent>
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>com.songoda</groupId>
|
||||
<artifactId>SongodaCore-Modules</artifactId>
|
||||
<version>2.4.24</version>
|
||||
<version>2.4.25</version>
|
||||
<relativePath>../../</relativePath>
|
||||
</parent>
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>com.songoda</groupId>
|
||||
<artifactId>SongodaCore-Modules</artifactId>
|
||||
<version>2.4.24</version>
|
||||
<version>2.4.25</version>
|
||||
<relativePath>../../</relativePath>
|
||||
</parent>
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>com.songoda</groupId>
|
||||
<artifactId>SongodaCore-Modules</artifactId>
|
||||
<version>2.4.24</version>
|
||||
<version>2.4.25</version>
|
||||
<relativePath>../../</relativePath>
|
||||
</parent>
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>com.songoda</groupId>
|
||||
<artifactId>SongodaCore-Modules</artifactId>
|
||||
<version>2.4.24</version>
|
||||
<version>2.4.25</version>
|
||||
<relativePath>../../</relativePath>
|
||||
</parent>
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>com.songoda</groupId>
|
||||
<artifactId>SongodaCore-Modules</artifactId>
|
||||
<version>2.4.24</version>
|
||||
<version>2.4.25</version>
|
||||
<relativePath>../../</relativePath>
|
||||
</parent>
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>com.songoda</groupId>
|
||||
<artifactId>SongodaCore-Modules</artifactId>
|
||||
<version>2.4.24</version>
|
||||
<version>2.4.25</version>
|
||||
<relativePath>../../</relativePath>
|
||||
</parent>
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>com.songoda</groupId>
|
||||
<artifactId>SongodaCore-Modules</artifactId>
|
||||
<version>2.4.24</version>
|
||||
<version>2.4.25</version>
|
||||
<relativePath>../../</relativePath>
|
||||
</parent>
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>com.songoda</groupId>
|
||||
<artifactId>SongodaCore-Modules</artifactId>
|
||||
<version>2.4.24</version>
|
||||
<version>2.4.25</version>
|
||||
<relativePath>../../</relativePath>
|
||||
</parent>
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>com.songoda</groupId>
|
||||
<artifactId>SongodaCore-Modules</artifactId>
|
||||
<version>2.4.24</version>
|
||||
<version>2.4.25</version>
|
||||
<relativePath>../../</relativePath>
|
||||
</parent>
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>com.songoda</groupId>
|
||||
<artifactId>SongodaCore-Modules</artifactId>
|
||||
<version>2.4.24</version>
|
||||
<version>2.4.25</version>
|
||||
<relativePath>../../</relativePath>
|
||||
</parent>
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>com.songoda</groupId>
|
||||
<artifactId>SongodaCore-Modules</artifactId>
|
||||
<version>2.4.24</version>
|
||||
<version>2.4.25</version>
|
||||
<relativePath>../../</relativePath>
|
||||
</parent>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user