-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #49 from efrei-craft/init-dac
Draft: DAC + MapManager mapFolder
- Loading branch information
Showing
12 changed files
with
439 additions
and
56 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
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 was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import net.minecrell.pluginyml.bukkit.BukkitPluginDescription | ||
|
||
plugins { | ||
`java-library` | ||
id("net.minecrell.plugin-yml.bukkit") version "0.5.2" // Generates plugin.yml | ||
} | ||
|
||
dependencies { | ||
implementation(project(":core")) | ||
|
||
compileOnly("io.papermc.paper:paper-api:1.19.2-R0.1-SNAPSHOT") | ||
|
||
compileOnly("fr.efreicraft:ECATUP:latest.integration") | ||
} | ||
|
||
bukkit { | ||
load = BukkitPluginDescription.PluginLoadOrder.POSTWORLD | ||
name = "LudosDAC" | ||
main = "fr.efreicraft.ludos.games.dac.Main" | ||
apiVersion = "1.19" | ||
authors = listOf("Nat.io") | ||
prefix = "DAC" | ||
} |
39 changes: 39 additions & 0 deletions
39
games/dac/src/main/java/fr/efreicraft/ludos/games/dac/EventListener.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,39 @@ | ||
package fr.efreicraft.ludos.games.dac; | ||
|
||
import fr.efreicraft.ludos.core.Core; | ||
import fr.efreicraft.ludos.core.players.LudosPlayer; | ||
import org.bukkit.event.EventHandler; | ||
import org.bukkit.event.Listener; | ||
import org.bukkit.event.entity.EntityDamageEvent; | ||
import org.bukkit.event.player.PlayerMoveEvent; | ||
|
||
public record EventListener(GameLogic dac) implements Listener { | ||
|
||
@EventHandler | ||
public void onPlayerMove(PlayerMoveEvent event) { | ||
if (!event.hasChangedBlock()) { | ||
return; | ||
} | ||
LudosPlayer player = Core.get().getPlayerManager().getPlayer(event.getPlayer()); | ||
if (!player.getTeam().isPlayingTeam()) { | ||
return; | ||
} | ||
if (this.dac.isInBassin(event.getTo())) { | ||
dac.onPlayerInBassin(player); | ||
} else if (this.dac.isOnGround(event.getTo().getY())) { | ||
dac.onPlayerTouchingGround(player); | ||
} | ||
} | ||
|
||
|
||
@EventHandler | ||
public void onDamage(EntityDamageEvent event) { | ||
if (event.getEntity() instanceof org.bukkit.entity.Player bukkitPlayer) { | ||
LudosPlayer player = Core.get().getPlayerManager().getPlayer(bukkitPlayer); | ||
if (!player.getTeam().isPlayingTeam()) { | ||
return; | ||
} | ||
event.setDamage(0); | ||
} | ||
} | ||
} |
Oops, something went wrong.