death messages, give item fix
This commit is contained in:
parent
e11185cf2d
commit
ecb33764ef
5 changed files with 19 additions and 5 deletions
|
@ -50,6 +50,8 @@ public class Main extends JavaPlugin implements Listener {
|
|||
Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "gamerule doImmediateRespawn true");
|
||||
Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "gamerule logAdminCommands false");
|
||||
Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "gamerule naturalRegeneration false");
|
||||
Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "gamerule keepInventory false");
|
||||
Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "gamerule showDeathMessages false");
|
||||
|
||||
// Register Commands
|
||||
CommandManager.registerCommands();
|
||||
|
|
|
@ -39,7 +39,6 @@ public class Store {
|
|||
}
|
||||
|
||||
public static int getPlayerData(String playerName, String key) {
|
||||
if(playerData == null) return 0;
|
||||
if(playerData.get(playerName + " " + key) == null) {
|
||||
return 0;
|
||||
} else {
|
||||
|
|
|
@ -41,6 +41,9 @@ public class Start implements ICommand {
|
|||
Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "gamerule doImmediateRespawn true");
|
||||
Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "gamerule logAdminCommands false");
|
||||
Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "gamerule naturalRegeneration false");
|
||||
Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "gamerule keepInventory false");
|
||||
Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "gamerule showDeathMessages false");
|
||||
|
||||
playerData = new HashMap<String,Integer>();
|
||||
for(Player player : playerList.values()) {
|
||||
resetPlayerData(player.getName(),true);
|
||||
|
|
|
@ -2,6 +2,7 @@ package net.tylermurphy.hideAndSeek.manager;
|
|||
|
||||
import static net.tylermurphy.hideAndSeek.Store.*;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.event.EventHandler;
|
||||
|
@ -11,6 +12,8 @@ import org.bukkit.event.player.PlayerJoinEvent;
|
|||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
|
||||
import net.md_5.bungee.api.ChatColor;
|
||||
|
||||
public class EventManager implements Listener {
|
||||
|
||||
@EventHandler
|
||||
|
@ -43,6 +46,13 @@ public class EventManager implements Listener {
|
|||
@EventHandler
|
||||
public void onDeath(PlayerDeathEvent event) {
|
||||
if(status.equals("Playing")) {
|
||||
if(Hider.hasEntry(event.getEntity().getName())) {
|
||||
Bukkit.getServer().broadcastMessage(String.format(messagePrefix + "%s%s has died", ChatColor.GOLD, event.getEntity().getName()));
|
||||
}
|
||||
if(Seeker.hasEntry(event.getEntity().getName())) {
|
||||
Bukkit.getServer().broadcastMessage(String.format(messagePrefix + "%s%s has died", ChatColor.RED, event.getEntity().getName()));
|
||||
}
|
||||
|
||||
setPlayerData(event.getEntity().getName(), "Death", 1);
|
||||
setPlayerData(event.getEntity().getName(), "GiveStatus", 1);
|
||||
}
|
||||
|
|
|
@ -149,6 +149,10 @@ public class TickManager {
|
|||
}
|
||||
for(Player player : playerList.values()) {
|
||||
player.addPotionEffect(new PotionEffect(PotionEffectType.DOLPHINS_GRACE, 1000000, 1, false, false));
|
||||
if(getPlayerData(player.getName(),"Death") > 0) {
|
||||
setPlayerData(player.getName(),"Death",0);
|
||||
Seeker.addEntry(player.getName());
|
||||
}
|
||||
if(getPlayerData(player.getName(),"GiveStatus") > 0) {
|
||||
setPlayerData(player.getName(),"GiveStatus",0);
|
||||
player.getInventory().clear();
|
||||
|
@ -193,10 +197,6 @@ public class TickManager {
|
|||
player.getInventory().addItem(potion);
|
||||
}
|
||||
}
|
||||
if(getPlayerData(player.getName(),"Death") > 0) {
|
||||
setPlayerData(player.getName(),"Death",0);
|
||||
Seeker.addEntry(player.getName());
|
||||
}
|
||||
}
|
||||
for(String playerName : Seeker.getEntries()) {
|
||||
Player player = playerList.get(playerName);
|
||||
|
|
Loading…
Reference in a new issue