Fork of Poseidon providing Bukkit #1060 to older Beta versions (b1.0-b1.7.3)
1package org.bukkit.event;
2
3import org.bukkit.entity.Projectile;
4
5import java.io.Serializable;
6
7/**
8 * Represents an event
9 */
10public abstract class Event implements Serializable {
11 private final Type type;
12 private final String name;
13
14 protected Event(final Type type) {
15 exAssert(type != null, "type is null");
16 exAssert(type != Type.CUSTOM_EVENT, "use Event(String) to make custom events");
17 this.type = type;
18 this.name = null;
19 }
20
21 protected Event(final String name) {
22 exAssert(name != null, "name is null");
23 this.type = Type.CUSTOM_EVENT;
24 this.name = name;
25 }
26
27 /**
28 * Gets the Type of this event
29 *
30 * @return Event type that this object represents
31 */
32 public final Type getType() {
33 return type;
34 }
35
36 private void exAssert(boolean b, String s) {
37 if (!b) {
38 throw new IllegalArgumentException(s);
39 }
40 }
41
42 /**
43 * Gets the event's name. Should only be used if getType() == Type.CUSTOM
44 *
45 * @return Name of this event
46 */
47 public final String getEventName() {
48 return (type != Type.CUSTOM_EVENT) ? type.toString() : name;
49 }
50
51 /**
52 * Represents an events priority in execution
53 */
54 public enum Priority {
55
56 /**
57 * Event call is of very low importance and should be ran first, to allow
58 * other plugins to further customise the outcome
59 */
60 Lowest,
61 /**
62 * Event call is of low importance
63 */
64 Low,
65 /**
66 * Event call is neither important or unimportant, and may be ran normally
67 */
68 Normal,
69 /**
70 * Event call is of high importance
71 */
72 High,
73 /**
74 * Event call is critical and must have the final say in what happens
75 * to the event
76 */
77 Highest,
78 /**
79 * Event is listened to purely for monitoring the outcome of an event.
80 * <p>
81 * No modifications to the event should be made under this priority
82 */
83 Monitor
84 }
85
86 /**
87 * Represents a category used by Type
88 */
89 public enum Category {
90
91 /**
92 * POSEIDON CATEGORIES
93 */
94 PACKET,
95
96 /**
97 * Represents Player-based events
98 *
99 * @see Category.LIVING_ENTITY
100 */
101 PLAYER,
102 /**
103 * Represents Entity-based events
104 */
105 ENTITY,
106 /**
107 * Represents Block-based events
108 */
109 BLOCK,
110 /**
111 * Represents LivingEntity-based events
112 */
113 LIVING_ENTITY,
114 /**
115 * Represents Weather-based events
116 */
117 WEATHER,
118 /**
119 * Represents Vehicle-based events
120 */
121 VEHICLE,
122 /**
123 * Represents World-based events
124 */
125 WORLD,
126 /**
127 * Represents Server and Plugin based events
128 */
129 SERVER,
130 /**
131 * Represents Inventory-based events
132 */
133 INVENTORY,
134 /**
135 * Represents any miscellaneous events
136 */
137 MISCELLANEOUS;
138 }
139
140 /**
141 * Provides a lookup for all core events
142 *
143 * @see org.bukkit.event
144 */
145 public enum Type {
146
147 /**
148 * POSEIDON EVENTS
149 */
150
151 PLAYER_RECEIVE_PACKET(Category.PACKET),
152
153 PLAYER_SEND_PACKET(Category.PACKET),
154
155 PACKET_RECEIVED(Category.PACKET),
156
157 PACKET_SENT(Category.PACKET),
158
159 CHEST_OPENED(Category.BLOCK),
160
161 /**
162 * Called when a player first starts their connection. Called before UUID is known.
163 *
164 * @see org.bukkit.event.player.PlayerConnectionInitializationEvent
165 */
166 Player_Connection_Initialization(Category.PLAYER),
167
168
169 /**
170 * PLAYER EVENTS
171 */
172
173 /**
174 * Called when a player enters the world on a server
175 *
176 * @see org.bukkit.event.player.PlayerJoinEvent
177 */
178 PLAYER_JOIN(Category.PLAYER),
179 /**
180 * Called when a player is attempting to connect to the server
181 *
182 * @see org.bukkit.event.player.PlayerLoginEvent
183 */
184 PLAYER_LOGIN(Category.PLAYER),
185 /**
186 * Called when a player has just been authenticated
187 *
188 * @see org.bukkit.event.player.PlayerPreLoginEvent
189 */
190 PLAYER_PRELOGIN(Category.PLAYER),
191 /**
192 * Called when a player respawns
193 *
194 * @see org.bukkit.event.player.PlayerRespawnEvent
195 */
196 PLAYER_RESPAWN(Category.PLAYER),
197 /**
198 * Called when a player gets kicked from the server
199 *
200 * @see org.bukkit.event.player.PlayerKickEvent
201 */
202 PLAYER_KICK(Category.PLAYER),
203 /**
204 * Called when a player sends a chat message
205 *
206 * @see org.bukkit.event.player.PlayerChatEvent
207 */
208 PLAYER_CHAT(Category.PLAYER),
209 /**
210 * Called when a player uses a command (early in the command handling process)
211 *
212 * @see org.bukkit.event.player.PlayerCommandPreprocessEvent
213 */
214 PLAYER_COMMAND_PREPROCESS(Category.PLAYER),
215 /**
216 * Called when a player leaves the server
217 *
218 * @see org.bukkit.event.player.PlayerQuitEvent
219 */
220 PLAYER_QUIT(Category.PLAYER),
221 /**
222 * Called when a player moves position in the world
223 *
224 * @see org.bukkit.event.player.PlayerMoveEvent
225 */
226 PLAYER_MOVE(Category.PLAYER),
227 /**
228 * Called before a player gets a velocity vector sent, which will instruct him to
229 * get "pushed" into a specific direction, e.g. after an explosion
230 *
231 * @see org.bukkit.event.player.PlayerVelocityEvent
232 */
233 PLAYER_VELOCITY(Category.PLAYER),
234 /**
235 * Called when a player undergoes an animation (Arm Swing is the only animation currently supported)
236 *
237 * @see org.bukkit.event.player.PlayerAnimationEvent
238 */
239 PLAYER_ANIMATION(Category.PLAYER),
240 /**
241 * Called when a player toggles sneak mode
242 *
243 * @see org.bukkit.event.player.PlayerToggleSneakEvent
244 */
245 PLAYER_TOGGLE_SNEAK(Category.PLAYER),
246 /**
247 * Called when a player interacts with an object or air
248 *
249 * @see org.bukkit.event.player.PlayerInteractEvent
250 */
251 PLAYER_INTERACT(Category.PLAYER),
252 /**
253 * Called when a player right clicks an entity
254 *
255 * @see org.bukkit.event.player.PlayerInteractEntityEvent
256 */
257 PLAYER_INTERACT_ENTITY(Category.PLAYER),
258 /**
259 * Called when a player throws an egg
260 *
261 * @see org.bukkit.event.player.PlayerEggThrowEvent
262 */
263 PLAYER_EGG_THROW(Category.PLAYER),
264 /**
265 * Called when a player teleports from one position to another
266 *
267 * @see org.bukkit.event.player.PlayerTeleportEvent
268 */
269 PLAYER_TELEPORT(Category.PLAYER),
270 /**
271 * Called when a player completes the portaling process by standing in a portal
272 *
273 * @see org.bukkit.event.player.PlayerPortalEvent
274 */
275 PLAYER_PORTAL(Category.PLAYER),
276 /**
277 * Called when a player changes their held item
278 *
279 * @see org.bukkit.event.player.PlayerItemHeldEvent
280 */
281 PLAYER_ITEM_HELD(Category.PLAYER),
282 /**
283 * Called when a player drops an item
284 *
285 * @see org.bukkit.event.player.PlayerDropItemEvent
286 */
287 PLAYER_DROP_ITEM(Category.PLAYER),
288 /**
289 * Called when a player picks an item up off the ground
290 *
291 * @see org.bukkit.event.player.PlayerPickupItemEvent
292 */
293 PLAYER_PICKUP_ITEM(Category.PLAYER),
294 /**
295 * Called after a player has changed to a new world
296 *
297 * @see org.bukkit.event.player.PlayerChangedWorldEvent
298 */
299 PLAYER_CHANGED_WORLD(Category.PLAYER),
300 /**
301 * Called when a player empties a bucket
302 *
303 * @see org.bukkit.event.player.PlayerBucketEmptyEvent
304 */
305 PLAYER_BUCKET_EMPTY(Category.PLAYER),
306 /**
307 * Called when a player fills a bucket
308 *
309 * @see org.bukkit.event.player.PlayerBucketFillEvent
310 */
311 PLAYER_BUCKET_FILL(Category.PLAYER),
312 /**
313 * Called when a player interacts with the inventory
314 *
315 * @see org.bukkit.event.player.PlayerInventoryEvent
316 */
317 PLAYER_INVENTORY(Category.PLAYER),
318 /**
319 * Called when a player enter a bed
320 *
321 * @see org.bukkit.event.player.PlayerBedEnterEvent
322 */
323 PLAYER_BED_ENTER(Category.PLAYER),
324 /**
325 * Called when a player leaves a bed
326 *
327 * @see org.bukkit.event.player.PlayerBedLeaveEvent
328 */
329 PLAYER_BED_LEAVE(Category.PLAYER),
330 /**
331 * Called when a player is fishing
332 *
333 * @see org.bukkit.event.player.PlayerFishEvent
334 */
335 PLAYER_FISH(Category.PLAYER),
336 /**
337 * Called when a player used item is damaged
338 *
339 * @see org.bukkit.event.player.PlayerItemDamageEvent
340 */
341 PLAYER_ITEM_DAMAGE(Category.PLAYER),
342
343 /**
344 * BLOCK EVENTS
345 */
346
347 /**
348 * Called when a block is damaged (hit by a player)
349 *
350 * @see org.bukkit.event.block.BlockDamageEvent
351 */
352 BLOCK_DAMAGE(Category.BLOCK),
353 /**
354 * Called when a block is undergoing a universe physics
355 * check on whether it can be built
356 * <p>
357 * For example, cacti cannot be built on grass unless overridden here
358 *
359 * @see org.bukkit.event.block.BlockCanBuildEvent
360 */
361 BLOCK_CANBUILD(Category.BLOCK),
362 /**
363 * Called when a block of water or lava attempts to flow into another
364 * block
365 *
366 * @see org.bukkit.event.block.BlockFromToEvent
367 */
368 BLOCK_FROMTO(Category.BLOCK),
369 /**
370 * Called when a block is being set on fire from another block, such as
371 * an adjacent block of fire attempting to set fire to wood
372 *
373 * @see org.bukkit.event.block.BlockIgniteEvent
374 */
375 BLOCK_IGNITE(Category.BLOCK),
376 /**
377 * Called when a block undergoes a physics check
378 * <p>
379 * A physics check is commonly called when an adjacent block changes
380 * type
381 *
382 * @see org.bukkit.event.block.BlockPhysicsEvent
383 */
384 BLOCK_PHYSICS(Category.BLOCK),
385 /**
386 * Called when a player is attempting to place a block
387 *
388 * @see org.bukkit.event.block.BlockPlaceEvent
389 */
390 BLOCK_PLACE(Category.BLOCK),
391 /**
392 * Called when a block dispenses something
393 *
394 * @see org.bukkit.event.block.BlockDispenseEvent
395 */
396 BLOCK_DISPENSE(Category.BLOCK),
397 /**
398 * Called when a block is destroyed from being burnt by fire
399 *
400 * @see org.bukkit.event.block.BlockBurnEvent
401 */
402 BLOCK_BURN(Category.BLOCK),
403 /**
404 * Called when leaves are decaying naturally
405 *
406 * @see org.bukkit.event.block.LeavesDecayEvent
407 */
408 LEAVES_DECAY(Category.BLOCK),
409 /**
410 * Called when a sign is changed
411 *
412 * @see org.bukkit.event.block.SignChangeEvent
413 */
414 SIGN_CHANGE(Category.BLOCK),
415 /**
416 * Called when a block changes redstone current. Only triggered on blocks
417 * that are actually capable of transmitting or carrying a redstone
418 * current
419 *
420 * @see org.bukkit.event.block.BlockRedstoneEvent
421 */
422 REDSTONE_CHANGE(Category.BLOCK),
423 /**
424 * Called when a block is broken by a player
425 *
426 * @see org.bukkit.event.block.BlockBreakEvent
427 */
428 BLOCK_BREAK(Category.BLOCK),
429 /**
430 * Called when a block is formed based on world conditions
431 *
432 * @see org.bukkit.event.block.BlockFormEvent
433 */
434 BLOCK_FORM(Category.BLOCK),
435 /**
436 * Called when a block spreads based on world conditions
437 *
438 * @see org.bukkit.event.block.BlockSpreadEvent
439 */
440 BLOCK_SPREAD(Category.BLOCK),
441 /**
442 * Called when a block fades, melts or disappears based on world conditions
443 *
444 * @see org.bukkit.event.block.BlockFadeEvent
445 */
446 BLOCK_FADE(Category.BLOCK),
447 /**
448 * Called when a piston extends
449 *
450 * @see org.bukkit.event.block.PistonExtendEvent
451 */
452 BLOCK_PISTON_EXTEND(Category.BLOCK),
453 /**
454 * Called when a piston retracts
455 *
456 * @see org.bukkit.event.block.PistonRetractEvent
457 */
458 BLOCK_PISTON_RETRACT(Category.BLOCK),
459
460 /**
461 * INVENTORY EVENTS
462 */
463
464 /**
465 * Called when a player opens an inventory
466 *
467 * @todo: add javadoc see comment
468 */
469 INVENTORY_OPEN(Category.INVENTORY),
470 /**
471 * Called when a player closes an inventory
472 *
473 * @todo: add javadoc see comment
474 */
475 INVENTORY_CLOSE(Category.INVENTORY),
476 /**
477 * Called when a player clicks on an inventory slot
478 *
479 * @todo: add javadoc see comment
480 */
481 INVENTORY_CLICK(Category.INVENTORY),
482 /**
483 * Called when an inventory slot changes values or type
484 *
485 * @todo: add javadoc see comment
486 */
487 INVENTORY_CHANGE(Category.INVENTORY),
488 /**
489 * Called when a player is attempting to perform an inventory transaction
490 *
491 * @todo: add javadoc see comment
492 */
493 INVENTORY_TRANSACTION(Category.INVENTORY),
494 /**
495 * Called when an ItemStack is successfully smelted in a furnace.
496 *
497 * @see org.bukkit.event.inventory.FurnaceSmeltEvent
498 */
499 FURNACE_SMELT(Category.INVENTORY),
500 /**
501 * Called when an ItemStack is successfully burned as fuel in a furnace.
502 *
503 * @see org.bukkit.event.inventory.FurnaceBurnEvent
504 */
505 FURNACE_BURN(Category.INVENTORY),
506
507 /**
508 * SERVER EVENTS
509 */
510
511 /**
512 * Called when a plugin is enabled
513 *
514 * @see org.bukkit.event.server.PluginEnableEvent
515 */
516 PLUGIN_ENABLE(Category.SERVER),
517 /**
518 * Called when a plugin is disabled
519 *
520 * @see org.bukkit.event.server.PluginDisableEvent
521 */
522 PLUGIN_DISABLE(Category.SERVER),
523 /**
524 * Called when a server command is called
525 *
526 * @see org.bukkit.event.server.ServerCommandEvent
527 */
528 SERVER_COMMAND(Category.SERVER),
529 /**
530 * Called when a map is initialized (created or loaded into memory)
531 *
532 * @see org.bukkit.event.server.MapInitializeEvent
533 */
534 MAP_INITIALIZE(Category.SERVER),
535
536 /**
537 * WORLD EVENTS
538 */
539
540 /**
541 * Called when a chunk is loaded
542 * <p>
543 * If a new chunk is being generated for loading, it will call
544 * Type.CHUNK_GENERATION and then Type.CHUNK_LOADED upon completion
545 *
546 * @see org.bukkit.event.world.ChunkLoadEvent
547 */
548 CHUNK_LOAD(Category.WORLD),
549 /**
550 * Called when a chunk is unloaded
551 *
552 * @see org.bukkit.event.world.ChunkUnloadEvent
553 */
554 CHUNK_UNLOAD(Category.WORLD),
555 /**
556 * Called when a newly created chunk has been populated.
557 * <p>
558 * If your intent is to populate the chunk using this event, please see {@link BlockPopulator}
559 *
560 * @see org.bukkit.event.world.ChunkPopulateEvent
561 */
562 CHUNK_POPULATED(Category.WORLD),
563 /**
564 * Called when an ItemEntity spawns in the world
565 *
566 * @see org.bukkit.event.entity.ItemSpawnEvent
567 */
568 ITEM_SPAWN(Category.WORLD),
569 /**
570 * Called when a World's spawn is changed
571 *
572 * @see org.bukkit.event.world.SpawnChangeEvent
573 */
574 SPAWN_CHANGE(Category.WORLD),
575 /**
576 * Called when a world is saved
577 *
578 * @see org.bukkit.event.world.WorldSaveEvent
579 */
580 WORLD_SAVE(Category.WORLD),
581 /**
582 * Called when a World is initializing
583 *
584 * @see org.bukkit.event.world.WorldInitEvent
585 */
586 WORLD_INIT(Category.WORLD),
587 /**
588 * Called when a World is loaded
589 *
590 * @see org.bukkit.event.world.WorldLoadEvent
591 */
592 WORLD_LOAD(Category.WORLD),
593 /**
594 * Called when a World is unloaded
595 *
596 * @see org.bukkit.event.world.WorldUnloadEvent
597 */
598 WORLD_UNLOAD(Category.WORLD),
599 /**
600 * Called when world attempts to create a matching end to a portal
601 *
602 * @see org.bukkit.event.world.PortalCreateEvent
603 */
604 PORTAL_CREATE(Category.WORLD),
605
606 /**
607 * ENTITY EVENTS
608 */
609
610 /**
611 * Called when an item despawns
612 *
613 * @see org.bukkit.event.entity.ItemDespawnEvent
614 */
615 ITEM_DESPAWN(Category.ENTITY),
616 /**
617 * Called when a painting is placed by player
618 *
619 * @see org.bukkit.event.painting.PaintingPlaceEvent
620 */
621 PAINTING_PLACE(Category.ENTITY),
622 /**
623 * Called when a painting is removed
624 *
625 * @see org.bukkit.event.painting.PaintingBreakEvent
626 */
627 PAINTING_BREAK(Category.ENTITY),
628 /**
629 * Called when an entity touches a portal block
630 *
631 * @see org.bukkit.event.entity.EntityPortalEnterEvent
632 */
633 ENTITY_PORTAL_ENTER(Category.ENTITY),
634
635 /**
636 * LIVING_ENTITY EVENTS
637 */
638
639 /**
640 * Called when a creature, either hostile or neutral, attempts to spawn
641 * in the world "naturally"
642 *
643 * @see org.bukkit.event.entity.CreatureSpawnEvent
644 */
645 CREATURE_SPAWN(Category.LIVING_ENTITY),
646 /**
647 * Called when a LivingEntity is damaged with no source.
648 *
649 * @see org.bukkit.event.entity.EntityDamageEvent
650 */
651 ENTITY_DAMAGE(Category.LIVING_ENTITY), // Project Poseidon Start
652 ENTITY_DAMAGE_BY_ENTITY(Category.LIVING_ENTITY), ENTITY_DAMAGE_BY_BLOCK(Category.LIVING_ENTITY),
653 // Project Poseidon End
654 /**
655 * Called when a LivingEntity dies
656 *
657 * @see org.bukkit.event.entity.EntityDeathEvent
658 */
659 ENTITY_DEATH(Category.LIVING_ENTITY),
660 /**
661 * Called when a Skeleton or Zombie catch fire due to the sun
662 *
663 * @see org.bukkit.event.entity.EntityCombustEvent
664 */
665 ENTITY_COMBUST(Category.LIVING_ENTITY),
666 /**
667 * Called when an entity explodes, either TNT, Creeper, or Ghast Fireball
668 *
669 * @see org.bukkit.event.entity.EntityExplodeEvent
670 */
671 ENTITY_EXPLODE(Category.LIVING_ENTITY),
672 /**
673 * Called when an entity has made a decision to explode.
674 * <p>
675 * Provides an opportunity to act on the entity, change the explosion radius,
676 * or to change the fire-spread flag.
677 * <p>
678 * Canceling the event negates the entity's decision to explode.
679 * For EntityCreeper, this resets the fuse but does not kill the Entity.
680 * For EntityFireball and EntityTNTPrimed....?
681 *
682 * @see org.bukkit.event.entity.ExplosionPrimeEvent
683 */
684 EXPLOSION_PRIME(Category.LIVING_ENTITY),
685 /**
686 * Called when an entity targets another entity
687 *
688 * @see org.bukkit.event.entity.EntityTargetEvent
689 */
690 ENTITY_TARGET(Category.LIVING_ENTITY),
691 /**
692 * Called when an entity interacts with a block
693 * This event specifically excludes player entities
694 *
695 * @see org.bukkit.event.entity.EntityInteractEvent
696 */
697 ENTITY_INTERACT(Category.LIVING_ENTITY),
698 /**
699 * Called when a creeper gains or loses a power shell
700 *
701 * @see org.bukkit.event.entity.CreeperPowerEvent
702 */
703 CREEPER_POWER(Category.LIVING_ENTITY),
704 /**
705 * Called when a pig is zapped, zombifying it
706 *
707 * @see org.bukkit.event.entity.PigZapEvent
708 */
709 PIG_ZAP(Category.LIVING_ENTITY),
710 /**
711 * Called when a LivingEntity is tamed
712 *
713 * @see org.bukkit.event.entity.EntityTameEvent
714 */
715 ENTITY_TAME(Category.LIVING_ENTITY),
716 /**
717 * Called when a {@link Projectile} hits something
718 *
719 * @see org.bukkit.event.entity.ProjectileHitEvent
720 */
721 PROJECTILE_HIT(Category.ENTITY),
722
723 /**
724 * Called when a LivingEntity is regains health
725 *
726 * @see org.bukkit.event.entity.EntityRegainHealthEvent
727 */
728 ENTITY_REGAIN_HEALTH(Category.LIVING_ENTITY),
729
730 /**
731 * WEATHER EVENTS
732 */
733
734 /**
735 * Called when a lightning entity strikes somewhere
736 *
737 * @see org.bukkit.event.weather.LightningStrikeEvent
738 */
739 LIGHTNING_STRIKE(Category.WEATHER),
740 /**
741 * Called when the weather in a world changes
742 *
743 * @see org.bukkit.event.weather.WeatherChangeEvent
744 */
745 WEATHER_CHANGE(Category.WEATHER),
746 /**
747 * Called when the thunder state in a world changes
748 *
749 * @see org.bukkit.event.weather.ThunderChangeEvent
750 */
751 THUNDER_CHANGE(Category.WEATHER),
752
753 /**
754 * VEHICLE EVENTS
755 */
756
757 /**
758 * Called when a vehicle is placed by a player
759 *
760 * @see org.bukkit.event.vehicle.VehicleCreateEvent
761 */
762 VEHICLE_CREATE(Category.VEHICLE),
763 /**
764 * Called when a vehicle is destroyed
765 *
766 * @see org.bukkit.event.vehicle.VehicleDestroyEvent
767 */
768 VEHICLE_DESTROY(Category.VEHICLE),
769 /**
770 * Called when a vehicle is damaged by a LivingEntity
771 *
772 * @see org.bukkit.event.vehicle.VehicleDamageEvent
773 */
774 VEHICLE_DAMAGE(Category.VEHICLE),
775 /**
776 * Called when a vehicle collides with an Entity
777 *
778 * @see org.bukkit.event.vehicle.VehicleCollisionEvent
779 */
780 VEHICLE_COLLISION_ENTITY(Category.VEHICLE),
781 /**
782 * Called when a vehicle collides with a Block
783 *
784 * @see org.bukkit.event.vehicle.VehicleBlockCollisionEvent
785 */
786 VEHICLE_COLLISION_BLOCK(Category.VEHICLE),
787 /**
788 * Called when a vehicle is entered by a LivingEntity
789 *
790 * @see org.bukkit.event.vehicle.VehicleEnterEvent
791 */
792 VEHICLE_ENTER(Category.VEHICLE),
793 /**
794 * Called when a vehicle is exited by a LivingEntity
795 *
796 * @see org.bukkit.event.vehicle.VehicleExitEvent
797 */
798 VEHICLE_EXIT(Category.VEHICLE),
799 /**
800 * Called when a vehicle moves position in the world
801 *
802 * @see org.bukkit.event.vehicle.VehicleMoveEvent
803 */
804 VEHICLE_MOVE(Category.VEHICLE),
805 /**
806 * Called when a vehicle is going through an update cycle, rechecking itself
807 *
808 * @see org.bukkit.event.vehicle.VehicleUpdateEvent
809 */
810 VEHICLE_UPDATE(Category.VEHICLE),
811 /**
812 * MISCELLANEOUS EVENTS
813 */
814
815 /**
816 * Represents a custom event, isn't actually used
817 */
818 CUSTOM_EVENT(Category.MISCELLANEOUS);
819
820 private final Category category;
821
822 private Type(Category category) {
823 this.category = category;
824 }
825
826 // Project Poseidon Start
827 public static Type getTypeByName(String name) {
828 for (Type type : Type.values()) {
829 String typeName = type.name();
830 String typeName_ = typeName.replace("_", "");
831 if (name.equalsIgnoreCase(typeName)) return type;
832 if (name.equalsIgnoreCase(typeName_)) return type;
833 }
834 return null;
835 }
836 // Project Poseidon End
837
838 /**
839 * Gets the Category assigned to this event
840 *
841 * @return Category of this Event.Type
842 */
843 public Category getCategory() {
844 return category;
845 }
846 }
847
848 public enum Result {
849
850 /**
851 * Deny the event.
852 * Depending on the event, the action indicated by the event will either not take place or will be reverted.
853 * Some actions may not be denied.
854 */
855 DENY,
856 /**
857 * Neither deny nor allow the event.
858 * The server will proceed with its normal handling.
859 */
860 DEFAULT,
861 /**
862 * Allow / Force the event.
863 * The action indicated by the event will take place if possible, even if the server would not normally allow the action.
864 * Some actions may not be allowed.
865 */
866 ALLOW;
867 }
868}