Removed Arconix & updated hooks.

This commit is contained in:
Brianna O'Keefe 2019-01-13 05:39:36 -05:00
parent 4bb3767b39
commit 6057155a7e
29 changed files with 394 additions and 151 deletions

View File

@ -4,7 +4,7 @@ stages:
variables:
name: "EpicHoppers"
path: "/builds/Songoda/$name"
version: "3.2.12"
version: "3.3"
build:
stage: build
@ -19,4 +19,3 @@ build:
name: $name-$version
paths:
- "$path/*.jar"
- "$path/Read_this_before_your_first_use.txt"

View File

@ -34,14 +34,15 @@ public interface EpicHoppers {
*/
HopperManager getHopperManager();
void register(Supplier<ProtectionPluginHook> hookSupplier);
ProtectionPluginHook register(Supplier<ProtectionPluginHook> hookSupplier);
/**
* Register a new {@link ProtectionPluginHook} implementation
* in order for EpicSpawners to support plugins that protect
* in order for EpicHoppers to support plugins that protect
* blocks from being interacted with
*
* @param hook the hook to register
*/
void registerProtectionHook(ProtectionPluginHook hook);
ProtectionPluginHook registerProtectionHook(ProtectionPluginHook hook);
}

View File

@ -32,12 +32,6 @@
ILL HANG YOU NEXT TIME
CreeperCow-->
</dependency>
<dependency>
<groupId>com.songoda</groupId>
<artifactId>arconix</artifactId>
<version>LATEST</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org</groupId>
<artifactId>kingdoms</artifactId>
@ -71,7 +65,13 @@
<dependency>
<groupId>com</groupId>
<artifactId>plotsquared</artifactId>
<version>RELEASE</version>
<version>BREAKING</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.songoda</groupId>
<artifactId>skyblockearth</artifactId>
<version>LATEST</version>
<scope>provided</scope>
</dependency>
<dependency>

View File

@ -1,10 +1,6 @@
package com.songoda.epichoppers;
import com.google.common.base.Preconditions;
import com.songoda.arconix.api.methods.formatting.TextComponent;
import com.songoda.arconix.api.methods.serialize.Serialize;
import com.songoda.arconix.api.utils.ConfigWrapper;
import com.songoda.arconix.plugin.Arconix;
import com.songoda.epichoppers.api.EpicHoppers;
import com.songoda.epichoppers.api.EpicHoppersAPI;
import com.songoda.epichoppers.api.hopper.Hopper;
@ -36,13 +32,13 @@ import com.songoda.epichoppers.storage.StorageItem;
import com.songoda.epichoppers.storage.StorageRow;
import com.songoda.epichoppers.storage.types.StorageMysql;
import com.songoda.epichoppers.storage.types.StorageYaml;
import com.songoda.epichoppers.utils.ConfigWrapper;
import com.songoda.epichoppers.utils.Methods;
import com.songoda.epichoppers.utils.SettingsManager;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.command.CommandSender;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.entity.Player;
@ -72,7 +68,7 @@ public class EpicHoppersPlugin extends JavaPlugin implements EpicHoppers {
public References references = null;
public EnchantmentHandler enchantmentHandler;
private List<ProtectionPluginHook> protectionHooks = new ArrayList<>();
private ClaimableProtectionPluginHook factionsHook, townyHook, aSkyblockHook, uSkyblockHook;
private ClaimableProtectionPluginHook factionsHook, townyHook, aSkyblockHook, uSkyblockHook, skyBlockEarhHook;
private SettingsManager settingsManager;
private ConfigWrapper hooksFile = new ConfigWrapper(this, "", "hooks.yml");
private Locale locale;
@ -117,11 +113,9 @@ public class EpicHoppersPlugin extends JavaPlugin implements EpicHoppers {
INSTANCE = this;
EpicHoppersAPI.setImplementation(this);
Arconix.pl().hook(this);
console.sendMessage(TextComponent.formatText("&a============================="));
console.sendMessage(TextComponent.formatText("&7EpicHoppers " + this.getDescription().getVersion() + " by &5Brianna <3&7!"));
console.sendMessage(TextComponent.formatText("&7Action: &aEnabling&7..."));
console.sendMessage(Methods.formatText("&a============================="));
console.sendMessage(Methods.formatText("&7EpicHoppers " + this.getDescription().getVersion() + " by &5Brianna <3&7!"));
console.sendMessage(Methods.formatText("&7Action: &aEnabling&7..."));
settingsManager = new SettingsManager(this);
this.setupConfig();
@ -150,7 +144,7 @@ public class EpicHoppersPlugin extends JavaPlugin implements EpicHoppers {
Bukkit.getScheduler().runTaskLater(this, () -> {
if (storage.containsGroup("sync")) {
for (StorageRow row : storage.getRowsByGroup("sync")) {
Location location = Serialize.getInstance().unserializeLocation(row.getKey());
Location location = Methods.unserializeLocation(row.getKey());
if (location == null) return;
int level = row.get("level").asInt();
@ -159,7 +153,7 @@ public class EpicHoppersPlugin extends JavaPlugin implements EpicHoppers {
List<Location> blocks = new ArrayList<>();
if (blockLoc != null) {
for (String string : blockLoc) {
blocks.add(Arconix.pl().getApi().serialize().unserializeLocation(string));
blocks.add(Methods.unserializeLocation(string));
}
}
@ -177,7 +171,7 @@ public class EpicHoppersPlugin extends JavaPlugin implements EpicHoppers {
Material autoCrafting = Material.valueOf(row.get("autocrafting").asString() == null ? "AIR" : row.get("autocrafting").asString());
String blackLoc = row.get("black").asString();
Location black = blackLoc == null ? null : Arconix.pl().getApi().serialize().unserializeLocation(blackLoc);
Location black = blackLoc == null ? null : Methods.unserializeLocation(blackLoc);
EFilter filter = new EFilter();
@ -229,27 +223,29 @@ public class EpicHoppersPlugin extends JavaPlugin implements EpicHoppers {
if (pluginManager.isPluginEnabled("LiquidTanks")) liquidtanks = true;
// Register default hooks
if (pluginManager.isPluginEnabled("ASkyBlock")) this.register(HookASkyBlock::new);
if (pluginManager.isPluginEnabled("FactionsFramework")) this.register(HookFactions::new);
if (pluginManager.isPluginEnabled("GriefPrevention")) this.register(HookGriefPrevention::new);
if (pluginManager.isPluginEnabled("Kingdoms")) this.register(HookKingdoms::new);
if (pluginManager.isPluginEnabled("PlotSquared")) this.register(HookPlotSquared::new);
if (pluginManager.isPluginEnabled("RedProtect")) this.register(HookRedProtect::new);
if (pluginManager.isPluginEnabled("Towny")) this.register(HookTowny::new);
if (pluginManager.isPluginEnabled("USkyBlock")) this.register(HookUSkyBlock::new);
if (pluginManager.isPluginEnabled("Towny")) townyHook = (ClaimableProtectionPluginHook)this.register(HookTowny::new);
if (pluginManager.isPluginEnabled("USkyBlock")) uSkyblockHook = (ClaimableProtectionPluginHook)this.register(HookUSkyBlock::new);
if (pluginManager.isPluginEnabled("SkyBlock")) skyBlockEarhHook = (ClaimableProtectionPluginHook)this.register(HookSkyBlockEarth::new);
if (pluginManager.isPluginEnabled("WorldGuard")) this.register(HookWorldGuard::new);
console.sendMessage(TextComponent.formatText("&a============================="));
console.sendMessage(Methods.formatText("&a============================="));
}
public void onDisable() {
saveToFile();
this.storage.closeConnection();
this.protectionHooks.clear();
console.sendMessage(TextComponent.formatText("&a============================="));
console.sendMessage(TextComponent.formatText("&7EpicHoppers " + this.getDescription().getVersion() + " by &5Brianna <3!"));
console.sendMessage(TextComponent.formatText("&7Action: &cDisabling&7..."));
console.sendMessage(TextComponent.formatText("&a============================="));
console.sendMessage(Methods.formatText("&a============================="));
console.sendMessage(Methods.formatText("&7EpicHoppers " + this.getDescription().getVersion() + " by &5Brianna <3!"));
console.sendMessage(Methods.formatText("&7Action: &cDisabling&7..."));
console.sendMessage(Methods.formatText("&a============================="));
}
private void update() {
@ -307,7 +303,7 @@ public class EpicHoppersPlugin extends JavaPlugin implements EpicHoppers {
for (Hopper hopper : hopperManager.getHoppers().values()) {
if (hopper.getLevel() == null || hopper.getLocation() == null || hopper.getLocation().getChunk() == null)
continue;
String locationStr = Arconix.pl().getApi().serialize().serializeLocation(hopper.getLocation());
String locationStr = Methods.serializeLocation(hopper.getLocation());
storage.prepareSaveItem("sync", new StorageItem("location", locationStr),
new StorageItem("level", hopper.getLevel().getLevel()),
@ -320,7 +316,7 @@ public class EpicHoppersPlugin extends JavaPlugin implements EpicHoppers {
new StorageItem("whitelist", hopper.getFilter().getWhiteList()),
new StorageItem("blacklist", hopper.getFilter().getBlackList()),
new StorageItem("void", hopper.getFilter().getVoidList()),
new StorageItem("black", hopper.getFilter().getEndPoint() == null ? null : Arconix.pl().getApi().serialize().serializeLocation(hopper.getFilter().getEndPoint())));
new StorageItem("black", hopper.getFilter().getEndPoint() == null ? null : Methods.serializeLocation(hopper.getFilter().getEndPoint())));
}
/*
@ -491,7 +487,7 @@ public class EpicHoppersPlugin extends JavaPlugin implements EpicHoppers {
public ItemStack newHopperItem(Level level) {
ItemStack item = new ItemStack(Material.HOPPER, 1);
ItemMeta itemmeta = item.getItemMeta();
itemmeta.setDisplayName(TextComponent.formatText(Methods.formatName(level.getLevel(), true)));
itemmeta.setDisplayName(Methods.formatText(Methods.formatName(level.getLevel(), true)));
String line = getLocale().getMessage("general.nametag.lore");
if (!line.equals("")) {
itemmeta.setLore(Arrays.asList(line.split("\n")));
@ -539,12 +535,13 @@ public class EpicHoppersPlugin extends JavaPlugin implements EpicHoppers {
}
@Override
public void register(Supplier<ProtectionPluginHook> hookSupplier) {
this.registerProtectionHook(hookSupplier.get());
public ProtectionPluginHook register(Supplier<ProtectionPluginHook> hookSupplier) {
return this.registerProtectionHook(hookSupplier.get());
}
@Override
public void registerProtectionHook(ProtectionPluginHook hook) {
public ProtectionPluginHook registerProtectionHook(ProtectionPluginHook hook) {
Preconditions.checkNotNull(hook, "Cannot register null hook");
Preconditions.checkNotNull(hook.getPlugin(), "Protection plugin hook returns null plugin instance (#getPlugin())");
@ -556,12 +553,13 @@ public class EpicHoppersPlugin extends JavaPlugin implements EpicHoppers {
}
this.hooksFile.getConfig().addDefault("hooks." + hookPlugin.getName(), true);
if (!hooksFile.getConfig().getBoolean("hooks." + hookPlugin.getName(), true)) return;
if (!hooksFile.getConfig().getBoolean("hooks." + hookPlugin.getName(), true)) return null;
this.hooksFile.getConfig().options().copyDefaults(true);
this.hooksFile.saveConfig();
this.protectionHooks.add(hook);
this.getLogger().info("Registered protection hook for plugin: " + hook.getPlugin().getName());
return hook;
}
}

View File

@ -1,8 +1,8 @@
package com.songoda.epichoppers.command;
import com.songoda.arconix.api.methods.formatting.TextComponent;
import com.songoda.epichoppers.EpicHoppersPlugin;
import com.songoda.epichoppers.command.commands.*;
import com.songoda.epichoppers.utils.Methods;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
@ -53,7 +53,7 @@ public class CommandManager implements CommandExecutor {
}
}
}
commandSender.sendMessage(instance.references.getPrefix() + TextComponent.formatText("&7The command you entered does not exist or is spelt incorrectly."));
commandSender.sendMessage(instance.references.getPrefix() + Methods.formatText("&7The command you entered does not exist or is spelt incorrectly."));
return true;
}
@ -65,8 +65,8 @@ public class CommandManager implements CommandExecutor {
if (command.getPermissionNode() == null || sender.hasPermission(command.getPermissionNode())) {
AbstractCommand.ReturnType returnType = command.runCommand(instance, sender, strings);
if (returnType == AbstractCommand.ReturnType.SYNTAX_ERROR) {
sender.sendMessage(instance.references.getPrefix() + TextComponent.formatText("&cInvalid Syntax!"));
sender.sendMessage(instance.references.getPrefix() + TextComponent.formatText("&7The valid syntax is: &6" + command.getSyntax() + "&7."));
sender.sendMessage(instance.references.getPrefix() + Methods.formatText("&cInvalid Syntax!"));
sender.sendMessage(instance.references.getPrefix() + Methods.formatText("&7The valid syntax is: &6" + command.getSyntax() + "&7."));
}
return;
}

View File

@ -1,8 +1,8 @@
package com.songoda.epichoppers.command.commands;
import com.songoda.arconix.api.methods.formatting.TextComponent;
import com.songoda.epichoppers.EpicHoppersPlugin;
import com.songoda.epichoppers.command.AbstractCommand;
import com.songoda.epichoppers.utils.Methods;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@ -21,7 +21,7 @@ public class CommandBook extends AbstractCommand {
return ReturnType.SUCCESS;
}
} else if (Bukkit.getPlayerExact(args[1]) == null) {
sender.sendMessage(instance.references.getPrefix() + TextComponent.formatText("&cThat username does not exist, or the user is not online!"));
sender.sendMessage(instance.references.getPrefix() + Methods.formatText("&cThat username does not exist, or the user is not online!"));
return ReturnType.FAILURE;
} else {
Bukkit.getPlayerExact(args[1]).getInventory().addItem(instance.enchantmentHandler.getbook());

View File

@ -1,10 +1,9 @@
package com.songoda.epichoppers.command.commands;
import com.songoda.arconix.api.methods.formatting.TextComponent;
import com.songoda.arconix.api.methods.math.AMath;
import com.songoda.epichoppers.EpicHoppersPlugin;
import com.songoda.epichoppers.boost.BoostData;
import com.songoda.epichoppers.command.AbstractCommand;
import com.songoda.epichoppers.utils.Methods;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
@ -23,10 +22,10 @@ public class CommandBoost extends AbstractCommand {
return ReturnType.SYNTAX_ERROR;
}
if (Bukkit.getPlayer(args[1]) == null) {
sender.sendMessage(TextComponent.formatText(instance.references.getPrefix() + "&cThat player does not exist..."));
sender.sendMessage(Methods.formatText(instance.references.getPrefix() + "&cThat player does not exist..."));
return ReturnType.FAILURE;
} else if (!AMath.isInt(args[2])) {
sender.sendMessage(TextComponent.formatText(instance.references.getPrefix() + "&6" + args[2] + " &7is not a number..."));
} else if (!Methods.isInt(args[2])) {
sender.sendMessage(Methods.formatText(instance.references.getPrefix() + "&6" + args[2] + " &7is not a number..."));
return ReturnType.FAILURE;
} else {
Calendar c = Calendar.getInstance();
@ -53,7 +52,7 @@ public class CommandBoost extends AbstractCommand {
c.add(Calendar.YEAR, Integer.parseInt(arr2[1]));
time = " &7for &6" + arr2[1] + " years&7.";
} else {
sender.sendMessage(TextComponent.formatText(instance.references.getPrefix() + "&7" + args[3] + " &7is invalid."));
sender.sendMessage(Methods.formatText(instance.references.getPrefix() + "&7" + args[3] + " &7is invalid."));
return ReturnType.SUCCESS;
}
} else {
@ -62,7 +61,7 @@ public class CommandBoost extends AbstractCommand {
BoostData boostData = new BoostData(Integer.parseInt(args[2]), c.getTime().getTime(), Bukkit.getPlayer(args[1]).getUniqueId());
instance.getBoostManager().addBoostToPlayer(boostData);
sender.sendMessage(TextComponent.formatText(instance.references.getPrefix() + "&7Successfully boosted &6" + Bukkit.getPlayer(args[1]).getName() + "'s &7hoppers transfer rates by &6" + args[2] + "x" + time));
sender.sendMessage(Methods.formatText(instance.references.getPrefix() + "&7Successfully boosted &6" + Bukkit.getPlayer(args[1]).getName() + "'s &7hoppers transfer rates by &6" + args[2] + "x" + time));
}
return ReturnType.FAILURE;
}

View File

@ -1,8 +1,8 @@
package com.songoda.epichoppers.command.commands;
import com.songoda.arconix.api.methods.formatting.TextComponent;
import com.songoda.epichoppers.EpicHoppersPlugin;
import com.songoda.epichoppers.command.AbstractCommand;
import com.songoda.epichoppers.utils.Methods;
import org.bukkit.command.CommandSender;
public class CommandEpicHoppers extends AbstractCommand {
@ -14,11 +14,11 @@ public class CommandEpicHoppers extends AbstractCommand {
@Override
protected ReturnType runCommand(EpicHoppersPlugin instance, CommandSender sender, String... args) {
sender.sendMessage("");
sender.sendMessage(TextComponent.formatText(instance.references.getPrefix() + "&7Version " + instance.getDescription().getVersion() + " Created with <3 by &5&l&oBrianna"));
sender.sendMessage(Methods.formatText(instance.references.getPrefix() + "&7Version " + instance.getDescription().getVersion() + " Created with <3 by &5&l&oBrianna"));
for (AbstractCommand command : instance.getCommandManager().getCommands()) {
if (command.getPermissionNode() == null || sender.hasPermission(command.getPermissionNode())) {
sender.sendMessage(TextComponent.formatText("&8 - &a" + command.getSyntax() + "&7 - " + command.getDescription()));
sender.sendMessage(Methods.formatText("&8 - &a" + command.getSyntax() + "&7 - " + command.getDescription()));
}
}
sender.sendMessage("");

View File

@ -1,9 +1,9 @@
package com.songoda.epichoppers.command.commands;
import com.songoda.arconix.api.methods.formatting.TextComponent;
import com.songoda.epichoppers.EpicHoppersPlugin;
import com.songoda.epichoppers.api.hopper.levels.Level;
import com.songoda.epichoppers.command.AbstractCommand;
import com.songoda.epichoppers.utils.Methods;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@ -20,18 +20,18 @@ public class CommandGive extends AbstractCommand {
return ReturnType.SYNTAX_ERROR;
}
if (Bukkit.getPlayerExact(args[1]) == null) {
sender.sendMessage(instance.references.getPrefix() + TextComponent.formatText("&cThat username does not exist, or the user is not online!"));
sender.sendMessage(instance.references.getPrefix() + Methods.formatText("&cThat username does not exist, or the user is not online!"));
return ReturnType.FAILURE;
}
Level level = instance.getLevelManager().getLowestLevel();
Player player;
if (args.length != 1 && Bukkit.getPlayer(args[1]) == null) {
sender.sendMessage(instance.references.getPrefix() + TextComponent.formatText("&cThat player does not exist or is currently offline."));
sender.sendMessage(instance.references.getPrefix() + Methods.formatText("&cThat player does not exist or is currently offline."));
return ReturnType.FAILURE;
} else if (args.length == 1) {
if (!(sender instanceof Player)) {
sender.sendMessage(instance.references.getPrefix() + TextComponent.formatText("&cYou need to be a player to give a hopper to yourself."));
sender.sendMessage(instance.references.getPrefix() + Methods.formatText("&cYou need to be a player to give a hopper to yourself."));
return ReturnType.FAILURE;
}
player = (Player) sender;
@ -41,7 +41,7 @@ public class CommandGive extends AbstractCommand {
if (args.length >= 3 && !instance.getLevelManager().isLevel(Integer.parseInt(args[2]))) {
sender.sendMessage(instance.references.getPrefix() + TextComponent.formatText("&cNot a valid level... The current valid levels are: &4" + instance.getLevelManager().getLowestLevel().getLevel() + "-" + instance.getLevelManager().getHighestLevel().getLevel() + "&c."));
sender.sendMessage(instance.references.getPrefix() + Methods.formatText("&cNot a valid level... The current valid levels are: &4" + instance.getLevelManager().getLowestLevel().getLevel() + "-" + instance.getLevelManager().getHighestLevel().getLevel() + "&c."));
return ReturnType.FAILURE;
} else if (args.length != 1) {
level = instance.getLevelManager().getLevel(Integer.parseInt(args[2]));

View File

@ -1,8 +1,8 @@
package com.songoda.epichoppers.command.commands;
import com.songoda.arconix.api.methods.formatting.TextComponent;
import com.songoda.epichoppers.EpicHoppersPlugin;
import com.songoda.epichoppers.command.AbstractCommand;
import com.songoda.epichoppers.utils.Methods;
import org.bukkit.command.CommandSender;
public class CommandReload extends AbstractCommand {
@ -14,7 +14,7 @@ public class CommandReload extends AbstractCommand {
@Override
protected ReturnType runCommand(EpicHoppersPlugin instance, CommandSender sender, String... args) {
instance.reload();
sender.sendMessage(TextComponent.formatText(instance.references.getPrefix() + "&7Configuration and Language files reloaded."));
sender.sendMessage(Methods.formatText(instance.references.getPrefix() + "&7Configuration and Language files reloaded."));
return ReturnType.SUCCESS;
}

View File

@ -1,7 +1,7 @@
package com.songoda.epichoppers.handlers;
import com.songoda.arconix.plugin.Arconix;
import com.songoda.epichoppers.utils.Debugger;
import com.songoda.epichoppers.utils.Methods;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.inventory.ItemStack;
@ -17,12 +17,12 @@ public class EnchantmentHandler {
public ItemStack createSyncTouch(ItemStack item, Block b) {
try {
ItemMeta itemmeta = item.getItemMeta();
ArrayList<String> lore = new ArrayList<String>();
ArrayList<String> lore = new ArrayList<>();
if (b != null) {
lore.add(Arconix.pl().getApi().format().formatText("&aSync Touch"));
lore.add(Arconix.pl().getApi().format().convertToInvisibleString(Arconix.pl().getApi().serialize().serializeLocation(b)));
lore.add(Methods.formatText("&aSync Touch"));
lore.add(Methods.convertToInvisibleString(Methods.serializeLocation(b)));
} else {
lore.add(Arconix.pl().getApi().format().formatText("&7Sync Touch"));
lore.add(Methods.formatText("&7Sync Touch"));
}
itemmeta.setLore(lore);
item.setItemMeta(itemmeta);
@ -37,10 +37,10 @@ public class EnchantmentHandler {
try {
ItemStack book = new ItemStack(Material.ENCHANTED_BOOK);
ItemMeta meta = book.getItemMeta();
meta.setDisplayName(Arconix.pl().getApi().format().formatText("&eEnchanted Book"));
meta.setDisplayName(Methods.formatText("&eEnchanted Book"));
ArrayList<String> lore = new ArrayList<>();
lore.add(Arconix.pl().getApi().format().formatText("&7Sync Touch"));
lore.add(Methods.formatText("&7Sync Touch"));
meta.setLore(lore);
book.setItemMeta(meta);
return book;

View File

@ -27,7 +27,7 @@ public class HookFactions implements ClaimableProtectionPluginHook {
public boolean canBuild(Player player, Location location) {
FPlayer fPlayer = FPlayers.getBySender(player);
Faction faction = Factions.getFactionAt(location);
return faction.isNone() || fPlayer.getFaction().equals(faction);
}

View File

@ -24,7 +24,7 @@ public class HookGriefPrevention implements ProtectionPluginHook {
@Override
public boolean canBuild(Player player, Location location) {
Claim claim = griefPrevention.dataStore.getClaimAt(location, false, null);
return claim != null && claim.allowBuild(player, Material.STONE) == null;
return claim != null && claim.allowBuild(player, Material.SPAWNER) == null;
}
}

View File

@ -27,11 +27,11 @@ public class HookKingdoms implements ProtectionPluginHook {
public boolean canBuild(Player player, Location location) {
KingdomPlayer kPlayer = GameManagement.getPlayerManager().getOfflineKingdomPlayer(player).getKingdomPlayer();
if (kPlayer.getKingdom() == null) return true;
SimpleChunkLocation chunkLocation = new SimpleChunkLocation(location.getChunk());
Land land = GameManagement.getLandManager().getOrLoadLand(chunkLocation);
String owner = land.getOwner();
return owner == null || kPlayer.getKingdom().getKingdomName().equals(owner);
}

View File

@ -1,7 +1,8 @@
package com.songoda.epichoppers.hooks;
import com.intellectualcrafters.plot.api.PlotAPI;
import com.plotsquared.bukkit.BukkitMain;
import com.github.intellectualsites.plotsquared.api.PlotAPI;
import com.github.intellectualsites.plotsquared.bukkit.BukkitMain;
import com.github.intellectualsites.plotsquared.plot.object.Plot;
import com.songoda.epichoppers.api.utils.ProtectionPluginHook;
import org.bukkit.Location;
import org.bukkit.entity.Player;
@ -22,8 +23,15 @@ public class HookPlotSquared implements ProtectionPluginHook {
@Override
public boolean canBuild(Player player, Location location) {
return plotSquared.getPlot(location) != null && plotSquared.isInPlot(player)
&& plotSquared.getPlot(location) == plotSquared.getPlot(player);
com.github.intellectualsites.plotsquared.plot.object.Location plotLocation =
new com.github.intellectualsites.plotsquared.plot.object.Location(location.getWorld().getName(),
location.getBlockX(), location.getBlockY(), location.getBlockZ());
Plot plot = plotLocation.getPlot();
return plot != null
&& plot.getOwners().contains(player.getUniqueId())
&& plot.getMembers().contains(player.getUniqueId());
}
}

View File

@ -25,7 +25,7 @@ public class HookRedProtect implements ProtectionPluginHook {
public boolean canBuild(Player player, Location location) {
RedProtectAPI api = redProtect.getAPI();
Region region = api.getRegion(location);
return region != null && region.canBuild(player);
}

View File

@ -0,0 +1,59 @@
package com.songoda.epichoppers.hooks;
import com.songoda.epichoppers.api.utils.ClaimableProtectionPluginHook;
import me.goodandevil.skyblock.SkyBlock;
import me.goodandevil.skyblock.island.Island;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
import java.util.List;
import java.util.Set;
import java.util.UUID;
public class HookSkyBlockEarth implements ClaimableProtectionPluginHook {
private final SkyBlock skyblock;
public HookSkyBlockEarth() {
this.skyblock = SkyBlock.getInstance();
}
@Override
public JavaPlugin getPlugin() {
return SkyBlock.getInstance();
}
@Override
public boolean canBuild(Player player, Location location) {
Island island = skyblock.getIslandManager().getIslandAtLocation(location);
if (island == null) return true;
UUID owner = island.getOwnerUUID();
UUID playerUUID = player.getUniqueId();
if (owner == null || owner.equals(playerUUID)) return true;
Set<UUID> teamMembers = island.getCoopPlayers();
if (teamMembers.contains(playerUUID)) return true;
List<Island> coopIslands = skyblock.getIslandManager().getCoopIslands(player);
for (Island is : coopIslands) {
if (is.getOwnerUUID().equals(playerUUID)) {
return true;
}
}
return false;
}
@Override
public boolean isInClaim(Location location, String id) {
return skyblock.getIslandManager().getIslandAtLocation(location).getOwnerUUID().toString().equals(id);
}
@Override
public String getClaimID(String name) {
return null;
}
}

View File

@ -25,8 +25,9 @@ public class HookTowny implements ClaimableProtectionPluginHook {
@Override
public boolean canBuild(Player player, Location location) {
if (TownyUniverse.isWilderness(location.getBlock()) || !TownyUniverse.getTownBlock(location).hasTown()) return true;
if (TownyUniverse.isWilderness(location.getBlock()) || !TownyUniverse.getTownBlock(location).hasTown())
return true;
try {
Resident resident = TownyUniverse.getDataSource().getResident(player.getName());
return resident.hasTown() && TownyUniverse.getTownName(location).equals(resident.getTown().getName());

View File

@ -1,8 +1,5 @@
package com.songoda.epichoppers.hopper;
import com.songoda.arconix.api.methods.formatting.TextComponent;
import com.songoda.arconix.api.methods.formatting.TimeComponent;
import com.songoda.arconix.plugin.Arconix;
import com.songoda.epichoppers.EpicHoppersPlugin;
import com.songoda.epichoppers.api.hopper.Filter;
import com.songoda.epichoppers.api.hopper.Hopper;
@ -86,7 +83,7 @@ public class EHopper implements Hopper {
ArrayList<String> loreperl = new ArrayList<>();
String[] parts = instance.getLocale().getMessage("interface.hopper.perllore2", teleportTrigger == TeleportTrigger.DISABLED ? instance.getLocale().getMessage("general.word.disabled") : teleportTrigger.name()).split("\\|");
for (String line : parts) {
loreperl.add(Arconix.pl().getApi().format().formatText(line));
loreperl.add(Methods.formatText(line));
}
perlmeta.setLore(loreperl);
perl.setItemMeta(perlmeta);
@ -97,7 +94,7 @@ public class EHopper implements Hopper {
ArrayList<String> lorefilter = new ArrayList<>();
parts = instance.getLocale().getMessage("interface.hopper.filterlore").split("\\|");
for (String line : parts) {
lorefilter.add(Arconix.pl().getApi().format().formatText(line));
lorefilter.add(Methods.formatText(line));
}
filtermeta.setLore(lorefilter);
filter.setItemMeta(filtermeta);
@ -108,7 +105,7 @@ public class EHopper implements Hopper {
ArrayList<String> lorecrafting = new ArrayList<>();
parts = instance.getLocale().getMessage("interface.hopper.craftinglore").split("\\|");
for (String line : parts) {
lorecrafting.add(Arconix.pl().getApi().format().formatText(line));
lorecrafting.add(Methods.formatText(line));
}
craftingmeta.setLore(lorecrafting);
crafting.setItemMeta(craftingmeta);
@ -129,10 +126,10 @@ public class EHopper implements Hopper {
BoostData boostData = instance.getBoostManager().getBoost(placedBy);
if (boostData != null) {
parts = instance.getLocale().getMessage("interface.hopper.boostedstats", Integer.toString(boostData.getMultiplier()), TimeComponent.makeReadable(boostData.getEndTime() - System.currentTimeMillis())).split("\\|");
parts = instance.getLocale().getMessage("interface.hopper.boostedstats", Integer.toString(boostData.getMultiplier()), Methods.makeReadable(boostData.getEndTime() - System.currentTimeMillis())).split("\\|");
lore.add("");
for (String line : parts)
lore.add(TextComponent.formatText(line));
lore.add(Methods.formatText(line));
}
itemmeta.setLore(lore);
@ -144,7 +141,7 @@ public class EHopper implements Hopper {
ArrayList<String> lorehook = new ArrayList<>();
parts = instance.getLocale().getMessage("interface.hopper.synclore").split("\\|");
for (String line : parts) {
lorehook.add(Arconix.pl().getApi().format().formatText(line));
lorehook.add(Methods.formatText(line));
}
hookmeta.setLore(lorehook);
hook.setItemMeta(hookmeta);
@ -165,7 +162,7 @@ public class EHopper implements Hopper {
itemmetaECO.setDisplayName(instance.getLocale().getMessage("interface.hopper.upgradewitheconomy"));
ArrayList<String> loreECO = new ArrayList<>();
if (nextLevel != null)
loreECO.add(instance.getLocale().getMessage("interface.hopper.upgradewitheconomylore", Arconix.pl().getApi().format().formatEconomy(nextLevel.getCostEconomy())));
loreECO.add(instance.getLocale().getMessage("interface.hopper.upgradewitheconomylore", Methods.formatEconomy(nextLevel.getCostEconomy())));
else
loreECO.add(instance.getLocale().getMessage("interface.hopper.alreadymaxed"));
itemmetaECO.setLore(loreECO);
@ -236,7 +233,7 @@ public class EHopper implements Hopper {
EpicHoppersPlugin instance = EpicHoppersPlugin.getInstance();
instance.getPlayerDataManager().getPlayerData(player).setLastHopper(this);
Inventory i = Bukkit.createInventory(null, 27, Arconix.pl().getApi().format().formatText(Methods.formatName(level.getLevel(), false) + " &8-&f Crafting"));
Inventory i = Bukkit.createInventory(null, 27, Methods.formatText(Methods.formatName(level.getLevel(), false) + " &8-&f Crafting"));
int nu = 0;
while (nu != 27) {
@ -275,7 +272,7 @@ public class EHopper implements Hopper {
try {
EpicHoppersPlugin instance = EpicHoppersPlugin.getInstance();
Inventory i = Bukkit.createInventory(null, 54, Arconix.pl().getApi().format().formatText(Methods.formatName(level.getLevel(), false) + " &8-&f Filter"));
Inventory i = Bukkit.createInventory(null, 54, Methods.formatText(Methods.formatName(level.getLevel(), false) + " &8-&f Filter"));
i.setItem(2, Methods.getBackgroundGlass(true));
i.setItem(3, Methods.getBackgroundGlass(true));
@ -370,7 +367,7 @@ public class EHopper implements Hopper {
ArrayList<String> loreInfo = new ArrayList<>();
String[] parts = instance.getLocale().getMessage("interface.filter.infolore").split("\\|");
for (String line : parts) {
loreInfo.add(Arconix.pl().getApi().format().formatText(line));
loreInfo.add(Methods.formatText(line));
}
itemmetaInfo.setLore(loreInfo);
itemInfo.setItemMeta(itemmetaInfo);
@ -384,7 +381,7 @@ public class EHopper implements Hopper {
ArrayList<String> lorehook = new ArrayList<>();
parts = instance.getLocale().getMessage("interface.hopper.synclore").split("\\|");
for (String line : parts) {
lorehook.add(Arconix.pl().getApi().format().formatText(line));
lorehook.add(Methods.formatText(line));
}
hookmeta.setLore(lorehook);
hook.setItemMeta(hookmeta);

View File

@ -1,11 +1,11 @@
package com.songoda.epichoppers.hopper.levels.modules;
import com.songoda.arconix.plugin.Arconix;
import com.songoda.epichoppers.EpicHoppersPlugin;
import com.songoda.epichoppers.api.hopper.Hopper;
import com.songoda.epichoppers.api.hopper.levels.modules.Module;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Particle;
import org.bukkit.Sound;
import org.bukkit.block.Block;
@ -45,10 +45,11 @@ public class ModuleBlockBreak implements Module {
Location locationAbove = above.getLocation();
locationAbove.add(.5, .5, .5);
float ox = (float) (0 + (Math.random() * .5));
float oy = (float) (0 + (Math.random() * .5));
float oz = (float) (0 + (Math.random() * .5));
Arconix.pl().getApi().packetLibrary.getParticleManager().broadcastParticle(locationAbove, ox, oy, oz, 0, EpicHoppersPlugin.getInstance().getConfig().getString("Main.BlockBreak Particle Type"), 15);
float xx = (float) (0 + (Math.random() * .5));
float yy = (float) (0 + (Math.random() * .5));
float zz = (float) (0 + (Math.random() * .5));
above.getWorld().spawnParticle(Particle.valueOf(EpicHoppersPlugin.getInstance().getConfig().getString("Main.BlockBreak Particle Type")), locationAbove, 15, xx, yy, zz);
above.breakNaturally();
}
blockTick.remove(block);

View File

@ -1,13 +1,14 @@
package com.songoda.epichoppers.hopper.levels.modules;
import com.songoda.arconix.plugin.Arconix;
import com.songoda.epichoppers.EpicHoppersPlugin;
import com.songoda.epichoppers.api.hopper.Hopper;
import com.songoda.epichoppers.api.hopper.levels.modules.Module;
import com.songoda.epichoppers.utils.Debugger;
import org.apache.commons.lang.StringUtils;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Particle;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Item;
import org.bukkit.inventory.Inventory;
@ -67,10 +68,10 @@ public class ModuleSuction implements Module {
}
((Item) entity).setPickupDelay(10);
entity.setMetadata("grabbed", new FixedMetadataValue(EpicHoppersPlugin.getInstance(), ""));
float xx = (float) (0 + (Math.random() * .3));
float yy = (float) (0 + (Math.random() * .3));
float zz = (float) (0 + (Math.random() * .3));
Arconix.pl().getApi().packetLibrary.getParticleManager().broadcastParticle(entity.getLocation(), xx, yy, zz, 0, "FLAME", 5);
float xx = (float) (0 + (Math.random() * .1));
float yy = (float) (0 + (Math.random() * .1));
float zz = (float) (0 + (Math.random() * .1));
entity.getLocation().getWorld().spawnParticle(Particle.FLAME, entity.getLocation(), 5, xx, yy, zz, 0);
for (ItemStack itemStack : hopperBlock.getInventory().addItem(hopItem).values()) {
entity.getWorld().dropItemNaturally(entity.getLocation(), itemStack);

View File

@ -1,6 +1,5 @@
package com.songoda.epichoppers.listeners;
import com.songoda.arconix.plugin.Arconix;
import com.songoda.epichoppers.EpicHoppersPlugin;
import com.songoda.epichoppers.api.hopper.Hopper;
import com.songoda.epichoppers.api.hopper.TeleportTrigger;
@ -153,7 +152,7 @@ public class BlockListeners implements Listener {
ItemMeta meta = tool.getItemMeta();
if (tool.getItemMeta().getLore().size() != 2) return;
Location location = Arconix.pl().getApi().serialize().unserializeLocation(meta.getLore().get(1).replaceAll("§", ""));
Location location = Methods.unserializeLocation(meta.getLore().get(1).replaceAll("§", ""));
if (location.getBlock().getType() != Material.CHEST) return;

View File

@ -1,6 +1,5 @@
package com.songoda.epichoppers.listeners;
import com.songoda.arconix.plugin.Arconix;
import com.songoda.epichoppers.EpicHoppersPlugin;
import com.songoda.epichoppers.utils.Debugger;
import com.songoda.epichoppers.utils.Methods;
@ -53,7 +52,7 @@ public class EntityListeners implements Listener {
ItemStack item = p.getItemInHand();
ItemMeta meta = item.getItemMeta();
Location location = Arconix.pl().getApi().serialize().unserializeLocation(meta.getLore().get(1).replaceAll("§", ""));
Location location = Methods.unserializeLocation(meta.getLore().get(1).replaceAll("§", ""));
if (location.getBlock().getType() != Material.CHEST) return;
InventoryHolder ih = (InventoryHolder) location.getBlock().getState();
for (ItemStack is : e.getDrops()) {

View File

@ -1,7 +1,7 @@
package com.songoda.epichoppers.storage;
import com.songoda.arconix.api.utils.ConfigWrapper;
import com.songoda.epichoppers.EpicHoppersPlugin;
import com.songoda.epichoppers.utils.ConfigWrapper;
import java.util.List;

View File

@ -1,6 +1,6 @@
package com.songoda.epichoppers.storage;
import com.songoda.arconix.plugin.Arconix;
import com.songoda.epichoppers.utils.Methods;
import com.songoda.epichoppers.utils.Serializers;
import org.bukkit.Location;
import org.bukkit.Material;
@ -37,7 +37,7 @@ public class StorageItem {
public StorageItem(String key, boolean type, List<Location> blocks) {
StringBuilder object = new StringBuilder();
for (Location location : blocks) {
object.append(Arconix.pl().getApi().serialize().serializeLocation(location));
object.append(Methods.serializeLocation(location));
object.append(";;");
}
this.key = key;

View File

@ -0,0 +1,67 @@
package com.songoda.epichoppers.utils;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.plugin.java.JavaPlugin;
import java.io.File;
import java.io.IOException;
import java.util.logging.Level;
/**
* ConfigWrapper made by @clip
*/
public class ConfigWrapper {
private final JavaPlugin plugin;
private final String folderName, fileName;
private FileConfiguration config;
private File configFile;
public ConfigWrapper(final JavaPlugin instance, final String folderName, final String fileName) {
this.plugin = instance;
this.folderName = folderName;
this.fileName = fileName;
}
public void createNewFile(final String message, final String header) {
reloadConfig();
saveConfig();
loadConfig(header);
if (message != null) {
plugin.getLogger().info(message);
}
}
public FileConfiguration getConfig() {
if (config == null) {
reloadConfig();
}
return config;
}
public void loadConfig(final String header) {
config.options().header(header);
config.options().copyDefaults(true);
saveConfig();
}
public void reloadConfig() {
if (configFile == null) {
configFile = new File(plugin.getDataFolder() + folderName, fileName);
}
config = YamlConfiguration.loadConfiguration(configFile);
}
public void saveConfig() {
if (config == null || configFile == null) {
return;
}
try {
getConfig().save(configFile);
} catch (final IOException ex) {
plugin.getLogger().log(Level.SEVERE, "Could not save config to " + configFile, ex);
}
}
}

View File

@ -1,11 +1,18 @@
package com.songoda.epichoppers.utils;
import com.songoda.arconix.plugin.Arconix;
import com.songoda.epichoppers.EpicHoppersPlugin;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.*;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import java.text.DecimalFormat;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
/**
* Created by songoda on 2/24/2017.
@ -19,7 +26,7 @@ public class Methods {
&& p.getItemInHand().getType() != Material.ENCHANTED_BOOK
&& p.getItemInHand().getItemMeta().hasLore()) {
for (String str : p.getItemInHand().getItemMeta().getLore()) {
if (str.equals(Arconix.pl().getApi().format().formatText("&7Sync Touch")) || str.equals(Arconix.pl().getApi().format().formatText("&aSync Touch"))) {
if (str.equals(Methods.formatText("&7Sync Touch")) || str.equals(Methods.formatText("&aSync Touch"))) {
return true;
}
}
@ -33,7 +40,7 @@ public class Methods {
public static ItemStack getGlass() {
try {
EpicHoppersPlugin instance = EpicHoppersPlugin.getInstance();
return Arconix.pl().getApi().getGUI().getGlass(instance.getConfig().getBoolean("Interfaces.Replace Glass Type 1 With Rainbow Glass"), instance.getConfig().getInt("Interfaces.Glass Type 1"));
return Methods.getGlass(instance.getConfig().getBoolean("Interfaces.Replace Glass Type 1 With Rainbow Glass"), instance.getConfig().getInt("Interfaces.Glass Type 1"));
} catch (Exception e) {
Debugger.runReport(e);
}
@ -44,15 +51,29 @@ public class Methods {
try {
EpicHoppersPlugin instance = EpicHoppersPlugin.getInstance();
if (type)
return Arconix.pl().getApi().getGUI().getGlass(false, instance.getConfig().getInt("Interfaces.Glass Type 2"));
return getGlass(false, instance.getConfig().getInt("Interfaces.Glass Type 2"));
else
return Arconix.pl().getApi().getGUI().getGlass(false, instance.getConfig().getInt("Interfaces.Glass Type 3"));
return getGlass(false, instance.getConfig().getInt("Interfaces.Glass Type 3"));
} catch (Exception e) {
Debugger.runReport(e);
}
return null;
}
private static ItemStack getGlass(Boolean rainbow, int type) {
int randomNum = 1 + (int) (Math.random() * 6);
ItemStack glass;
if (rainbow) {
glass = new ItemStack(Material.LEGACY_STAINED_GLASS_PANE, 1, (short) randomNum);
} else {
glass = new ItemStack(Material.LEGACY_STAINED_GLASS_PANE, 1, (short) type);
}
ItemMeta glassmeta = glass.getItemMeta();
glassmeta.setDisplayName("§l");
glass.setItemMeta(glassmeta);
return glass;
}
public static String formatName(int level, boolean full) {
try {
EpicHoppersPlugin instance = EpicHoppersPlugin.getInstance();
@ -60,10 +81,10 @@ public class Methods {
String info = "";
if (full) {
info += Arconix.pl().getApi().format().convertToInvisibleString(level + ":");
info += Methods.convertToInvisibleString(level + ":");
}
return info + Arconix.pl().getApi().format().formatText(name);
return info + Methods.formatText(name);
} catch (Exception e) {
Debugger.runReport(e);
}
@ -81,4 +102,119 @@ public class Methods {
Debugger.runReport(e);
}
}
/**
* Serializes the location of the block specified.
*
* @param b The block whose location is to be saved.
* @return The serialized data.
*/
public static String serializeLocation(Block b) {
if (b == null)
return "";
return serializeLocation(b.getLocation());
}
/**
* Serializes the location specified.
*
* @param location The location that is to be saved.
* @return The serialized data.
*/
public static String serializeLocation(Location location) {
if (location == null)
return "";
String w = location.getWorld().getName();
double x = location.getX();
double y = location.getY();
double z = location.getZ();
String str = w + ":" + x + ":" + y + ":" + z;
str = str.replace(".0", "").replace("/", "");
return str;
}
private static Map<String, Location> serializeCache = new HashMap<>();
/**
* Deserializes a location from the string.
*
* @param str The string to parse.
* @return The location that was serialized in the string.
*/
public static Location unserializeLocation(String str) {
if (str == null || str.equals(""))
return null;
if (serializeCache.containsKey(str)) {
return serializeCache.get(str).clone();
}
String cacheKey = str;
str = str.replace("y:", ":").replace("z:", ":").replace("w:", "").replace("x:", ":").replace("/", ".");
List<String> args = Arrays.asList(str.split("\\s*:\\s*"));
World world = Bukkit.getWorld(args.get(0));
double x = Double.parseDouble(args.get(1)), y = Double.parseDouble(args.get(2)), z = Double.parseDouble(args.get(3));
Location location = new Location(world, x, y, z, 0, 0);
serializeCache.put(cacheKey, location.clone());
return location;
}
public static String convertToInvisibleString(String s) {
if (s == null || s.equals(""))
return "";
StringBuilder hidden = new StringBuilder();
for (char c : s.toCharArray()) hidden.append(ChatColor.COLOR_CHAR + "").append(c);
return hidden.toString();
}
public static String formatText(String text) {
if (text == null || text.equals(""))
return "";
return formatText(text, false);
}
public static String formatText(String text, boolean cap) {
if (text == null || text.equals(""))
return "";
if (cap)
text = text.substring(0, 1).toUpperCase() + text.substring(1);
return ChatColor.translateAlternateColorCodes('&', text);
}
/**
* Makes the specified Unix Epoch time human readable as per the format settings in the Arconix config.
*
* @param time The time to convert.
* @return A human readable string representing to specified time.
*/
public static String makeReadable(Long time) {
if (time == null)
return "";
return String.format("%d hour(s), %d min(s), %d sec(s)", TimeUnit.MILLISECONDS.toHours(time), TimeUnit.MILLISECONDS.toMinutes(time) - TimeUnit.HOURS.toMinutes(TimeUnit.MILLISECONDS.toHours(time)), TimeUnit.MILLISECONDS.toSeconds(time) - TimeUnit.MINUTES.toSeconds(TimeUnit.MILLISECONDS.toMinutes(time)));
}
/**
* Formats the specified double into the Economy format specified in the Arconix config.
*
* @param amt The double to format.
* @return The economy formatted double.
*/
public static String formatEconomy(double amt) {
DecimalFormat formatter = new DecimalFormat("#,###.00");
return formatter.format(amt);
}
public static boolean isInt(String number) {
if (number == null || number.equals(""))
return false;
try {
Integer.parseInt(number);
} catch (NumberFormatException e) {
return false;
}
return true;
}
}

View File

@ -1,7 +1,5 @@
package com.songoda.epichoppers.utils;
import com.songoda.arconix.api.methods.formatting.TextComponent;
import com.songoda.arconix.api.utils.ConfigWrapper;
import com.songoda.epichoppers.EpicHoppersPlugin;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
@ -105,9 +103,9 @@ public class SettingsManager implements Listener {
player.closeInventory();
player.sendMessage("");
player.sendMessage(TextComponent.formatText("&7Please enter a value for &6" + current + "&7."));
player.sendMessage(Methods.formatText("&7Please enter a value for &6" + current + "&7."));
if (instance.getConfig().isInt(current) || instance.getConfig().isDouble(current)) {
player.sendMessage(TextComponent.formatText("&cUse only numbers."));
player.sendMessage(Methods.formatText("&cUse only numbers."));
}
player.sendMessage("");
}
@ -123,8 +121,8 @@ public class SettingsManager implements Listener {
for (String key : instance.getConfig().getDefaultSection().getKeys(false)) {
ItemStack item = new ItemStack(Material.WHITE_WOOL, 1, (byte) (slot - 9)); //ToDo: Make this function as it was meant to.
ItemMeta meta = item.getItemMeta();
meta.setLore(Collections.singletonList(TextComponent.formatText("&6Click To Edit This Category.")));
meta.setDisplayName(TextComponent.formatText("&f&l" + key));
meta.setLore(Collections.singletonList(Methods.formatText("&6Click To Edit This Category.")));
meta.setDisplayName(Methods.formatText("&f&l" + key));
item.setItemMeta(meta);
inventory.setItem(slot, item);
slot++;
@ -142,18 +140,18 @@ public class SettingsManager implements Listener {
String fKey = cat.get(player) + "." + key;
ItemStack item = new ItemStack(Material.DIAMOND_HELMET);
ItemMeta meta = item.getItemMeta();
meta.setDisplayName(TextComponent.formatText("&6" + key));
meta.setDisplayName(Methods.formatText("&6" + key));
List<String> lore = new ArrayList<>();
if (config.isBoolean(fKey)) {
item.setType(Material.LEVER);
lore.add(TextComponent.formatText(config.getBoolean(fKey) ? "&atrue" : "&cfalse"));
lore.add(Methods.formatText(config.getBoolean(fKey) ? "&atrue" : "&cfalse"));
} else if (config.isString(fKey)) {
item.setType(Material.PAPER);
lore.add(TextComponent.formatText("&9" + config.getString(fKey)));
lore.add(Methods.formatText("&9" + config.getString(fKey)));
} else if (config.isInt(fKey)) {
item.setType(Material.CLOCK);
lore.add(TextComponent.formatText("&5" + config.getInt(fKey)));
lore.add(Methods.formatText("&5" + config.getInt(fKey)));
}
meta.setLore(lore);

View File

@ -1,20 +0,0 @@
Hey loves,
Thanks for downloading our plugin ^_^ In order to
run it you will need a plugin called arconix. It
basically takes a bunch of methods that we use all
over the place throughout our plugin lineup and
stores it in one place so we don't have to write
new code every time we need to get something simple
done. So make sure to stay up to date with the latest
updates for it.
Link to download:
https://gitlab.com/Songoda/Arconix/-/jobs/artifacts/master/download?job=build
If you need help you can always join our
discord in which is listed at the bottom of all of
our plugin pages.
Enjoy <3
Brianna & The Songoda Team.