Skip to content

Commit

Permalink
1.3 SNAPSHOT
Browse files Browse the repository at this point in the history
Remove PlayerDeathByPlayerWithCrystalEvent.getRawEvent()
Add PlayerDeathByPlayerWithCrystalEvent.getDeathMessage() -> String
Add PlayerDeathByPlayerWithCrystalEvent.getKeepInventory() -> boolean
Add PlayerDeathByPlayerWithCrystalEvent.getKeepLevel() -> boolean
Add PlayerDeathByPlayerWithCrystalEvent.getDroppedExp() -> int
Add PlayerDeathByPlayerWithCrystalEvent.getDrops() -> List<ItemStack>
Add PlayerDeathByPlayerWithCrystalEvent.getNewExp() -> int
Add PlayerDeathByPlayerWithCrystalEvent.getNewTotalExp() -> int
Add PlayerDeathByPlayerWithCrystalEvent.getNewLevel() -> int
  • Loading branch information
GuangChen2333 committed Jan 16, 2022
1 parent 4e04228 commit cc7f31c
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 8 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ plugins {
}

group 'cn.guangchen233'
version '1.2-SNAPSHOT'
version '1.3-SNAPSHOT'

repositories {
maven {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
import org.bukkit.event.HandlerList;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.inventory.ItemStack;

import java.util.List;

public class PlayerDeathByPlayerWithCrystalEvent extends Event {
private static final HandlerList handlers = new HandlerList();
Expand Down Expand Up @@ -107,11 +110,78 @@ public boolean isSuicide() {
}

/**
* Get raw event
* Get the death message that will appear to everyone on the server.
*
* @return message to appear to other players on the server.
*/
public String getDeathMessage() {
return playerDeathEvent.getDeathMessage();
}

/**
* Get if the Player keeps inventory on death.
*
* @return true if the player keeps inventory on death
*/
public boolean getKeepInventory() {
return playerDeathEvent.getKeepInventory();
}

/**
* Get if the Player should keep all EXP at respawn.
* This flag overrides other EXP settings
*
* @return true if Player should keep all pre-death exp
*/
public boolean getKeepLevel() {
return playerDeathEvent.getKeepLevel();
}

/**
* Get how much EXP should be dropped from this death.
* This does not indicate how much EXP should be taken from the entity in question,
* merely how much should be created after its death.
*
* @return amount of EXP to drop.
*/
public int getDroppedExp() {
return playerDeathEvent.getDroppedExp();
}

/**
* Get all the items which will drop when the entity dies
*
* @return items to drop when the entity dies
*/
public List<ItemStack> getDrops() {
return playerDeathEvent.getDrops();
}

/**
* Get how much EXP the Player should have at respawn.
* This does not indicate how much EXP should be dropped, please see getDroppedExp() for that.
*
* @return new EXP of the respawned player
*/
public int getNewExp() {
return playerDeathEvent.getNewExp();
}

/**
* Get the Total EXP the Player should have at respawn.
*
* @return new Total EXP of the respawned player
*/
public int getNewTotalExp() {
return playerDeathEvent.getNewTotalExp();
}

/**
* Get the Level the Player should have at respawn.
*
* @return Return the PlayerDeathEvent
* @return new Level of the respawned player
*/
public PlayerDeathEvent getRawEvent() {
return playerDeathEvent;
public int getNewLevel() {
return playerDeathEvent.getNewLevel();
}
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
package cn.guangchen233.crystallistener.plugin;

import org.bukkit.event.Listener;
import org.bukkit.plugin.java.JavaPlugin;


public class CrystalListener extends JavaPlugin implements Listener {
public class CrystalListener extends JavaPlugin {
private static CrystalListener instance;

public static CrystalListener getInstance() {
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: CrystalKillListener
main: cn.guangchen233.crystallistener.plugin.CrystalListener
version: 1.2-SNAPSHOT
version: 1.3-SNAPSHOT
author: GuangChen233
website: https://github.com/GuangChen2333/CrystalKillListener
api-version: 1.12

0 comments on commit cc7f31c

Please sign in to comment.