-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
First part in reverting back to the old death system, testing will be…
… needed before actual Release. 0.9.14.1 Pre Release Refers to issue #20 where players die with one hit.
- Loading branch information
Showing
9 changed files
with
199 additions
and
199 deletions.
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
114 changes: 0 additions & 114 deletions
114
src/main/java/com/teozcommunity/teozfrank/duelme/events/EntityDamage.java
This file was deleted.
Oops, something went wrong.
79 changes: 79 additions & 0 deletions
79
src/main/java/com/teozcommunity/teozfrank/duelme/events/PlayerDeath.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,79 @@ | ||
package com.teozcommunity.teozfrank.duelme.events; | ||
|
||
import com.teozcommunity.teozfrank.duelme.main.DuelMe; | ||
import com.teozcommunity.teozfrank.duelme.mysql.FieldName; | ||
import com.teozcommunity.teozfrank.duelme.mysql.MySql; | ||
import com.teozcommunity.teozfrank.duelme.util.DuelManager; | ||
import com.teozcommunity.teozfrank.duelme.util.FileManager; | ||
import com.teozcommunity.teozfrank.duelme.util.SendConsoleMessage; | ||
import org.bukkit.ChatColor; | ||
import org.bukkit.entity.Player; | ||
import org.bukkit.event.EventHandler; | ||
import org.bukkit.event.EventPriority; | ||
import org.bukkit.event.Listener; | ||
import org.bukkit.event.entity.PlayerDeathEvent; | ||
|
||
import java.util.UUID; | ||
|
||
/** | ||
* Created by Frank on 04/05/2015. | ||
*/ | ||
public class PlayerDeath implements Listener { | ||
|
||
private DuelMe plugin; | ||
|
||
public PlayerDeath(DuelMe plugin) { | ||
this.plugin = plugin; | ||
plugin.getServer().getPluginManager().registerEvents(this, plugin); | ||
} | ||
|
||
@EventHandler (priority = EventPriority.NORMAL) | ||
public void onPlayerDeath(PlayerDeathEvent e) { | ||
Player player = e.getEntity(); | ||
String playerName = player.getName(); | ||
UUID playerUUID = player.getUniqueId(); | ||
|
||
DuelManager dm = plugin.getDuelManager(); | ||
FileManager fm = plugin.getFileManager(); | ||
MySql mySql = plugin.getMySql(); | ||
|
||
if(dm.isInDuel(playerUUID)){ | ||
dm.addDeadPlayer(playerUUID); | ||
|
||
if(fm.isMySqlEnabled()) { | ||
mySql.addPlayerKillDeath(playerUUID, playerName, FieldName.DEATH); | ||
} | ||
|
||
if(e.getEntity().getKiller() instanceof Player){ | ||
Player killer = e.getEntity().getKiller(); | ||
String killerName = killer.getName(); | ||
if(fm.isMySqlEnabled()) { | ||
mySql.addPlayerKillDeath(playerUUID, killerName, FieldName.KILL); | ||
} | ||
|
||
if(!fm.isDropItemsOnDeathEnabled()) { | ||
if(plugin.isDebugEnabled()) { | ||
SendConsoleMessage.debug("Item drops disabled, clearing."); | ||
} | ||
e.getDrops().clear(); | ||
} | ||
|
||
if(!fm.isDeathMessagesEnabled()){ | ||
e.setDeathMessage(""); | ||
return; | ||
} | ||
e.setDeathMessage(fm.getPrefix() + ChatColor.AQUA + player.getName() + ChatColor.RED + " was killed in a duel by " | ||
+ ChatColor.AQUA + killer.getName()); | ||
} else { | ||
if(!fm.isDeathMessagesEnabled()){ | ||
e.setDeathMessage(""); | ||
return; | ||
} | ||
e.setDeathMessage(fm.getPrefix() + ChatColor.AQUA + player.getName() + ChatColor.RED + " was killed in a duel!"); | ||
} | ||
dm.endDuel(player); | ||
|
||
} | ||
} | ||
|
||
} |
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
Oops, something went wrong.