Skip to content

Commit

Permalink
Merge pull request #10 from DrawethreeSoftware/1.11.18
Browse files Browse the repository at this point in the history
1.11.18
  • Loading branch information
Drawethree authored Jul 24, 2022
2 parents ef9cbda + b8303b4 commit 7f74e45
Show file tree
Hide file tree
Showing 28 changed files with 61 additions and 49 deletions.
2 changes: 1 addition & 1 deletion modules/core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>UltraPrisonCore</artifactId>
<groupId>me.drawethree</groupId>
<version>1.11.17</version>
<version>1.11.18</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,7 @@
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.RegisteredServiceProvider;

import java.util.Collection;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.*;
import java.util.stream.Collectors;


Expand All @@ -56,7 +53,7 @@ public final class UltraPrisonCore extends ExtendedJavaPlugin {
private static UltraPrisonCore instance;

private boolean debugMode;
private LinkedHashMap<String, UltraPrisonModule> modules;
private Map<String, UltraPrisonModule> modules;
private Database pluginDatabase;
private Economy economy;
private FileManager fileManager;
Expand All @@ -80,18 +77,11 @@ public final class UltraPrisonCore extends ExtendedJavaPlugin {

private JetsPrisonMinesAPI jetsPrisonMinesAPI;

@Getter
private boolean ultraBackpacksEnabled;
@Getter
private boolean placeholderAPIEnabled;


@Override
protected void enable() {

instance = this;

this.modules = new LinkedHashMap<>();
this.fileManager = new FileManager(this);
this.fileManager.getConfig("config.yml").copyDefaults(true).save();
this.debugMode = this.getConfig().getBoolean("debug-mode", false);
Expand Down Expand Up @@ -136,8 +126,6 @@ private void initVariables() {
for (Material m : this.supportedPickaxes) {
this.getLogger().info("Added support for " + m);
}

this.ultraBackpacksEnabled = this.getServer().getPluginManager().isPluginEnabled("UltraBackpacks");
}

private void loadModules() {
Expand All @@ -162,7 +150,7 @@ private void loadModules() {
}

if (this.getConfig().getBoolean("modules.autosell")) {
if (this.ultraBackpacksEnabled) {
if (isUltraBackpacksEnabled()) {
this.getLogger().info("Module AutoSell will not be loaded because selling system is handled by UltraBackpacks.");
} else {
this.loadModule(autoSell);
Expand Down Expand Up @@ -219,6 +207,8 @@ private boolean initDatabase() {

private void initModules() {

this.modules = new LinkedHashMap<>();

this.tokens = new UltraPrisonTokens(this);
this.gems = new UltraPrisonGems(this);
this.ranks = new UltraPrisonRanks(this);
Expand Down Expand Up @@ -336,11 +326,14 @@ public boolean isModuleEnabled(String moduleName) {
}

private void registerPlaceholders() {
if (Bukkit.getPluginManager().getPlugin("PlaceholderAPI") != null) {
this.placeholderAPIEnabled = true;

if (isMVdWPlaceholderAPIEnabled()) {
new UltraPrisonMVdWPlaceholder(this).register();
}

if (isPlaceholderAPIEnabled()) {
new UltraPrisonPAPIPlaceholder(this).register();
}
new UltraPrisonMVdWPlaceholder(this).register();
}

private void registerJetsPrisonMines() {
Expand Down Expand Up @@ -399,4 +392,16 @@ public void setDebugMode(boolean enabled) {
this.getConfig().set("debug-mode", debugMode);
this.saveConfig();
}

public boolean isUltraBackpacksEnabled() {
return this.getServer().getPluginManager().isPluginEnabled("UltraBackpacks");
}

public boolean isPlaceholderAPIEnabled() {
return this.getServer().getPluginManager().isPluginEnabled("PlaceholderAPI");
}

public boolean isMVdWPlaceholderAPIEnabled() {
return this.getServer().getPluginManager().isPluginEnabled("MVdWPlaceholderAPI");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public class CommandManager {
private CooldownMap<CommandSender> gemsCommandCooldownMap;
private String[] gemsCommandAliases;
private String[] gemsTopCommandAliases;
private String[] gemsMessageCommandAliases;

public CommandManager(UltraPrisonGems plugin) {
this.plugin = plugin;
Expand Down Expand Up @@ -90,7 +91,7 @@ private void registerCommands() {
// /gemsmessage
Commands.create()
.assertPlayer()
.handler(c -> this.plugin.getGemsManager().toggleGemsMessage(c.sender())).registerAndBind(this.plugin.getCore(), "gemmessage", "gemsmessage");
.handler(c -> this.plugin.getGemsManager().toggleGemsMessage(c.sender())).registerAndBind(this.plugin.getCore(), this.gemsMessageCommandAliases);

}

Expand Down Expand Up @@ -121,6 +122,7 @@ private GemsCommand getCommand(String arg) {
private void loadVariables() {
this.gemsCommandAliases = this.plugin.getConfig().get().getStringList("gems-command-aliases").toArray(new String[0]);
this.gemsTopCommandAliases = this.plugin.getConfig().get().getStringList("gems-top-command-aliases").toArray(new String[0]);
this.gemsMessageCommandAliases = this.plugin.getConfig().get().getStringList("gems-message-command-aliases").toArray(new String[0]);
}

public Set<GemsCommand> getAll() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,12 @@
public class UltraPrisonMVdWPlaceholder {

private final UltraPrisonCore plugin;
private final boolean enabled;

public UltraPrisonMVdWPlaceholder(UltraPrisonCore plugin) {
this.plugin = plugin;
this.enabled = plugin.getServer().getPluginManager().isPluginEnabled("MVdWPlaceholderAPI");
}

public void register() {
if (!this.enabled) {
return;
}
this.registerTokensPlaceholders();
this.registerEnchantsPlaceholders();
this.registerGemsPlaceholders();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public class CommandManager {
private String[] tokensCommandAliases;
private String[] tokensTopCommandAliases;
private String[] blocksTopCommandAliases;
private String[] tokenMessageCommandAliases;

public CommandManager(UltraPrisonTokens plugin) {
this.plugin = plugin;
Expand Down Expand Up @@ -90,7 +91,7 @@ private void registerCommands() {
.assertPlayer()
.handler(c -> {
this.plugin.getTokensManager().toggleTokenMessage(c.sender());
}).registerAndBind(this.plugin.getCore(), "tokenmessage");
}).registerAndBind(this.plugin.getCore(), this.tokenMessageCommandAliases);

// /blockstop, / blocktop
Commands.create()
Expand Down Expand Up @@ -219,5 +220,6 @@ private void loadVariables() {
this.tokensCommandAliases = this.plugin.getConfig().get().getStringList("tokens-command-aliases").toArray(new String[0]);
this.tokensTopCommandAliases = this.plugin.getConfig().get().getStringList("tokens-top-command-aliases").toArray(new String[0]);
this.blocksTopCommandAliases = this.plugin.getConfig().get().getStringList("blocks-top-command-aliases").toArray(new String[0]);
this.tokenMessageCommandAliases = this.plugin.getConfig().get().getStringList("token-message-command-aliases").toArray(new String[0]);
}
}
6 changes: 5 additions & 1 deletion modules/core/src/main/resources/gems.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,8 @@ gems-command-aliases:
# Aliases for /gemstop command
gems-top-command-aliases:
- gemstop
- gemtop
- gemtop
# Aliases for /gemsmessage command
gems-message-command-aliases:
- gemmessage
- gemsmessage
6 changes: 5 additions & 1 deletion modules/core/src/main/resources/tokens.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,8 @@ tokens-top-command-aliases:
# Aliases for /blockstop command
blocks-top-command-aliases:
- blockstop
- blocktop
- blocktop
# Aliases for /tokenmessage command
token-message-command-aliases:
- tokenmessage
- tokenmessages
2 changes: 1 addition & 1 deletion modules/dist/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>me.drawethree</groupId>
<artifactId>UltraPrisonCore</artifactId>
<version>1.11.17</version>
<version>1.11.18</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion modules/v1_10_R1/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<parent>
<groupId>me.drawethree</groupId>
<artifactId>UltraPrisonCore</artifactId>
<version>1.11.17</version>
<version>1.11.18</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<build>
Expand Down
2 changes: 1 addition & 1 deletion modules/v1_11_R1/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<parent>
<groupId>me.drawethree</groupId>
<artifactId>UltraPrisonCore</artifactId>
<version>1.11.17</version>
<version>1.11.18</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<build>
Expand Down
2 changes: 1 addition & 1 deletion modules/v1_12_R1/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<parent>
<groupId>me.drawethree</groupId>
<artifactId>UltraPrisonCore</artifactId>
<version>1.11.17</version>
<version>1.11.18</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<build>
Expand Down
2 changes: 1 addition & 1 deletion modules/v1_13_R1/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<parent>
<groupId>me.drawethree</groupId>
<artifactId>UltraPrisonCore</artifactId>
<version>1.11.17</version>
<version>1.11.18</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<build>
Expand Down
2 changes: 1 addition & 1 deletion modules/v1_13_R2/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<parent>
<groupId>me.drawethree</groupId>
<artifactId>UltraPrisonCore</artifactId>
<version>1.11.17</version>
<version>1.11.18</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<build>
Expand Down
2 changes: 1 addition & 1 deletion modules/v1_14_R1/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<parent>
<groupId>me.drawethree</groupId>
<artifactId>UltraPrisonCore</artifactId>
<version>1.11.17</version>
<version>1.11.18</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<build>
Expand Down
2 changes: 1 addition & 1 deletion modules/v1_15_R1/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<parent>
<groupId>me.drawethree</groupId>
<artifactId>UltraPrisonCore</artifactId>
<version>1.11.17</version>
<version>1.11.18</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<build>
Expand Down
2 changes: 1 addition & 1 deletion modules/v1_16_R1/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<parent>
<groupId>me.drawethree</groupId>
<artifactId>UltraPrisonCore</artifactId>
<version>1.11.17</version>
<version>1.11.18</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<build>
Expand Down
2 changes: 1 addition & 1 deletion modules/v1_16_R2/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<parent>
<groupId>me.drawethree</groupId>
<artifactId>UltraPrisonCore</artifactId>
<version>1.11.17</version>
<version>1.11.18</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<build>
Expand Down
2 changes: 1 addition & 1 deletion modules/v1_16_R3/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<parent>
<groupId>me.drawethree</groupId>
<artifactId>UltraPrisonCore</artifactId>
<version>1.11.17</version>
<version>1.11.18</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<build>
Expand Down
2 changes: 1 addition & 1 deletion modules/v1_17_R1/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>UltraPrisonCore</artifactId>
<groupId>me.drawethree</groupId>
<version>1.11.17</version>
<version>1.11.18</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion modules/v1_18_R1/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<artifactId>UltraPrisonCore</artifactId>
<groupId>me.drawethree</groupId>
<version>1.11.17</version>
<version>1.11.18</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion modules/v1_18_R2/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<parent>
<groupId>me.drawethree</groupId>
<artifactId>UltraPrisonCore</artifactId>
<version>1.11.17</version>
<version>1.11.18</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion modules/v1_19_R1/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<parent>
<groupId>me.drawethree</groupId>
<artifactId>UltraPrisonCore</artifactId>
<version>1.11.17</version>
<version>1.11.18</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion modules/v1_8_R1/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<parent>
<groupId>me.drawethree</groupId>
<artifactId>UltraPrisonCore</artifactId>
<version>1.11.17</version>
<version>1.11.18</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<build>
Expand Down
2 changes: 1 addition & 1 deletion modules/v1_8_R2/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<parent>
<groupId>me.drawethree</groupId>
<artifactId>UltraPrisonCore</artifactId>
<version>1.11.17</version>
<version>1.11.18</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<build>
Expand Down
2 changes: 1 addition & 1 deletion modules/v1_8_R3/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<parent>
<groupId>me.drawethree</groupId>
<artifactId>UltraPrisonCore</artifactId>
<version>1.11.17</version>
<version>1.11.18</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<build>
Expand Down
2 changes: 1 addition & 1 deletion modules/v1_9_R1/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<parent>
<groupId>me.drawethree</groupId>
<artifactId>UltraPrisonCore</artifactId>
<version>1.11.17</version>
<version>1.11.18</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<build>
Expand Down
2 changes: 1 addition & 1 deletion modules/v1_9_R2/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<parent>
<groupId>me.drawethree</groupId>
<artifactId>UltraPrisonCore</artifactId>
<version>1.11.17</version>
<version>1.11.18</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<build>
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>me.drawethree</groupId>
<artifactId>UltraPrisonCore</artifactId>
<version>1.11.17</version>
<version>1.11.18</version>

<modules>
<module>modules/core</module>
Expand Down

0 comments on commit 7f74e45

Please sign in to comment.