mirror of
https://github.com/songoda/EpicHoppers.git
synced 2024-11-25 11:46:45 +01:00
Merge branch 'development'
This commit is contained in:
commit
261a61a847
7
pom.xml
7
pom.xml
@ -2,7 +2,7 @@
|
||||
<groupId>com.songoda</groupId>
|
||||
<artifactId>EpicHoppers</artifactId>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<version>4.6.5</version>
|
||||
<version>4.6.6</version>
|
||||
<build>
|
||||
<defaultGoal>clean install</defaultGoal>
|
||||
<finalName>EpicHoppers-${project.version}</finalName>
|
||||
@ -103,6 +103,11 @@
|
||||
<artifactId>spigot</artifactId>
|
||||
<version>1.15</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.songoda</groupId>
|
||||
<artifactId>skyblock</artifactId>
|
||||
<version>2.2.13</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.songoda</groupId>
|
||||
<artifactId>SongodaCore</artifactId>
|
||||
|
@ -16,6 +16,7 @@ import com.songoda.core.nms.nbt.NBTItem;
|
||||
import com.songoda.epichoppers.boost.BoostData;
|
||||
import com.songoda.epichoppers.boost.BoostManager;
|
||||
import com.songoda.epichoppers.commands.*;
|
||||
import com.songoda.epichoppers.compatiility.EpicHoppersPermission;
|
||||
import com.songoda.epichoppers.database.DataManager;
|
||||
import com.songoda.epichoppers.database.migrations._1_InitialMigration;
|
||||
import com.songoda.epichoppers.handlers.TeleportHandler;
|
||||
@ -32,6 +33,7 @@ import com.songoda.epichoppers.storage.types.StorageYaml;
|
||||
import com.songoda.epichoppers.tasks.HopTask;
|
||||
import com.songoda.epichoppers.utils.Methods;
|
||||
import com.songoda.epichoppers.utils.TeleportTrigger;
|
||||
import com.songoda.skyblock.SkyBlock;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
@ -226,6 +228,10 @@ public class EpicHoppers extends SongodaPlugin {
|
||||
pluginManager.registerEvents(new InteractListeners(this), this);
|
||||
pluginManager.registerEvents(new InventoryListeners(), this);
|
||||
|
||||
if (pluginManager.isPluginEnabled("FabledSkyBlock")) {
|
||||
SkyBlock.getInstance().getPermissionManager().registerPermission(new EpicHoppersPermission());
|
||||
}
|
||||
|
||||
// Check for liquid tanks
|
||||
if (pluginManager.isPluginEnabled("LiquidTanks")) liquidtanks = true;
|
||||
|
||||
|
@ -0,0 +1,13 @@
|
||||
package com.songoda.epichoppers.compatiility;
|
||||
|
||||
import com.songoda.skyblock.core.compatibility.CompatibleMaterial;
|
||||
import com.songoda.skyblock.permission.BasicPermission;
|
||||
import com.songoda.skyblock.permission.PermissionType;
|
||||
|
||||
public class EpicHoppersPermission extends BasicPermission {
|
||||
|
||||
public EpicHoppersPermission() {
|
||||
super("EpicHoppers", CompatibleMaterial.HOPPER, PermissionType.GENERIC);
|
||||
}
|
||||
|
||||
}
|
@ -172,20 +172,20 @@ public class DataManager extends DataManagerAbstract {
|
||||
Map<ItemStack, ItemType> items = new HashMap<>();
|
||||
Filter filter = hopper.getFilter();
|
||||
|
||||
for (ItemStack item : filter.getWhiteList())
|
||||
items.put(item, ItemType.WHITELIST);
|
||||
for (ItemStack item : filter.getWhiteList())
|
||||
items.put(item, ItemType.WHITELIST);
|
||||
|
||||
for (ItemStack item : filter.getBlackList())
|
||||
items.put(item, ItemType.BLACKLIST);
|
||||
for (ItemStack item : filter.getBlackList())
|
||||
items.put(item, ItemType.BLACKLIST);
|
||||
|
||||
for (ItemStack item : filter.getVoidList())
|
||||
items.put(item, ItemType.VOID);
|
||||
for (ItemStack item : filter.getVoidList())
|
||||
items.put(item, ItemType.VOID);
|
||||
|
||||
for (ItemStack item : filter.getAutoSellWhiteList())
|
||||
items.put(item, ItemType.AUTO_SELL_WHITELIST);
|
||||
for (ItemStack item : filter.getAutoSellWhiteList())
|
||||
items.put(item, ItemType.AUTO_SELL_WHITELIST);
|
||||
|
||||
for (ItemStack item : filter.getAutoSellBlackList())
|
||||
items.put(item, ItemType.AUTO_SELL_BLACKLIST);
|
||||
for (ItemStack item : filter.getAutoSellBlackList())
|
||||
items.put(item, ItemType.AUTO_SELL_BLACKLIST);
|
||||
|
||||
String createItem = "INSERT INTO " + this.getTablePrefix() + "items (hopper_id, item_type, item) VALUES (?, ?, ?)";
|
||||
try (PreparedStatement statement = connection.prepareStatement(createItem)) {
|
||||
@ -218,17 +218,17 @@ public class DataManager extends DataManagerAbstract {
|
||||
for (Map.Entry<Location, LinkType> entry : links.entrySet()) {
|
||||
statement.setInt(1, hopper.getId());
|
||||
|
||||
statement.setString(2,entry.getValue().name());
|
||||
statement.setString(2, entry.getValue().name());
|
||||
|
||||
Location location = entry.getKey();
|
||||
statement.setString(3, location.getWorld().getName());
|
||||
statement.setInt(4, location.getBlockX());
|
||||
statement.setInt(5, location.getBlockY());
|
||||
statement.setInt(6, location.getBlockZ());
|
||||
statement.addBatch();
|
||||
Location location = entry.getKey();
|
||||
statement.setString(3, location.getWorld().getName());
|
||||
statement.setInt(4, location.getBlockX());
|
||||
statement.setInt(5, location.getBlockY());
|
||||
statement.setInt(6, location.getBlockZ());
|
||||
statement.addBatch();
|
||||
}
|
||||
statement.executeBatch();
|
||||
}
|
||||
statement.executeBatch();
|
||||
}
|
||||
}), "create");
|
||||
}
|
||||
|
||||
@ -327,8 +327,10 @@ public class DataManager extends DataManagerAbstract {
|
||||
int z = result.getInt("z");
|
||||
Location location = new Location(world, x, y, z);
|
||||
|
||||
Hopper hopper = hoppers.get(id);
|
||||
if (hopper == null) break;
|
||||
|
||||
hoppers.get(id).addLinkedBlock(location, type);
|
||||
hopper.addLinkedBlock(location, type);
|
||||
}
|
||||
}
|
||||
|
||||
@ -347,8 +349,11 @@ public class DataManager extends DataManagerAbstract {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
Hopper hopper = hoppers.get(id);
|
||||
if (hopper == null) break;
|
||||
|
||||
if (item != null)
|
||||
hoppers.get(id).getFilter().addItem(item, type);
|
||||
hopper.getFilter().addItem(item, type);
|
||||
}
|
||||
}
|
||||
this.sync(() -> callback.accept(hoppers));
|
||||
|
@ -8,6 +8,8 @@ import com.songoda.epichoppers.player.SyncType;
|
||||
import com.songoda.epichoppers.settings.Settings;
|
||||
import com.songoda.epichoppers.utils.Methods;
|
||||
import com.songoda.epichoppers.utils.TeleportTrigger;
|
||||
import com.songoda.skyblock.SkyBlock;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.BlockFace;
|
||||
@ -64,6 +66,16 @@ public class InteractListeners implements Listener {
|
||||
if (WorldGuardHook.isInteractAllowed(event.getClickedBlock().getLocation()))
|
||||
return;
|
||||
|
||||
if (Bukkit.getPluginManager().isPluginEnabled("FabledSkyBlock")) {
|
||||
SkyBlock skyBlock = SkyBlock.getInstance();
|
||||
|
||||
if (skyBlock.getWorldManager().isIslandWorld(event.getPlayer().getWorld()))
|
||||
if (!skyBlock.getPermissionManager().hasPermission(event.getPlayer(),
|
||||
skyBlock.getIslandManager().getIslandAtLocation(event.getClickedBlock().getLocation()),
|
||||
"EpicHoppers"))
|
||||
return;
|
||||
}
|
||||
|
||||
PlayerData playerData = instance.getPlayerDataManager().getPlayerData(player);
|
||||
|
||||
if (playerData.getSyncType() == null) {
|
||||
|
Loading…
Reference in New Issue
Block a user