Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
itasli authored Dec 29, 2021
1 parent 89dd785 commit ff5601a
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 53 deletions.
22 changes: 5 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -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.|
|NoDamageNoHunger.nodamage|OP|Player takes no damage|
|NoDamageNoHunger.nohunger|OP|Player loses no hunger|
30 changes: 15 additions & 15 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.rainas</groupId>
<artifactId>NoHealthHunger</artifactId>
<version>1.0.1</version>
<groupId>io.github.itasli</groupId>
<artifactId>NoDamageNoHunger</artifactId>
<version>1.0</version>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>bukkit-repo</id>
<url>https://hub.spigotmc.org/nexus/content/groups/public/</url>
</repository>
<repository>
<id>papermc</id>
<url>https://papermc.io/repo/repository/maven-public/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
<version>1.8-R0.1-SNAPSHOT</version>
<type>jar</type>
<scope>provided</scope>
</dependency>
<groupId>io.papermc.paper</groupId>
<artifactId>paper-api</artifactId>
<version>1.18-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
17 changes: 5 additions & 12 deletions src/main/java/org/rainas/nohealthhunger/HealthHungerListener.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.rainas.nohealthhunger;
package io.github.itasli.nodamagenohunger;

import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
Expand All @@ -8,34 +8,27 @@
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;
}

@EventHandler
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);
}
}
}
}

@EventHandler
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);
}
}
Expand Down
21 changes: 21 additions & 0 deletions src/main/java/org/rainas/nohealthhunger/NoDamageNoHunger.java
Original file line number Diff line number Diff line change
@@ -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);
}

}
19 changes: 10 additions & 9 deletions src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
@@ -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
default: op

0 comments on commit ff5601a

Please sign in to comment.