Add extra GUI settings to config.yml, push to v6.4

This commit is contained in:
Esophose 2019-02-05 02:20:19 -07:00
parent 3a95de9803
commit b2459eb8d0
13 changed files with 71 additions and 23 deletions

View file

@ -1,5 +1,9 @@
== UPDATING WILL DELETE YOUR CONFIG.YML == == UPDATING WILL DELETE YOUR CONFIG.YML ==
* Create a backup of your config.yml if you wish to import all your old settings! * Create a backup of your config.yml if you wish to import all your old settings!
=== v6.4 (In progress) ===
+ Added setting 'gui-close-after-group-selected' to the config.yml
+ Added setting 'gui-presets-only' to the config.yml
+ Added Vietnamese translation file (vi_VN.lang)
=== v6.3 === === v6.3 ===
+ Added the ability to remove particles by id/effect/style using '/pp remove <id>|<effect>|<style>' + Added the ability to remove particles by id/effect/style using '/pp remove <id>|<effect>|<style>'
+ Added new styles 'popper', 'pulse', 'twins', 'whirl', and 'whirlwind' + Added new styles 'popper', 'pulse', 'twins', 'whirl', and 'whirlwind'

View file

@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>com.esophose.playerparticles</groupId> <groupId>com.esophose.playerparticles</groupId>
<artifactId>PlayerParticles</artifactId> <artifactId>PlayerParticles</artifactId>
<version>6.3</version> <version>6.4</version>
<name>PlayerParticles</name> <name>PlayerParticles</name>
<url>https://github.com/Esophose/PlayerParticles</url> <url>https://github.com/Esophose/PlayerParticles</url>
<description>Display particles around your player using customized styles and data!</description> <description>Display particles around your player using customized styles and data!</description>

View file

@ -39,7 +39,7 @@ public class DataUpdater {
updateFrom_legacy_to_current(); updateFrom_legacy_to_current();
} else if (configVersion == 5.3) { } else if (configVersion == 5.3) {
updateFrom_5_3_to_current(); updateFrom_5_3_to_current();
} else if (configVersion == 6.0) { } else {
PlayerParticles.getPlugin().getLogger().warning("Found nothing to update."); PlayerParticles.getPlugin().getLogger().warning("Found nothing to update.");
} }

View file

@ -1,10 +1,14 @@
/* /*
* TODO: v6.4+ * TODO: v6.4
* + Add new style(s) 'wings_<type>', multiple new wing types: fairy, demon
* + Add ability to create/manage fixed effects from the GUI * + Add ability to create/manage fixed effects from the GUI
* * Convert fixed effect ids into names * * Convert fixed effect ids into names
* + Add command '/pp fixed teleport <id>' that requires the permission playerparticles.fixed.teleport * + Add command '/pp fixed teleport <id>' that requires the permission playerparticles.fixed.teleport
* + Add named colors to the color data * + Add named colors to the color data
* * Clean up duplicated command parsing
*/
/*
* TODO: v6.5
* + Add effect/style name customization through config files * + Add effect/style name customization through config files
* + Add effect/style settings folder that lets you disable effects/style and edit style properties * + Add effect/style settings folder that lets you disable effects/style and edit style properties
*/ */

View file

@ -6,6 +6,8 @@ import java.util.List;
import com.esophose.playerparticles.gui.GuiHandler; import com.esophose.playerparticles.gui.GuiHandler;
import com.esophose.playerparticles.manager.LangManager; import com.esophose.playerparticles.manager.LangManager;
import com.esophose.playerparticles.manager.LangManager.Lang; import com.esophose.playerparticles.manager.LangManager.Lang;
import com.esophose.playerparticles.manager.ParticleGroupPresetManager;
import com.esophose.playerparticles.manager.SettingManager.PSetting;
import com.esophose.playerparticles.manager.PermissionManager; import com.esophose.playerparticles.manager.PermissionManager;
import com.esophose.playerparticles.particles.PPlayer; import com.esophose.playerparticles.particles.PPlayer;
@ -25,8 +27,10 @@ public class GUICommandModule implements CommandModule {
} }
return; return;
} }
if (PermissionManager.getEffectNamesUserHasPermissionFor(pplayer.getPlayer()).isEmpty()) { if (PSetting.GUI_PRESETS_ONLY.getBoolean() && ParticleGroupPresetManager.getPresetGroupsForPlayer(pplayer.getPlayer()).isEmpty()) {
return;
} else if (PermissionManager.getEffectNamesUserHasPermissionFor(pplayer.getPlayer()).isEmpty()) {
if (byDefault) { if (byDefault) {
LangManager.sendMessage(pplayer, Lang.COMMAND_ERROR_UNKNOWN); LangManager.sendMessage(pplayer, Lang.COMMAND_ERROR_UNKNOWN);
} else { } else {

View file

@ -112,10 +112,15 @@ public class GuiHandler extends BukkitRunnable implements Listener {
public static void openDefault(PPlayer pplayer) { public static void openDefault(PPlayer pplayer) {
removeGuiInventory(pplayer); removeGuiInventory(pplayer);
GuiInventoryDefault defaultInventory = new GuiInventoryDefault(pplayer); GuiInventory inventoryToOpen;
guiInventories.add(defaultInventory); if (!PSetting.GUI_PRESETS_ONLY.getBoolean()) {
inventoryToOpen = new GuiInventoryDefault(pplayer);
pplayer.getPlayer().openInventory(defaultInventory.getInventory()); } else {
inventoryToOpen = new GuiInventoryLoadPresetGroups(pplayer, true);
}
guiInventories.add(inventoryToOpen);
pplayer.getPlayer().openInventory(inventoryToOpen.getInventory());
} }
/** /**

View file

@ -101,7 +101,7 @@ public class GuiInventoryDefault extends GuiInventory {
LangManager.getText(Lang.GUI_COLOR_ICON_NAME) + LangManager.getText(Lang.GUI_LOAD_A_PRESET_GROUP), LangManager.getText(Lang.GUI_COLOR_ICON_NAME) + LangManager.getText(Lang.GUI_LOAD_A_PRESET_GROUP),
new String[] { LangManager.getText(Lang.GUI_COLOR_INFO) + LangManager.getText(Lang.GUI_LOAD_A_PRESET_GROUP_DESCRIPTION) }, new String[] { LangManager.getText(Lang.GUI_COLOR_INFO) + LangManager.getText(Lang.GUI_LOAD_A_PRESET_GROUP_DESCRIPTION) },
(button, isShiftClick) -> { (button, isShiftClick) -> {
GuiHandler.transition(new GuiInventoryLoadPresetGroups(pplayer)); GuiHandler.transition(new GuiInventoryLoadPresetGroups(pplayer, false));
}); });
this.actionButtons.add(loadPresetGroups); this.actionButtons.add(loadPresetGroups);
} }

View file

@ -10,6 +10,7 @@ import com.esophose.playerparticles.manager.LangManager;
import com.esophose.playerparticles.manager.LangManager.Lang; import com.esophose.playerparticles.manager.LangManager.Lang;
import com.esophose.playerparticles.manager.ParticleGroupPresetManager; import com.esophose.playerparticles.manager.ParticleGroupPresetManager;
import com.esophose.playerparticles.manager.SettingManager.GuiIcon; import com.esophose.playerparticles.manager.SettingManager.GuiIcon;
import com.esophose.playerparticles.manager.SettingManager.PSetting;
import com.esophose.playerparticles.particles.PPlayer; import com.esophose.playerparticles.particles.PPlayer;
import com.esophose.playerparticles.particles.ParticleGroup; import com.esophose.playerparticles.particles.ParticleGroup;
import com.esophose.playerparticles.particles.ParticleGroupPreset; import com.esophose.playerparticles.particles.ParticleGroupPreset;
@ -18,7 +19,7 @@ import com.esophose.playerparticles.util.ParticleUtils;
public class GuiInventoryLoadPresetGroups extends GuiInventory { public class GuiInventoryLoadPresetGroups extends GuiInventory {
public GuiInventoryLoadPresetGroups(PPlayer pplayer) { public GuiInventoryLoadPresetGroups(PPlayer pplayer, boolean isEndPoint) {
super(pplayer, Bukkit.createInventory(pplayer.getPlayer(), INVENTORY_SIZE, LangManager.getText(Lang.GUI_LOAD_A_PRESET_GROUP))); super(pplayer, Bukkit.createInventory(pplayer.getPlayer(), INVENTORY_SIZE, LangManager.getText(Lang.GUI_LOAD_A_PRESET_GROUP)));
this.fillBorder(BorderColor.GREEN); this.fillBorder(BorderColor.GREEN);
@ -47,7 +48,9 @@ public class GuiInventoryLoadPresetGroups extends GuiInventory {
activeGroup.getParticles().add(particle.clone()); activeGroup.getParticles().add(particle.clone());
DataManager.saveParticleGroup(pplayer.getUniqueId(), activeGroup); DataManager.saveParticleGroup(pplayer.getUniqueId(), activeGroup);
pplayer.getPlayer().closeInventory(); if (PSetting.GUI_CLOSE_AFTER_GROUP_SELECTED.getBoolean()) {
pplayer.getPlayer().closeInventory();
}
}); });
this.actionButtons.add(groupButton); this.actionButtons.add(groupButton);
@ -59,11 +62,24 @@ public class GuiInventoryLoadPresetGroups extends GuiInventory {
if (index > maxIndex) break; // Overflowed the available space if (index > maxIndex) break; // Overflowed the available space
} }
// Back Button if (!isEndPoint) {
GuiActionButton backButton = new GuiActionButton(INVENTORY_SIZE - 1, GuiIcon.BACK.get(), LangManager.getText(Lang.GUI_COLOR_INFO) + LangManager.getText(Lang.GUI_BACK_BUTTON), new String[] {}, (button, isShiftClick) -> { // Back Button
GuiHandler.transition(new GuiInventoryDefault(pplayer)); GuiActionButton backButton = new GuiActionButton(INVENTORY_SIZE - 1, GuiIcon.BACK.get(), LangManager.getText(Lang.GUI_COLOR_INFO) + LangManager.getText(Lang.GUI_BACK_BUTTON), new String[] {}, (button, isShiftClick) -> {
}); GuiHandler.transition(new GuiInventoryDefault(pplayer));
this.actionButtons.add(backButton); });
this.actionButtons.add(backButton);
} else {
// Reset Particles Button
GuiActionButton resetParticles = new GuiActionButton(49,
GuiIcon.RESET.get(),
LangManager.getText(Lang.GUI_COLOR_ICON_NAME) + LangManager.getText(Lang.GUI_RESET_PARTICLES),
new String[] { LangManager.getText(Lang.GUI_COLOR_UNAVAILABLE) + LangManager.getText(Lang.GUI_RESET_PARTICLES_DESCRIPTION) },
(button, isShiftClick) -> {
// Reset particles
DataManager.saveParticleGroup(pplayer.getUniqueId(), ParticleGroup.getDefaultGroup());
});
this.actionButtons.add(resetParticles);
}
this.populate(); this.populate();
} }

View file

@ -13,6 +13,7 @@ import com.esophose.playerparticles.manager.LangManager;
import com.esophose.playerparticles.manager.PermissionManager; import com.esophose.playerparticles.manager.PermissionManager;
import com.esophose.playerparticles.manager.LangManager.Lang; import com.esophose.playerparticles.manager.LangManager.Lang;
import com.esophose.playerparticles.manager.SettingManager.GuiIcon; import com.esophose.playerparticles.manager.SettingManager.GuiIcon;
import com.esophose.playerparticles.manager.SettingManager.PSetting;
import com.esophose.playerparticles.particles.PPlayer; import com.esophose.playerparticles.particles.PPlayer;
import com.esophose.playerparticles.particles.ParticleGroup; import com.esophose.playerparticles.particles.ParticleGroup;
import com.esophose.playerparticles.particles.ParticlePair; import com.esophose.playerparticles.particles.ParticlePair;
@ -60,7 +61,9 @@ public class GuiInventoryManageGroups extends GuiInventory {
activeGroup.getParticles().add(particle.clone()); activeGroup.getParticles().add(particle.clone());
DataManager.saveParticleGroup(pplayer.getUniqueId(), activeGroup); DataManager.saveParticleGroup(pplayer.getUniqueId(), activeGroup);
pplayer.getPlayer().closeInventory(); if (PSetting.GUI_CLOSE_AFTER_GROUP_SELECTED.getBoolean()) {
pplayer.getPlayer().closeInventory();
}
} }
}); });
this.actionButtons.add(groupButton); this.actionButtons.add(groupButton);

View file

@ -32,7 +32,10 @@ public class SettingManager {
TICKS_PER_PARTICLE(PSettingType.LONG), TICKS_PER_PARTICLE(PSettingType.LONG),
CHECK_UPDATES(PSettingType.BOOLEAN), CHECK_UPDATES(PSettingType.BOOLEAN),
SEND_METRICS(PSettingType.BOOLEAN), SEND_METRICS(PSettingType.BOOLEAN),
GUI_ENABLED(PSettingType.BOOLEAN), GUI_ENABLED(PSettingType.BOOLEAN),
GUI_PRESETS_ONLY(PSettingType.BOOLEAN),
GUI_CLOSE_AFTER_GROUP_SELECTED(PSettingType.BOOLEAN),
GUI_BUTTON_SOUND(PSettingType.BOOLEAN), GUI_BUTTON_SOUND(PSettingType.BOOLEAN),
TOGGLE_ON_MOVE(PSettingType.BOOLEAN), TOGGLE_ON_MOVE(PSettingType.BOOLEAN),

View file

@ -13,7 +13,7 @@
# This value is the version of the plugin that last modified the config file # This value is the version of the plugin that last modified the config file
# Changing this value manually will likely result in data loss and errors! # Changing this value manually will likely result in data loss and errors!
# Do not change this manually unless specifically told to by the plugin author # Do not change this manually unless specifically told to by the plugin author
version: 6.3 version: 6.4
# Check for new versions of the plugin # Check for new versions of the plugin
# Default: true # Default: true
@ -46,6 +46,15 @@ message-prefix: '&7[&3PlayerParticles&7]'
# Default: true # Default: true
gui-enabled: true gui-enabled: true
# If true, only the preset groups will be available in the GUI
# Permissions to open the GUI will change to only open if the user has any preset groups available
# Default: false
gui-presets-only: false
# If true, the GUI will close after selecting a group (either saved or preset)
# Default: true
gui-close-after-group-selected: true
# If clicking a GUI button should make a noise # If clicking a GUI button should make a noise
# Default: true # Default: true
gui-button-sound: true gui-button-sound: true

View file

@ -95,8 +95,8 @@ group-list-output: "&eBạn đã lưu các Group sau: &b{0}"
group-list-presets: "&eCác preset group có sẵn: &b{0}" group-list-presets: "&eCác preset group có sẵn: &b{0}"
# Reload Command # Reload Command
reload-success: "&aCác plugin đã được tải lại!" reload-success: "&aĐã tải lại plugins!"
reload-no-permission: "&cBạn không có quyền tải lại các cài đặt plugin!" reload-no-permission: "&cBạn không có quyền để tải lại plugins!"
# Remove Command # Remove Command
remove-no-args: "&cBạn không chỉ định IDs để xóa! &b/pp remove <ID>" remove-no-args: "&cBạn không chỉ định IDs để xóa! &b/pp remove <ID>"

View file

@ -1,6 +1,6 @@
name: PlayerParticles name: PlayerParticles
main: com.esophose.playerparticles.PlayerParticles main: com.esophose.playerparticles.PlayerParticles
version: 6.3 version: 6.4
api-version: 1.13 api-version: 1.13
description: Display particles around your player using customized styles and data! description: Display particles around your player using customized styles and data!
author: Esophose author: Esophose