瀏覽代碼

add sendBlockAcknowledge method

This method lets other SkyBlock plugins now of the block creation of the
cobblestone generator.
MasterCake 4 年之前
父節點
當前提交
ca499ab80c

+ 1 - 1
pom.xml

@@ -4,7 +4,7 @@
 	<modelVersion>4.0.0</modelVersion>
 	<groupId>xyz.spaceio</groupId>
 	<artifactId>CustomOreGen</artifactId>
-	<version>1.3.27-SNAPSHOT</version>
+	<version>1.3.28-SNAPSHOT</version>
 	<repositories>
 		<!-- Spigot repository -->
 		<repository>

+ 2 - 1
src/xyz/spaceio/customoregen/Events.java

@@ -84,6 +84,7 @@ public class Events implements Listener {
 				if(useLegacyBlockPlaceMethod) {
 					try {
 						legacyBlockPlaceMethod.invoke(b, Material.getMaterial(winning.getName()).getId() , winning.getDamage(), true);
+						plugin.getSkyblockAPICached().sendBlockAcknowledge(b);
 					} catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
 						// TODO Auto-generated catch block
 						e.printStackTrace();
@@ -93,7 +94,7 @@ public class Events implements Listener {
 						b.setType(Material.getMaterial(winning.getName()));
 						b.getState().update(true);
 						b.getWorld().playSound(b.getLocation(), Sound.BLOCK_FIRE_EXTINGUISH, 1f, 10f);
-
+						plugin.getSkyblockAPICached().sendBlockAcknowledge(b);
 				}
 				//b.setData(winning.getDamage(), true);
 			}

+ 8 - 0
src/xyz/spaceio/hooks/HookASkyBlock.java

@@ -4,6 +4,7 @@ import java.util.Optional;
 import java.util.UUID;
 
 import org.bukkit.Location;
+import org.bukkit.block.Block;
 
 import com.wasteofplastic.askyblock.ASkyBlockAPI;
 
@@ -34,4 +35,11 @@ public class HookASkyBlock implements SkyblockAPIHook {
 		return new String[] { api.getIslandWorld().getName() };
 	}
 
+	@Override
+	public void sendBlockAcknowledge(Block block) {
+		// TODO Auto-generated method stub
+		
+	}
+	
+
 }

+ 7 - 0
src/xyz/spaceio/hooks/HookAcidIsland.java

@@ -4,6 +4,7 @@ import java.util.Optional;
 import java.util.UUID;
 
 import org.bukkit.Location;
+import org.bukkit.block.Block;
 
 import com.wasteofplastic.acidisland.ASkyBlockAPI;
 
@@ -33,4 +34,10 @@ public class HookAcidIsland implements SkyblockAPIHook {
 	public String[] getSkyBlockWorldNames() {
 		return new String[] { api.getIslandWorld().getName() };
 	}
+
+	@Override
+	public void sendBlockAcknowledge(Block block) {
+		// TODO Auto-generated method stub
+		
+	}
 }

+ 7 - 0
src/xyz/spaceio/hooks/HookBentoBox.java

@@ -9,6 +9,7 @@ import java.util.UUID;
 import org.bukkit.Bukkit;
 import org.bukkit.Location;
 import org.bukkit.World;
+import org.bukkit.block.Block;
 
 import world.bentobox.bentobox.BentoBox;
 import world.bentobox.bentobox.database.objects.Island;
@@ -56,4 +57,10 @@ public class HookBentoBox implements SkyblockAPIHook{
 		return api.getIWM().getOverWorlds().stream().map(w -> new String[]{w.getName(), w.getName() + "_nether", w.getName() + "_the_end"}).flatMap(s -> Arrays.stream(s)).toArray(String[]::new);
 	}
 	
+	@Override
+	public void sendBlockAcknowledge(Block block) {
+		// TODO Auto-generated method stub
+		
+	}
+	
 }

+ 7 - 0
src/xyz/spaceio/hooks/HookFabledSkyblock.java

@@ -6,6 +6,7 @@ import java.util.UUID;
 import org.bukkit.Bukkit;
 import org.bukkit.Location;
 import org.bukkit.OfflinePlayer;
+import org.bukkit.block.Block;
 
 import com.songoda.skyblock.SkyBlock;
 import com.songoda.skyblock.island.Island;
@@ -59,4 +60,10 @@ public class HookFabledSkyblock implements SkyblockAPIHook{
 		return null;
 	}
 	
+	@Override
+	public void sendBlockAcknowledge(Block block) {
+		// TODO Auto-generated method stub
+		
+	}
+	
 }

+ 7 - 0
src/xyz/spaceio/hooks/HookIslandWorld.java

@@ -5,6 +5,7 @@ import java.util.UUID;
 
 import org.bukkit.Bukkit;
 import org.bukkit.Location;
+import org.bukkit.block.Block;
 
 import pl.islandworld.IslandWorld;
 import pl.islandworld.entity.SimpleIsland;
@@ -39,5 +40,11 @@ public class HookIslandWorld implements SkyblockAPIHook {
 	public String[] getSkyBlockWorldNames() {
 		return new String[] { api.getIslandWorld().getName() };
 	}
+	
+	@Override
+	public void sendBlockAcknowledge(Block block) {
+		// TODO Auto-generated method stub
+		
+	}
 
 }

+ 7 - 0
src/xyz/spaceio/hooks/HookPlotSquared.java

@@ -4,6 +4,7 @@ import java.util.Optional;
 import java.util.UUID;
 
 import org.bukkit.Location;
+import org.bukkit.block.Block;
 
 import com.github.intellectualsites.plotsquared.api.PlotAPI;
 
@@ -43,4 +44,10 @@ public class HookPlotSquared implements SkyblockAPIHook {
 		
 		return loc;
 	}
+	
+	@Override
+	public void sendBlockAcknowledge(Block block) {
+		// TODO Auto-generated method stub
+		
+	}
 }

+ 7 - 0
src/xyz/spaceio/hooks/HookPlotSquaredLegacy.java

@@ -4,6 +4,7 @@ import java.util.Optional;
 import java.util.UUID;
 
 import org.bukkit.Location;
+import org.bukkit.block.Block;
 
 import com.intellectualcrafters.plot.api.PlotAPI;
 
@@ -33,4 +34,10 @@ public class HookPlotSquaredLegacy implements SkyblockAPIHook {
 	public String[] getSkyBlockWorldNames() {
 		return api.getPlotWorlds();
 	}
+	
+	@Override
+	public void sendBlockAcknowledge(Block block) {
+		// TODO Auto-generated method stub
+		
+	}
 }

+ 7 - 0
src/xyz/spaceio/hooks/HookSpaceSkyblock.java

@@ -5,6 +5,7 @@ import java.util.UUID;
 
 import org.bukkit.Bukkit;
 import org.bukkit.Location;
+import org.bukkit.block.Block;
 
 import xyz.spaceio.skyblock.SpaceSkyblock;
 import xyz.spaceio.skyblock.islands.Island;
@@ -42,4 +43,10 @@ public class HookSpaceSkyblock implements SkyblockAPIHook{
 		return api.getIslandManager().getSkyWorlds().stream().toArray(String[]::new);
 	}
 	
+	@Override
+	public void sendBlockAcknowledge(Block block) {
+		// TODO Auto-generated method stub
+		
+	}
+	
 }

+ 8 - 0
src/xyz/spaceio/hooks/HookSuperiorSkyblock.java

@@ -4,6 +4,7 @@ import java.util.Optional;
 import java.util.UUID;
 
 import org.bukkit.Location;
+import org.bukkit.block.Block;
 
 import com.bgsoftware.superiorskyblock.api.SuperiorSkyblockAPI;
 
@@ -37,5 +38,12 @@ public class HookSuperiorSkyblock implements SkyblockAPIHook {
 	public String[] getSkyBlockWorldNames() {
 		return new String[] {SuperiorSkyblockAPI.getIslandsWorld().getName()};
 	}
+	
+	@Override
+	public void sendBlockAcknowledge(Block block) {
+		if(SuperiorSkyblockAPI.getIslandAt(block.getLocation()) != null) {
+			SuperiorSkyblockAPI.getIslandAt(block.getLocation()).handleBlockPlace(block);	
+		}
+	}
 
 }

+ 7 - 0
src/xyz/spaceio/hooks/HookVanilla.java

@@ -8,6 +8,7 @@ import java.util.stream.Collectors;
 
 import org.bukkit.Bukkit;
 import org.bukkit.Location;
+import org.bukkit.block.Block;
 import org.bukkit.entity.Player;
 
 public class HookVanilla implements SkyblockAPIHook{
@@ -42,4 +43,10 @@ public class HookVanilla implements SkyblockAPIHook{
 		return Bukkit.getWorlds().stream().map(w -> w.getName()).toArray(String[]::new);
 		
 	}
+	
+	@Override
+	public void sendBlockAcknowledge(Block block) {
+		// TODO Auto-generated method stub
+		
+	}
 }

+ 6 - 0
src/xyz/spaceio/hooks/HookuSkyBlock.java

@@ -5,6 +5,7 @@ import java.util.UUID;
 
 import org.bukkit.Bukkit;
 import org.bukkit.Location;
+import org.bukkit.block.Block;
 
 import us.talabrek.ultimateskyblock.api.uSkyBlockAPI;
 
@@ -38,4 +39,9 @@ public class HookuSkyBlock implements SkyblockAPIHook {
 		return new String[] { api.getConfig().getString("options.general.worldName") };
 	}
 
+	@Override
+	public void sendBlockAcknowledge(Block block) {
+		// TODO Auto-generated method stub
+		
+	}
 }

+ 6 - 1
src/xyz/spaceio/hooks/SkyblockAPICached.java

@@ -1,12 +1,13 @@
 package xyz.spaceio.hooks;
 
+import java.util.Map.Entry;
 import java.util.Optional;
 import java.util.UUID;
-import java.util.Map.Entry;
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.TimeUnit;
 
 import org.bukkit.Location;
+import org.bukkit.block.Block;
 
 import com.google.common.cache.CacheBuilder;
 import com.google.common.cache.CacheLoader;
@@ -66,4 +67,8 @@ public class SkyblockAPICached {
 	public String[] getSkyBlockWorldNames() {
 		return hook.getSkyBlockWorldNames();
 	}
+	
+	public void sendBlockAcknowledge(Block block) {
+		hook.sendBlockAcknowledge(block);
+	}
 }

+ 7 - 0
src/xyz/spaceio/hooks/SkyblockAPIHook.java

@@ -5,6 +5,7 @@ import java.util.UUID;
 
 import org.bukkit.Location;
 import org.bukkit.World;
+import org.bukkit.block.Block;
 
 public interface SkyblockAPIHook {
 	/**
@@ -30,4 +31,10 @@ public interface SkyblockAPIHook {
 	 * @return the names of the skyblock worlds
 	 */
 	public String[] getSkyBlockWorldNames();
+	
+	/*
+	 * Calls the specific SkyBlock-API to make it aware of a block placement
+	 * 
+	 */
+	public void sendBlockAcknowledge(Block block);
 }