mirror of
https://github.com/songoda/EpicBuckets.git
synced 2024-11-25 03:35:24 +01:00
Cleanup.
This commit is contained in:
parent
ded93d2f01
commit
2130776df9
@ -1,4 +1,4 @@
|
|||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
@ -7,7 +7,6 @@
|
|||||||
<artifactId>EpicBuckets-Parent</artifactId>
|
<artifactId>EpicBuckets-Parent</artifactId>
|
||||||
<version>maven-version-number</version>
|
<version>maven-version-number</version>
|
||||||
</parent>
|
</parent>
|
||||||
<groupId>com.songoda</groupId>
|
|
||||||
<artifactId>EpicBuckets-Legacy-Hooks</artifactId>
|
<artifactId>EpicBuckets-Legacy-Hooks</artifactId>
|
||||||
<build>
|
<build>
|
||||||
<defaultGoal>clean install</defaultGoal>
|
<defaultGoal>clean install</defaultGoal>
|
||||||
@ -20,12 +19,6 @@
|
|||||||
</repository>
|
</repository>
|
||||||
</repositories>
|
</repositories>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
|
||||||
<groupId>com.songoda</groupId>
|
|
||||||
<artifactId>EpicBuckets-Plugin</artifactId>
|
|
||||||
<version>${project.version}</version>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.sk89q</groupId>
|
<groupId>com.sk89q</groupId>
|
||||||
<artifactId>worldguard</artifactId>
|
<artifactId>worldguard</artifactId>
|
||||||
|
@ -2,7 +2,7 @@ package com.songoda.epicbuckets.hooks.legacy;
|
|||||||
|
|
||||||
import com.intellectualcrafters.plot.api.PlotAPI;
|
import com.intellectualcrafters.plot.api.PlotAPI;
|
||||||
import com.plotsquared.bukkit.BukkitMain;
|
import com.plotsquared.bukkit.BukkitMain;
|
||||||
import com.songoda.epicbuckets.util.hooks.ProtectionPluginHook;
|
import com.songoda.epicbuckets.utils.hooks.ProtectionPluginHook;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.songoda.epicbuckets.hooks.legacy;
|
package com.songoda.epicbuckets.hooks.legacy;
|
||||||
|
|
||||||
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
|
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
|
||||||
import com.songoda.epicbuckets.util.hooks.ProtectionPluginHook;
|
import com.songoda.epicbuckets.utils.hooks.ProtectionPluginHook;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package com.songoda.epicbuckets.util.hooks;
|
package com.songoda.epicbuckets.utils.hooks;
|
||||||
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
|
|
||||||
@ -8,17 +8,16 @@ import org.bukkit.Location;
|
|||||||
* interface is not recommended over the ProtectionPluginHook interface as its methods
|
* interface is not recommended over the ProtectionPluginHook interface as its methods
|
||||||
* will not often be used by implementation, though they are available if more information
|
* will not often be used by implementation, though they are available if more information
|
||||||
* is desired. It is, however, recommended to use the former
|
* is desired. It is, however, recommended to use the former
|
||||||
*
|
*
|
||||||
* @author Parker Hawke - 2008Choco
|
* @author Parker Hawke - 2008Choco
|
||||||
*/
|
*/
|
||||||
public interface ClaimableProtectionPluginHook extends ProtectionPluginHook {
|
public interface ClaimableProtectionPluginHook extends ProtectionPluginHook {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check whether the provided location is in the claim with the given String ID
|
* Check whether the provided location is in the claim with the given String ID
|
||||||
*
|
*
|
||||||
* @param location the location to check
|
* @param location the location to check
|
||||||
* @param id the ID of the claim to check
|
* @param id the ID of the claim to check
|
||||||
*
|
|
||||||
* @return true if the location is within the claim, false otherwise or if the
|
* @return true if the location is within the claim, false otherwise or if the
|
||||||
* claim ID does not exist
|
* claim ID does not exist
|
||||||
*/
|
*/
|
||||||
@ -29,9 +28,8 @@ public interface ClaimableProtectionPluginHook extends ProtectionPluginHook {
|
|||||||
* as unique IDs are not provided by a claim implementation, though for plugins
|
* as unique IDs are not provided by a claim implementation, though for plugins
|
||||||
* such as factions, the passed parameter is the name of the faction and the
|
* such as factions, the passed parameter is the name of the faction and the
|
||||||
* returned String is its unique ID
|
* returned String is its unique ID
|
||||||
*
|
*
|
||||||
* @param name the name of the claim to check
|
* @param name the name of the claim to check
|
||||||
*
|
|
||||||
* @return the unique String ID. null if no claim exists
|
* @return the unique String ID. null if no claim exists
|
||||||
*/
|
*/
|
||||||
public String getClaimID(String name);
|
public String getClaimID(String name);
|
@ -1,6 +1,5 @@
|
|||||||
package com.songoda.epicbuckets.util.hooks;
|
package com.songoda.epicbuckets.utils.hooks;
|
||||||
|
|
||||||
import com.songoda.epicbuckets.EpicBuckets;
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -10,35 +9,31 @@ import org.bukkit.plugin.java.JavaPlugin;
|
|||||||
* Represents a hook for a protection plugin. This is used by EpicBuckets to determine
|
* Represents a hook for a protection plugin. This is used by EpicBuckets to determine
|
||||||
* whether a block break should be successful or not according to the current state of
|
* whether a block break should be successful or not according to the current state of
|
||||||
* another plugin. For plugins providing claims with unique String IDs, see the
|
* another plugin. For plugins providing claims with unique String IDs, see the
|
||||||
* {@link ClaimableProtectionPluginHook} for a more detailed implementation. To register
|
* {@link ClaimableProtectionPluginHook} for a more detailed implementation.
|
||||||
* a protection hook implementation, see
|
|
||||||
* {@link EpicBuckets#registerProtectionHook(ProtectionPluginHook)}
|
|
||||||
*/
|
*/
|
||||||
public interface ProtectionPluginHook {
|
public interface ProtectionPluginHook {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The plugin to which this plugin hook belongs. Must not be null
|
* The plugin to which this plugin hook belongs. Must not be null
|
||||||
*
|
*
|
||||||
* @return the hooking plugin
|
* @return the hooking plugin
|
||||||
*/
|
*/
|
||||||
public JavaPlugin getPlugin();
|
public JavaPlugin getPlugin();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check whether the provided player may build at the specified location
|
* Check whether the provided player may build at the specified location
|
||||||
*
|
*
|
||||||
* @param player the player to check
|
* @param player the player to check
|
||||||
* @param location the location to check
|
* @param location the location to check
|
||||||
*
|
|
||||||
* @return true if player is permitted to build, false otherwise
|
* @return true if player is permitted to build, false otherwise
|
||||||
*/
|
*/
|
||||||
public boolean canBuild(Player player, Location location);
|
public boolean canBuild(Player player, Location location);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check whether the provided player may build at the specified block
|
* Check whether the provided player may build at the specified block
|
||||||
*
|
*
|
||||||
* @param player the player to check
|
* @param player the player to check
|
||||||
* @param block the block to check
|
* @param block the block to check
|
||||||
*
|
|
||||||
* @return true if player is permitted to build, false otherwise
|
* @return true if player is permitted to build, false otherwise
|
||||||
*/
|
*/
|
||||||
public default boolean canBuild(Player player, Block block) {
|
public default boolean canBuild(Player player, Block block) {
|
@ -1,4 +1,4 @@
|
|||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
@ -9,12 +9,12 @@ import com.songoda.epicbuckets.listeners.GenbucketPlaceListener;
|
|||||||
import com.songoda.epicbuckets.listeners.PlayerJoinListeners;
|
import com.songoda.epicbuckets.listeners.PlayerJoinListeners;
|
||||||
import com.songoda.epicbuckets.listeners.SourceBlockBreakListener;
|
import com.songoda.epicbuckets.listeners.SourceBlockBreakListener;
|
||||||
import com.songoda.epicbuckets.shop.ShopManager;
|
import com.songoda.epicbuckets.shop.ShopManager;
|
||||||
import com.songoda.epicbuckets.util.ChatUtil;
|
import com.songoda.epicbuckets.utils.ChatUtil;
|
||||||
import com.songoda.epicbuckets.util.ConfigWrapper;
|
import com.songoda.epicbuckets.utils.ConfigWrapper;
|
||||||
import com.songoda.epicbuckets.util.Debugger;
|
import com.songoda.epicbuckets.utils.Debugger;
|
||||||
import com.songoda.epicbuckets.util.ServerVersion;
|
import com.songoda.epicbuckets.utils.ServerVersion;
|
||||||
import com.songoda.epicbuckets.util.hooks.ClaimableProtectionPluginHook;
|
import com.songoda.epicbuckets.utils.hooks.ClaimableProtectionPluginHook;
|
||||||
import com.songoda.epicbuckets.util.hooks.ProtectionPluginHook;
|
import com.songoda.epicbuckets.utils.hooks.ProtectionPluginHook;
|
||||||
import net.milkbowl.vault.economy.Economy;
|
import net.milkbowl.vault.economy.Economy;
|
||||||
import org.apache.commons.lang.ArrayUtils;
|
import org.apache.commons.lang.ArrayUtils;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
@ -51,6 +51,10 @@ public class EpicBuckets extends JavaPlugin {
|
|||||||
private List<ProtectionPluginHook> protectionHooks = new ArrayList<>();
|
private List<ProtectionPluginHook> protectionHooks = new ArrayList<>();
|
||||||
private ClaimableProtectionPluginHook factionsHook, townyHook, aSkyblockHook, uSkyblockHook, skyBlockEarhHook;
|
private ClaimableProtectionPluginHook factionsHook, townyHook, aSkyblockHook, uSkyblockHook, skyBlockEarhHook;
|
||||||
|
|
||||||
|
public static EpicBuckets getInstance() {
|
||||||
|
return INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
INSTANCE = this;
|
INSTANCE = this;
|
||||||
@ -81,14 +85,19 @@ public class EpicBuckets extends JavaPlugin {
|
|||||||
pluginManager.registerEvents(new PlayerJoinListeners(this), this);
|
pluginManager.registerEvents(new PlayerJoinListeners(this), this);
|
||||||
|
|
||||||
// Register default hooks
|
// Register default hooks
|
||||||
if (pluginManager.isPluginEnabled("ASkyBlock")) aSkyblockHook = (ClaimableProtectionPluginHook) this.register(HookASkyBlock::new);
|
if (pluginManager.isPluginEnabled("ASkyBlock"))
|
||||||
if (pluginManager.isPluginEnabled("FactionsFramework")) factionsHook = (ClaimableProtectionPluginHook) this.register(HookFactions::new);
|
aSkyblockHook = (ClaimableProtectionPluginHook) this.register(HookASkyBlock::new);
|
||||||
|
if (pluginManager.isPluginEnabled("FactionsFramework"))
|
||||||
|
factionsHook = (ClaimableProtectionPluginHook) this.register(HookFactions::new);
|
||||||
if (pluginManager.isPluginEnabled("GriefPrevention")) this.register(HookGriefPrevention::new);
|
if (pluginManager.isPluginEnabled("GriefPrevention")) this.register(HookGriefPrevention::new);
|
||||||
if (pluginManager.isPluginEnabled("Kingdoms")) this.register(HookKingdoms::new);
|
if (pluginManager.isPluginEnabled("Kingdoms")) this.register(HookKingdoms::new);
|
||||||
if (pluginManager.isPluginEnabled("RedProtect")) this.register(HookRedProtect::new);
|
if (pluginManager.isPluginEnabled("RedProtect")) this.register(HookRedProtect::new);
|
||||||
if (pluginManager.isPluginEnabled("Towny")) townyHook = (ClaimableProtectionPluginHook) this.register(HookTowny::new);
|
if (pluginManager.isPluginEnabled("Towny"))
|
||||||
if (pluginManager.isPluginEnabled("USkyBlock")) uSkyblockHook = (ClaimableProtectionPluginHook) this.register(HookUSkyBlock::new);
|
townyHook = (ClaimableProtectionPluginHook) this.register(HookTowny::new);
|
||||||
if (pluginManager.isPluginEnabled("SkyBlock")) skyBlockEarhHook = (ClaimableProtectionPluginHook) this.register(HookSkyBlockEarth::new);
|
if (pluginManager.isPluginEnabled("USkyBlock"))
|
||||||
|
uSkyblockHook = (ClaimableProtectionPluginHook) this.register(HookUSkyBlock::new);
|
||||||
|
if (pluginManager.isPluginEnabled("SkyBlock"))
|
||||||
|
skyBlockEarhHook = (ClaimableProtectionPluginHook) this.register(HookSkyBlockEarth::new);
|
||||||
|
|
||||||
if (isServerVersionAtLeast(ServerVersion.V1_13)) {
|
if (isServerVersionAtLeast(ServerVersion.V1_13)) {
|
||||||
if (pluginManager.isPluginEnabled("WorldGuard")) this.register(HookWorldGuard::new);
|
if (pluginManager.isPluginEnabled("WorldGuard")) this.register(HookWorldGuard::new);
|
||||||
@ -123,7 +132,6 @@ public class EpicBuckets extends JavaPlugin {
|
|||||||
return this.registerProtectionHook(hookSupplier.get());
|
return this.registerProtectionHook(hookSupplier.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public ProtectionPluginHook registerProtectionHook(ProtectionPluginHook hook) {
|
public ProtectionPluginHook registerProtectionHook(ProtectionPluginHook hook) {
|
||||||
Preconditions.checkNotNull(hook, "Cannot register null hook");
|
Preconditions.checkNotNull(hook, "Cannot register null hook");
|
||||||
Preconditions.checkNotNull(hook.getPlugin(), "Protection plugin hook returns null plugin instance (#getPlugin())");
|
Preconditions.checkNotNull(hook.getPlugin(), "Protection plugin hook returns null plugin instance (#getPlugin())");
|
||||||
@ -219,6 +227,4 @@ public class EpicBuckets extends JavaPlugin {
|
|||||||
public References getReferences() {
|
public References getReferences() {
|
||||||
return references;
|
return references;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static EpicBuckets getInstance() { return INSTANCE; }
|
|
||||||
}
|
}
|
||||||
|
@ -23,11 +23,10 @@ import java.util.stream.Collectors;
|
|||||||
*/
|
*/
|
||||||
public class Locale {
|
public class Locale {
|
||||||
|
|
||||||
private static JavaPlugin plugin;
|
|
||||||
private static final List<Locale> LOCALES = Lists.newArrayList();
|
private static final List<Locale> LOCALES = Lists.newArrayList();
|
||||||
|
|
||||||
private static final Pattern NODE_PATTERN = Pattern.compile("(\\w+(?:\\.{1}\\w+)*)\\s*=\\s*\"(.*)\"");
|
private static final Pattern NODE_PATTERN = Pattern.compile("(\\w+(?:\\.{1}\\w+)*)\\s*=\\s*\"(.*)\"");
|
||||||
private static final String FILE_EXTENSION = ".lang";
|
private static final String FILE_EXTENSION = ".lang";
|
||||||
|
private static JavaPlugin plugin;
|
||||||
private static File localeFolder;
|
private static File localeFolder;
|
||||||
|
|
||||||
private static String defaultLocale;
|
private static String defaultLocale;
|
||||||
@ -52,122 +51,6 @@ public class Locale {
|
|||||||
plugin.getLogger().info("Loaded locale " + fileName);
|
plugin.getLogger().info("Loaded locale " + fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the name of the language that this locale is based on.
|
|
||||||
* (i.e. "en" for English, or "fr" for French)
|
|
||||||
*
|
|
||||||
* @return the name of the language
|
|
||||||
*/
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the name of the region that this locale is from.
|
|
||||||
* (i.e. "US" for United States or "CA" for Canada)
|
|
||||||
*
|
|
||||||
* @return the name of the region
|
|
||||||
*/
|
|
||||||
public String getRegion() {
|
|
||||||
return region;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the entire locale tag (i.e. "en_US")
|
|
||||||
*
|
|
||||||
* @return the language tag
|
|
||||||
*/
|
|
||||||
public String getLanguageTag() {
|
|
||||||
return name + "_" + region;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the file that represents this locale
|
|
||||||
*
|
|
||||||
* @return the locale file (.lang)
|
|
||||||
*/
|
|
||||||
public File getFile() {
|
|
||||||
return file;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get a message set for a specific node
|
|
||||||
*
|
|
||||||
* @param node the node to get
|
|
||||||
* @return the message for the specified node
|
|
||||||
*/
|
|
||||||
public String getMessage(String node) {
|
|
||||||
return ChatColor.translateAlternateColorCodes('&', this.getMessageOrDefault(node, node));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get a message set for a specific node and replace its params with a supplied arguments.
|
|
||||||
*
|
|
||||||
* @param node the node to get
|
|
||||||
* @param args the replacement arguments
|
|
||||||
* @return the message for the specified node
|
|
||||||
*/
|
|
||||||
public String getMessage(String node, Object... args) {
|
|
||||||
String message = getMessage(node);
|
|
||||||
for (Object arg : args) {
|
|
||||||
message = message.replaceFirst("\\%.*?\\%", arg.toString());
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get a message set for a specific node
|
|
||||||
*
|
|
||||||
* @param node the node to get
|
|
||||||
* @param defaultValue the default value given that a value for the node was not found
|
|
||||||
* @return the message for the specified node. Default if none found
|
|
||||||
*/
|
|
||||||
public String getMessageOrDefault(String node, String defaultValue) {
|
|
||||||
return this.nodes.getOrDefault(node, defaultValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the key-value map of nodes to messages
|
|
||||||
*
|
|
||||||
* @return node-message map
|
|
||||||
*/
|
|
||||||
public Map<String, String> getMessageNodeMap() {
|
|
||||||
return ImmutableMap.copyOf(nodes);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Clear the previous message cache and load new messages directly from file
|
|
||||||
*
|
|
||||||
* @return reload messages from file
|
|
||||||
*/
|
|
||||||
public boolean reloadMessages() {
|
|
||||||
if (!this.file.exists()) {
|
|
||||||
plugin.getLogger().warning("Could not find file for locale " + this.name);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.nodes.clear(); // Clear previous data (if any)
|
|
||||||
|
|
||||||
try (BufferedReader reader = new BufferedReader(new FileReader(file))) {
|
|
||||||
String line;
|
|
||||||
for (int lineNumber = 0; (line = reader.readLine()) != null; lineNumber++) {
|
|
||||||
if (line.isEmpty() || line.startsWith("#") /* Comment */) continue;
|
|
||||||
|
|
||||||
Matcher matcher = NODE_PATTERN.matcher(line);
|
|
||||||
if (!matcher.find()) {
|
|
||||||
System.err.println("Invalid locale syntax at (line=" + lineNumber + ")");
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
nodes.put(matcher.group(1), matcher.group(2));
|
|
||||||
}
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize the locale class to generate information and search for localizations.
|
* Initialize the locale class to generate information and search for localizations.
|
||||||
* This must be called before any other methods in the Locale class can be invoked.
|
* This must be called before any other methods in the Locale class can be invoked.
|
||||||
@ -361,4 +244,120 @@ public class Locale {
|
|||||||
return changed;
|
return changed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the name of the language that this locale is based on.
|
||||||
|
* (i.e. "en" for English, or "fr" for French)
|
||||||
|
*
|
||||||
|
* @return the name of the language
|
||||||
|
*/
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the name of the region that this locale is from.
|
||||||
|
* (i.e. "US" for United States or "CA" for Canada)
|
||||||
|
*
|
||||||
|
* @return the name of the region
|
||||||
|
*/
|
||||||
|
public String getRegion() {
|
||||||
|
return region;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the entire locale tag (i.e. "en_US")
|
||||||
|
*
|
||||||
|
* @return the language tag
|
||||||
|
*/
|
||||||
|
public String getLanguageTag() {
|
||||||
|
return name + "_" + region;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the file that represents this locale
|
||||||
|
*
|
||||||
|
* @return the locale file (.lang)
|
||||||
|
*/
|
||||||
|
public File getFile() {
|
||||||
|
return file;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a message set for a specific node
|
||||||
|
*
|
||||||
|
* @param node the node to get
|
||||||
|
* @return the message for the specified node
|
||||||
|
*/
|
||||||
|
public String getMessage(String node) {
|
||||||
|
return ChatColor.translateAlternateColorCodes('&', this.getMessageOrDefault(node, node));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a message set for a specific node and replace its params with a supplied arguments.
|
||||||
|
*
|
||||||
|
* @param node the node to get
|
||||||
|
* @param args the replacement arguments
|
||||||
|
* @return the message for the specified node
|
||||||
|
*/
|
||||||
|
public String getMessage(String node, Object... args) {
|
||||||
|
String message = getMessage(node);
|
||||||
|
for (Object arg : args) {
|
||||||
|
message = message.replaceFirst("\\%.*?\\%", arg.toString());
|
||||||
|
}
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a message set for a specific node
|
||||||
|
*
|
||||||
|
* @param node the node to get
|
||||||
|
* @param defaultValue the default value given that a value for the node was not found
|
||||||
|
* @return the message for the specified node. Default if none found
|
||||||
|
*/
|
||||||
|
public String getMessageOrDefault(String node, String defaultValue) {
|
||||||
|
return this.nodes.getOrDefault(node, defaultValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the key-value map of nodes to messages
|
||||||
|
*
|
||||||
|
* @return node-message map
|
||||||
|
*/
|
||||||
|
public Map<String, String> getMessageNodeMap() {
|
||||||
|
return ImmutableMap.copyOf(nodes);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clear the previous message cache and load new messages directly from file
|
||||||
|
*
|
||||||
|
* @return reload messages from file
|
||||||
|
*/
|
||||||
|
public boolean reloadMessages() {
|
||||||
|
if (!this.file.exists()) {
|
||||||
|
plugin.getLogger().warning("Could not find file for locale " + this.name);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.nodes.clear(); // Clear previous data (if any)
|
||||||
|
|
||||||
|
try (BufferedReader reader = new BufferedReader(new FileReader(file))) {
|
||||||
|
String line;
|
||||||
|
for (int lineNumber = 0; (line = reader.readLine()) != null; lineNumber++) {
|
||||||
|
if (line.isEmpty() || line.startsWith("#") /* Comment */) continue;
|
||||||
|
|
||||||
|
Matcher matcher = NODE_PATTERN.matcher(line);
|
||||||
|
if (!matcher.find()) {
|
||||||
|
System.err.println("Invalid locale syntax at (line=" + lineNumber + ")");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
nodes.put(matcher.group(1), matcher.group(2));
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -9,16 +9,12 @@ import java.util.List;
|
|||||||
|
|
||||||
public abstract class AbstractCommand {
|
public abstract class AbstractCommand {
|
||||||
|
|
||||||
public enum ReturnType { SUCCESS, FAILURE, SYNTAX_ERROR }
|
|
||||||
|
|
||||||
private final AbstractCommand parent;
|
private final AbstractCommand parent;
|
||||||
|
private final boolean noConsole;
|
||||||
private List<String> command;
|
private List<String> command;
|
||||||
|
|
||||||
private List<String> subCommand = new ArrayList<>();
|
private List<String> subCommand = new ArrayList<>();
|
||||||
|
|
||||||
private final boolean noConsole;
|
|
||||||
|
|
||||||
protected AbstractCommand(AbstractCommand parent, boolean noConsole, String... command) {
|
protected AbstractCommand(AbstractCommand parent, boolean noConsole, String... command) {
|
||||||
if (parent != null) {
|
if (parent != null) {
|
||||||
this.subCommand = Arrays.asList(command);
|
this.subCommand = Arrays.asList(command);
|
||||||
@ -34,7 +30,6 @@ public abstract class AbstractCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public List<String> getCommand() {
|
public List<String> getCommand() {
|
||||||
System.out.println(command + " " + (command != null && command.contains("epicbuckets")));
|
|
||||||
return command;
|
return command;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -57,4 +52,6 @@ public abstract class AbstractCommand {
|
|||||||
public boolean isNoConsole() {
|
public boolean isNoConsole() {
|
||||||
return noConsole;
|
return noConsole;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public enum ReturnType {SUCCESS, FAILURE, SYNTAX_ERROR}
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@ package com.songoda.epicbuckets.command;
|
|||||||
import com.songoda.epicbuckets.EpicBuckets;
|
import com.songoda.epicbuckets.EpicBuckets;
|
||||||
import com.songoda.epicbuckets.References;
|
import com.songoda.epicbuckets.References;
|
||||||
import com.songoda.epicbuckets.command.commands.*;
|
import com.songoda.epicbuckets.command.commands.*;
|
||||||
import com.songoda.epicbuckets.util.ChatUtil;
|
import com.songoda.epicbuckets.utils.ChatUtil;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandExecutor;
|
import org.bukkit.command.CommandExecutor;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
@ -67,11 +67,11 @@ public class CommandManager implements CommandExecutor {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (command.getPermissionNode() == null || sender.hasPermission(command.getPermissionNode())) {
|
if (command.getPermissionNode() == null || sender.hasPermission(command.getPermissionNode())) {
|
||||||
AbstractCommand.ReturnType returnType = command.runCommand(instance, sender, strings);
|
AbstractCommand.ReturnType returnType = command.runCommand(instance, sender, strings);
|
||||||
if (returnType == AbstractCommand.ReturnType.SYNTAX_ERROR) {
|
if (returnType == AbstractCommand.ReturnType.SYNTAX_ERROR) {
|
||||||
sender.sendMessage(References.getPrefix() + ChatUtil.colorString("&cInvalid Syntax!"));
|
sender.sendMessage(References.getPrefix() + ChatUtil.colorString("&cInvalid Syntax!"));
|
||||||
sender.sendMessage(References.getPrefix() + ChatUtil.colorString("&7The valid syntax is: &6" + command.getSyntax() + "&7."));
|
sender.sendMessage(References.getPrefix() + ChatUtil.colorString("&7The valid syntax is: &6" + command.getSyntax() + "&7."));
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
sender.sendMessage(References.getPrefix() + instance.getLocale().getMessage("event.general.nopermission"));
|
sender.sendMessage(References.getPrefix() + instance.getLocale().getMessage("event.general.nopermission"));
|
||||||
|
@ -14,7 +14,7 @@ public class CommandAdminPanel extends AbstractCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected ReturnType runCommand(EpicBuckets instance, CommandSender sender, String... args) {
|
protected ReturnType runCommand(EpicBuckets instance, CommandSender sender, String... args) {
|
||||||
new GUIPanel((Player)sender);
|
new GUIPanel((Player) sender);
|
||||||
return ReturnType.SUCCESS;
|
return ReturnType.SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ public class CommandAdminToggle extends AbstractCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected ReturnType runCommand(EpicBuckets instance, CommandSender sender, String... args) {
|
protected ReturnType runCommand(EpicBuckets instance, CommandSender sender, String... args) {
|
||||||
instance.getGenbucketManager().toggleAdmin((Player)sender);
|
instance.getGenbucketManager().toggleAdmin((Player) sender);
|
||||||
return ReturnType.SUCCESS;
|
return ReturnType.SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ public class CommandEpicBuckets extends AbstractCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected AbstractCommand.ReturnType runCommand(EpicBuckets instance, CommandSender sender, String... args) {
|
protected AbstractCommand.ReturnType runCommand(EpicBuckets instance, CommandSender sender, String... args) {
|
||||||
new GUIMain((Player)sender);
|
new GUIMain((Player) sender);
|
||||||
return ReturnType.SUCCESS;
|
return ReturnType.SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,8 +5,8 @@ import com.songoda.epicbuckets.References;
|
|||||||
import com.songoda.epicbuckets.command.AbstractCommand;
|
import com.songoda.epicbuckets.command.AbstractCommand;
|
||||||
import com.songoda.epicbuckets.shop.Shop;
|
import com.songoda.epicbuckets.shop.Shop;
|
||||||
import com.songoda.epicbuckets.shop.SubShop;
|
import com.songoda.epicbuckets.shop.SubShop;
|
||||||
import com.songoda.epicbuckets.util.ChatUtil;
|
import com.songoda.epicbuckets.utils.ChatUtil;
|
||||||
import com.songoda.epicbuckets.util.Validator;
|
import com.songoda.epicbuckets.utils.Validator;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
@ -3,7 +3,7 @@ package com.songoda.epicbuckets.command.commands;
|
|||||||
import com.songoda.epicbuckets.EpicBuckets;
|
import com.songoda.epicbuckets.EpicBuckets;
|
||||||
import com.songoda.epicbuckets.References;
|
import com.songoda.epicbuckets.References;
|
||||||
import com.songoda.epicbuckets.command.AbstractCommand;
|
import com.songoda.epicbuckets.command.AbstractCommand;
|
||||||
import com.songoda.epicbuckets.util.ChatUtil;
|
import com.songoda.epicbuckets.utils.ChatUtil;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
|
||||||
public class CommandHelp extends AbstractCommand {
|
public class CommandHelp extends AbstractCommand {
|
||||||
|
@ -2,7 +2,7 @@ package com.songoda.epicbuckets.command.commands;
|
|||||||
|
|
||||||
import com.songoda.epicbuckets.EpicBuckets;
|
import com.songoda.epicbuckets.EpicBuckets;
|
||||||
import com.songoda.epicbuckets.command.AbstractCommand;
|
import com.songoda.epicbuckets.command.AbstractCommand;
|
||||||
import com.songoda.epicbuckets.util.ChatUtil;
|
import com.songoda.epicbuckets.utils.ChatUtil;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
|
||||||
public class CommandReload extends AbstractCommand {
|
public class CommandReload extends AbstractCommand {
|
||||||
|
@ -8,6 +8,10 @@ import org.bukkit.event.HandlerList;
|
|||||||
|
|
||||||
public class GenbucketPlaceEvent extends Event implements Cancellable {
|
public class GenbucketPlaceEvent extends Event implements Cancellable {
|
||||||
|
|
||||||
|
/*
|
||||||
|
Needed for the event
|
||||||
|
*/
|
||||||
|
private static final HandlerList HANDLERS = new HandlerList();
|
||||||
private final Player player;
|
private final Player player;
|
||||||
private final Genbucket genbucket;
|
private final Genbucket genbucket;
|
||||||
private boolean isCancelled;
|
private boolean isCancelled;
|
||||||
@ -18,6 +22,10 @@ public class GenbucketPlaceEvent extends Event implements Cancellable {
|
|||||||
this.isCancelled = false;
|
this.isCancelled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static HandlerList getHandlerList() {
|
||||||
|
return HANDLERS;
|
||||||
|
}
|
||||||
|
|
||||||
public Player getPlayer() {
|
public Player getPlayer() {
|
||||||
return this.player;
|
return this.player;
|
||||||
}
|
}
|
||||||
@ -26,19 +34,10 @@ public class GenbucketPlaceEvent extends Event implements Cancellable {
|
|||||||
return this.genbucket;
|
return this.genbucket;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
Needed for the event
|
|
||||||
*/
|
|
||||||
private static final HandlerList HANDLERS = new HandlerList();
|
|
||||||
|
|
||||||
public HandlerList getHandlers() {
|
public HandlerList getHandlers() {
|
||||||
return HANDLERS;
|
return HANDLERS;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static HandlerList getHandlerList() {
|
|
||||||
return HANDLERS;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isCancelled() {
|
public boolean isCancelled() {
|
||||||
return this.isCancelled;
|
return this.isCancelled;
|
||||||
|
@ -2,9 +2,9 @@ package com.songoda.epicbuckets.file;
|
|||||||
|
|
||||||
import com.songoda.epicbuckets.EpicBuckets;
|
import com.songoda.epicbuckets.EpicBuckets;
|
||||||
import com.songoda.epicbuckets.genbucket.GenbucketType;
|
import com.songoda.epicbuckets.genbucket.GenbucketType;
|
||||||
import com.songoda.epicbuckets.util.InventoryHelper;
|
import com.songoda.epicbuckets.utils.InventoryHelper;
|
||||||
import com.songoda.epicbuckets.util.Validator;
|
import com.songoda.epicbuckets.utils.Validator;
|
||||||
import com.songoda.epicbuckets.util.XMaterial;
|
import com.songoda.epicbuckets.utils.XMaterial;
|
||||||
import org.bukkit.block.BlockFace;
|
import org.bukkit.block.BlockFace;
|
||||||
import org.bukkit.configuration.file.FileConfiguration;
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -253,6 +253,10 @@ public class ConfigManager {
|
|||||||
return backButtonPath;
|
return backButtonPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setBackButtonPath(String backButtonPath) {
|
||||||
|
this.backButtonPath = backButtonPath;
|
||||||
|
}
|
||||||
|
|
||||||
public String getFillItemPath() {
|
public String getFillItemPath() {
|
||||||
return fillItemPath;
|
return fillItemPath;
|
||||||
}
|
}
|
||||||
@ -281,18 +285,34 @@ public class ConfigManager {
|
|||||||
return supportFactions;
|
return supportFactions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setSupportFactions(boolean supportFactions) {
|
||||||
|
this.supportFactions = supportFactions;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isSupportWorldGuard() {
|
public boolean isSupportWorldGuard() {
|
||||||
return supportWorldGuard;
|
return supportWorldGuard;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setSupportWorldGuard(boolean supportWorldGuard) {
|
||||||
|
this.supportWorldGuard = supportWorldGuard;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isSupportGriefPrevention() {
|
public boolean isSupportGriefPrevention() {
|
||||||
return supportGriefPrevention;
|
return supportGriefPrevention;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setSupportGriefPrevention(boolean supportGriefPrevention) {
|
||||||
|
this.supportGriefPrevention = supportGriefPrevention;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isGensInWilderness() {
|
public boolean isGensInWilderness() {
|
||||||
return gensInWilderness;
|
return gensInWilderness;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setGensInWilderness(boolean gensInWilderness) {
|
||||||
|
this.gensInWilderness = gensInWilderness;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isEnchantGenbuckets() {
|
public boolean isEnchantGenbuckets() {
|
||||||
return enchantGenbuckets;
|
return enchantGenbuckets;
|
||||||
}
|
}
|
||||||
@ -301,38 +321,66 @@ public class ConfigManager {
|
|||||||
return spongeCheck;
|
return spongeCheck;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setSpongeCheck(boolean spongeCheck) {
|
||||||
|
this.spongeCheck = spongeCheck;
|
||||||
|
}
|
||||||
|
|
||||||
public int getSpongeRadius() {
|
public int getSpongeRadius() {
|
||||||
return spongeRadius;
|
return spongeRadius;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setSpongeRadius(int spongeRadius) {
|
||||||
|
this.spongeRadius = spongeRadius;
|
||||||
|
}
|
||||||
|
|
||||||
public int getMaxGenbucketsPerPlayer() {
|
public int getMaxGenbucketsPerPlayer() {
|
||||||
return maxGenbucketsPerPlayer;
|
return maxGenbucketsPerPlayer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setMaxGenbucketsPerPlayer(int maxGenbucketsPerPlayer) {
|
||||||
|
this.maxGenbucketsPerPlayer = maxGenbucketsPerPlayer;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isUnlimitedGenbuckets() {
|
public boolean isUnlimitedGenbuckets() {
|
||||||
return unlimitedGenbuckets;
|
return unlimitedGenbuckets;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setUnlimitedGenbuckets(boolean unlimitedGenbuckets) {
|
||||||
|
this.unlimitedGenbuckets = unlimitedGenbuckets;
|
||||||
|
}
|
||||||
|
|
||||||
public int getMaxVerticalHeight() {
|
public int getMaxVerticalHeight() {
|
||||||
return maxVerticalHeight;
|
return maxVerticalHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setMaxVerticalHeight(int maxVerticalHeight) {
|
||||||
|
this.maxVerticalHeight = maxVerticalHeight;
|
||||||
|
}
|
||||||
|
|
||||||
public int getMaxHorizontalLength() {
|
public int getMaxHorizontalLength() {
|
||||||
return maxHorizontalLength;
|
return maxHorizontalLength;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setMaxHorizontalLength(int maxHorizontalLength) {
|
||||||
|
this.maxHorizontalLength = maxHorizontalLength;
|
||||||
|
}
|
||||||
|
|
||||||
public int getDelay() {
|
public int getDelay() {
|
||||||
return delay;
|
return delay;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setGenbucketsDisabled(boolean enabled) {
|
public void setDelay(int delay) {
|
||||||
this.genbucketsDisabled = enabled;
|
this.delay = delay;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isGenbucketsDisabled() {
|
public boolean isGenbucketsDisabled() {
|
||||||
return genbucketsDisabled;
|
return genbucketsDisabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setGenbucketsDisabled(boolean enabled) {
|
||||||
|
this.genbucketsDisabled = enabled;
|
||||||
|
}
|
||||||
|
|
||||||
public ItemStack getBackButton() {
|
public ItemStack getBackButton() {
|
||||||
return backButton;
|
return backButton;
|
||||||
}
|
}
|
||||||
@ -353,6 +401,10 @@ public class ConfigManager {
|
|||||||
return fillInventory;
|
return fillInventory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setFillInventory(boolean fillInventory) {
|
||||||
|
this.fillInventory = fillInventory;
|
||||||
|
}
|
||||||
|
|
||||||
public ItemStack getFillItem() {
|
public ItemStack getFillItem() {
|
||||||
return fillItem;
|
return fillItem;
|
||||||
}
|
}
|
||||||
@ -377,10 +429,18 @@ public class ConfigManager {
|
|||||||
return infiniteUse;
|
return infiniteUse;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setInfiniteUse(boolean infiniteUse) {
|
||||||
|
this.infiniteUse = infiniteUse;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isChargeInfiniteUse() {
|
public boolean isChargeInfiniteUse() {
|
||||||
return chargeInfiniteUse;
|
return chargeInfiniteUse;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setChargeInfiniteUse(boolean chargeInfiniteUse) {
|
||||||
|
this.chargeInfiniteUse = chargeInfiniteUse;
|
||||||
|
}
|
||||||
|
|
||||||
public double getInfiniteUseCostForGenbucketType(GenbucketType genbucketType, ItemStack item) {
|
public double getInfiniteUseCostForGenbucketType(GenbucketType genbucketType, ItemStack item) {
|
||||||
for (ItemStack itemStack : infiniteUseCost.get(genbucketType).keySet()) {
|
for (ItemStack itemStack : infiniteUseCost.get(genbucketType).keySet()) {
|
||||||
if (itemStack.getType() == item.getType() && itemStack.getData() == item.getData()) {
|
if (itemStack.getType() == item.getType() && itemStack.getData() == item.getData()) {
|
||||||
@ -394,70 +454,10 @@ public class ConfigManager {
|
|||||||
return genbucketDelay;
|
return genbucketDelay;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setBackButtonPath(String backButtonPath) {
|
|
||||||
this.backButtonPath = backButtonPath;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSupportFactions(boolean supportFactions) {
|
|
||||||
this.supportFactions = supportFactions;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSupportWorldGuard(boolean supportWorldGuard) {
|
|
||||||
this.supportWorldGuard = supportWorldGuard;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSupportGriefPrevention(boolean supportGriefPrevention) {
|
|
||||||
this.supportGriefPrevention = supportGriefPrevention;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setGensInWilderness(boolean gensInWilderness) {
|
|
||||||
this.gensInWilderness = gensInWilderness;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSpongeCheck(boolean spongeCheck) {
|
|
||||||
this.spongeCheck = spongeCheck;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSpongeRadius(int spongeRadius) {
|
|
||||||
this.spongeRadius = spongeRadius;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMaxGenbucketsPerPlayer(int maxGenbucketsPerPlayer) {
|
|
||||||
this.maxGenbucketsPerPlayer = maxGenbucketsPerPlayer;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUnlimitedGenbuckets(boolean unlimitedGenbuckets) {
|
|
||||||
this.unlimitedGenbuckets = unlimitedGenbuckets;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setInfiniteUse(boolean infiniteUse) {
|
|
||||||
this.infiniteUse = infiniteUse;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setChargeInfiniteUse(boolean chargeInfiniteUse) {
|
|
||||||
this.chargeInfiniteUse = chargeInfiniteUse;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setGenbucketDelay(int genbucketDelay) {
|
public void setGenbucketDelay(int genbucketDelay) {
|
||||||
this.genbucketDelay = genbucketDelay;
|
this.genbucketDelay = genbucketDelay;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMaxVerticalHeight(int maxVerticalHeight) {
|
|
||||||
this.maxVerticalHeight = maxVerticalHeight;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMaxHorizontalLength(int maxHorizontalLength) {
|
|
||||||
this.maxHorizontalLength = maxHorizontalLength;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDelay(int delay) {
|
|
||||||
this.delay = delay;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setFillInventory(boolean fillInventory) {
|
|
||||||
this.fillInventory = fillInventory;
|
|
||||||
}
|
|
||||||
|
|
||||||
public HashMap<String, Consumer<Boolean>> getSettingsGenbucketBooleans() {
|
public HashMap<String, Consumer<Boolean>> getSettingsGenbucketBooleans() {
|
||||||
return settingsGenbucketBooleans;
|
return settingsGenbucketBooleans;
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@ package com.songoda.epicbuckets.genbucket;
|
|||||||
|
|
||||||
import com.songoda.epicbuckets.EpicBuckets;
|
import com.songoda.epicbuckets.EpicBuckets;
|
||||||
import com.songoda.epicbuckets.shop.SubShop;
|
import com.songoda.epicbuckets.shop.SubShop;
|
||||||
import com.songoda.epicbuckets.util.XMaterial;
|
import com.songoda.epicbuckets.utils.XMaterial;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
@ -148,7 +148,8 @@ public abstract class Genbucket {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected boolean placeGen(Block block) {
|
protected boolean placeGen(Block block) {
|
||||||
if (!epicBuckets.getConfigManager().getIgnoredMaterials().contains(XMaterial.requestXMaterial(block.getType().name(), block.getData()))) return false;
|
if (!epicBuckets.getConfigManager().getIgnoredMaterials().contains(XMaterial.requestXMaterial(block.getType().name(), block.getData())))
|
||||||
|
return false;
|
||||||
if (spongeInRange(block)) return false;
|
if (spongeInRange(block)) return false;
|
||||||
block.setType(getGenItem().getType());
|
block.setType(getGenItem().getType());
|
||||||
return true;
|
return true;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.songoda.epicbuckets.genbucket;
|
package com.songoda.epicbuckets.genbucket;
|
||||||
|
|
||||||
import com.songoda.epicbuckets.EpicBuckets;
|
import com.songoda.epicbuckets.EpicBuckets;
|
||||||
import com.songoda.epicbuckets.util.ChatUtil;
|
import com.songoda.epicbuckets.utils.ChatUtil;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@ -63,7 +63,8 @@ public class GenbucketManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void registerGenbucketForPlayer(Player owner, Genbucket genbucket) {
|
public void registerGenbucketForPlayer(Player owner, Genbucket genbucket) {
|
||||||
if (!activeGens.containsKey(owner.getUniqueId())) activeGens.put(owner.getUniqueId(), new ArrayList<>(Arrays.asList(genbucket)));
|
if (!activeGens.containsKey(owner.getUniqueId()))
|
||||||
|
activeGens.put(owner.getUniqueId(), new ArrayList<>(Arrays.asList(genbucket)));
|
||||||
List<Genbucket> genbucketItems = activeGens.get(owner.getUniqueId());
|
List<Genbucket> genbucketItems = activeGens.get(owner.getUniqueId());
|
||||||
genbucketItems.add(genbucket);
|
genbucketItems.add(genbucket);
|
||||||
activeGens.put(owner.getUniqueId(), genbucketItems);
|
activeGens.put(owner.getUniqueId(), genbucketItems);
|
||||||
|
@ -5,7 +5,7 @@ import com.songoda.epicbuckets.file.ConfigManager;
|
|||||||
import com.songoda.epicbuckets.shop.Shop;
|
import com.songoda.epicbuckets.shop.Shop;
|
||||||
import com.songoda.epicbuckets.shop.ShopManager;
|
import com.songoda.epicbuckets.shop.ShopManager;
|
||||||
import com.songoda.epicbuckets.shop.SubShop;
|
import com.songoda.epicbuckets.shop.SubShop;
|
||||||
import com.songoda.epicbuckets.util.gui.AbstractGUI;
|
import com.songoda.epicbuckets.utils.gui.AbstractGUI;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
@ -70,16 +70,16 @@ public class GUIBulk extends AbstractGUI {
|
|||||||
|
|
||||||
shopManager.getDecreaseSlots().forEach(i ->
|
shopManager.getDecreaseSlots().forEach(i ->
|
||||||
registerClickable(i, ((player1, inventory1, cursor, slot, type) -> {
|
registerClickable(i, ((player1, inventory1, cursor, slot, type) -> {
|
||||||
ItemStack genbucket = inventory.getItem(shopManager.getBulkMainItemSlot());
|
ItemStack genbucket = inventory.getItem(shopManager.getBulkMainItemSlot());
|
||||||
int amount = shopManager.getBulkAmounts().get(shopManager.getDecreaseSlots().indexOf(i));
|
int amount = shopManager.getBulkAmounts().get(shopManager.getDecreaseSlots().indexOf(i));
|
||||||
genbucket.setAmount(genbucket.getAmount() - amount < 1 ? 1 : genbucket.getAmount() - amount);
|
genbucket.setAmount(genbucket.getAmount() - amount < 1 ? 1 : genbucket.getAmount() - amount);
|
||||||
})));
|
})));
|
||||||
|
|
||||||
shopManager.getIncreaseSlots().forEach(i ->
|
shopManager.getIncreaseSlots().forEach(i ->
|
||||||
registerClickable(i, ((player1, inventory1, cursor, slot, type) -> {
|
registerClickable(i, ((player1, inventory1, cursor, slot, type) -> {
|
||||||
ItemStack genbucket = inventory.getItem(shopManager.getBulkMainItemSlot());
|
ItemStack genbucket = inventory.getItem(shopManager.getBulkMainItemSlot());
|
||||||
int amount = shopManager.getBulkAmounts().get(shopManager.getIncreaseSlots().indexOf(i));
|
int amount = shopManager.getBulkAmounts().get(shopManager.getIncreaseSlots().indexOf(i));
|
||||||
genbucket.setAmount(genbucket.getAmount() + amount > 64 ? 64 : genbucket.getAmount() + amount);
|
genbucket.setAmount(genbucket.getAmount() + amount > 64 ? 64 : genbucket.getAmount() + amount);
|
||||||
})));
|
})));
|
||||||
|
|
||||||
registerClickable(shopManager.getPurchaseSlot(), ((player1, inventory1, cursor, slot, type) -> {
|
registerClickable(shopManager.getPurchaseSlot(), ((player1, inventory1, cursor, slot, type) -> {
|
||||||
|
@ -4,7 +4,7 @@ import com.songoda.epicbuckets.EpicBuckets;
|
|||||||
import com.songoda.epicbuckets.file.ConfigManager;
|
import com.songoda.epicbuckets.file.ConfigManager;
|
||||||
import com.songoda.epicbuckets.shop.Shop;
|
import com.songoda.epicbuckets.shop.Shop;
|
||||||
import com.songoda.epicbuckets.shop.ShopManager;
|
import com.songoda.epicbuckets.shop.ShopManager;
|
||||||
import com.songoda.epicbuckets.util.gui.AbstractGUI;
|
import com.songoda.epicbuckets.utils.gui.AbstractGUI;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
@ -2,9 +2,9 @@ package com.songoda.epicbuckets.gui;
|
|||||||
|
|
||||||
import com.songoda.epicbuckets.EpicBuckets;
|
import com.songoda.epicbuckets.EpicBuckets;
|
||||||
import com.songoda.epicbuckets.genbucket.Genbucket;
|
import com.songoda.epicbuckets.genbucket.Genbucket;
|
||||||
import com.songoda.epicbuckets.util.ChatUtil;
|
import com.songoda.epicbuckets.utils.ChatUtil;
|
||||||
import com.songoda.epicbuckets.util.XMaterial;
|
import com.songoda.epicbuckets.utils.XMaterial;
|
||||||
import com.songoda.epicbuckets.util.gui.AbstractGUI;
|
import com.songoda.epicbuckets.utils.gui.AbstractGUI;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
@ -42,8 +42,8 @@ public class GUIPanel extends AbstractGUI {
|
|||||||
inventory.setItem(place, skull);
|
inventory.setItem(place, skull);
|
||||||
registerClickable(place, ((player1, inventory1, cursor, slot, type) ->
|
registerClickable(place, ((player1, inventory1, cursor, slot, type) ->
|
||||||
player.teleport(genbucket.getPlayerLocation()
|
player.teleport(genbucket.getPlayerLocation()
|
||||||
)));
|
)));
|
||||||
place ++;
|
place++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@ import com.songoda.epicbuckets.file.ConfigManager;
|
|||||||
import com.songoda.epicbuckets.shop.Shop;
|
import com.songoda.epicbuckets.shop.Shop;
|
||||||
import com.songoda.epicbuckets.shop.ShopManager;
|
import com.songoda.epicbuckets.shop.ShopManager;
|
||||||
import com.songoda.epicbuckets.shop.SubShop;
|
import com.songoda.epicbuckets.shop.SubShop;
|
||||||
import com.songoda.epicbuckets.util.gui.AbstractGUI;
|
import com.songoda.epicbuckets.utils.gui.AbstractGUI;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.inventory.ClickType;
|
import org.bukkit.event.inventory.ClickType;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
@ -56,9 +56,10 @@ public class GUIShop extends AbstractGUI {
|
|||||||
registerClickable(shop.getBackButtonSlot(), ((player, inventory, cursor, slot, type) -> new GUIMain(player)));
|
registerClickable(shop.getBackButtonSlot(), ((player, inventory, cursor, slot, type) -> new GUIMain(player)));
|
||||||
}
|
}
|
||||||
|
|
||||||
shop.getSubShops().stream().filter(SubShop::isEnabled).forEach(subShop -> {
|
shop.getSubShops().stream().filter(SubShop::isEnabled).forEach(subShop -> {
|
||||||
registerClickable(subShop.getSlot(), ClickType.LEFT, ((player1, inventory1, cursor, slot, type) -> {
|
registerClickable(subShop.getSlot(), ClickType.LEFT, ((player1, inventory1, cursor, slot, type) -> {
|
||||||
if (shopManager.hasEnoughFunds(player1, subShop, 1) && !shopManager.inventoryFull(player)) shopManager.buyFromShop(player, subShop, 1);
|
if (shopManager.hasEnoughFunds(player1, subShop, 1) && !shopManager.inventoryFull(player))
|
||||||
|
shopManager.buyFromShop(player, subShop, 1);
|
||||||
if (shopManager.isCloseAfterPurchase()) new GUIMain(player);
|
if (shopManager.isCloseAfterPurchase()) new GUIMain(player);
|
||||||
}));
|
}));
|
||||||
registerClickable(subShop.getSlot(), ClickType.RIGHT, ((player1, inventory1, cursor, slot, type) -> new GUIBulk(player, shop, subShop)));
|
registerClickable(subShop.getSlot(), ClickType.RIGHT, ((player1, inventory1, cursor, slot, type) -> new GUIBulk(player, shop, subShop)));
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.songoda.epicbuckets.hooks;
|
package com.songoda.epicbuckets.hooks;
|
||||||
|
|
||||||
import com.songoda.epicbuckets.util.hooks.ClaimableProtectionPluginHook;
|
import com.songoda.epicbuckets.utils.hooks.ClaimableProtectionPluginHook;
|
||||||
import com.wasteofplastic.askyblock.ASkyBlock;
|
import com.wasteofplastic.askyblock.ASkyBlock;
|
||||||
import com.wasteofplastic.askyblock.ASkyBlockAPI;
|
import com.wasteofplastic.askyblock.ASkyBlockAPI;
|
||||||
import com.wasteofplastic.askyblock.Island;
|
import com.wasteofplastic.askyblock.Island;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.songoda.epicbuckets.hooks;
|
package com.songoda.epicbuckets.hooks;
|
||||||
|
|
||||||
import com.songoda.epicbuckets.util.hooks.ClaimableProtectionPluginHook;
|
import com.songoda.epicbuckets.utils.hooks.ClaimableProtectionPluginHook;
|
||||||
import me.markeh.factionsframework.FactionsFramework;
|
import me.markeh.factionsframework.FactionsFramework;
|
||||||
import me.markeh.factionsframework.entities.FPlayer;
|
import me.markeh.factionsframework.entities.FPlayer;
|
||||||
import me.markeh.factionsframework.entities.FPlayers;
|
import me.markeh.factionsframework.entities.FPlayers;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.songoda.epicbuckets.hooks;
|
package com.songoda.epicbuckets.hooks;
|
||||||
|
|
||||||
import com.songoda.epicbuckets.util.hooks.ProtectionPluginHook;
|
import com.songoda.epicbuckets.utils.hooks.ProtectionPluginHook;
|
||||||
import me.ryanhamshire.GriefPrevention.Claim;
|
import me.ryanhamshire.GriefPrevention.Claim;
|
||||||
import me.ryanhamshire.GriefPrevention.GriefPrevention;
|
import me.ryanhamshire.GriefPrevention.GriefPrevention;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.songoda.epicbuckets.hooks;
|
package com.songoda.epicbuckets.hooks;
|
||||||
|
|
||||||
import com.songoda.epicbuckets.util.hooks.ProtectionPluginHook;
|
import com.songoda.epicbuckets.utils.hooks.ProtectionPluginHook;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
@ -2,7 +2,7 @@ package com.songoda.epicbuckets.hooks;
|
|||||||
|
|
||||||
import com.intellectualcrafters.plot.api.PlotAPI;
|
import com.intellectualcrafters.plot.api.PlotAPI;
|
||||||
import com.plotsquared.bukkit.BukkitMain;
|
import com.plotsquared.bukkit.BukkitMain;
|
||||||
import com.songoda.epicbuckets.util.hooks.ProtectionPluginHook;
|
import com.songoda.epicbuckets.utils.hooks.ProtectionPluginHook;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
@ -3,7 +3,7 @@ package com.songoda.epicbuckets.hooks;
|
|||||||
import br.net.fabiozumbi12.RedProtect.Bukkit.API.RedProtectAPI;
|
import br.net.fabiozumbi12.RedProtect.Bukkit.API.RedProtectAPI;
|
||||||
import br.net.fabiozumbi12.RedProtect.Bukkit.RedProtect;
|
import br.net.fabiozumbi12.RedProtect.Bukkit.RedProtect;
|
||||||
import br.net.fabiozumbi12.RedProtect.Bukkit.Region;
|
import br.net.fabiozumbi12.RedProtect.Bukkit.Region;
|
||||||
import com.songoda.epicbuckets.util.hooks.ProtectionPluginHook;
|
import com.songoda.epicbuckets.utils.hooks.ProtectionPluginHook;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.songoda.epicbuckets.hooks;
|
package com.songoda.epicbuckets.hooks;
|
||||||
|
|
||||||
import com.songoda.epicbuckets.util.hooks.ClaimableProtectionPluginHook;
|
import com.songoda.epicbuckets.utils.hooks.ClaimableProtectionPluginHook;
|
||||||
import me.goodandevil.skyblock.SkyBlock;
|
import me.goodandevil.skyblock.SkyBlock;
|
||||||
import me.goodandevil.skyblock.island.Island;
|
import me.goodandevil.skyblock.island.Island;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
|
@ -4,8 +4,7 @@ import com.palmergames.bukkit.towny.Towny;
|
|||||||
import com.palmergames.bukkit.towny.exceptions.NotRegisteredException;
|
import com.palmergames.bukkit.towny.exceptions.NotRegisteredException;
|
||||||
import com.palmergames.bukkit.towny.object.Resident;
|
import com.palmergames.bukkit.towny.object.Resident;
|
||||||
import com.palmergames.bukkit.towny.object.TownyUniverse;
|
import com.palmergames.bukkit.towny.object.TownyUniverse;
|
||||||
import com.songoda.epicbuckets.util.hooks.ClaimableProtectionPluginHook;
|
import com.songoda.epicbuckets.utils.hooks.ClaimableProtectionPluginHook;
|
||||||
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.songoda.epicbuckets.hooks;
|
package com.songoda.epicbuckets.hooks;
|
||||||
|
|
||||||
import com.songoda.epicbuckets.util.hooks.ClaimableProtectionPluginHook;
|
import com.songoda.epicbuckets.utils.hooks.ClaimableProtectionPluginHook;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.songoda.epicbuckets.hooks;
|
package com.songoda.epicbuckets.hooks;
|
||||||
|
|
||||||
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
|
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
|
||||||
import com.songoda.epicbuckets.util.hooks.ProtectionPluginHook;
|
import com.songoda.epicbuckets.utils.hooks.ProtectionPluginHook;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
@ -9,8 +9,8 @@ import com.songoda.epicbuckets.genbucket.types.Horizontal;
|
|||||||
import com.songoda.epicbuckets.genbucket.types.Infused;
|
import com.songoda.epicbuckets.genbucket.types.Infused;
|
||||||
import com.songoda.epicbuckets.genbucket.types.PsuedoVertical;
|
import com.songoda.epicbuckets.genbucket.types.PsuedoVertical;
|
||||||
import com.songoda.epicbuckets.genbucket.types.Vertical;
|
import com.songoda.epicbuckets.genbucket.types.Vertical;
|
||||||
import com.songoda.epicbuckets.util.XMaterial;
|
import com.songoda.epicbuckets.utils.XMaterial;
|
||||||
import com.songoda.epicbuckets.util.itemnbtapi.NBTItem;
|
import com.songoda.epicbuckets.utils.itemnbtapi.NBTItem;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
@ -20,9 +20,9 @@ import org.bukkit.event.player.PlayerBucketEmptyEvent;
|
|||||||
import org.bukkit.event.player.PlayerInteractEvent;
|
import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
|
|
||||||
public class GenbucketPlaceListener implements Listener {
|
public class GenbucketPlaceListener implements Listener {
|
||||||
|
|
||||||
private final EpicBuckets instance;
|
private final EpicBuckets instance;
|
||||||
|
|
||||||
public GenbucketPlaceListener(EpicBuckets instance) {
|
public GenbucketPlaceListener(EpicBuckets instance) {
|
||||||
this.instance = instance;
|
this.instance = instance;
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@ package com.songoda.epicbuckets.listeners;
|
|||||||
|
|
||||||
import com.songoda.epicbuckets.EpicBuckets;
|
import com.songoda.epicbuckets.EpicBuckets;
|
||||||
import com.songoda.epicbuckets.References;
|
import com.songoda.epicbuckets.References;
|
||||||
import com.songoda.epicbuckets.util.ChatUtil;
|
import com.songoda.epicbuckets.utils.ChatUtil;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
@ -21,19 +21,19 @@ public class PlayerJoinListeners implements Listener {
|
|||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerJoin(PlayerJoinEvent event) {
|
public void onPlayerJoin(PlayerJoinEvent event) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
if (player.isOp()) {
|
if (player.isOp()) {
|
||||||
if (instance.getServer().getPluginManager().getPlugin("Factions") != null && instance.getServer().getPluginManager().getPlugin("FactionsFramework") == null) {
|
if (instance.getServer().getPluginManager().getPlugin("Factions") != null && instance.getServer().getPluginManager().getPlugin("FactionsFramework") == null) {
|
||||||
player.sendMessage("");
|
player.sendMessage("");
|
||||||
player.sendMessage(ChatUtil.colorString(References.getPrefix() + "&7Here's the deal,"));
|
player.sendMessage(ChatUtil.colorString(References.getPrefix() + "&7Here's the deal,"));
|
||||||
player.sendMessage(ChatUtil.colorString("&7I cannot give you full support for Factions out of the box."));
|
player.sendMessage(ChatUtil.colorString("&7I cannot give you full support for Factions out of the box."));
|
||||||
player.sendMessage(ChatUtil.colorString("&7Things will work without it but if you wan't a flawless"));
|
player.sendMessage(ChatUtil.colorString("&7Things will work without it but if you wan't a flawless"));
|
||||||
player.sendMessage(ChatUtil.colorString("&7experience you need to download"));
|
player.sendMessage(ChatUtil.colorString("&7experience you need to download"));
|
||||||
player.sendMessage(ChatUtil.colorString("&7&6https://www.spigotmc.org/resources/54337/&7."));
|
player.sendMessage(ChatUtil.colorString("&7&6https://www.spigotmc.org/resources/54337/&7."));
|
||||||
player.sendMessage(ChatUtil.colorString("&7If you don't care and don't want to see this message again"));
|
player.sendMessage(ChatUtil.colorString("&7If you don't care and don't want to see this message again"));
|
||||||
player.sendMessage(ChatUtil.colorString("&7turn &6Helpful-Tips &7off in the config."));
|
player.sendMessage(ChatUtil.colorString("&7turn &6Helpful-Tips &7off in the config."));
|
||||||
player.sendMessage("");
|
player.sendMessage("");
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -2,9 +2,9 @@ package com.songoda.epicbuckets.shop;
|
|||||||
|
|
||||||
import com.songoda.epicbuckets.EpicBuckets;
|
import com.songoda.epicbuckets.EpicBuckets;
|
||||||
import com.songoda.epicbuckets.genbucket.GenbucketType;
|
import com.songoda.epicbuckets.genbucket.GenbucketType;
|
||||||
import com.songoda.epicbuckets.util.InventoryHelper;
|
import com.songoda.epicbuckets.utils.InventoryHelper;
|
||||||
import com.songoda.epicbuckets.util.Validator;
|
import com.songoda.epicbuckets.utils.Validator;
|
||||||
import com.songoda.epicbuckets.util.XMaterial;
|
import com.songoda.epicbuckets.utils.XMaterial;
|
||||||
import org.bukkit.configuration.file.FileConfiguration;
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
@ -109,21 +109,21 @@ public class Shop {
|
|||||||
public SubShop getSubShop(XMaterial mat) {
|
public SubShop getSubShop(XMaterial mat) {
|
||||||
for (SubShop subShop : subShops.values()) {
|
for (SubShop subShop : subShops.values()) {
|
||||||
if (subShop.getGenItem().getType() == mat.parseMaterial() &&
|
if (subShop.getGenItem().getType() == mat.parseMaterial() &&
|
||||||
subShop.getGenItem().getDurability() == mat.parseItem().getDurability()) {
|
subShop.getGenItem().getDurability() == mat.parseItem().getDurability()) {
|
||||||
return subShop;
|
return subShop;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setEnabled(boolean enabled) {
|
|
||||||
this.enabled = enabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isEnabled() {
|
public boolean isEnabled() {
|
||||||
return enabled;
|
return enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setEnabled(boolean enabled) {
|
||||||
|
this.enabled = enabled;
|
||||||
|
}
|
||||||
|
|
||||||
public int getSlot() {
|
public int getSlot() {
|
||||||
return slot;
|
return slot;
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@ package com.songoda.epicbuckets.shop;
|
|||||||
|
|
||||||
import com.songoda.epicbuckets.EpicBuckets;
|
import com.songoda.epicbuckets.EpicBuckets;
|
||||||
import com.songoda.epicbuckets.genbucket.GenbucketType;
|
import com.songoda.epicbuckets.genbucket.GenbucketType;
|
||||||
import com.songoda.epicbuckets.util.*;
|
import com.songoda.epicbuckets.utils.*;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.configuration.file.FileConfiguration;
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -171,10 +171,18 @@ public class ShopManager {
|
|||||||
return useBackButtons;
|
return useBackButtons;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setUseBackButtons(boolean useBackButtons) {
|
||||||
|
this.useBackButtons = useBackButtons;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isCloseAfterPurchase() {
|
public boolean isCloseAfterPurchase() {
|
||||||
return closeAfterPurchase;
|
return closeAfterPurchase;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setCloseAfterPurchase(boolean closeAfterPurchase) {
|
||||||
|
this.closeAfterPurchase = closeAfterPurchase;
|
||||||
|
}
|
||||||
|
|
||||||
public String getBulkInventoryName() {
|
public String getBulkInventoryName() {
|
||||||
return bulkInventoryName;
|
return bulkInventoryName;
|
||||||
}
|
}
|
||||||
@ -187,6 +195,10 @@ public class ShopManager {
|
|||||||
return bulkFillInventory;
|
return bulkFillInventory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setBulkFillInventory(boolean bulkFillInventory) {
|
||||||
|
this.bulkFillInventory = bulkFillInventory;
|
||||||
|
}
|
||||||
|
|
||||||
public int getBulkBackButtonSlot() {
|
public int getBulkBackButtonSlot() {
|
||||||
return bulkBackButtonSlot;
|
return bulkBackButtonSlot;
|
||||||
}
|
}
|
||||||
@ -202,16 +214,4 @@ public class ShopManager {
|
|||||||
public void setShopDatabase(HashMap<String, Shop> shopDatabase) {
|
public void setShopDatabase(HashMap<String, Shop> shopDatabase) {
|
||||||
this.shopDatabase = shopDatabase;
|
this.shopDatabase = shopDatabase;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setBulkFillInventory(boolean bulkFillInventory) {
|
|
||||||
this.bulkFillInventory = bulkFillInventory;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUseBackButtons(boolean useBackButtons) {
|
|
||||||
this.useBackButtons = useBackButtons;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCloseAfterPurchase(boolean closeAfterPurchase) {
|
|
||||||
this.closeAfterPurchase = closeAfterPurchase;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
package com.songoda.epicbuckets.shop;
|
package com.songoda.epicbuckets.shop;
|
||||||
|
|
||||||
import com.songoda.epicbuckets.EpicBuckets;
|
import com.songoda.epicbuckets.EpicBuckets;
|
||||||
import com.songoda.epicbuckets.util.InventoryHelper;
|
import com.songoda.epicbuckets.utils.InventoryHelper;
|
||||||
import com.songoda.epicbuckets.util.Validator;
|
import com.songoda.epicbuckets.utils.Validator;
|
||||||
import com.songoda.epicbuckets.util.XMaterial;
|
import com.songoda.epicbuckets.utils.XMaterial;
|
||||||
import org.bukkit.configuration.file.FileConfiguration;
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
@ -85,14 +85,14 @@ public class SubShop {
|
|||||||
genShopItem = InventoryHelper.setDisplayName(InventoryHelper.setLore(genShopItem, getGenItemLore()), getShopName());
|
genShopItem = InventoryHelper.setDisplayName(InventoryHelper.setLore(genShopItem, getGenItemLore()), getShopName());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setEnabled(boolean enabled) {
|
|
||||||
this.enabled = enabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isEnabled() {
|
public boolean isEnabled() {
|
||||||
return enabled;
|
return enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setEnabled(boolean enabled) {
|
||||||
|
this.enabled = enabled;
|
||||||
|
}
|
||||||
|
|
||||||
public ItemStack getShopItem() {
|
public ItemStack getShopItem() {
|
||||||
return shopItem;
|
return shopItem;
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package com.songoda.epicbuckets.util;
|
package com.songoda.epicbuckets.utils;
|
||||||
|
|
||||||
import com.songoda.epicbuckets.EpicBuckets;
|
import com.songoda.epicbuckets.EpicBuckets;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
@ -1,4 +1,4 @@
|
|||||||
package com.songoda.epicbuckets.util;
|
package com.songoda.epicbuckets.utils;
|
||||||
|
|
||||||
import org.bukkit.configuration.file.FileConfiguration;
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
import org.bukkit.configuration.file.YamlConfiguration;
|
@ -1,4 +1,4 @@
|
|||||||
package com.songoda.epicbuckets.util;
|
package com.songoda.epicbuckets.utils;
|
||||||
|
|
||||||
import com.songoda.epicbuckets.EpicBuckets;
|
import com.songoda.epicbuckets.EpicBuckets;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
@ -1,4 +1,4 @@
|
|||||||
package com.songoda.epicbuckets.util;
|
package com.songoda.epicbuckets.utils;
|
||||||
|
|
||||||
import com.songoda.epicbuckets.EpicBuckets;
|
import com.songoda.epicbuckets.EpicBuckets;
|
||||||
import com.songoda.epicbuckets.shop.SubShop;
|
import com.songoda.epicbuckets.shop.SubShop;
|
||||||
@ -52,7 +52,8 @@ public class InventoryHelper {
|
|||||||
lore.forEach(s -> {
|
lore.forEach(s -> {
|
||||||
String line = s;
|
String line = s;
|
||||||
if (line.contains("%price%")) line = line.replace("%price%", subShop.getPrice() + "");
|
if (line.contains("%price%")) line = line.replace("%price%", subShop.getPrice() + "");
|
||||||
if (line.contains("%material%")) line = line.replace("%material%", subShop.getType().parseMaterial().name());
|
if (line.contains("%material%"))
|
||||||
|
line = line.replace("%material%", subShop.getType().parseMaterial().name());
|
||||||
newLore.add(ChatColor.translateAlternateColorCodes('&', line));
|
newLore.add(ChatColor.translateAlternateColorCodes('&', line));
|
||||||
});
|
});
|
||||||
im.setLore(newLore);
|
im.setLore(newLore);
|
@ -1,8 +1,8 @@
|
|||||||
package com.songoda.epicbuckets.util;
|
package com.songoda.epicbuckets.utils;
|
||||||
|
|
||||||
import com.songoda.epicbuckets.genbucket.GenbucketType;
|
import com.songoda.epicbuckets.genbucket.GenbucketType;
|
||||||
import com.songoda.epicbuckets.shop.SubShop;
|
import com.songoda.epicbuckets.shop.SubShop;
|
||||||
import com.songoda.epicbuckets.util.itemnbtapi.NBTItem;
|
import com.songoda.epicbuckets.utils.itemnbtapi.NBTItem;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
public class NBTHelper {
|
public class NBTHelper {
|
@ -1,4 +1,4 @@
|
|||||||
package com.songoda.epicbuckets.util;
|
package com.songoda.epicbuckets.utils;
|
||||||
|
|
||||||
public enum ServerVersion {
|
public enum ServerVersion {
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package com.songoda.epicbuckets.util;
|
package com.songoda.epicbuckets.utils;
|
||||||
|
|
||||||
import com.songoda.epicbuckets.genbucket.GenbucketType;
|
import com.songoda.epicbuckets.genbucket.GenbucketType;
|
||||||
|
|
||||||
@ -8,7 +8,7 @@ public class Validator {
|
|||||||
int i;
|
int i;
|
||||||
if (isInt(s)) {
|
if (isInt(s)) {
|
||||||
i = Integer.parseInt(s);
|
i = Integer.parseInt(s);
|
||||||
if (i<=6) return i;
|
if (i <= 6) return i;
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
@ -1,18 +1,19 @@
|
|||||||
package com.songoda.epicbuckets.util;
|
package com.songoda.epicbuckets.utils;
|
||||||
/** The MIT License (MIT)
|
/**
|
||||||
*
|
* The MIT License (MIT)
|
||||||
|
* <p>
|
||||||
* Copyright (c) 2018 Hex_27
|
* Copyright (c) 2018 Hex_27
|
||||||
*
|
* <p>
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
* of this software and associated documentation files (the "Software"),
|
* of this software and associated documentation files (the "Software"),
|
||||||
* to deal in the Software without restriction, including without limitation
|
* to deal in the Software without restriction, including without limitation
|
||||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||||
* and/or sell copies of the Software, and to permit persons to whom the
|
* and/or sell copies of the Software, and to permit persons to whom the
|
||||||
* Software is furnished to do so, subject to the following conditions:
|
* Software is furnished to do so, subject to the following conditions:
|
||||||
*
|
* <p>
|
||||||
* The above copyright notice and this permission notice shall be included
|
* The above copyright notice and this permission notice shall be included
|
||||||
* in all copies or substantial portions of the Software.
|
* in all copies or substantial portions of the Software.
|
||||||
*
|
* <p>
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||||
* OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
* OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
@ -22,11 +23,11 @@ package com.songoda.epicbuckets.util;
|
|||||||
* DEALINGS IN THE SOFTWARE.
|
* DEALINGS IN THE SOFTWARE.
|
||||||
**/
|
**/
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
public enum XMaterial {
|
public enum XMaterial {
|
||||||
|
|
||||||
ACACIA_BOAT("BOAT_ACACIA", 0),
|
ACACIA_BOAT("BOAT_ACACIA", 0),
|
||||||
@ -878,29 +879,22 @@ public enum XMaterial {
|
|||||||
ZOMBIE_PIGMAN_SPAWN_EGG("MONSTER_EGG", 0),
|
ZOMBIE_PIGMAN_SPAWN_EGG("MONSTER_EGG", 0),
|
||||||
ZOMBIE_SPAWN_EGG("MONSTER_EGG", 0),
|
ZOMBIE_SPAWN_EGG("MONSTER_EGG", 0),
|
||||||
ZOMBIE_VILLAGER_SPAWN_EGG("MONSTER_EGG", 0),
|
ZOMBIE_VILLAGER_SPAWN_EGG("MONSTER_EGG", 0),
|
||||||
ZOMBIE_WALL_HEAD("SKULL", 0),
|
ZOMBIE_WALL_HEAD("SKULL", 0),;
|
||||||
;
|
static int newV = -1;
|
||||||
|
private static HashMap<String, XMaterial> cachedSearch = new HashMap<>();
|
||||||
String m;
|
String m;
|
||||||
int data;
|
int data;
|
||||||
|
|
||||||
XMaterial(String m, int data ){
|
XMaterial(String m, int data) {
|
||||||
this.m = m;
|
this.m = m;
|
||||||
this.data = data;
|
this.data = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemStack parseItem(){
|
public static boolean isNewVersion() {
|
||||||
Material mat = parseMaterial();
|
if (newV == 0) return false;
|
||||||
if(isNewVersion()){
|
if (newV == 1) return true;
|
||||||
return new ItemStack(mat);
|
|
||||||
}
|
|
||||||
return new ItemStack(mat,1,(byte) data);
|
|
||||||
}
|
|
||||||
static int newV = -1;
|
|
||||||
public static boolean isNewVersion(){
|
|
||||||
if(newV == 0) return false;
|
|
||||||
if(newV == 1) return true;
|
|
||||||
Material mat = Material.matchMaterial("RED_WOOL");
|
Material mat = Material.matchMaterial("RED_WOOL");
|
||||||
if(mat != null){
|
if (mat != null) {
|
||||||
newV = 1;
|
newV = 1;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -908,43 +902,67 @@ public enum XMaterial {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static HashMap<String, XMaterial> cachedSearch = new HashMap<>();
|
public static XMaterial requestXMaterial(String name, byte data) {
|
||||||
public static XMaterial requestXMaterial(String name, byte data){
|
if (cachedSearch.containsKey(name.toUpperCase() + "," + data)) {
|
||||||
if(cachedSearch.containsKey(name.toUpperCase()+","+data)){
|
return cachedSearch.get(name.toUpperCase() + "," + data);
|
||||||
return cachedSearch.get(name.toUpperCase()+","+data);
|
|
||||||
}
|
}
|
||||||
for(XMaterial mat:XMaterial.values()){
|
for (XMaterial mat : XMaterial.values()) {
|
||||||
if(name.toUpperCase().equals(mat.m) && ((byte)mat.data) == data){
|
if (name.toUpperCase().equals(mat.m) && ((byte) mat.data) == data) {
|
||||||
cachedSearch.put(mat.m+","+data,mat);
|
cachedSearch.put(mat.m + "," + data, mat);
|
||||||
return mat;
|
return mat;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isSameMaterial(ItemStack comp){
|
public static XMaterial fromString(String key) {
|
||||||
if(isNewVersion()){
|
XMaterial xmat = null;
|
||||||
|
try {
|
||||||
|
xmat = XMaterial.valueOf(key);
|
||||||
|
return xmat;
|
||||||
|
} catch (IllegalArgumentException e) {
|
||||||
|
String[] split = key.split(":");
|
||||||
|
if (split.length == 1) {
|
||||||
|
xmat = requestXMaterial(key, (byte) 0);
|
||||||
|
} else {
|
||||||
|
xmat = requestXMaterial(split[0], (byte) Integer.parseInt(split[1]));
|
||||||
|
}
|
||||||
|
return xmat;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public ItemStack parseItem() {
|
||||||
|
Material mat = parseMaterial();
|
||||||
|
if (isNewVersion()) {
|
||||||
|
return new ItemStack(mat);
|
||||||
|
}
|
||||||
|
return new ItemStack(mat, 1, (byte) data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isSameMaterial(ItemStack comp) {
|
||||||
|
if (isNewVersion()) {
|
||||||
return comp.getType() == this.parseMaterial();
|
return comp.getType() == this.parseMaterial();
|
||||||
}
|
}
|
||||||
if(comp.getType() == this.parseMaterial() &&
|
if (comp.getType() == this.parseMaterial() &&
|
||||||
(int) comp.getData().getData() == (int) this.data){
|
(int) comp.getData().getData() == (int) this.data) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
XMaterial xmat = fromMaterial(comp.getType());
|
XMaterial xmat = fromMaterial(comp.getType());
|
||||||
if(isDamageable(xmat)){
|
if (isDamageable(xmat)) {
|
||||||
if(this.parseMaterial() == comp.getType()){
|
if (this.parseMaterial() == comp.getType()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public XMaterial fromMaterial(Material mat){
|
public XMaterial fromMaterial(Material mat) {
|
||||||
try{
|
try {
|
||||||
return XMaterial.valueOf(mat.toString());
|
return XMaterial.valueOf(mat.toString());
|
||||||
}catch(IllegalArgumentException e){
|
} catch (IllegalArgumentException e) {
|
||||||
for(XMaterial xmat:XMaterial.values()){
|
for (XMaterial xmat : XMaterial.values()) {
|
||||||
if(xmat.m.equals(mat.toString())){
|
if (xmat.m.equals(mat.toString())) {
|
||||||
return xmat;
|
return xmat;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -952,27 +970,10 @@ public enum XMaterial {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static XMaterial fromString(String key){
|
public boolean isDamageable(XMaterial type) {
|
||||||
XMaterial xmat = null;
|
|
||||||
try{
|
|
||||||
xmat = XMaterial.valueOf(key);
|
|
||||||
return xmat;
|
|
||||||
}catch(IllegalArgumentException e){
|
|
||||||
String[] split = key.split(":");
|
|
||||||
if(split.length == 1){
|
|
||||||
xmat = requestXMaterial(key,(byte) 0);
|
|
||||||
}else{
|
|
||||||
xmat = requestXMaterial(split[0],(byte) Integer.parseInt(split[1]));
|
|
||||||
}
|
|
||||||
return xmat;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isDamageable(XMaterial type){
|
|
||||||
String[] split = type.toString().split("_");
|
String[] split = type.toString().split("_");
|
||||||
int length = split.length;
|
int length = split.length;
|
||||||
switch(split[length-1]){
|
switch (split[length - 1]) {
|
||||||
case "HELMET":
|
case "HELMET":
|
||||||
return true;
|
return true;
|
||||||
case "CHESTPLATE":
|
case "CHESTPLATE":
|
||||||
@ -1006,9 +1007,9 @@ public enum XMaterial {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Material parseMaterial(){
|
public Material parseMaterial() {
|
||||||
Material mat = Material.matchMaterial(this.toString());
|
Material mat = Material.matchMaterial(this.toString());
|
||||||
if(mat != null){
|
if (mat != null) {
|
||||||
return mat;
|
return mat;
|
||||||
}
|
}
|
||||||
return Material.matchMaterial(m);
|
return Material.matchMaterial(m);
|
@ -1,151 +1,152 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
<modelVersion>4.0.0</modelVersion>
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||||
<groupId>com.songoda</groupId>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<artifactId>EpicBuckets</artifactId>
|
<groupId>com.songoda</groupId>
|
||||||
<version>1.0.2</version>
|
<artifactId>EpicBuckets</artifactId>
|
||||||
<build>
|
<version>1.0.2</version>
|
||||||
<sourceDirectory>src/main/java</sourceDirectory>
|
<build>
|
||||||
<defaultGoal>clean package</defaultGoal>
|
<sourceDirectory>src/main/java</sourceDirectory>
|
||||||
<resources>
|
<defaultGoal>clean package</defaultGoal>
|
||||||
<resource>
|
<resources>
|
||||||
<filtering>true</filtering>
|
<resource>
|
||||||
<directory>src/main/resources</directory>
|
<filtering>true</filtering>
|
||||||
</resource>
|
<directory>src/main/resources</directory>
|
||||||
</resources>
|
</resource>
|
||||||
<plugins>
|
</resources>
|
||||||
<plugin>
|
<plugins>
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
<plugin>
|
||||||
<version>3.6.1</version>
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
<configuration>
|
<version>3.6.1</version>
|
||||||
<source>1.8</source>
|
<configuration>
|
||||||
<target>1.8</target>
|
<source>1.8</source>
|
||||||
</configuration>
|
<target>1.8</target>
|
||||||
</plugin>
|
</configuration>
|
||||||
<plugin>
|
</plugin>
|
||||||
<artifactId>maven-shade-plugin</artifactId>
|
<plugin>
|
||||||
<version>2.4.3</version>
|
<artifactId>maven-shade-plugin</artifactId>
|
||||||
<executions>
|
<version>2.4.3</version>
|
||||||
<execution>
|
<executions>
|
||||||
<phase>package</phase>
|
<execution>
|
||||||
<goals>
|
<phase>package</phase>
|
||||||
<goal>shade</goal>
|
<goals>
|
||||||
</goals>
|
<goal>shade</goal>
|
||||||
</execution>
|
</goals>
|
||||||
</executions>
|
</execution>
|
||||||
<configuration>
|
</executions>
|
||||||
<shadedClassifierName>shaded</shadedClassifierName>
|
<configuration>
|
||||||
<artifactSet>
|
<shadedClassifierName>shaded</shadedClassifierName>
|
||||||
<excludes>
|
<artifactSet>
|
||||||
<exclude>org.spigotmc:spigot</exclude>
|
<excludes>
|
||||||
<exclude>com.songoda:arconix</exclude>
|
<exclude>org.spigotmc:spigot</exclude>
|
||||||
<exclude>net.milkbowl.vault:VaultAPI</exclude>
|
<exclude>com.songoda:arconix</exclude>
|
||||||
<exclude>me.ryanhamshire:GriefPrevention</exclude>
|
<exclude>net.milkbowl.vault:VaultAPI</exclude>
|
||||||
<exclude>com.sk89q</exclude>
|
<exclude>me.ryanhamshire:GriefPrevention</exclude>
|
||||||
<exclude>com:plotsquared</exclude>
|
<exclude>com.sk89q</exclude>
|
||||||
<exclude>me.markeh:factionsframework</exclude>
|
<exclude>com:plotsquared</exclude>
|
||||||
<exclude>com.massivecraft</exclude>
|
<exclude>me.markeh:factionsframework</exclude>
|
||||||
</excludes>
|
<exclude>com.massivecraft</exclude>
|
||||||
</artifactSet>
|
</excludes>
|
||||||
<relocations>
|
</artifactSet>
|
||||||
<relocation>
|
<relocations>
|
||||||
<pattern>co.aikar.commands</pattern>
|
<relocation>
|
||||||
<shadedPattern>${project.groupId}.${project.artifactId}.acf</shadedPattern>
|
<pattern>co.aikar.commands</pattern>
|
||||||
</relocation>
|
<shadedPattern>${project.groupId}.${project.artifactId}.acf</shadedPattern>
|
||||||
<relocation>
|
</relocation>
|
||||||
<pattern>de.tr7zw.itemnbtapi</pattern>
|
<relocation>
|
||||||
<shadedPattern>${project.groupId}.${project.artifactId}.itemnbtapi</shadedPattern>
|
<pattern>de.tr7zw.itemnbtapi</pattern>
|
||||||
</relocation>
|
<shadedPattern>${project.groupId}.${project.artifactId}.itemnbtapi</shadedPattern>
|
||||||
</relocations>
|
</relocation>
|
||||||
</configuration>
|
</relocations>
|
||||||
</plugin>
|
</configuration>
|
||||||
</plugins>
|
</plugin>
|
||||||
</build>
|
</plugins>
|
||||||
<repositories>
|
</build>
|
||||||
<repository>
|
<repositories>
|
||||||
<id>11_private</id>
|
<repository>
|
||||||
<url>http://repo.songoda.com/repository/private</url>
|
<id>11_private</id>
|
||||||
</repository>
|
<url>http://repo.songoda.com/repository/private</url>
|
||||||
<repository>
|
</repository>
|
||||||
<id>22_vault</id>
|
<repository>
|
||||||
<url>http://nexus.hc.to/content/repositories/pub_releases</url>
|
<id>22_vault</id>
|
||||||
</repository>
|
<url>http://nexus.hc.to/content/repositories/pub_releases</url>
|
||||||
<repository>
|
</repository>
|
||||||
<id>3_aikar</id>
|
<repository>
|
||||||
<url>https://repo.aikar.co/content/groups/aikar/</url>
|
<id>3_aikar</id>
|
||||||
</repository>
|
<url>https://repo.aikar.co/content/groups/aikar/</url>
|
||||||
<repository>
|
</repository>
|
||||||
<id>44_jitpack.io</id>
|
<repository>
|
||||||
<url>https://jitpack.io</url>
|
<id>44_jitpack.io</id>
|
||||||
</repository>
|
<url>https://jitpack.io</url>
|
||||||
</repositories>
|
</repository>
|
||||||
<dependencies>
|
</repositories>
|
||||||
<dependency>
|
<dependencies>
|
||||||
<groupId>org.spigotmc</groupId>
|
<dependency>
|
||||||
<artifactId>spigot</artifactId>
|
<groupId>org.spigotmc</groupId>
|
||||||
<version>1.13.2</version>
|
<artifactId>spigot</artifactId>
|
||||||
<scope>provided</scope>
|
<version>1.13.2</version>
|
||||||
</dependency>
|
<scope>provided</scope>
|
||||||
<dependency>
|
</dependency>
|
||||||
<groupId>com.songoda</groupId>
|
<dependency>
|
||||||
<artifactId>arconix</artifactId>
|
<groupId>com.songoda</groupId>
|
||||||
<version>LATEST</version>
|
<artifactId>arconix</artifactId>
|
||||||
<scope>provided</scope>
|
<version>LATEST</version>
|
||||||
</dependency>
|
<scope>provided</scope>
|
||||||
<dependency>
|
</dependency>
|
||||||
<groupId>net.milkbowl.vault</groupId>
|
<dependency>
|
||||||
<artifactId>VaultAPI</artifactId>
|
<groupId>net.milkbowl.vault</groupId>
|
||||||
<version>LATEST</version>
|
<artifactId>VaultAPI</artifactId>
|
||||||
<scope>provided</scope>
|
<version>LATEST</version>
|
||||||
<exclusions>
|
<scope>provided</scope>
|
||||||
<exclusion>
|
<exclusions>
|
||||||
<artifactId>bukkit</artifactId>
|
<exclusion>
|
||||||
<groupId>org.bukkit</groupId>
|
<artifactId>bukkit</artifactId>
|
||||||
</exclusion>
|
<groupId>org.bukkit</groupId>
|
||||||
</exclusions>
|
</exclusion>
|
||||||
</dependency>
|
</exclusions>
|
||||||
<dependency>
|
</dependency>
|
||||||
<groupId>me.ryanhamshire</groupId>
|
<dependency>
|
||||||
<artifactId>GriefPrevention</artifactId>
|
<groupId>me.ryanhamshire</groupId>
|
||||||
<version>LATEST</version>
|
<artifactId>GriefPrevention</artifactId>
|
||||||
<scope>provided</scope>
|
<version>LATEST</version>
|
||||||
</dependency>
|
<scope>provided</scope>
|
||||||
<dependency>
|
</dependency>
|
||||||
<groupId>com.sk89q</groupId>
|
<dependency>
|
||||||
<artifactId>worldedit</artifactId>
|
<groupId>com.sk89q</groupId>
|
||||||
<version>LATEST</version>
|
<artifactId>worldedit</artifactId>
|
||||||
<scope>provided</scope>
|
<version>LATEST</version>
|
||||||
</dependency>
|
<scope>provided</scope>
|
||||||
<dependency>
|
</dependency>
|
||||||
<groupId>com.sk89q</groupId>
|
<dependency>
|
||||||
<artifactId>worldguard</artifactId>
|
<groupId>com.sk89q</groupId>
|
||||||
<version>6.2.2</version>
|
<artifactId>worldguard</artifactId>
|
||||||
<scope>provided</scope>
|
<version>6.2.2</version>
|
||||||
</dependency>
|
<scope>provided</scope>
|
||||||
<dependency>
|
</dependency>
|
||||||
<groupId>com</groupId>
|
<dependency>
|
||||||
<artifactId>plotsquared</artifactId>
|
<groupId>com</groupId>
|
||||||
<version>RELEASE</version>
|
<artifactId>plotsquared</artifactId>
|
||||||
<scope>provided</scope>
|
<version>RELEASE</version>
|
||||||
</dependency>
|
<scope>provided</scope>
|
||||||
<dependency>
|
</dependency>
|
||||||
<groupId>me.markeh</groupId>
|
<dependency>
|
||||||
<artifactId>factionsframework</artifactId>
|
<groupId>me.markeh</groupId>
|
||||||
<version>1.2.0</version>
|
<artifactId>factionsframework</artifactId>
|
||||||
<scope>provided</scope>
|
<version>1.2.0</version>
|
||||||
</dependency>
|
<scope>provided</scope>
|
||||||
<dependency>
|
</dependency>
|
||||||
<groupId>com.massivecraft</groupId>
|
<dependency>
|
||||||
<artifactId>factions</artifactId>
|
<groupId>com.massivecraft</groupId>
|
||||||
<version>LATEST</version>
|
<artifactId>factions</artifactId>
|
||||||
<scope>provided</scope>
|
<version>LATEST</version>
|
||||||
</dependency>
|
<scope>provided</scope>
|
||||||
<dependency>
|
</dependency>
|
||||||
<groupId>com.massivecraft</groupId>
|
<dependency>
|
||||||
<artifactId>factionsuuid</artifactId>
|
<groupId>com.massivecraft</groupId>
|
||||||
<version>LATEST</version>
|
<artifactId>factionsuuid</artifactId>
|
||||||
<scope>provided</scope>
|
<version>LATEST</version>
|
||||||
</dependency>
|
<scope>provided</scope>
|
||||||
</dependencies>
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
</project>
|
</project>
|
||||||
|
|
||||||
|
2
pom.xml
2
pom.xml
@ -1,4 +1,4 @@
|
|||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user