From ff5601a7e3d8d02d572a842e781b854bfb9d18c4 Mon Sep 17 00:00:00 2001 From: itasli Date: Thu, 30 Dec 2021 00:32:36 +0100 Subject: [PATCH] Add files via upload --- README.md | 22 ++++---------- pom.xml | 30 +++++++++---------- .../nohealthhunger/HealthHungerListener.java | 17 ++++------- .../nohealthhunger/NoDamageNoHunger.java | 21 +++++++++++++ src/main/resources/plugin.yml | 19 ++++++------ 5 files changed, 56 insertions(+), 53 deletions(-) create mode 100644 src/main/java/org/rainas/nohealthhunger/NoDamageNoHunger.java diff --git a/README.md b/README.md index acb2d65..a56c012 100644 --- a/README.md +++ b/README.md @@ -1,24 +1,12 @@ -# no-health-hunger -## Bukkit plugin that disables health and hunger +# no-damage-no-hunger +## Spigot plugin that disables damage and hunger ### Features -* Disables health +* Disables damage * Disables hunger -* Teleports players in the void to spawn ### Permissions |Node|Default|Description| |:---|-------|----------:| -|NoHealthHunger.nohealth|OP|Player takes no damage| -|NoHealthHunger.nohunger|OP|Player loses no hunger| -|NoHealthHunger.escapevoid|TRUE|On entering void, player is teleported to spawn| - -### Config -|Node|Sample|Description| -|:---|------|----------:| -|escapevoid.teleport_out_of_void|true|Set _false_ to prevent all players from escaping the void (NOTE: This overrides permissions!| -|escapevoid.message|Please don't go on spacewalks.|Message that players see when they are teleported _out_ of the void.| -|spawn.world|Server_lobby|The name of the world that your spawn point is located in. This is usually the name of the folder containing the world data files.| -|spawn.x|0.5|The x-coordinate of the spawn point. Press F3 in-game to view your coordinates.| -|spawn.y|3|The y-coordinate of the spawn point. Press F3 in-game to view your coordinates.| -|spawn.z|0.5|The z-coordinate of the spawn point. Press F3 in-game to view your coordinates.| \ No newline at end of file +|NoDamageNoHunger.nodamage|OP|Player takes no damage| +|NoDamageNoHunger.nohunger|OP|Player loses no hunger| \ No newline at end of file diff --git a/pom.xml b/pom.xml index c58846d..1752b56 100644 --- a/pom.xml +++ b/pom.xml @@ -1,33 +1,33 @@ 4.0.0 - org.rainas - NoHealthHunger - 1.0.1 + io.github.itasli + NoDamageNoHunger + 1.0 org.apache.maven.plugins maven-compiler-plugin + 3.8.1 - 1.7 - 1.7 + 1.8 + 1.8 - - bukkit-repo - https://hub.spigotmc.org/nexus/content/groups/public/ - + + papermc + https://papermc.io/repo/repository/maven-public/ + - org.bukkit - bukkit - 1.8-R0.1-SNAPSHOT - jar - provided - + io.papermc.paper + paper-api + 1.18-R0.1-SNAPSHOT + provided + \ No newline at end of file diff --git a/src/main/java/org/rainas/nohealthhunger/HealthHungerListener.java b/src/main/java/org/rainas/nohealthhunger/HealthHungerListener.java index fa6edd0..86e1888 100644 --- a/src/main/java/org/rainas/nohealthhunger/HealthHungerListener.java +++ b/src/main/java/org/rainas/nohealthhunger/HealthHungerListener.java @@ -1,4 +1,4 @@ -package org.rainas.nohealthhunger; +package io.github.itasli.nodamagenohunger; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; @@ -8,9 +8,9 @@ import org.bukkit.event.entity.EntityDamageEvent.DamageCause; public class HealthHungerListener implements Listener { - NoHealthHunger plugin; + NoDamageNoHunger plugin; - public HealthHungerListener(NoHealthHunger plugin) { + public HealthHungerListener(NoDamageNoHunger plugin) { this.plugin = plugin; } @@ -18,16 +18,9 @@ public HealthHungerListener(NoHealthHunger plugin) { public void onEntityDamage(EntityDamageEvent event) { if (event.getEntity() instanceof Player) { Player player = (Player) event.getEntity(); - if (player.hasPermission("NoHealthHunger.nohealth")) { + if (player.hasPermission("NoDamageNoHunger.nohealth")) { event.setCancelled(true); } - - if (event.getCause() == DamageCause.VOID) { - if (plugin.doVoid && player.hasPermission("NoHealthHunger.escapevoid")) { - player.teleport(plugin.spawn); - player.sendMessage(plugin.voidMessage); - } - } } } @@ -35,7 +28,7 @@ public void onEntityDamage(EntityDamageEvent event) { public void onFoodLevelChange(FoodLevelChangeEvent event) { if (event.getEntity() instanceof Player) { Player player = (Player) event.getEntity(); - if (player.hasPermission("NoHealthHunger.nohunger")) { + if (player.hasPermission("NoDamageNoHunger.nohunger")) { event.setCancelled(true); } } diff --git a/src/main/java/org/rainas/nohealthhunger/NoDamageNoHunger.java b/src/main/java/org/rainas/nohealthhunger/NoDamageNoHunger.java new file mode 100644 index 0000000..8537b14 --- /dev/null +++ b/src/main/java/org/rainas/nohealthhunger/NoDamageNoHunger.java @@ -0,0 +1,21 @@ +package io.github.itasli.nodamagenohunger; + +import org.bukkit.Bukkit; +import org.bukkit.Location; +import org.bukkit.plugin.java.JavaPlugin; + +public class NoDamageNoHunger extends JavaPlugin { + + + @Override + public void onDisable() { + getLogger().info("Plugin disabled"); + } + + @Override + public void onEnable() { + getLogger().info("Plugin enabled"); + Bukkit.getServer().getPluginManager().registerEvents(new HealthHungerListener(this), this); + } + +} diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index badd8b2..942cec7 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,13 +1,14 @@ -name: NoHealthHunger -main: org.rainas.nohealthhunger.NoHealthHunger -version: 0.0.1 +main: io.github.itasli.nodamagenohunger.NoDamageNoHunger +name: NoDamageNoHunger +version: 1.0 +description: This plugin cancel damage and hunger if player has the permission ! +api-version: 1.18 +author: itasli +website: spigotmc.org permissions: - NoHealthHunger.nohealth: + NoDamageNoHunger.nodamage: description: Take no damage default: op - NoHealthHunger.nohunger: + NoDamageNoHunger.nohunger: description: Never go hungry - default: op - NoHealthHunger.escapevoid: - description: Teleport to spawn on entering the void - default: true \ No newline at end of file + default: op \ No newline at end of file