Skip to content

Commit

Permalink
fix slime-fun (or other third-part plugins) can dupe items problem
Browse files Browse the repository at this point in the history
  • Loading branch information
ColdeZhang committed Jan 16, 2025
1 parent 2e064b5 commit 4a84d62
Show file tree
Hide file tree
Showing 8 changed files with 241 additions and 241 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ var libraries = listOf<String>()
libraries = libraries + "cn.lunadeer:MinecraftPluginUtils:2.0.7"

group = "cn.lunadeer"
version = "3.3.1-beta"
version = "3.3.2-beta"

java {
toolchain.languageVersion.set(JavaLanguageVersion.of(17))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
import static org.bukkit.Material.FARMLAND;

public class EnvironmentEvents implements Listener {
@EventHandler(priority = EventPriority.HIGHEST) // creeper_explode
@EventHandler(priority = EventPriority.LOWEST) // creeper_explode
public void onEntityExplode(EntityExplodeEvent event) {
Entity entity = event.getEntity();
XLogger.debug("EntityExplodeEvent: " + entity.getType());
Expand All @@ -44,7 +44,7 @@ public void onEntityExplode(EntityExplodeEvent event) {
});
}

@EventHandler(priority = EventPriority.HIGHEST) // creeper_explode - bed anchor
@EventHandler(priority = EventPriority.LOWEST) // creeper_explode - bed anchor
public void onBedAnchorExplosion(BlockExplodeEvent event) {
BlockState block = event.getExplodedBlockState();
if (block == null) {
Expand All @@ -56,7 +56,7 @@ public void onBedAnchorExplosion(BlockExplodeEvent event) {
});
}

@EventHandler(priority = EventPriority.HIGHEST) // creeper_explode - item frame
@EventHandler(priority = EventPriority.LOWEST) // creeper_explode - item frame
public void onItemFrameExploded(HangingBreakByEntityEvent event) {
Entity entity = event.getEntity();
if (event.getCause() != HangingBreakEvent.RemoveCause.EXPLOSION) {
Expand All @@ -66,7 +66,7 @@ public void onItemFrameExploded(HangingBreakByEntityEvent event) {
checkFlag(dom, Flags.CREEPER_EXPLODE, event);
}

@EventHandler(priority = EventPriority.HIGHEST) // creeper_explode - item frame
@EventHandler(priority = EventPriority.LOWEST) // creeper_explode - item frame
public void onItemFrameShot(ProjectileHitEvent event) {
Entity hit = event.getHitEntity();
if (hit == null) {
Expand All @@ -82,7 +82,7 @@ public void onItemFrameShot(ProjectileHitEvent event) {
checkFlag(dom, Flags.CREEPER_EXPLODE, event);
}

@EventHandler(priority = EventPriority.HIGHEST) // creeper_explode - armor stand
@EventHandler(priority = EventPriority.LOWEST) // creeper_explode - armor stand
public void onArmorStandExploded(EntityDamageByEntityEvent event) {
Entity entity = event.getEntity();
if (entity.getType() != EntityType.ARMOR_STAND) {
Expand All @@ -95,7 +95,7 @@ public void onArmorStandExploded(EntityDamageByEntityEvent event) {
checkFlag(dom, Flags.CREEPER_EXPLODE, event);
}

@EventHandler(priority = EventPriority.HIGHEST) // item_frame_proj_damage
@EventHandler(priority = EventPriority.LOWEST) // item_frame_proj_damage
public void removeSomeOnItemFrameByArrow(HangingBreakByEntityEvent event) {
if (event.getCause() != HangingBreakEvent.RemoveCause.ENTITY) {
return;
Expand All @@ -121,7 +121,7 @@ private static boolean isNotExplodeEntity(Entity damager) {
&& damager.getType() != EntityType.DRAGON_FIREBALL;
}

@EventHandler(priority = EventPriority.HIGHEST) // dragon_break_block
@EventHandler(priority = EventPriority.LOWEST) // dragon_break_block
public void onDragonBreakBlock(EntityExplodeEvent event) {
Entity entity = event.getEntity();
if (entity.getType() != EntityType.ENDER_DRAGON) {
Expand All @@ -133,7 +133,7 @@ public void onDragonBreakBlock(EntityExplodeEvent event) {
});
}

@EventHandler(priority = EventPriority.HIGHEST) // fire_spread
@EventHandler(priority = EventPriority.LOWEST) // fire_spread
public void onFireSpread(BlockIgniteEvent event) {
Player player = event.getPlayer();
if (player != null) {
Expand All @@ -144,7 +144,7 @@ public void onFireSpread(BlockIgniteEvent event) {
checkFlag(dom, Flags.FIRE_SPREAD, event);
}

@EventHandler(priority = EventPriority.HIGHEST) // flow_in_protection
@EventHandler(priority = EventPriority.LOWEST) // flow_in_protection
public void onLiquidFlowIn(BlockFromToEvent event) {
Location from = event.getBlock().getLocation();
Location to = event.getToBlock().getLocation();
Expand All @@ -161,7 +161,7 @@ public void onLiquidFlowIn(BlockFromToEvent event) {
checkFlag(dom_to, Flags.FLOW_IN_PROTECTION, event);
}

@EventHandler(priority = EventPriority.HIGHEST) // mob_drop_item
@EventHandler(priority = EventPriority.LOWEST) // mob_drop_item
public void onMobDropItem(EntityDeathEvent event) {
Entity entity = event.getEntity();
if (entity instanceof Player) {
Expand All @@ -180,7 +180,7 @@ public void onMobDropItem(EntityDeathEvent event) {
event.getDrops().clear();
}

@EventHandler(priority = EventPriority.HIGHEST) // tnt_explode
@EventHandler(priority = EventPriority.LOWEST) // tnt_explode
public void onTntExplode(EntityExplodeEvent event) {
Entity entity = event.getEntity();
if (entity.getType() != EntityType.MINECART_TNT && entity.getType() != EntityType.PRIMED_TNT) {
Expand All @@ -192,7 +192,7 @@ public void onTntExplode(EntityExplodeEvent event) {
});
}

@EventHandler(priority = EventPriority.HIGHEST) // tnt_explode - entity
@EventHandler(priority = EventPriority.LOWEST) // tnt_explode - entity
public void onArmorStandExplodedByTnt(EntityDamageByEntityEvent event) {
Entity entity = event.getEntity();
Entity harmer = event.getDamager();
Expand All @@ -203,7 +203,7 @@ public void onArmorStandExplodedByTnt(EntityDamageByEntityEvent event) {
checkFlag(dom, Flags.TNT_EXPLODE, event);
}

@EventHandler(priority = EventPriority.HIGHEST) // trample
@EventHandler(priority = EventPriority.LOWEST) // trample
public void onFarmlandTrample(PlayerInteractEvent event) {
if (event.getAction() != Action.PHYSICAL) {
return;
Expand All @@ -224,7 +224,7 @@ public void onFarmlandTrample(PlayerInteractEvent event) {
TRIG_PRESSURE_MOB("trig_pressure_mob", "生物触发压力板", "生物(不包含玩家)是否可以触发压力板", false, true, true),
TRIG_PRESSURE_DROP("trig_pressure_drop", "掉落物触发压力板", "掉落物是否可以触发压力板", false, true, true),
*/
@EventHandler(priority = EventPriority.HIGHEST) // trig_pressure_proj
@EventHandler(priority = EventPriority.LOWEST) // trig_pressure_proj
public void onPressurePlateTriggeredByProjectile(EntityInteractEvent event) {
if (!(event.getEntity() instanceof Projectile)) {
return;
Expand All @@ -237,7 +237,7 @@ public void onPressurePlateTriggeredByProjectile(EntityInteractEvent event) {
checkFlag(dom, Flags.TRIG_PRESSURE_PROJ, event);
}

@EventHandler(priority = EventPriority.HIGHEST) // trig_pressure_mob
@EventHandler(priority = EventPriority.LOWEST) // trig_pressure_mob
public void onPressurePlateTriggeredByMob(EntityInteractEvent event) {
if (!(event.getEntity() instanceof Mob)) {
return;
Expand All @@ -250,7 +250,7 @@ public void onPressurePlateTriggeredByMob(EntityInteractEvent event) {
checkFlag(dom, Flags.TRIG_PRESSURE_MOB, event);
}

@EventHandler(priority = EventPriority.HIGHEST) // trig_pressure_drop
@EventHandler(priority = EventPriority.LOWEST) // trig_pressure_drop
public void onPressurePlateTriggeredByDrop(EntityInteractEvent event) {
if (!(event.getEntity() instanceof Item)) {
return;
Expand All @@ -263,7 +263,7 @@ public void onPressurePlateTriggeredByDrop(EntityInteractEvent event) {
checkFlag(dom, Flags.TRIG_PRESSURE_DROP, event);
}

@EventHandler(priority = EventPriority.HIGHEST) // wither_spawn
@EventHandler(priority = EventPriority.LOWEST) // wither_spawn
public void onWitherSpawn(CreatureSpawnEvent event) {
Entity entity = event.getEntity();
if (entity.getType() != EntityType.WITHER) {
Expand All @@ -273,7 +273,7 @@ public void onWitherSpawn(CreatureSpawnEvent event) {
checkFlag(dom, Flags.WITHER_SPAWN, event);
}

@EventHandler(priority = EventPriority.HIGHEST) // wither_spawn - explode
@EventHandler(priority = EventPriority.LOWEST) // wither_spawn - explode
public void onWitherSpawnExplode(EntityExplodeEvent event) {
Entity entity = event.getEntity();
if (entity.getType() != EntityType.WITHER) {
Expand All @@ -285,7 +285,7 @@ public void onWitherSpawnExplode(EntityExplodeEvent event) {
});
}

@EventHandler(priority = EventPriority.HIGHEST) // ender_man spawn
@EventHandler(priority = EventPriority.LOWEST) // ender_man spawn
public void onEnderManSpawn(CreatureSpawnEvent event) {
Entity entity = event.getEntity();
if (entity.getType() != EntityType.ENDERMAN) {
Expand All @@ -295,7 +295,7 @@ public void onEnderManSpawn(CreatureSpawnEvent event) {
checkFlag(dom, Flags.ENDER_MAN, event);
}

@EventHandler(priority = EventPriority.HIGHEST) // ender_man escape
@EventHandler(priority = EventPriority.LOWEST) // ender_man escape
public void onEnderManEscape(EntityTeleportEvent event) {
Entity entity = event.getEntity();
if (entity.getType() != EntityType.ENDERMAN) {
Expand All @@ -309,7 +309,7 @@ public void onEnderManEscape(EntityTeleportEvent event) {
}
}

@EventHandler(priority = EventPriority.HIGHEST) // monster_spawn
@EventHandler(priority = EventPriority.LOWEST) // monster_spawn
public void onMonsterSpawn(CreatureSpawnEvent event) {
Entity entity = event.getEntity();
if (!(entity instanceof Monster)) {
Expand All @@ -319,7 +319,7 @@ public void onMonsterSpawn(CreatureSpawnEvent event) {
checkFlag(dom, Flags.MONSTER_SPAWN, event);
}

@EventHandler(priority = EventPriority.HIGHEST) // animal_spawn
@EventHandler(priority = EventPriority.LOWEST) // animal_spawn
public void onAnimalSpawn(CreatureSpawnEvent event) {
Entity entity = event.getEntity();
if (!(entity instanceof Animals)) {
Expand All @@ -329,7 +329,7 @@ public void onAnimalSpawn(CreatureSpawnEvent event) {
checkFlag(dom, Flags.ANIMAL_SPAWN, event);
}

@EventHandler(priority = EventPriority.HIGHEST) // villager_spawn
@EventHandler(priority = EventPriority.LOWEST) // villager_spawn
public void onVillagerSpawn(CreatureSpawnEvent event) {
Entity entity = event.getEntity();
if (entity.getType() != EntityType.VILLAGER) {
Expand All @@ -339,7 +339,7 @@ public void onVillagerSpawn(CreatureSpawnEvent event) {
checkFlag(dom, Flags.VILLAGER_SPAWN, event);
}

@EventHandler(priority = EventPriority.HIGHEST)
@EventHandler(priority = EventPriority.LOWEST)
public void onHopper(InventoryMoveItemEvent event) { // hopper_outside
Inventory hopper = event.getDestination();
Inventory inventory = event.getSource();
Expand All @@ -355,7 +355,7 @@ public void onHopper(InventoryMoveItemEvent event) { // hopper_outside
}
}

@EventHandler(priority = EventPriority.HIGHEST)
@EventHandler(priority = EventPriority.LOWEST)
public void onBlockPushedByPiston(BlockPistonExtendEvent event) { // piston_outside
Block piston = event.getBlock();
DominionDTO pistonDom = Cache.instance.getDominionByLoc(piston.getLocation());
Expand All @@ -377,7 +377,7 @@ public void onBlockPushedByPiston(BlockPistonExtendEvent event) { // piston_ou
}
}

@EventHandler(priority = EventPriority.HIGHEST)
@EventHandler(priority = EventPriority.LOWEST)
public void onGravityBlockFalling(EntityChangeBlockEvent event) { // gravity_block
Entity entity = event.getEntity();
if (!(entity instanceof FallingBlock)) {
Expand Down
Loading

0 comments on commit 4a84d62

Please sign in to comment.