generated from devcordde/PluginJamGradle
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
31a508d
commit ee79030
Showing
6 changed files
with
98 additions
and
1 deletion.
There are no files selected for viewing
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 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,20 @@ | ||
package club.devcord.gamejam.level; | ||
|
||
import club.devcord.gamejam.Team; | ||
|
||
public abstract class Level { | ||
|
||
private final Team team; | ||
|
||
protected Level(Team team) { | ||
this.team = team; | ||
} | ||
|
||
abstract public void start(); | ||
|
||
abstract public void stop(); | ||
|
||
public Team team() { | ||
return team; | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
src/main/java/club/devcord/gamejam/level/poempel/MoveListener.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,18 @@ | ||
package club.devcord.gamejam.level.poempel; | ||
|
||
import org.bukkit.Location; | ||
import org.bukkit.event.EventHandler; | ||
import org.bukkit.event.Listener; | ||
import org.bukkit.event.player.PlayerMoveEvent; | ||
|
||
public class MoveListener implements Listener { | ||
|
||
@EventHandler | ||
void handlePlayerMove(PlayerMoveEvent event) { | ||
Location location = event.getTo(); | ||
|
||
if (location.blockX() == 163 && location.blockZ() <= -422 && location.blockZ() <= -426) { | ||
event.getPlayer().sendMessage("test"); | ||
} | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
src/main/java/club/devcord/gamejam/level/poempel/PoempelLevel.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,36 @@ | ||
package club.devcord.gamejam.level.poempel; | ||
|
||
import club.devcord.gamejam.Nigulpyggub; | ||
import club.devcord.gamejam.Team; | ||
import club.devcord.gamejam.level.Level; | ||
import org.bukkit.Bukkit; | ||
import org.bukkit.Material; | ||
import org.bukkit.entity.Player; | ||
import org.bukkit.event.player.PlayerMoveEvent; | ||
import org.bukkit.inventory.ItemStack; | ||
|
||
public class PoempelLevel extends Level { | ||
|
||
private final MoveListener moveListener = new MoveListener(); | ||
private final Nigulpyggub plugin; | ||
|
||
protected PoempelLevel(Team team, Nigulpyggub plugin) { | ||
super(team); | ||
this.plugin = plugin; | ||
} | ||
|
||
public void start() { | ||
var item = new ItemStack(Material.IRON_AXE); | ||
var meta = item.getItemMeta(); | ||
meta.setCustomModelData(16); | ||
item.setItemMeta(meta); | ||
|
||
plugin.getServer().getPluginManager().registerEvents(moveListener, plugin); | ||
} | ||
|
||
@Override | ||
public void stop() { | ||
PlayerMoveEvent.getHandlerList().unregister(moveListener); | ||
} | ||
|
||
} |