This commit is contained in:
Brianna O'Keefe 2018-08-02 11:22:52 -04:00
parent fa9d46bede
commit 50cf216632
39 changed files with 3811 additions and 3916 deletions

View File

@ -26,13 +26,6 @@ import java.util.*;
public final class EpicHoppers extends JavaPlugin implements Listener {
public static CommandSender console = Bukkit.getConsoleSender();
public boolean v1_12 = Bukkit.getServer().getClass().getPackage().getName().contains("1_12");
public boolean v1_11 = Bukkit.getServer().getClass().getPackage().getName().contains("1_11");
public boolean v1_10 = Bukkit.getServer().getClass().getPackage().getName().contains("1_10");
public boolean v1_9 = Bukkit.getServer().getClass().getPackage().getName().contains("1_9");
public boolean v1_7 = Bukkit.getServer().getClass().getPackage().getName().contains("1_7");
public boolean v1_8 = Bukkit.getServer().getClass().getPackage().getName().contains("1_8");
public Map<UUID, Hopper> inShow = new HashMap<>();
public Map<UUID, Hopper> inFilter = new HashMap<>();
@ -230,7 +223,6 @@ public final class EpicHoppers extends JavaPlugin implements Listener {
getConfig().addDefault("settings.levels.Level-4.Amount", 4);
getConfig().addDefault("settings.levels.Level-4.Suction", 2);
if (!v1_7 && !v1_8)
getConfig().addDefault("settings.levels.Level-4.BlockBreak", 4);
getConfig().addDefault("settings.levels.Level-4.Cost-xp", 35);
getConfig().addDefault("settings.levels.Level-4.Cost-eco", 12000);
@ -239,7 +231,6 @@ public final class EpicHoppers extends JavaPlugin implements Listener {
getConfig().addDefault("settings.levels.Level-5.Amount", 5);
getConfig().addDefault("settings.levels.Level-5.Suction", 3);
if (!v1_7 && !v1_8)
getConfig().addDefault("settings.levels.Level-5.BlockBreak", 2);
getConfig().addDefault("settings.levels.Level-5.Cost-xp", 40);
getConfig().addDefault("settings.levels.Level-5.Cost-eco", 15000);

View File

@ -59,11 +59,8 @@ public class BlockListeners implements Listener {
ItemStack item = e.getItemInHand().clone();
//not sure what this shit does
byte b = e.getBlock().getData();
e.getBlock().setType(Material.AIR);
e.getBlock().getLocation().getBlock().setType(Material.HOPPER);
e.getBlock().getLocation().getBlock().setData(b);
instance.getHopperManager().addHopper(e.getBlock().getLocation(), new Hopper(e.getBlock(), instance.getLevelManager().getLevel(instance.getApi().getILevel(item)), e.getPlayer().getUniqueId(), null, new Filter(), false));
@ -153,7 +150,7 @@ public class BlockListeners implements Listener {
if (location.getBlock().getType() != Material.CHEST) return;
if (e.getBlock().getType() == Material.MOB_SPAWNER || e.getBlock().getType() == Material.HOPPER || e.getBlock().getType() == Material.DISPENSER) return;
if (e.getBlock().getType() == Material.SPAWNER || e.getBlock().getType() == Material.HOPPER || e.getBlock().getType() == Material.DISPENSER) return;
try {
if (e.getBlock().getType().name().contains("SHULKER") && e.getBlock().getType() != Material.SHULKER_SHELL) return;
@ -168,18 +165,7 @@ public class BlockListeners implements Listener {
for (ItemStack is : e.getBlock().getDrops())
ih.getInventory().addItem(is);
}
if (instance.v1_12) {
e.setDropItems(false);
return;
}
e.isCancelled();
e.getPlayer().getItemInHand().setDurability((short) (e.getPlayer().getItemInHand().getDurability() + 1));
if (e.getPlayer().getItemInHand().getDurability() >= e.getPlayer().getItemInHand().getType().getMaxDurability()) {
e.getPlayer().getItemInHand().setType(null);
}
if (e.getExpToDrop() > 0)
e.getPlayer().getWorld().spawn(e.getBlock().getLocation(), ExperienceOrb.class).setExperience(e.getExpToDrop());
e.getBlock().setType(Material.AIR);
}
}

View File

@ -40,8 +40,6 @@ public class HopperListeners implements Listener {
try {
Inventory source = e.getSource();
if (instance.v1_7 || instance.v1_8) return;
if (!instance.getHopperManager().isHopper(e.getSource().getLocation())) return;
@ -50,27 +48,6 @@ public class HopperListeners implements Listener {
if (source.getHolder() instanceof Hopper && hopper.getSyncedBlock() != null) {
e.setCancelled(true);
}
/*
//if amt is not 1
int amt = hopper.getLevel().getAmount();
if (amt <= 1) {
return;
}
e.setCancelled(true);
// Set amount of items per hopper transfer
ItemStack item = e.getItem();
int transferAmount = Math.min(amt, getItemCount(source, item));
item.setAmount(transferAmount);
e.getDestination().addItem(item); //hacky as shit
source.removeItem(item);
//Please work.
*/
} catch (Exception ee) {
Debugger.runReport(ee);
}

View File

@ -38,7 +38,7 @@ public class InteractListeners implements Listener {
}
if (e.getClickedBlock().getType() == Material.CHEST && Methods.isSync(player)) {
ItemStack item = e.getPlayer().getItemInHand();
ItemStack item = e.getPlayer().getInventory().getItemInMainHand();
if (item.getItemMeta().getLore().size() == 2) {
player.sendMessage(instance.getLocale().getMessage("event.hopper.desyncchest", item.getType().toString()));
instance.enchant.createSyncTouch(item, null);
@ -56,8 +56,7 @@ public class InteractListeners implements Listener {
instance.lastBlock.put(player, e.getClickedBlock());
Hopper hopper = instance.getHopperManager().getHopper(e.getClickedBlock());
if (instance.getConfig().getBoolean("Main.Allow Hopper Upgrading")) {
if (player.getItemInHand().getType() != Material.WOOD_PICKAXE && player.getItemInHand().getType() != Material.STONE_PICKAXE &&
player.getItemInHand().getType() != Material.IRON_PICKAXE && player.getItemInHand().getType() != Material.DIAMOND_PICKAXE) {
if (!player.getInventory().getItemInMainHand().getType().name().contains("PICKAXE")) {
hopper.overview(player);
e.setCancelled(true);
}

View File

@ -117,9 +117,7 @@ public class HopHandler {
int suck = hopper.getLevel().getSuction();
double radius = suck + .5;
Collection<Entity> nearbyEntite = instance.v1_7
? Methods.getNearbyEntities(block.getLocation().add(0.5, 0.5, 0.5), radius, radius, radius)
: block.getLocation().getWorld().getNearbyEntities(block.getLocation().add(0.5, 0.5, 0.5), radius, radius, radius);
Collection<Entity> nearbyEntite = block.getLocation().getWorld().getNearbyEntities(block.getLocation().add(0.5, 0.5, 0.5), radius, radius, radius);
for (Entity e : nearbyEntite) {
if (!(e instanceof Item) || e.getTicksLived() < 10 || e.getLocation().getBlock().getType() == Material.HOPPER) {
@ -280,7 +278,7 @@ public class HopHandler {
if (!canHop(ih.getInventory(), newItem, amt) || b2.getType() == Material.BREWING_STAND) {
return 4;
}
if (b2.getType() == Material.FURNACE || b2.getType() == Material.BURNING_FURNACE) {
if (b2.getType() == Material.FURNACE) {
FurnaceInventory fi = (FurnaceInventory) ih.getInventory();
int amtt = 0;
boolean dont = false;

View File

@ -65,7 +65,7 @@ public class Hopper {
perlmeta.setLore(loreperl);
perl.setItemMeta(perlmeta);
ItemStack filter = new ItemStack(Material.REDSTONE_COMPARATOR, 1);
ItemStack filter = new ItemStack(Material.COMPARATOR, 1);
ItemMeta filtermeta = filter.getItemMeta();
filtermeta.setDisplayName(instance.getLocale().getMessage("interface.hopper.filtertitle"));
ArrayList<String> lorefilter = new ArrayList<>();
@ -217,7 +217,7 @@ public class Hopper {
i.setItem(39, Methods.getGlass());
i.setItem(41, Methods.getGlass());
ItemStack it = new ItemStack(Material.STAINED_GLASS_PANE, 1, (short) 0);
ItemStack it = new ItemStack(Material.WHITE_STAINED_GLASS_PANE, 1);
ItemMeta itm = it.getItemMeta();
itm.setDisplayName(instance.getLocale().getMessage("interface.filter.whitelist"));
it.setItemMeta(itm);
@ -234,7 +234,7 @@ public class Hopper {
}
}
it = new ItemStack(Material.STAINED_GLASS_PANE, 1, (short) 15);
it = new ItemStack(Material.BLACK_STAINED_GLASS_PANE, 1);
itm = it.getItemMeta();
itm.setDisplayName(instance.getLocale().getMessage("interface.filter.blacklist"));
it.setItemMeta(itm);
@ -318,13 +318,13 @@ public class Hopper {
for (ItemStack item : items2) {
for (int aa : awhite) {
if (aa == num) {
if (items2[num] != null && !items2[num].getType().equals(Material.STAINED_GLASS_PANE))
if (items2[num] != null && !items2[num].getType().name().contains("STAINED_GLASS"))
owhite.add(items2[num]);
}
}
for (int aa : ablack) {
if (aa == num) {
if (items2[num] != null && !items2[num].getType().equals(Material.STAINED_GLASS_PANE))
if (items2[num] != null && !items2[num].getType().name().contains("STAINED_GLASS"))
oblack.add(items2[num]);
}
}
@ -396,30 +396,17 @@ public class Hopper {
player.sendMessage(instance.getLocale().getMessage("event.upgrade.maxed", level.getLevel()));
}
Location loc = location.clone().add(.5, .5, .5);
if (!instance.v1_8 && !instance.v1_7) {
player.getWorld().spawnParticle(org.bukkit.Particle.valueOf(instance.getConfig().getString("Main.Upgrade Particle Type")), loc, 200, .5, .5, .5);
} else {
player.getWorld().playEffect(loc, org.bukkit.Effect.valueOf(instance.getConfig().getString("Main.Upgrade Particle Type")), 1, 0);
//Doesn't resolve --Nova
//player.getWorld().spigot().playEffect(loc, org.bukkit.Effect.valueOf(instance.getConfig().getString("Main.Upgrade Particle Type")), 1, 0, (float) 1, (float) 1, (float) 1, 1, 200, 10);
}
if (instance.getConfig().getBoolean("Main.Sounds Enabled")) {
if (instance.getLevelManager().getHighestLevel() != level) {
if (!instance.v1_8 && !instance.v1_7) {
player.playSound(player.getLocation(), Sound.ENTITY_PLAYER_LEVELUP, 0.6F, 15.0F);
} else {
player.playSound(player.getLocation(), Sound.valueOf("LEVEL_UP"), 2F, 15.0F);
}
} else {
if (!instance.v1_11 && !instance.v1_10 && !instance.v1_9 && !instance.v1_8 && !instance.v1_7) {
player.playSound(player.getLocation(), Sound.ENTITY_PLAYER_LEVELUP, 2F, 25.0F);
player.playSound(player.getLocation(), Sound.BLOCK_NOTE_CHIME, 2F, 25.0F);
Bukkit.getScheduler().scheduleSyncDelayedTask(instance, () -> player.playSound(player.getLocation(), Sound.BLOCK_NOTE_CHIME, 1.2F, 35.0F), 5L);
Bukkit.getScheduler().scheduleSyncDelayedTask(instance, () -> player.playSound(player.getLocation(), Sound.BLOCK_NOTE_CHIME, 1.8F, 35.0F), 10L);
} else {
player.playSound(player.getLocation(), org.bukkit.Sound.valueOf("LEVEL_UP"), 2F, 25.0F);
}
player.playSound(player.getLocation(), Sound.BLOCK_NOTE_BLOCK_CHIME, 2F, 25.0F);
Bukkit.getScheduler().scheduleSyncDelayedTask(instance, () -> player.playSound(player.getLocation(), Sound.BLOCK_NOTE_BLOCK_CHIME, 1.2F, 35.0F), 5L);
Bukkit.getScheduler().scheduleSyncDelayedTask(instance, () -> player.playSound(player.getLocation(), Sound.BLOCK_NOTE_BLOCK_CHIME, 1.8F, 35.0F), 10L);
}
}
} catch (Exception ex) {

View File

@ -3,12 +3,10 @@ package com.songoda.epichoppers.Utils;
import com.songoda.arconix.plugin.Arconix;
import com.songoda.epichoppers.EpicHoppers;
import com.songoda.epichoppers.Hopper.Hopper;
import net.minecraft.server.v1_7_R4.AxisAlignedBB;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.craftbukkit.v1_7_R4.CraftWorld;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
@ -86,33 +84,9 @@ public class Methods {
location.setX(location.getX() + .5);
location.setY(location.getY() + .5);
location.setZ(location.getZ() + .5);
if (!instance.v1_8 && !instance.v1_7) {
p.getWorld().spawnParticle(org.bukkit.Particle.valueOf(instance.getConfig().getString("Main.Upgrade Particle Type")), location, 200, .5, .5, .5);
} else {
p.getWorld().playEffect(location, org.bukkit.Effect.valueOf(instance.getConfig().getString("Main.Upgrade Particle Type")), 1, 0);
//Does not resolve --Nova
//p.getWorld().spigot().playEffect(location, org.bukkit.Effect.valueOf(instance.getConfig().getString("Main.Upgrade Particle Type")), 1, 0, (float) 1, (float) 1, (float) 1, 1, 200, 10);
}
} catch (Exception e) {
Debugger.runReport(e);
}
}
@SuppressWarnings("unchecked")
public static Collection<Entity> getNearbyEntities(Location location, double x, double y, double z) {
if (location == null) return Collections.emptyList();
World world = location.getWorld();
AxisAlignedBB aabb = AxisAlignedBB.a(location.getX() - x, location.getY() - y, location.getZ() - z, location.getX() + x, location.getY() + y, location.getZ() + z);
List<net.minecraft.server.v1_7_R4.Entity> entityList = ((CraftWorld) world).getHandle().getEntities(null, aabb, null);
List<Entity> bukkitEntityList = new ArrayList<>();
for (Object entity : entityList) {
bukkitEntityList.add(((net.minecraft.server.v1_7_R4.Entity) entity).getBukkitEntity());
}
return bukkitEntityList;
}
}

View File

@ -1,11 +1,13 @@
package com.songoda.epichoppers.Utils;
import com.songoda.arconix.api.methods.formatting.TextComponent;
import com.songoda.arconix.api.utils.ConfigWrapper;
import com.songoda.arconix.plugin.Arconix;
import com.songoda.epichoppers.EpicHoppers;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
@ -25,199 +27,179 @@ import java.util.regex.Pattern;
public class SettingsManager implements Listener {
private String pluginName = "EpicHoppers";
private final EpicHoppers instance;
private static final Pattern SETTINGS_PATTERN = Pattern.compile("(.{1,28}(?:\\s|$))|(.{0,28})", Pattern.DOTALL);
private static ConfigWrapper defs;
private Map<Player, String> cat = new HashMap<>();
public SettingsManager(EpicHoppers instance) {
this.instance = instance;
instance.saveResource("SettingDefinitions.yml", true);
defs = new ConfigWrapper(instance, "", "SettingDefinitions.yml");
defs.createNewFile("Loading data file", "EpicHoppers SettingDefinitions file");
instance.getServer().getPluginManager().registerEvents(this, instance);
private final EpicHoppers instance;
public SettingsManager(EpicHoppers plugin) {
this.instance = plugin;
plugin.saveResource("SettingDefinitions.yml", true);
defs = new ConfigWrapper(plugin, "", "SettingDefinitions.yml");
defs.createNewFile("Loading data file", pluginName + " SettingDefinitions file");
Bukkit.getPluginManager().registerEvents(this, plugin);
}
public Map<Player, String> current = new HashMap<>();
private Map<Player, String> current = new HashMap<>();
@EventHandler
public void onInventoryClick(InventoryClickEvent e) {
if (e.getInventory() == null
|| e.getCurrentItem() == null
|| !e.getCurrentItem().hasItemMeta()
|| !e.getCurrentItem().getItemMeta().hasDisplayName()
|| e.getWhoClicked().getOpenInventory().getTopInventory() != e.getInventory()) {
return;
}
if (e.getInventory().getTitle().equals(pluginName + " Settings Manager")) {
public void onInventoryClick(InventoryClickEvent event) {
ItemStack clickedItem = event.getCurrentItem();
if (e.getCurrentItem().getType().equals(Material.STAINED_GLASS_PANE)) {
e.setCancelled(true);
if (event.getInventory() != event.getWhoClicked().getOpenInventory().getTopInventory()
|| clickedItem == null || !clickedItem.hasItemMeta()
|| !clickedItem.getItemMeta().hasDisplayName()) {
return;
}
String type = ChatColor.stripColor(e.getCurrentItem().getItemMeta().getDisplayName());
cat.put((Player) e.getWhoClicked(), type);
openEditor((Player) e.getWhoClicked());
e.setCancelled(true);
} else if (e.getInventory().getTitle().equals(pluginName + " Settings Editor")) {
if (event.getInventory().getTitle().equals(pluginName + " Settings Manager")) {
event.setCancelled(true);
if (clickedItem.getType().name().contains("STAINED_GLASS")) return;
if (e.getCurrentItem().getType().equals(Material.STAINED_GLASS_PANE)) {
e.setCancelled(true);
return;
}
String type = ChatColor.stripColor(clickedItem.getItemMeta().getDisplayName());
this.cat.put((Player) event.getWhoClicked(), type);
this.openEditor((Player) event.getWhoClicked());
} else if (event.getInventory().getTitle().equals(pluginName + " Settings Editor")) {
event.setCancelled(true);
if (clickedItem.getType().name().contains("STAINED_GLASS")) return;
Player p = (Player) e.getWhoClicked();
e.setCancelled(true);
Player player = (Player) event.getWhoClicked();
String key = cat.get(p) + "." + ChatColor.stripColor(e.getCurrentItem().getItemMeta().getDisplayName());
String key = cat.get(player) + "." + ChatColor.stripColor(clickedItem.getItemMeta().getDisplayName());
if (instance.getConfig().get(key).getClass().getName().equals("java.lang.Boolean")) {
boolean bool = (Boolean) instance.getConfig().get(key);
if (!bool)
instance.getConfig().set(key, true);
else
instance.getConfig().set(key, false);
finishEditing(p);
this.instance.getConfig().set(key, !instance.getConfig().getBoolean(key));
this.finishEditing(player);
} else {
editObject(p, key);
this.editObject(player, key);
}
}
}
@EventHandler
public void onChat(AsyncPlayerChatEvent e) {
final Player p = e.getPlayer();
if (!current.containsKey(p)) {
return;
}
switch (instance.getConfig().get(current.get(p)).getClass().getName()) {
case "java.lang.Integer":
instance.getConfig().set(current.get(p), Integer.parseInt(e.getMessage()));
break;
case "java.lang.Double":
instance.getConfig().set(current.get(p), Double.parseDouble(e.getMessage()));
break;
case "java.lang.String":
instance.getConfig().set(current.get(p), e.getMessage());
break;
}
finishEditing(p);
e.setCancelled(true);
public void onChat(AsyncPlayerChatEvent event) {
Player player = event.getPlayer();
if (!current.containsKey(player)) return;
String value = current.get(player);
FileConfiguration config = instance.getConfig();
if (config.isInt(value)) {
config.set(value, Integer.parseInt(event.getMessage()));
} else if (config.isDouble(value)) {
config.set(value, Double.parseDouble(event.getMessage()));
} else if (config.isString(value)) {
config.set(value, event.getMessage());
}
public void finishEditing(Player p) {
current.remove(p);
instance.saveConfig();
openEditor(p);
this.finishEditing(player);
event.setCancelled(true);
}
public void finishEditing(Player player) {
this.current.remove(player);
this.instance.saveConfig();
this.openEditor(player);
}
public void editObject(Player p, String current) {
this.current.put(p, ChatColor.stripColor(current));
p.closeInventory();
p.sendMessage("");
p.sendMessage(Arconix.pl().getApi().format().formatText("&7Please enter a value for &6" + current + "&7."));
if (instance.getConfig().get(current).getClass().getName().equals("java.lang.Integer")) {
p.sendMessage(Arconix.pl().getApi().format().formatText("&cUse only numbers."));
public void editObject(Player player, String current) {
this.current.put(player, ChatColor.stripColor(current));
player.closeInventory();
player.sendMessage("");
player.sendMessage(TextComponent.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."));
}
p.sendMessage("");
player.sendMessage("");
}
public void openSettingsManager(Player p) {
Inventory i = Bukkit.createInventory(null, 27, pluginName + " Settings Manager");
int nu = 0;
while (nu != 27) {
i.setItem(nu, Methods.getGlass());
nu++;
public void openSettingsManager(Player player) {
Inventory inventory = Bukkit.createInventory(null, 27, pluginName + " Settings Manager");
ItemStack glass = Methods.getGlass();
for (int i = 0; i < inventory.getSize(); i++) {
inventory.setItem(i, glass);
}
int spot = 10;
for (String key : instance.getConfig().getConfigurationSection("").getKeys(false)) {
ItemStack item = new ItemStack(Material.WOOL, 1, (byte) (spot - 9));
int slot = 10;
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(Arconix.pl().getApi().format().formatText("&6Click To Edit This Category.")));
meta.setDisplayName(Arconix.pl().getApi().format().formatText("&f&l" + key));
meta.setLore(Collections.singletonList(TextComponent.formatText("&6Click To Edit This Category.")));
meta.setDisplayName(TextComponent.formatText("&f&l" + key));
item.setItemMeta(meta);
i.setItem(spot, item);
spot++;
}
p.openInventory(i);
inventory.setItem(slot, item);
slot++;
}
public void openEditor(Player p) {
Inventory i = Bukkit.createInventory(null, 54, pluginName + " Settings Editor");
player.openInventory(inventory);
}
int num = 0;
for (String key : instance.getConfig().getConfigurationSection(cat.get(p)).getKeys(true)) {
String fKey = cat.get(p) + "." + key;
public void openEditor(Player player) {
Inventory inventory = Bukkit.createInventory(null, 54, pluginName + " Settings Editor");
FileConfiguration config = instance.getConfig();
int slot = 0;
for (String key : config.getConfigurationSection(cat.get(player)).getKeys(true)) {
String fKey = cat.get(player) + "." + key;
ItemStack item = new ItemStack(Material.DIAMOND_HELMET);
ItemMeta meta = item.getItemMeta();
meta.setDisplayName(Arconix.pl().getApi().format().formatText("&6" + key));
ArrayList<String> lore = new ArrayList<>();
switch (instance.getConfig().get(fKey).getClass().getName()) {
case "java.lang.Boolean":
meta.setDisplayName(TextComponent.formatText("&6" + key));
List<String> lore = new ArrayList<>();
if (config.isBoolean(fKey)) {
item.setType(Material.LEVER);
boolean bool = (Boolean) instance.getConfig().get(fKey);
if (!bool)
lore.add(Arconix.pl().getApi().format().formatText("&c" + false));
else
lore.add(Arconix.pl().getApi().format().formatText("&a" + true));
break;
case "java.lang.String":
lore.add(TextComponent.formatText(config.getBoolean(fKey) ? "&atrue" : "&cfalse"));
} else if (config.isString(fKey)) {
item.setType(Material.PAPER);
String str = (String) instance.getConfig().get(fKey);
lore.add(Arconix.pl().getApi().format().formatText("&9" + str));
break;
case "java.lang.Integer":
item.setType(Material.WATCH);
int in = (Integer) instance.getConfig().get(fKey);
lore.add(Arconix.pl().getApi().format().formatText("&5" + in));
break;
default:
continue;
lore.add(TextComponent.formatText("&9" + config.getString(fKey)));
} else if (config.isInt(fKey)) {
item.setType(Material.CLOCK);
lore.add(TextComponent.formatText("&5" + config.getInt(fKey)));
}
if (defs.getConfig().contains(fKey)) {
String text = defs.getConfig().getString(key);
Pattern regex = Pattern.compile("(.{1,28}(?:\\s|$))|(.{0,28})", Pattern.DOTALL);
Matcher m = regex.matcher(text);
Matcher m = SETTINGS_PATTERN.matcher(text);
while (m.find()) {
if (m.end() != text.length() || m.group().length() != 0)
lore.add(Arconix.pl().getApi().format().formatText("&7" + m.group()));
lore.add(TextComponent.formatText("&7" + m.group()));
}
}
meta.setLore(lore);
item.setItemMeta(meta);
i.setItem(num, item);
num++;
inventory.setItem(slot, item);
slot++;
}
p.openInventory(i);
player.openInventory(inventory);
}
public void updateSettings() {
for (settings s : settings.values()) {
if (instance.getConfig().contains("settings." + s.oldSetting)) {
instance.getConfig().addDefault(s.setting, instance.getConfig().get("settings." + s.oldSetting));
instance.getConfig().set("settings." + s.oldSetting, null);
} else if (s.setting.equals("Main.Upgrade Particle Type")) {
if (instance.v1_7 || instance.v1_8)
instance.getConfig().addDefault(s.setting, "WITCH_MAGIC");
else
instance.getConfig().addDefault(s.setting, s.option);
} else
instance.getConfig().addDefault(s.setting, s.option);
FileConfiguration config = instance.getConfig();
for (Setting setting : Setting.values()) {
if (config.contains("settings." + setting.oldSetting)) {
config.addDefault(setting.setting, instance.getConfig().get("settings." + setting.oldSetting));
config.set("settings." + setting.oldSetting, null);
} else if (setting.setting.equals("Main.Upgrade Particle Type")) {
config.addDefault(setting.setting, setting.option);
} else {
config.addDefault(setting.setting, setting.option);
}
}
public enum settings {
config.set("settings", null);
}
public enum Setting {
o1("Upgrading-enabled", "Main.Allow Hopper Upgrading", true),
o2("Upgrade-with-eco", "Main.Upgrade With Economy", true),
o3("Upgrade-with-xp", "Main.Upgrade With XP", true),
@ -235,8 +217,8 @@ public class SettingsManager implements Listener {
o15("BlockBreak-Blacklist", "Main.BlockBreak Blacklisted Blocks", Arrays.asList("BEDROCK")),
o16("Rainbow-Glass", "Interfaces.Replace Glass Type 1 With Rainbow Glass", false),
o17("ECO-Icon", "Interfaces.Economy Icon", "DOUBLE_PLANT"),
o18("XP-Icon", "Interfaces.XP Icon", "EXP_BOTTLE"),
o17("ECO-Icon", "Interfaces.Economy Icon", "SUNFLOWER"),
o18("XP-Icon", "Interfaces.XP Icon", "EXPERIENCE_BOTTLE"),
o19("Glass-Type-1", "Interfaces.Glass Type 1", 7),
o20("Glass-Type-2", "Interfaces.Glass Type 2", 11),
o21("Glass-Type-3", "Interfaces.Glass Type 3", 3),
@ -247,7 +229,7 @@ public class SettingsManager implements Listener {
private String oldSetting;
private Object option;
settings(String oldSetting, String setting, Object option) {
Setting(String oldSetting, String setting, Object option) {
this.oldSetting = oldSetting;
this.setting = setting;
this.option = option;

View File

@ -5,6 +5,7 @@ depend: [Arconix]
softdepend: [Towny, RedProtect, Kingdoms, PlotsSquared, GriefPrevention, USkyBlock, ASkyBlock, WorldGuard, Factions, Vault]
version: 2.3.2
author: Songoda
api-version: 1.13
commands:
epichoppers:
description: View information on this plugin.