block spawn eggs

This commit is contained in:
ZeroEpoch1969 2019-08-07 00:31:05 -07:00
parent a4ee58cac7
commit fb336f27bb
No known key found for this signature in database
GPG Key ID: A7BAB4E14F089CF3
5 changed files with 135 additions and 19 deletions

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
<output url="file://$MODULE_DIR$/target/classes" />
<output-test url="file://$MODULE_DIR$/target/test-classes" />
@ -17,7 +17,6 @@
<orderEntry type="library" name="Maven: org.apache.commons:commons-lang3:3.6" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.spigotmc:spigot:1.14-R0.1-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.Pravian:Aero:5f82926" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.spigotmc:spigot-api:1.12-R0.1-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: commons-lang:commons-lang:2.6" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.googlecode.json-simple:json-simple:1.1.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: junit:junit:4.10" level="project" />
@ -25,7 +24,6 @@
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.guava:guava:21.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.code.gson:gson:2.8.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.yaml:snakeyaml:1.18" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.md-5:bungeecord-chat:1.12-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.TotalFreedom:BukkitTelnet:4.5-pre1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.logging.log4j:log4j-core:2.5" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.logging.log4j:log4j-api:2.5" level="project" />
@ -46,7 +44,69 @@
<orderEntry type="library" scope="PROVIDED" name="Maven: com.thoughtworks.paranamer:paranamer:2.6" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.sk89q.lib:jlibnoise:1.0.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.ess3:Essentials:2.13.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.bukkit:craftbukkit:1.13.2-R0.1-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.dv8tion:JDA:3.8.0_423" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.code.findbugs:jsr305:3.0.2" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.jetbrains:annotations:16.0.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.slf4j:slf4j-api:1.7.25" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.neovisionaries:nv-websocket-client:2.5" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.squareup.okhttp3:okhttp:3.8.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.squareup.okio:okio:1.13.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: club.minnced:opus-java-api:1.0.4" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.dev.jna:jna:4.4.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: club.minnced:opus-java-natives:1.0.4" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.commons:commons-collections4:4.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.json:json:20160810" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.sf.trove4j:trove4j:3.0.3" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.coreprotect:coreprotect:2.16.3" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.sk89q.worldedit:worldedit-bukkit:7.0.0-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.sk89q.worldedit:worldedit-core:7.0.0-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.sk89q.worldedit.worldedit-libs:core:7.0.0-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.sk89q.worldedit.worldedit-libs:bukkit:7.0.0-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.logging.log4j:log4j-slf4j-impl:2.8.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.TFPatches:TF-WorldGuard:50fd4cb470" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.TFPatches.TF-WorldGuard:worldguard-core:50fd4cb470" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.sk89q.intake:intake:4.2-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.sk89q:squirrelid:0.2.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.flywaydb:flyway-core:3.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.khelekore:prtree:1.5.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.sf.opencsv:opencsv:2.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.TFPatches.TF-WorldGuard:worldguard-legacy:50fd4cb470" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.sk89q:commandbook:2.3" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.projectlombok:lombok:1.18.0" level="project" />
<orderEntry type="library" name="Maven: commons-io:commons-io:2.6" level="project" />
<orderEntry type="library" name="Maven: org.apache.commons:commons-lang3:3.9" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.spigotmc:spigot:1.14.4-R0.1-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.Pravian:Aero:5f82926" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.spigotmc:spigot-api:1.12-R0.1-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: commons-lang:commons-lang:2.6" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.googlecode.json-simple:json-simple:1.1.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: junit:junit:4.10" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.hamcrest:hamcrest-core:1.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.guava:guava:21.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.code.gson:gson:2.8.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.yaml:snakeyaml:1.18" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.md-5:bungeecord-chat:1.12-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.TotalFreedom:BukkitTelnet:4.5-pre1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.logging.log4j:log4j-core:2.5" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.logging.log4j:log4j-api:2.5" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.TFPatches:TF-LibsDisguises:89efd2c93e" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.comphenix.protocol:ProtocolLib:4.4.0-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.comphenix.protocol:ProtocolLib-API:4.4.0-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: cglib:cglib-nodep:3.2.5" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.comphenix.executors:BukkitExecutors:1.1-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.TFPatches:TotalFreedomMod:4a91c81" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.TFPatches:TF-WorldEdit:0909dc1972" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.TFPatches.TF-WorldEdit:worldedit-bukkit:0909dc1972" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.sk89q:dummypermscompat:1.8" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.bstats:bstats-bukkit:1.4" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: io.papermc:paperlib:1.0.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.TFPatches.TF-WorldEdit:worldedit-core:0909dc1972" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: de.schlichtherle:truezip:6.8.3" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: rhino:js:1.7R2" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.sk89q:jchronic:0.2.4a" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.thoughtworks.paranamer:paranamer:2.6" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.sk89q.lib:jlibnoise:1.0.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.ess3:Essentials:2.13.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.dv8tion:JDA:3.8.0_423" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.code.findbugs:jsr305:3.0.2" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.jetbrains:annotations:16.0.1" level="project" />

View File

@ -7,13 +7,11 @@ import me.totalfreedom.totalfreedommod.util.FLog;
import me.totalfreedom.totalfreedommod.util.FUtil;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.entity.Egg;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.inventory.ItemStack;
import static net.minecraft.server.v1_14_R1.EnumMobSpawn.SPAWN_EGG;
public class BlockBlocker extends FreedomService
{
@ -105,7 +103,6 @@ public class BlockBlocker extends FreedomService
event.setCancelled(true);
break;
}
//TODO: seth block eggs thanks
}
}
}

View File

@ -218,19 +218,9 @@ public class EventBlocker extends FreedomService
@EventHandler(priority = EventPriority.NORMAL)
public void onBlockDispense(BlockDispenseEvent event)
{
ItemStack item = event.getItem();
if (Groups.SHULKER_BOXES.contains(item.getType()))
if (Groups.SPAWN_EGGS.contains(event.getItem().getType()))
{
BlockStateMeta blockStateMeta = (BlockStateMeta)item.getItemMeta();
ShulkerBox shulkerBox = (ShulkerBox)blockStateMeta.getBlockState();
for (ItemStack itemStack : shulkerBox.getInventory().getContents())
{
if (itemStack != null)
{
event.setCancelled(true);
break;
}
}
event.setCancelled(true);
}
}
}

View File

@ -4,6 +4,7 @@ import me.totalfreedom.totalfreedommod.FreedomService;
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
import me.totalfreedom.totalfreedommod.util.FLog;
import me.totalfreedom.totalfreedommod.util.Groups;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.entity.Player;
@ -79,6 +80,14 @@ public class InteractBlocker extends FreedomService
}
}
if (Groups.SPAWN_EGGS.contains(event.getMaterial()))
{
player.getInventory().clear(player.getInventory().getHeldItemSlot());
player.sendMessage(ChatColor.GRAY + "Spawn eggs are currently disabled.");
event.setCancelled(true);
return;
}
switch (event.getMaterial())
{
case WATER_BUCKET:

View File

@ -98,4 +98,64 @@ public class Groups
EntityType.WANDERING_TRADER,
EntityType.WOLF,
EntityType.ZOMBIE);
public static final List<Material> SPAWN_EGGS = Arrays.asList(
Material.BAT_SPAWN_EGG,
Material.BLAZE_SPAWN_EGG,
Material.CAVE_SPIDER_SPAWN_EGG,
Material.CHICKEN_SPAWN_EGG,
Material.CAT_SPAWN_EGG,
Material.COD_SPAWN_EGG,
Material.COW_SPAWN_EGG,
Material.CREEPER_SPAWN_EGG,
Material.DOLPHIN_SPAWN_EGG,
Material.DONKEY_SPAWN_EGG,
Material.DROWNED_SPAWN_EGG,
Material.ELDER_GUARDIAN_SPAWN_EGG,
Material.ENDERMAN_SPAWN_EGG,
Material.ENDERMITE_SPAWN_EGG,
Material.EVOKER_SPAWN_EGG,
Material.FOX_SPAWN_EGG,
Material.GHAST_SPAWN_EGG,
Material.GUARDIAN_SPAWN_EGG,
Material.HORSE_SPAWN_EGG,
Material.HUSK_SPAWN_EGG,
Material.LLAMA_SPAWN_EGG,
Material.MAGMA_CUBE_SPAWN_EGG,
Material.MOOSHROOM_SPAWN_EGG,
Material.MULE_SPAWN_EGG,
Material.OCELOT_SPAWN_EGG,
Material.PANDA_SPAWN_EGG,
Material.PARROT_SPAWN_EGG,
Material.PHANTOM_SPAWN_EGG,
Material.PIG_SPAWN_EGG,
Material.PILLAGER_SPAWN_EGG,
Material.POLAR_BEAR_SPAWN_EGG,
Material.PUFFERFISH_SPAWN_EGG,
Material.RABBIT_SPAWN_EGG,
Material.RAVAGER_SPAWN_EGG,
Material.SALMON_SPAWN_EGG,
Material.SHEEP_SPAWN_EGG,
Material.SHULKER_SPAWN_EGG,
Material.SILVERFISH_SPAWN_EGG,
Material.SKELETON_SPAWN_EGG,
Material.SKELETON_HORSE_SPAWN_EGG,
Material.SLIME_SPAWN_EGG,
Material.SPIDER_SPAWN_EGG,
Material.SQUID_SPAWN_EGG,
Material.STRAY_SPAWN_EGG,
Material.TRADER_LLAMA_SPAWN_EGG,
Material.TROPICAL_FISH_SPAWN_EGG,
Material.TURTLE_SPAWN_EGG,
Material.VEX_SPAWN_EGG,
Material.VILLAGER_SPAWN_EGG,
Material.VINDICATOR_SPAWN_EGG,
Material.WANDERING_TRADER_SPAWN_EGG,
Material.WITCH_SPAWN_EGG,
Material.WITHER_SKELETON_SPAWN_EGG,
Material.WOLF_SPAWN_EGG,
Material.ZOMBIE_SPAWN_EGG,
Material.ZOMBIE_HORSE_SPAWN_EGG,
Material.ZOMBIE_PIGMAN_SPAWN_EGG,
Material.ZOMBIE_VILLAGER_SPAWN_EGG);
}