mirror of
https://github.com/songoda/SongodaCore.git
synced 2024-11-27 20:45:27 +01:00
Removed the command and replaced it with an activation sequence.
This commit is contained in:
parent
3935f920f9
commit
35f3d381dc
@ -53,7 +53,7 @@ public class SongodaCore {
|
|||||||
/**
|
/**
|
||||||
* This has been added as of Rev 6
|
* 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
|
* This is specific to the website api
|
||||||
@ -162,8 +162,7 @@ public class SongodaCore {
|
|||||||
private void init() {
|
private void init() {
|
||||||
shadingListener = new ShadedEventListener();
|
shadingListener = new ShadedEventListener();
|
||||||
commandManager.registerCommandDynamically(new SongodaCoreCommand())
|
commandManager.registerCommandDynamically(new SongodaCoreCommand())
|
||||||
.addSubCommand(new SongodaCoreDiagCommand())
|
.addSubCommand(new SongodaCoreDiagCommand());
|
||||||
.addSubCommand(new SongodaCoreShowGuiKeysCommand());
|
|
||||||
Bukkit.getPluginManager().registerEvents(loginListener, piggybackedPlugin);
|
Bukkit.getPluginManager().registerEvents(loginListener, piggybackedPlugin);
|
||||||
Bukkit.getPluginManager().registerEvents(shadingListener, piggybackedPlugin);
|
Bukkit.getPluginManager().registerEvents(shadingListener, piggybackedPlugin);
|
||||||
// we aggressively want to own this command
|
// we aggressively want to own this command
|
||||||
|
@ -25,6 +25,7 @@ import java.util.Map;
|
|||||||
public class CustomizableGui extends Gui {
|
public class CustomizableGui extends Gui {
|
||||||
|
|
||||||
private static boolean showGuiKeys = false;
|
private static boolean showGuiKeys = false;
|
||||||
|
private int activationCount = 0;
|
||||||
|
|
||||||
private static final Map<String, CustomContent> loadedGuis = new HashMap<>();
|
private static final Map<String, CustomContent> loadedGuis = new HashMap<>();
|
||||||
private final CustomContent customContent;
|
private final CustomContent customContent;
|
||||||
@ -59,6 +60,7 @@ public class CustomizableGui extends Gui {
|
|||||||
config.saveChanges();
|
config.saveChanges();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!config.isConfigurationSection("disabled")) {
|
if (!config.isConfigurationSection("disabled")) {
|
||||||
config.setDefault("disabled", Arrays.asList("example3", "example4", "example5"),
|
config.setDefault("disabled", Arrays.asList("example3", "example4", "example5"),
|
||||||
"All keys on this list will be disabled. You can add any items key here",
|
"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 {
|
} else {
|
||||||
customContent = loadedGuis.get(guiKey);
|
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__"))
|
if (customContent.isButtonCustomized("__DEFAULT__"))
|
||||||
blankItem = GuiUtils.getBorderItem(customContent.getCustomizedButton("__DEFAULT__").item);
|
blankItem = GuiUtils.getBorderItem(customContent.getCustomizedButton("__DEFAULT__").item);
|
||||||
@ -511,11 +522,6 @@ public class CustomizableGui extends Gui {
|
|||||||
return newLore;
|
return newLore;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean toggleShowGuiKeys() {
|
|
||||||
showGuiKeys = !showGuiKeys;
|
|
||||||
return showGuiKeys;
|
|
||||||
}
|
|
||||||
|
|
||||||
private class CustomButton {
|
private class CustomButton {
|
||||||
|
|
||||||
private final String key;
|
private final String key;
|
||||||
|
@ -59,6 +59,7 @@ public class Gui {
|
|||||||
protected GuiManager guiManager;
|
protected GuiManager guiManager;
|
||||||
protected boolean open = false;
|
protected boolean open = false;
|
||||||
protected Clickable defaultClicker = null;
|
protected Clickable defaultClicker = null;
|
||||||
|
protected Clickable privateDefaultClicker = null;
|
||||||
protected Openable opener = null;
|
protected Openable opener = null;
|
||||||
protected Closable closer = null;
|
protected Closable closer = null;
|
||||||
protected Droppable dropper = null;
|
protected Droppable dropper = null;
|
||||||
@ -279,6 +280,12 @@ public class Gui {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
protected Gui setPrivateDefaultAction(@Nullable Clickable action) {
|
||||||
|
privateDefaultClicker = action;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public Gui setDefaultItem(@Nullable ItemStack item) {
|
public Gui setDefaultItem(@Nullable ItemStack item) {
|
||||||
blankItem = item;
|
blankItem = item;
|
||||||
@ -624,6 +631,12 @@ public class Gui {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void reset() {
|
||||||
|
if (inventory != null)
|
||||||
|
inventory.clear();
|
||||||
|
setActionForRange(0, 53, null);
|
||||||
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public Gui setNextPage(int cell, @NotNull ItemStack item) {
|
public Gui setNextPage(int cell, @NotNull ItemStack item) {
|
||||||
nextPageIndex = cell;
|
nextPageIndex = cell;
|
||||||
@ -812,6 +825,10 @@ public class Gui {
|
|||||||
// this is a default action, not a triggered action
|
// this is a default action, not a triggered action
|
||||||
defaultClicker.onClick(new GuiClickEvent(manager, this, player, event, cell, true));
|
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 false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
Reference in New Issue
Block a user