Skip to content

Commit

Permalink
Merge pull request #15 from Esophose/v6.3
Browse files Browse the repository at this point in the history
v6.3 Update
  • Loading branch information
Esophose committed Feb 3, 2019
2 parents e5f5760 + 429701c commit a3cc77d
Show file tree
Hide file tree
Showing 49 changed files with 2,716 additions and 720 deletions.
21 changes: 21 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,26 @@
== UPDATING WILL DELETE YOUR CONFIG.YML ==
* Create a backup of your config.yml if you wish to import all your old settings!
=== v6.3 ===
+ 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'
+ The "Save New Group" button in the GUI now actually saves a new group and prompts for a name in chat (15 second timeout)
+ Added a click sound to the GUI for button clicks (Can be disabled in the config.yml)
+ Added setting 'toggle-on-move-delay' to the config.yml
+ Added new lang file fr_FR.lang (French)
+ Added extra customization to the preset groups
+ Added bStats metrics (Can be disabled in the config.yml by setting send-metrics to false)
* The preset groups file was renamed from groups.yml to preset_groups.yml, you'll need to update the new file
* Renamed default.lang to en_US.lang
* Reduced the number of particles that spawn for the styles 'blockbreak', 'blockplace', and 'swords'
* Fix GUI borders showing up as glass panes instead of stained glass panes on servers running 1.12.2 or earlier
* Fix a missing message when trying to remove a group that doesn't exist
* Fix a console error that occured when trying to remove a group that doesn't exist
* Fix a console error that occured when a player logs off with the 'celebration' style applied and they have at least 1 fixed effect created
* Fix a console error "[PlayerParticles] An error occurred retrieving an SQLite database connection: [SQLITE_BUSY] The database file is locked (database is locked)"
=== v6.2 ===
+ Added command '/ppo' which allows executing a /pp command as another player.
* Fix not being able to change the lore of the player skull in the GUI
* Fix the 'saved groups' count on the player skull in the GUI being one higher than it was supposed to be
=== v6.1 ===
* Fix a bug where sometimes the GUI was unable to be opened due to an error
* You can now use \n on the GUI lore lines in the *.lang file to break them into multiple lines
Expand Down
6 changes: 5 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.esophose.playerparticles</groupId>
<artifactId>PlayerParticles</artifactId>
<version>6.2</version>
<version>6.3</version>
<name>PlayerParticles</name>
<url>https://github.com/Esophose/PlayerParticles</url>
<description>Display particles around your player using customized styles and data!</description>
Expand Down Expand Up @@ -174,6 +174,10 @@
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
<repository>
<id>CodeMC</id>
<url>https://repo.codemc.org/repository/maven-public</url>
</repository>
</repositories>
<dependencies>
<dependency>
Expand Down
6 changes: 3 additions & 3 deletions src/com/esophose/playerparticles/DataUpdater.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class DataUpdater {
* If they don't, create them
*/
protected static void tryCreateTables() {
PlayerParticles.getDBConnector().connect((connection) -> {
PlayerParticles.getPlugin().getDBConnector().connect((connection) -> {
try (Statement createStatement = connection.createStatement()) {
createStatement.addBatch("CREATE TABLE IF NOT EXISTS pp_settings (player_uuid VARCHAR(36), particles_hidden TINYINT)");
createStatement.addBatch("CREATE TABLE IF NOT EXISTS pp_particle (uuid VARCHAR(36), group_uuid VARCHAR(36), id SMALLINT, effect VARCHAR(100), style VARCHAR(100), item_material VARCHAR(100), block_material VARCHAR(100), note SMALLINT, r SMALLINT, g SMALLINT, b SMALLINT, PRIMARY KEY(uuid))");
Expand Down Expand Up @@ -50,7 +50,7 @@ protected static void updateData(double configVersion, double currentVersion) {
* Updates the data from versions older than v5.2
*/
private static void updateFrom_legacy_to_current() {
PlayerParticles.getDBConnector().connect((connection) -> {
PlayerParticles.getPlugin().getDBConnector().connect((connection) -> {
try (Statement statement = connection.createStatement()) {
statement.addBatch("DROP TABLE IF EXISTS pp_users");
statement.addBatch("DROP TABLE IF EXISTS pp_fixed");
Expand All @@ -68,7 +68,7 @@ private static void updateFrom_legacy_to_current() {
* Note: v5.3 was never officially released
*/
private static void updateFrom_5_3_to_current() {
PlayerParticles.getDBConnector().connect((connection) -> {
PlayerParticles.getPlugin().getDBConnector().connect((connection) -> {
// Create player settings table
try (Statement statement = connection.createStatement()) {
String updateQuery = "CREATE TABLE IF NOT EXISTS pp_settings (player_uuid VARCHAR(36), particles_hidden TINYINT)";
Expand Down
61 changes: 44 additions & 17 deletions src/com/esophose/playerparticles/PlayerParticles.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
/*
* TODO: v6.3
* + Add new style 'tornado'
* + Add new style 'doubleorbit'
* 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
* * Convert fixed effect ids into names
* + Add command '/pp fixed teleport <id>' that requires the permission playerparticles.fixed.teleport
* + Add named colors to the color data
* + Add effect/style name customization through config files
* + Add effect/style settings folder that lets you disable effects/style and edit style properties
*/

package com.esophose.playerparticles;
Expand All @@ -12,6 +16,7 @@
import org.bukkit.Bukkit;
import org.bukkit.command.PluginCommand;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.scheduler.BukkitRunnable;
import org.bukkit.scheduler.BukkitTask;
Expand All @@ -21,48 +26,55 @@
import com.esophose.playerparticles.database.MySqlDatabaseConnector;
import com.esophose.playerparticles.database.SqliteDatabaseConnector;
import com.esophose.playerparticles.gui.GuiHandler;
import com.esophose.playerparticles.gui.hook.PlayerChatHook;
import com.esophose.playerparticles.manager.LangManager;
import com.esophose.playerparticles.manager.ParticleGroupPresetManager;
import com.esophose.playerparticles.manager.ParticleManager;
import com.esophose.playerparticles.manager.SettingManager;
import com.esophose.playerparticles.manager.SettingManager.PSetting;
import com.esophose.playerparticles.particles.PPlayerMovementListener;
import com.esophose.playerparticles.particles.ParticleGroup;
import com.esophose.playerparticles.styles.DefaultStyles;
import com.esophose.playerparticles.updater.PluginUpdateListener;
import com.esophose.playerparticles.updater.Updater;
import com.esophose.playerparticles.util.Metrics;

public class PlayerParticles extends JavaPlugin {

private static Plugin pluginInstance;
/**
* The running instance of PlayerParticles on the server
*/
private static PlayerParticles pluginInstance;

/**
* The version a new update has, will be null if the config has it disabled
* or if there is no new version
*/
public static String updateVersion = null;
private String updateVersion = null;

/**
* The database connection manager
*/
private static DatabaseConnector databaseConnector = null;
private DatabaseConnector databaseConnector = null;

/**
* The task that spawns the particles
*/
private static BukkitTask particleTask = null;
private BukkitTask particleTask = null;

/**
* Executes essential tasks for starting up the plugin
*/
public void onEnable() {
pluginInstance = Bukkit.getServer().getPluginManager().getPlugin("PlayerParticles");
pluginInstance = (PlayerParticles)Bukkit.getServer().getPluginManager().getPlugin("PlayerParticles");

this.registerCommands();

Bukkit.getPluginManager().registerEvents(new ParticleManager(), this);
Bukkit.getPluginManager().registerEvents(new PluginUpdateListener(), this);
Bukkit.getPluginManager().registerEvents(new GuiHandler(), this);
Bukkit.getPluginManager().registerEvents(new PPlayerMovementListener(), this);

PluginManager pm = Bukkit.getPluginManager();
pm.registerEvents(new ParticleManager(), this);
pm.registerEvents(new PluginUpdateListener(), this);
pm.registerEvents(new GuiHandler(), this);
pm.registerEvents(new PPlayerMovementListener(), this);
pm.registerEvents(new PlayerChatHook(), this);

saveDefaultConfig();
double configVersion = PSetting.VERSION.getDouble();
Expand Down Expand Up @@ -99,6 +111,10 @@ public void run() {
}.runTaskAsynchronously(this);
}

if (PSetting.SEND_METRICS.getBoolean()) {
new Metrics(this);
}

this.reload(updatePluginSettings);
}

Expand Down Expand Up @@ -150,9 +166,10 @@ public void reload(boolean updatePluginSettings) {

SettingManager.reload();
LangManager.reload(updatePluginSettings);
ParticleGroup.reload();
ParticleGroupPresetManager.reload();

GuiHandler.setup();
PlayerChatHook.setup();

ParticleManager.refreshData();
startParticleTask();
Expand All @@ -163,7 +180,7 @@ public void reload(boolean updatePluginSettings) {
*
* @return The PlayerParticles plugin instance
*/
public static Plugin getPlugin() {
public static PlayerParticles getPlugin() {
return pluginInstance;
}

Expand All @@ -172,9 +189,19 @@ public static Plugin getPlugin() {
*
* @return The DatabaseConnector
*/
public static DatabaseConnector getDBConnector() {
public DatabaseConnector getDBConnector() {
return databaseConnector;
}

/**
* Gets the latest available version of the plugin
* Will be null if no update is available
*
* @return The latest version available for the plugin
*/
public String getUpdateVersion() {
return this.updateVersion;
}

/**
* Determines if we should use MySQL or SQLite based on the useMySql parameter and if we were able to connect successfully
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ public Lang getDescription() {
}

public String getArguments() {
return "<id> <effect>|<style>|<data> <args>";
return "<ID> <effect>|<style>|<data> <args>";
}

public boolean requiresEffects() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -661,7 +661,7 @@ public List<String> onTabComplete(PPlayer pplayer, String[] args) {
if (args.length == 5) {
StringUtil.copyPartialMatches(args[4], PermissionManager.getEffectNamesUserHasPermissionFor(p), matches);
} else if (args.length == 6) {
StringUtil.copyPartialMatches(args[5], PermissionManager.getStyleNamesUserHasPermissionFor(p), matches);
StringUtil.copyPartialMatches(args[5], PermissionManager.getFixableStyleNamesUserHasPermissionFor(p), matches);
} else if (args.length >= 7) {
ParticleEffect effect = ParticleEffect.fromName(args[4]);
if (effect != null) {
Expand Down Expand Up @@ -721,7 +721,7 @@ public List<String> onTabComplete(PPlayer pplayer, String[] args) {
} else if (property.equals("effect") && args.length == 4) {
StringUtil.copyPartialMatches(args[3], PermissionManager.getEffectNamesUserHasPermissionFor(p), matches);
} else if (property.equals("style") && args.length == 4) {
StringUtil.copyPartialMatches(args[3], PermissionManager.getStyleNamesUserHasPermissionFor(p), matches);
StringUtil.copyPartialMatches(args[3], PermissionManager.getFixableStyleNamesUserHasPermissionFor(p), matches);
} else if (property.equals("data")) {
int id = -1;
try {
Expand Down
34 changes: 21 additions & 13 deletions src/com/esophose/playerparticles/command/GroupCommandModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@

import com.esophose.playerparticles.manager.DataManager;
import com.esophose.playerparticles.manager.LangManager;
import com.esophose.playerparticles.manager.ParticleGroupPresetManager;
import com.esophose.playerparticles.manager.LangManager.Lang;
import com.esophose.playerparticles.manager.PermissionManager;
import com.esophose.playerparticles.particles.PPlayer;
import com.esophose.playerparticles.particles.ParticleGroup;
import com.esophose.playerparticles.particles.ParticleGroupPreset;
import com.esophose.playerparticles.particles.ParticlePair;

public class GroupCommandModule implements CommandModule {
Expand Down Expand Up @@ -128,17 +130,18 @@ private void onLoad(PPlayer pplayer, String groupName) {
ParticleGroup group = pplayer.getParticleGroupByName(groupName);
if (group == null) {
// Didn't find a saved group, look at the presets
group = ParticleGroup.getPresetGroup(groupName);
if (group == null) {
ParticleGroupPreset presetGroup = ParticleGroupPresetManager.getPresetGroup(groupName);
if (presetGroup == null) {
LangManager.sendMessage(pplayer, Lang.GROUP_INVALID, groupName);
return;
}

if (!group.canPlayerUse(pplayer.getPlayer())) {
if (!presetGroup.canPlayerUse(pplayer.getPlayer())) {
LangManager.sendMessage(pplayer, Lang.GROUP_PRESET_NO_PERMISSION, groupName);
return;
}

group = presetGroup.getGroup();
isPreset = true;
}

Expand Down Expand Up @@ -173,11 +176,14 @@ private void onRemove(PPlayer pplayer, String groupName) {
ParticleGroup group = pplayer.getParticleGroupByName(groupName);
if (group == null) {
// Didn't find a saved group, look at the presets
group = ParticleGroup.getPresetGroup(groupName);
if (group != null) {
ParticleGroupPreset presetGroup = ParticleGroupPresetManager.getPresetGroup(groupName);

if (presetGroup == null) {
LangManager.sendMessage(pplayer, Lang.GROUP_INVALID, groupName);
} else {
LangManager.sendMessage(pplayer, Lang.GROUP_REMOVE_PRESET);
return;
}
return;
}

// Delete the group and notify player
Expand All @@ -201,16 +207,18 @@ private void onInfo(PPlayer pplayer, String groupName) {
ParticleGroup group = pplayer.getParticleGroupByName(groupName);
if (group == null) {
// Didn't find a saved group, look at the presets
group = ParticleGroup.getPresetGroup(groupName);
if (group == null) {
ParticleGroupPreset presetGroup = ParticleGroupPresetManager.getPresetGroup(groupName);
if (presetGroup == null) {
LangManager.sendMessage(pplayer, Lang.GROUP_INVALID, groupName);
return;
}

if (!group.canPlayerUse(pplayer.getPlayer())) {
if (!presetGroup.canPlayerUse(pplayer.getPlayer())) {
LangManager.sendMessage(pplayer, Lang.GROUP_PRESET_NO_PERMISSION, groupName);
return;
}

group = presetGroup.getGroup();
}

List<ParticlePair> particles = group.getParticles();
Expand Down Expand Up @@ -239,8 +247,8 @@ private void onList(PPlayer pplayer) {
groupsList = groupsList.substring(0, groupsList.length() - 2);

String presetsList = "";
for (ParticleGroup group : ParticleGroup.getPresetGroupsForPlayer(pplayer.getPlayer()))
presetsList += group.getName() + ", ";
for (ParticleGroupPreset group : ParticleGroupPresetManager.getPresetGroupsForPlayer(pplayer.getPlayer()))
presetsList += group.getGroup().getName() + ", ";

if (presetsList.endsWith(", "))
presetsList = presetsList.substring(0, presetsList.length() - 2);
Expand Down Expand Up @@ -275,8 +283,8 @@ public List<String> onTabComplete(PPlayer pplayer, String[] args) {
if (!group.getName().equals(ParticleGroup.DEFAULT_NAME))
groupNames.add(group.getName());
if (!args[0].equals("remove"))
for (ParticleGroup group : ParticleGroup.getPresetGroupsForPlayer(pplayer.getPlayer()))
groupNames.add(group.getName());
for (ParticleGroupPreset group : ParticleGroupPresetManager.getPresetGroupsForPlayer(pplayer.getPlayer()))
groupNames.add(group.getGroup().getName());
StringUtil.copyPartialMatches(args[1], groupNames, matches);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ public class ReloadCommandModule implements CommandModule {

public void onCommandExecute(PPlayer pplayer, String[] args) {
if (PermissionManager.canReloadPlugin(pplayer.getPlayer())) {
((PlayerParticles)PlayerParticles.getPlugin()).reload(false);
PlayerParticles.getPlugin().reload(false);
LangManager.sendMessage(pplayer, Lang.RELOAD_SUCCESS);
PlayerParticles.getPlugin().getLogger().info("Reloaded configuration.");
} else {
LangManager.sendMessage(pplayer, Lang.RELOAD_NO_PERMISSION);
}
Expand Down

0 comments on commit a3cc77d

Please sign in to comment.