11package de .z0rdak .yawp .handler .flags ;
22
33import de .z0rdak .yawp .api .FlagEvaluator ;
4- import de .z0rdak .yawp .api .events .region . FlagCheckEvent ;
5- import de .z0rdak .yawp .api .events .region .FlagCheckResult ;
4+ import de .z0rdak .yawp .api .events .flag . FlagCheckRequest ;
5+ import de .z0rdak .yawp .api .events .flag .FlagCheckResult ;
66import de .z0rdak .yawp .constants .Constants ;
77import de .z0rdak .yawp .core .flag .FlagState ;
88import de .z0rdak .yawp .core .flag .RegionFlag ;
@@ -47,16 +47,16 @@ public static void onEnderTeleportTo(EntityTeleportEvent.EnderEntity event) {
4747 // handle enderman teleportation
4848 BlockPos target = new BlockPos ((int ) event .getPrev ().x , (int ) event .getPrev ().y , (int ) event .getPrev ().z );
4949 if (event .getEntityLiving () instanceof EnderMan ) {
50- FlagCheckEvent checkEvent = new FlagCheckEvent (target , RegionFlag .ENDERMAN_TELEPORT_FROM_REGION , dim );
51- if (Services .EVENT .post (checkEvent )) {
50+ FlagCheckRequest checkEvent = new FlagCheckRequest (target , RegionFlag .ENDERMAN_TELEPORT_FROM_REGION , dim );
51+ if (Services .FLAG_EVENT_DISPATCHER .post (checkEvent )) {
5252 return ;
5353 }
5454 FlagEvaluator .processCheck (checkEvent , denyResult -> event .setCanceled (true ));
5555 }
5656 // handle shulker teleportation
5757 if (event .getEntityLiving () instanceof Shulker ) {
58- FlagCheckEvent checkEvent = new FlagCheckEvent (target , RegionFlag .SHULKER_TELEPORT_FROM_REGION , dim );
59- if (Services .EVENT .post (checkEvent )) {
58+ FlagCheckRequest checkEvent = new FlagCheckRequest (target , RegionFlag .SHULKER_TELEPORT_FROM_REGION , dim );
59+ if (Services .FLAG_EVENT_DISPATCHER .post (checkEvent )) {
6060 return ;
6161 }
6262 FlagEvaluator .processCheck (checkEvent , denyResult -> event .setCanceled (true ));
@@ -76,35 +76,35 @@ public static void onFall(LivingFallEvent event) {
7676 event .setDamageMultiplier (0.0f );
7777 };
7878
79- FlagCheckEvent checkEvent = new FlagCheckEvent (target , RegionFlag .FALL_DAMAGE , dim , entity instanceof Player ? (Player ) entity : null );
80- if (Services .EVENT .post (checkEvent )) {
79+ FlagCheckRequest checkEvent = new FlagCheckRequest (target , RegionFlag .FALL_DAMAGE , dim , entity instanceof Player ? (Player ) entity : null );
80+ if (Services .FLAG_EVENT_DISPATCHER .post (checkEvent )) {
8181 return ;
8282 }
8383 FlagState flagState = FlagEvaluator .processCheck (checkEvent , preventFallDmg );
8484 if (flagState == FlagState .DENIED )
8585 return ;
8686
8787 if (entity instanceof Player player ) {
88- checkEvent = new FlagCheckEvent (target , RegionFlag .FALL_DAMAGE_PLAYERS , dim , player );
89- if (Services .EVENT .post (checkEvent )) {
88+ checkEvent = new FlagCheckRequest (target , RegionFlag .FALL_DAMAGE_PLAYERS , dim , player );
89+ if (Services .FLAG_EVENT_DISPATCHER .post (checkEvent )) {
9090 return ;
9191 }
9292 }
9393 if (isVillager (entity )) {
94- checkEvent = new FlagCheckEvent (target , RegionFlag .FALL_DAMAGE_VILLAGERS , dim );
95- if (Services .EVENT .post (checkEvent )) {
94+ checkEvent = new FlagCheckRequest (target , RegionFlag .FALL_DAMAGE_VILLAGERS , dim );
95+ if (Services .FLAG_EVENT_DISPATCHER .post (checkEvent )) {
9696 return ;
9797 }
9898 }
9999 if (isAnimal (entity )) {
100- checkEvent = new FlagCheckEvent (target , RegionFlag .FALL_DAMAGE_ANIMALS , dim );
101- if (Services .EVENT .post (checkEvent )) {
100+ checkEvent = new FlagCheckRequest (target , RegionFlag .FALL_DAMAGE_ANIMALS , dim );
101+ if (Services .FLAG_EVENT_DISPATCHER .post (checkEvent )) {
102102 return ;
103103 }
104104 }
105105 if (isMonster (entity )) {
106- checkEvent = new FlagCheckEvent (target , RegionFlag .FALL_DAMAGE_MONSTERS , dim );
107- if (Services .EVENT .post (checkEvent )) {
106+ checkEvent = new FlagCheckRequest (target , RegionFlag .FALL_DAMAGE_MONSTERS , dim );
107+ if (Services .FLAG_EVENT_DISPATCHER .post (checkEvent )) {
108108 return ;
109109 }
110110 }
@@ -122,55 +122,55 @@ public static void onEntityJoinWorld(EntityJoinLevelEvent event) {
122122 BlockPos target = entity .blockPosition ();
123123 Consumer <FlagCheckResult > onDenyHandler = denyResult -> event .setCanceled (true );
124124
125- FlagCheckEvent checkEvent = null ;
125+ FlagCheckRequest checkEvent = null ;
126126 if (entity instanceof Mob ) {
127- checkEvent = new FlagCheckEvent (target , RegionFlag .SPAWNING_ALL , dim );
128- if (Services .EVENT .post (checkEvent )) {
127+ checkEvent = new FlagCheckRequest (target , RegionFlag .SPAWNING_ALL , dim );
128+ if (Services .FLAG_EVENT_DISPATCHER .post (checkEvent )) {
129129 return ;
130130 }
131131 FlagState flagState = FlagEvaluator .processCheck (checkEvent , onDenyHandler );
132132 if (flagState == FlagState .DENIED )
133133 return ;
134134 }
135135 if (isAnimal (entity )) {
136- checkEvent = new FlagCheckEvent (target , RegionFlag .SPAWNING_ANIMAL , dim );
137- if (Services .EVENT .post (checkEvent )) {
136+ checkEvent = new FlagCheckRequest (target , RegionFlag .SPAWNING_ANIMAL , dim );
137+ if (Services .FLAG_EVENT_DISPATCHER .post (checkEvent )) {
138138 return ;
139139 }
140140 }
141141 if (isMonster (entity )) {
142- checkEvent = new FlagCheckEvent (target , RegionFlag .SPAWNING_MONSTER , dim );
143- if (Services .EVENT .post (checkEvent )) {
142+ checkEvent = new FlagCheckRequest (target , RegionFlag .SPAWNING_MONSTER , dim );
143+ if (Services .FLAG_EVENT_DISPATCHER .post (checkEvent )) {
144144 return ;
145145 }
146146 }
147147 if (entity instanceof SnowGolem || entity instanceof IronGolem ) {
148- checkEvent = new FlagCheckEvent (target , RegionFlag .SPAWNING_GOLEM , dim );
149- if (Services .EVENT .post (checkEvent )) {
148+ checkEvent = new FlagCheckRequest (target , RegionFlag .SPAWNING_GOLEM , dim );
149+ if (Services .FLAG_EVENT_DISPATCHER .post (checkEvent )) {
150150 return ;
151151 }
152152 }
153153 if (entity instanceof Villager ) {
154- checkEvent = new FlagCheckEvent (target , RegionFlag .SPAWNING_VILLAGER , dim );
155- if (Services .EVENT .post (checkEvent )) {
154+ checkEvent = new FlagCheckRequest (target , RegionFlag .SPAWNING_VILLAGER , dim );
155+ if (Services .FLAG_EVENT_DISPATCHER .post (checkEvent )) {
156156 return ;
157157 }
158158 }
159159 if (entity instanceof WanderingTrader || entity instanceof TraderLlama ) {
160- checkEvent = new FlagCheckEvent (target , RegionFlag .SPAWNING_TRADER , dim );
161- if (Services .EVENT .post (checkEvent )) {
160+ checkEvent = new FlagCheckRequest (target , RegionFlag .SPAWNING_TRADER , dim );
161+ if (Services .FLAG_EVENT_DISPATCHER .post (checkEvent )) {
162162 return ;
163163 }
164164 }
165165 if (entity instanceof Slime ) {
166- checkEvent = new FlagCheckEvent (target , RegionFlag .SPAWNING_SLIME , dim );
167- if (Services .EVENT .post (checkEvent )) {
166+ checkEvent = new FlagCheckRequest (target , RegionFlag .SPAWNING_SLIME , dim );
167+ if (Services .FLAG_EVENT_DISPATCHER .post (checkEvent )) {
168168 return ;
169169 }
170170 }
171171 if (entity instanceof ExperienceOrb ) {
172- checkEvent = new FlagCheckEvent (target , RegionFlag .SPAWNING_XP , dim );
173- if (Services .EVENT .post (checkEvent )) {
172+ checkEvent = new FlagCheckRequest (target , RegionFlag .SPAWNING_XP , dim );
173+ if (Services .FLAG_EVENT_DISPATCHER .post (checkEvent )) {
174174 return ;
175175 }
176176 }
0 commit comments