hunder and standby health rewrite
This commit is contained in:
parent
dc731b425f
commit
20037e986f
5 changed files with 22 additions and 27 deletions
2
pom.xml
2
pom.xml
|
@ -1,7 +1,7 @@
|
|||
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd"><modelVersion>4.0.0</modelVersion>
|
||||
<groupId>net.tylermurphy</groupId>
|
||||
<artifactId>HideAndSeek</artifactId>
|
||||
<version>1.1.0</version>
|
||||
<version>1.1.1</version>
|
||||
<name>Hide and Seek Plugin</name>
|
||||
<build>
|
||||
<plugins>
|
||||
|
|
|
@ -9,7 +9,7 @@ public class About implements ICommand {
|
|||
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
sender.sendMessage(
|
||||
String.format("%s%sHide and Seek %s(1.1.0%s)\n", ChatColor.AQUA, ChatColor.BOLD, ChatColor.GRAY,ChatColor.WHITE,ChatColor.GRAY) +
|
||||
String.format("%s%sHide and Seek %s(1.1.1%s)\n", ChatColor.AQUA, ChatColor.BOLD, ChatColor.GRAY,ChatColor.WHITE,ChatColor.GRAY) +
|
||||
String.format("%sAuthor: %s[KenshinEto]\n", ChatColor.GRAY, ChatColor.WHITE) +
|
||||
String.format("%sHelp Command: %s/hs %shelp", ChatColor.GRAY, ChatColor.AQUA, ChatColor.WHITE)
|
||||
);
|
||||
|
|
|
@ -15,6 +15,7 @@ import org.bukkit.event.Listener;
|
|||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
import org.bukkit.event.entity.EntityRegainHealthEvent;
|
||||
import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason;
|
||||
import org.bukkit.event.entity.FoodLevelChangeEvent;
|
||||
import org.bukkit.event.entity.ProjectileLaunchEvent;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
|
@ -54,6 +55,10 @@ public class EventManager implements Listener {
|
|||
@EventHandler
|
||||
public void onPlayerDamage(EntityDamageEvent event) {
|
||||
if(event.getEntity() instanceof Player) {
|
||||
if(!status.equals("Playing")) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
Player player = (Player) event.getEntity();
|
||||
if(player.getHealth()-event.getDamage() < 0) {
|
||||
if(spawnPosition == null) return;
|
||||
|
@ -61,7 +66,6 @@ public class EventManager implements Listener {
|
|||
player.setHealth(player.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue());
|
||||
player.teleport(new Location(player.getWorld(), spawnPosition.getX(), spawnPosition.getY(), spawnPosition.getZ()));
|
||||
Functions.playSound(player, Sound.ENTITY_PLAYER_DEATH, 1, 1);
|
||||
if(status.equals("Playing")) {
|
||||
Functions.resetPlayer(player);
|
||||
if(Hider.hasEntry(event.getEntity().getName())) {
|
||||
Bukkit.broadcastMessage(String.format(messagePrefix + "%s%s%s has died and become a seeker", ChatColor.GOLD, event.getEntity().getName(), ChatColor.WHITE));
|
||||
|
@ -72,7 +76,6 @@ public class EventManager implements Listener {
|
|||
Seeker.addEntry(player.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -99,6 +102,11 @@ public class EventManager implements Listener {
|
|||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onFoodLevelChange(FoodLevelChangeEvent event) {
|
||||
event.setCancelled(false);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerRegainHealth(EntityRegainHealthEvent event) {
|
||||
if(event.getRegainReason() == RegainReason.SATIATED || event.getRegainReason() == RegainReason.REGEN)
|
||||
|
|
|
@ -32,13 +32,7 @@ public class TickManager {
|
|||
|
||||
Functions.emptyOfflinePlayers();
|
||||
|
||||
for(Player player : playerList.values()) {
|
||||
player.addPotionEffect(new PotionEffect(PotionEffectType.SATURATION, 1000000, 127, false, false));
|
||||
}
|
||||
|
||||
if(status.equals("Standby") || status.equals("Setup")) {
|
||||
onStandby();
|
||||
} else if(status.equals("Starting")) {
|
||||
if(status.equals("Starting")) {
|
||||
onStarting();
|
||||
} else if(status.equals("Playing")) {
|
||||
onPlaying();
|
||||
|
@ -56,13 +50,6 @@ public class TickManager {
|
|||
}
|
||||
}
|
||||
|
||||
private static void onStandby() {
|
||||
for(Player player : playerList.values()) {
|
||||
player.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION, 1000000, 127, false, false));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static void onStarting() {
|
||||
for(String playerName : Seeker.getEntries()) {
|
||||
Player player = playerList.get(playerName);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
name: HideAndSeek
|
||||
main: net.tylermurphy.hideAndSeek.Main
|
||||
version: 1.1.0
|
||||
version: 1.1.1
|
||||
author: KenshinEto
|
||||
load: STARTUP
|
||||
api-version: 1.17
|
||||
|
|
Loading…
Reference in a new issue