diff --git a/src/main/java/com/songoda/epichoppers/EpicHoppers.java b/src/main/java/com/songoda/epichoppers/EpicHoppers.java index d27434a..4faf225 100644 --- a/src/main/java/com/songoda/epichoppers/EpicHoppers.java +++ b/src/main/java/com/songoda/epichoppers/EpicHoppers.java @@ -40,7 +40,6 @@ public final class EpicHoppers extends JavaPlugin implements Listener { public SettingsManager sm; public References references = null; - private ConfigWrapper langFile = new ConfigWrapper(this, "", "lang.yml"); public ConfigWrapper dataFile = new ConfigWrapper(this, "", "data.yml"); public Map sync = new HashMap<>(); @@ -119,8 +118,6 @@ public final class EpicHoppers extends JavaPlugin implements Listener { } } - - langFile.createNewFile("Loading language file", "EpicHoppers language file"); references = new References(); hooks = new HookHandler(); diff --git a/src/main/java/com/songoda/epichoppers/Events/BlockListeners.java b/src/main/java/com/songoda/epichoppers/Events/BlockListeners.java index 2605d8a..b764b81 100644 --- a/src/main/java/com/songoda/epichoppers/Events/BlockListeners.java +++ b/src/main/java/com/songoda/epichoppers/Events/BlockListeners.java @@ -6,12 +6,16 @@ import com.songoda.epichoppers.Hopper.Filter; import com.songoda.epichoppers.Hopper.Hopper; import com.songoda.epichoppers.Utils.Debugger; import com.songoda.epichoppers.Utils.Methods; +import org.bukkit.Bukkit; import org.bukkit.Chunk; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.enchantments.Enchantment; +import org.bukkit.entity.Entity; +import org.bukkit.entity.EntityType; import org.bukkit.entity.ExperienceOrb; +import org.bukkit.entity.Item; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; @@ -21,6 +25,8 @@ import org.bukkit.inventory.InventoryHolder; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.ItemMeta; +import java.util.Collection; + /** * Created by songoda on 3/14/2017. */ @@ -92,15 +98,14 @@ public class BlockListeners implements Listener { Block block = event.getBlock(); + if (event.getPlayer().getItemInHand() == null) return; + + handleSyncTouch(event); + if (event.getBlock().getType() != Material.HOPPER) return; Hopper hopper = instance.getHopperManager().getHopper(block); - if (event.getPlayer().getItemInHand() == null) return; - - handlePick(event); - - int level = hopper.getLevel().getLevel(); if (level != 0) { @@ -137,16 +142,28 @@ public class BlockListeners implements Listener { } } - private void handlePick(BlockBreakEvent e) { + private void handleSyncTouch(BlockBreakEvent e) { if (!Methods.isSync(e.getPlayer())) return; - ItemStack item = e.getPlayer().getItemInHand(); - ItemMeta meta = item.getItemMeta(); - if (item.getItemMeta().getLore().size() != 2) return; + + ItemStack tool = e.getPlayer().getItemInHand(); + ItemMeta meta = tool.getItemMeta(); + if (tool.getItemMeta().getLore().size() != 2) return; + Location location = Arconix.pl().getApi().serialize().unserializeLocation(meta.getLore().get(1).replaceAll("§", "")); + 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; + + try { + if (e.getBlock().getType().name().contains("SHULKER") && e.getBlock().getType() != Material.SHULKER_SHELL) return; + } catch (Exception ee) { + + } + InventoryHolder ih = (InventoryHolder) location.getBlock().getState(); if (e.getPlayer().getItemInHand().getItemMeta().hasEnchant(Enchantment.SILK_TOUCH)) { - ih.getInventory().addItem(new ItemStack(e.getBlock().getType())); + ih.getInventory().addItem(new ItemStack(e.getBlock().getType(),1, e.getBlock().getData())); } else { for (ItemStack is : e.getBlock().getDrops()) ih.getInventory().addItem(is); diff --git a/src/main/java/com/songoda/epichoppers/Handlers/HopHandler.java b/src/main/java/com/songoda/epichoppers/Handlers/HopHandler.java index 883ffd8..b86da3f 100644 --- a/src/main/java/com/songoda/epichoppers/Handlers/HopHandler.java +++ b/src/main/java/com/songoda/epichoppers/Handlers/HopHandler.java @@ -113,9 +113,6 @@ public class HopHandler { } } } - for (Entity e : metaItems) { - e.removeMetadata("grabbed", instance); - } if (hopper.getLevel().getSuction() != 0) { int suck = hopper.getLevel().getSuction(); double radius = suck + .5; diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 6c646b8..3cb7a78 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -2,8 +2,8 @@ name: EpicHoppers description: EpicHoppers main: com.songoda.epichoppers.EpicHoppers depend: [Arconix] -softdepend: [Towny, RedProtect, Kingdoms, PlotsSquared, GriefPrevention, USkyBlock, ASkyBlock, WorldGuard, Factions, Vault, PlaceholderAPI] -version: 2.3.0 +softdepend: [Towny, RedProtect, Kingdoms, PlotsSquared, GriefPrevention, USkyBlock, ASkyBlock, WorldGuard, Factions, Vault] +version: 2.3.1 author: Songoda commands: epichoppers: diff --git a/target/classes/SettingDefinitions.yml b/target/classes/SettingDefinitions.yml new file mode 100644 index 0000000..69dcf58 --- /dev/null +++ b/target/classes/SettingDefinitions.yml @@ -0,0 +1,14 @@ +ECO-Icon: 'This is the default icon that will be used for the Economy upgrade button.' +XP-Icon: 'This is the default icon that will be used for the Experience upgrade button.' +Upgrading-enabled: 'Setting this to true will allow users to access the upgrade window.' +Upgrade-with-eco: 'Setting this to true will allow users to use Economy to upgrade their hoppers.' +Upgrade-with-xp: 'Setting this to true will allow users to use Experience to upgrade their hoppers.' +On-upgrade-particles: 'Setting this to true will cause particles to emit when a hopper is upgraded.' +Teleport-hoppers: 'These are the default levels, the amount of levels can be expanded if you want, just add another level to the bottom of the list while keeping numeric order. Allows you to enable or disable teleporting with hoppers' +Hop-Tick: 'This is the tick speed for synced hoppers.' +Sync-Timeout: 'This is the timeout that if reached will cancel a sync.' +Glass-Type: 'This is the id of the glass used for the background in the guis.' +Rainbow-Glass: 'If this is enabled the glass background will be randomized colors. ' +Limit-Hoppers-Per-Chunk: 'If enabled this will limit the amount hoppers per chunk' +Hopper-Limit: 'This is the amount of allowed hoppers per chunk.' +Upgrade-particle-type: 'This is the type of particle an upgrade will emit.' diff --git a/target/classes/com/songoda/epichoppers/API/EpicHoppersAPI.class b/target/classes/com/songoda/epichoppers/API/EpicHoppersAPI.class new file mode 100644 index 0000000..dc0725d Binary files /dev/null and b/target/classes/com/songoda/epichoppers/API/EpicHoppersAPI.class differ diff --git a/target/classes/com/songoda/epichoppers/EpicHoppers.class b/target/classes/com/songoda/epichoppers/EpicHoppers.class new file mode 100644 index 0000000..01f8a6a Binary files /dev/null and b/target/classes/com/songoda/epichoppers/EpicHoppers.class differ diff --git a/target/classes/com/songoda/epichoppers/Events/BlockListeners.class b/target/classes/com/songoda/epichoppers/Events/BlockListeners.class new file mode 100644 index 0000000..4a90e36 Binary files /dev/null and b/target/classes/com/songoda/epichoppers/Events/BlockListeners.class differ diff --git a/target/classes/com/songoda/epichoppers/Events/HopperListeners.class b/target/classes/com/songoda/epichoppers/Events/HopperListeners.class new file mode 100644 index 0000000..2142ebc Binary files /dev/null and b/target/classes/com/songoda/epichoppers/Events/HopperListeners.class differ diff --git a/target/classes/com/songoda/epichoppers/Events/InteractListeners.class b/target/classes/com/songoda/epichoppers/Events/InteractListeners.class new file mode 100644 index 0000000..64fb890 Binary files /dev/null and b/target/classes/com/songoda/epichoppers/Events/InteractListeners.class differ diff --git a/target/classes/com/songoda/epichoppers/Events/InventoryListeners.class b/target/classes/com/songoda/epichoppers/Events/InventoryListeners.class new file mode 100644 index 0000000..6a4fb46 Binary files /dev/null and b/target/classes/com/songoda/epichoppers/Events/InventoryListeners.class differ diff --git a/target/classes/com/songoda/epichoppers/Events/LoginListeners.class b/target/classes/com/songoda/epichoppers/Events/LoginListeners.class new file mode 100644 index 0000000..5f2ce7f Binary files /dev/null and b/target/classes/com/songoda/epichoppers/Events/LoginListeners.class differ diff --git a/target/classes/com/songoda/epichoppers/Handlers/CommandHandler.class b/target/classes/com/songoda/epichoppers/Handlers/CommandHandler.class new file mode 100644 index 0000000..cde3c06 Binary files /dev/null and b/target/classes/com/songoda/epichoppers/Handlers/CommandHandler.class differ diff --git a/target/classes/com/songoda/epichoppers/Handlers/EnchantmentHandler.class b/target/classes/com/songoda/epichoppers/Handlers/EnchantmentHandler.class new file mode 100644 index 0000000..316583c Binary files /dev/null and b/target/classes/com/songoda/epichoppers/Handlers/EnchantmentHandler.class differ diff --git a/target/classes/com/songoda/epichoppers/Handlers/HookHandler.class b/target/classes/com/songoda/epichoppers/Handlers/HookHandler.class new file mode 100644 index 0000000..0a949c7 Binary files /dev/null and b/target/classes/com/songoda/epichoppers/Handlers/HookHandler.class differ diff --git a/target/classes/com/songoda/epichoppers/Handlers/HopHandler.class b/target/classes/com/songoda/epichoppers/Handlers/HopHandler.class new file mode 100644 index 0000000..9d708ee Binary files /dev/null and b/target/classes/com/songoda/epichoppers/Handlers/HopHandler.class differ diff --git a/target/classes/com/songoda/epichoppers/Handlers/TeleportHandler.class b/target/classes/com/songoda/epichoppers/Handlers/TeleportHandler.class new file mode 100644 index 0000000..16cfcd8 Binary files /dev/null and b/target/classes/com/songoda/epichoppers/Handlers/TeleportHandler.class differ diff --git a/target/classes/com/songoda/epichoppers/Hooks/ASkyBlockHook.class b/target/classes/com/songoda/epichoppers/Hooks/ASkyBlockHook.class new file mode 100644 index 0000000..497335a Binary files /dev/null and b/target/classes/com/songoda/epichoppers/Hooks/ASkyBlockHook.class differ diff --git a/target/classes/com/songoda/epichoppers/Hooks/FactionsHook.class b/target/classes/com/songoda/epichoppers/Hooks/FactionsHook.class new file mode 100644 index 0000000..5ec904a Binary files /dev/null and b/target/classes/com/songoda/epichoppers/Hooks/FactionsHook.class differ diff --git a/target/classes/com/songoda/epichoppers/Hooks/GriefPreventionHook.class b/target/classes/com/songoda/epichoppers/Hooks/GriefPreventionHook.class new file mode 100644 index 0000000..9a79a78 Binary files /dev/null and b/target/classes/com/songoda/epichoppers/Hooks/GriefPreventionHook.class differ diff --git a/target/classes/com/songoda/epichoppers/Hooks/Hook.class b/target/classes/com/songoda/epichoppers/Hooks/Hook.class new file mode 100644 index 0000000..a3bedbc Binary files /dev/null and b/target/classes/com/songoda/epichoppers/Hooks/Hook.class differ diff --git a/target/classes/com/songoda/epichoppers/Hooks/KingdomsHook.class b/target/classes/com/songoda/epichoppers/Hooks/KingdomsHook.class new file mode 100644 index 0000000..283fb57 Binary files /dev/null and b/target/classes/com/songoda/epichoppers/Hooks/KingdomsHook.class differ diff --git a/target/classes/com/songoda/epichoppers/Hooks/PlotSquaredHook.class b/target/classes/com/songoda/epichoppers/Hooks/PlotSquaredHook.class new file mode 100644 index 0000000..e7971f4 Binary files /dev/null and b/target/classes/com/songoda/epichoppers/Hooks/PlotSquaredHook.class differ diff --git a/target/classes/com/songoda/epichoppers/Hooks/RedProtectHook.class b/target/classes/com/songoda/epichoppers/Hooks/RedProtectHook.class new file mode 100644 index 0000000..2fda75d Binary files /dev/null and b/target/classes/com/songoda/epichoppers/Hooks/RedProtectHook.class differ diff --git a/target/classes/com/songoda/epichoppers/Hooks/TownyHook.class b/target/classes/com/songoda/epichoppers/Hooks/TownyHook.class new file mode 100644 index 0000000..793b566 Binary files /dev/null and b/target/classes/com/songoda/epichoppers/Hooks/TownyHook.class differ diff --git a/target/classes/com/songoda/epichoppers/Hooks/USkyBlockHook.class b/target/classes/com/songoda/epichoppers/Hooks/USkyBlockHook.class new file mode 100644 index 0000000..af9f1ca Binary files /dev/null and b/target/classes/com/songoda/epichoppers/Hooks/USkyBlockHook.class differ diff --git a/target/classes/com/songoda/epichoppers/Hooks/WorldGuardHook.class b/target/classes/com/songoda/epichoppers/Hooks/WorldGuardHook.class new file mode 100644 index 0000000..bcc1156 Binary files /dev/null and b/target/classes/com/songoda/epichoppers/Hooks/WorldGuardHook.class differ diff --git a/target/classes/com/songoda/epichoppers/Hopper/Filter.class b/target/classes/com/songoda/epichoppers/Hopper/Filter.class new file mode 100644 index 0000000..f82a938 Binary files /dev/null and b/target/classes/com/songoda/epichoppers/Hopper/Filter.class differ diff --git a/target/classes/com/songoda/epichoppers/Hopper/Hopper.class b/target/classes/com/songoda/epichoppers/Hopper/Hopper.class new file mode 100644 index 0000000..a910fa6 Binary files /dev/null and b/target/classes/com/songoda/epichoppers/Hopper/Hopper.class differ diff --git a/target/classes/com/songoda/epichoppers/Hopper/HopperManager.class b/target/classes/com/songoda/epichoppers/Hopper/HopperManager.class new file mode 100644 index 0000000..f3aa66e Binary files /dev/null and b/target/classes/com/songoda/epichoppers/Hopper/HopperManager.class differ diff --git a/target/classes/com/songoda/epichoppers/Hopper/Level.class b/target/classes/com/songoda/epichoppers/Hopper/Level.class new file mode 100644 index 0000000..8ffd02a Binary files /dev/null and b/target/classes/com/songoda/epichoppers/Hopper/Level.class differ diff --git a/target/classes/com/songoda/epichoppers/Hopper/LevelManager.class b/target/classes/com/songoda/epichoppers/Hopper/LevelManager.class new file mode 100644 index 0000000..8333c43 Binary files /dev/null and b/target/classes/com/songoda/epichoppers/Hopper/LevelManager.class differ diff --git a/target/classes/com/songoda/epichoppers/Locale.class b/target/classes/com/songoda/epichoppers/Locale.class new file mode 100644 index 0000000..209f208 Binary files /dev/null and b/target/classes/com/songoda/epichoppers/Locale.class differ diff --git a/target/classes/com/songoda/epichoppers/References.class b/target/classes/com/songoda/epichoppers/References.class new file mode 100644 index 0000000..dc2a5e6 Binary files /dev/null and b/target/classes/com/songoda/epichoppers/References.class differ diff --git a/target/classes/com/songoda/epichoppers/Utils/Debugger.class b/target/classes/com/songoda/epichoppers/Utils/Debugger.class new file mode 100644 index 0000000..2f72ff5 Binary files /dev/null and b/target/classes/com/songoda/epichoppers/Utils/Debugger.class differ diff --git a/target/classes/com/songoda/epichoppers/Utils/Methods.class b/target/classes/com/songoda/epichoppers/Utils/Methods.class new file mode 100644 index 0000000..36d6e4e Binary files /dev/null and b/target/classes/com/songoda/epichoppers/Utils/Methods.class differ diff --git a/target/classes/com/songoda/epichoppers/Utils/SettingsManager$settings.class b/target/classes/com/songoda/epichoppers/Utils/SettingsManager$settings.class new file mode 100644 index 0000000..9c76b7f Binary files /dev/null and b/target/classes/com/songoda/epichoppers/Utils/SettingsManager$settings.class differ diff --git a/target/classes/com/songoda/epichoppers/Utils/SettingsManager.class b/target/classes/com/songoda/epichoppers/Utils/SettingsManager.class new file mode 100644 index 0000000..7bfcbbb Binary files /dev/null and b/target/classes/com/songoda/epichoppers/Utils/SettingsManager.class differ diff --git a/target/classes/en_US.lang b/target/classes/en_US.lang new file mode 100644 index 0000000..054bb30 --- /dev/null +++ b/target/classes/en_US.lang @@ -0,0 +1,53 @@ +#General Messages + +general.nametag.prefix = "&7[&6EpicHoppers&7]" +general.nametag.next = "&9Next" +general.nametag.back = "&9Back" +general.nametag.nameformat = "&eLevel %level% &fHopper" + +#Interface Messages + +interface.hopper.upgradewithxp = "&aUpgrade with XP" +interface.hopper.upgradewithxplore = "&7Cost: &a%cost% Levels" +interface.hopper.upgradewitheconomy = "&aUpgrade with ECO" +interface.hopper.upgradewitheconomylore = "&7Cost: &a$%cost%" +interface.hopper.currentlevel = "&6Hopper Level &7%level%" +interface.hopper.nextlevel = "&6Next Level &7%level%" +interface.hopper.range = "&7Range: &6%range%" +interface.hopper.amount = "&7Amount: &6%amount%" +interface.hopper.suction = "&7Suction: &6%suction%" +interface.hopper.blockbreak = "&7Block Break: &6Every %ticks% ticks" +interface.hopper.alreadymaxed = "&7This hopper is already maxed out!" +interface.hopper.synclore = "|&7Left-Click then click a another|&7hopper or chest to sync!||&7Right-Click to desync." +interface.hopper.perltitle = "&6Click to Teleport" +interface.hopper.perllore = "|&7Left-Click to teleport to|&7the end of the chain.||&7Right-Click to toggle walk|&7on teleport." +interface.hopper.filtertitle = "&cClick to Filter" +interface.hopper.filterlore = "|&7This allows you to choose|&7which items go where." +interface.hopper.synchopper = "&6Click to Sync This hopper" +interface.hopper.rejectsync = "&6Click to Sync Rejected Items" +interface.filter.infotitle = "&aFilter Guide" +interface.filter.infolore = "&7Items placed in the top left|&7space will be whitelisted.||&7Items placed in the right|&7will be void.||&7Items placed in the bottom left|&7will be blacklisted.||&cUsing the whitelist will disable|&cboth the blacklist and the void." +interface.filter.whitelist = "&f&lWhite List" +interface.filter.blacklist = "&8&lBlack List" +interface.filter.void = "&c&lVoid" + +#Event Messages + +event.general.nopermission = "&cYou do not have permission to do that." +event.upgrade.cannotafford = "&cYou cannot afford this upgrade." +event.upgrade.success = "&7You successfully upgraded this hopper to &6level %level%&7!" +event.upgrade.maxed = "&7You maxed out this hopper at &6level %level%&7." +event.inventory.noroom = "&7You do not have space in your inventory for this." +event.hopper.syncsuccess = "&aSynchronization Successful." +event.hopper.desync = "&7You have desynchronized this hopper." +event.hopper.syncnext = "&7Click another hopper or container to sync." +event.hopper.syncself = "&cYou can't sync a hopper to itself." +event.hopper.synctimeout = "&cSyncing timed out." +event.hopper.syncoutofrange = "&cThis block is out of your hoppers range." +event.hopper.syncdidnotplace = "&cSorry! You need to have placed this hopper to sync things to it." +event.hopper.toomany = "&cYou can only place %amount% hoppers per chunk..." +event.hopper.walkteleenabled = "Walk on teleporting has been enabled for this hopper." +event.hopper.walkteledisabled = "Walk on teleporting has been disabled for this hopper." +event.hopper.onlyone = "&cYou may only place a single item at a time." +event.hopper.syncchest = "&7You have synchronized your &9%name% &7with this chest." +event.hopper.desyncchest = "&7You have desynchronized your &9%name% &7with this chest." \ No newline at end of file diff --git a/target/classes/plugin.yml b/target/classes/plugin.yml new file mode 100644 index 0000000..3cb7a78 --- /dev/null +++ b/target/classes/plugin.yml @@ -0,0 +1,13 @@ +name: EpicHoppers +description: EpicHoppers +main: com.songoda.epichoppers.EpicHoppers +depend: [Arconix] +softdepend: [Towny, RedProtect, Kingdoms, PlotsSquared, GriefPrevention, USkyBlock, ASkyBlock, WorldGuard, Factions, Vault] +version: 2.3.1 +author: Songoda +commands: + epichoppers: + description: View information on this plugin. + default: true + aliases: [sc, eh, synccraft] + usage: /eh \ No newline at end of file