-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Permission d'interagir avec les entites sur une île
- Loading branch information
Showing
5 changed files
with
68 additions
and
2 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
plugin/src/main/java/fr/euphyllia/skyllia/listeners/bukkitevents/player/InteractEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
package fr.euphyllia.skyllia.listeners.bukkitevents.player; | ||
|
||
import fr.euphyllia.skyllia.api.InterneAPI; | ||
import fr.euphyllia.skyllia.api.skyblock.model.permissions.PermissionsIsland; | ||
import fr.euphyllia.skyllia.listeners.ListenersUtils; | ||
import org.apache.logging.log4j.LogManager; | ||
import org.apache.logging.log4j.Logger; | ||
import org.bukkit.entity.Player; | ||
import org.bukkit.event.Event; | ||
import org.bukkit.event.EventHandler; | ||
import org.bukkit.event.EventPriority; | ||
import org.bukkit.event.Listener; | ||
import org.bukkit.event.player.PlayerInteractAtEntityEvent; | ||
import org.bukkit.event.player.PlayerInteractEntityEvent; | ||
import org.bukkit.event.player.PlayerInteractEvent; | ||
|
||
public class InteractEvent implements Listener { | ||
private final InterneAPI api; | ||
private final Logger logger = LogManager.getLogger(InteractEvent.class); | ||
|
||
public InteractEvent(InterneAPI interneAPI) { | ||
this.api = interneAPI; | ||
} | ||
|
||
@EventHandler(priority = EventPriority.HIGHEST) | ||
public void onPlayerInteractEvent(final PlayerInteractEvent event) { | ||
if (event.useInteractedBlock().equals(Event.Result.DENY)) return; | ||
if (event.useItemInHand().equals(Event.Result.DENY)) return; | ||
|
||
Player player = event.getPlayer(); | ||
if (player.hasPermission("skyllia.interact.bypass")) { | ||
return; | ||
} | ||
ListenersUtils.checkPermission(player.getChunk(), player, PermissionsIsland.INTERACT, event); | ||
} | ||
|
||
@EventHandler(priority = EventPriority.HIGHEST) | ||
public void onPlayerInteractEntitiesEvent(final PlayerInteractEntityEvent event) { | ||
if (event.isCancelled()) return; | ||
|
||
Player player = event.getPlayer(); | ||
if (player.hasPermission("skyllia.interact_entity.bypass")) { | ||
return; | ||
} | ||
ListenersUtils.checkPermission(event.getRightClicked().getChunk(), player, PermissionsIsland.INTERACT_ENTITIES, event); | ||
} | ||
|
||
@EventHandler(priority = EventPriority.HIGHEST) | ||
public void onPlayerInteractEntitiesEvent(final PlayerInteractAtEntityEvent event) { | ||
if (event.isCancelled()) return; | ||
|
||
Player player = event.getPlayer(); | ||
if (player.hasPermission("skyllia.interact_entity.bypass")) { | ||
return; | ||
} | ||
ListenersUtils.checkPermission(event.getRightClicked().getChunk(), player, PermissionsIsland.INTERACT_ENTITIES, event); | ||
} | ||
|
||
} |