figuring out api stuff for recent minecraft releases
This commit is contained in:
parent
7ab8389f0f
commit
908cd6297c
4 changed files with 35 additions and 11 deletions
10
TODO.md
10
TODO.md
|
@ -5,12 +5,12 @@
|
||||||
* 1.8
|
* 1.8
|
||||||
* Enables but crashes when trying to play ender dragon noise upon resurrection (ender dragon introduced in 1.9, wither noise instead? `Caused by: java.lang.NoSuchFieldError: ENTITY_ENDER_DRAGON_GROWL`)
|
* Enables but crashes when trying to play ender dragon noise upon resurrection (ender dragon introduced in 1.9, wither noise instead? `Caused by: java.lang.NoSuchFieldError: ENTITY_ENDER_DRAGON_GROWL`)
|
||||||
* 1.9
|
* 1.9
|
||||||
* Doesn't enable, "compiled by more recent version of java"
|
* seems to work now
|
||||||
* THIS SHOULD BE FIXED AFTER MOVING TO VSCODE (using java 8)
|
|
||||||
* 1.10
|
* 1.10
|
||||||
* same as 1.9
|
* seems to work now
|
||||||
* 1.11
|
* 1.11
|
||||||
* same as 1.9
|
* seems to work now
|
||||||
* 1.12
|
* 1.12
|
||||||
* same as 1.9
|
* seems to work now
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -61,7 +61,12 @@ public class CommandResurrect implements CommandExecutor {
|
||||||
resurrectPlayer.removePotionEffect(effect.getType());
|
resurrectPlayer.removePotionEffect(effect.getType());
|
||||||
resurrectPlayer.setGameMode(GameMode.SURVIVAL);
|
resurrectPlayer.setGameMode(GameMode.SURVIVAL);
|
||||||
for(Player player : Bukkit.getOnlinePlayers()){
|
for(Player player : Bukkit.getOnlinePlayers()){
|
||||||
|
try {
|
||||||
player.playSound(player.getLocation(), Sound.ENTITY_ENDER_DRAGON_GROWL, 1, 0);
|
player.playSound(player.getLocation(), Sound.ENTITY_ENDER_DRAGON_GROWL, 1, 0);
|
||||||
|
} catch (NoSuchFieldError e) {
|
||||||
|
log.warning("NoSuchFieldError encountered, playing Wither noise instead.");
|
||||||
|
player.playSound(player.getLocation(), Sound.ENTITY_WITHER_DEATH, 1, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Bukkit.broadcastMessage(ChatColor.YELLOW +""+ ChatColor.BOLD + strings[0] + " has been resurrected manually by an admin!");
|
Bukkit.broadcastMessage(ChatColor.YELLOW +""+ ChatColor.BOLD + strings[0] + " has been resurrected manually by an admin!");
|
||||||
removeDeath(resurrectPlayer);
|
removeDeath(resurrectPlayer);
|
||||||
|
@ -108,7 +113,12 @@ public class CommandResurrect implements CommandExecutor {
|
||||||
resurrectPlayer.removePotionEffect(effect.getType());
|
resurrectPlayer.removePotionEffect(effect.getType());
|
||||||
resurrectPlayer.setGameMode(GameMode.SURVIVAL);
|
resurrectPlayer.setGameMode(GameMode.SURVIVAL);
|
||||||
for(Player player : Bukkit.getOnlinePlayers()){
|
for(Player player : Bukkit.getOnlinePlayers()){
|
||||||
|
try {
|
||||||
player.playSound(player.getLocation(), Sound.ENTITY_ENDER_DRAGON_GROWL, 1, 0);
|
player.playSound(player.getLocation(), Sound.ENTITY_ENDER_DRAGON_GROWL, 1, 0);
|
||||||
|
} catch (NoSuchFieldError e) {
|
||||||
|
log.warning("NoSuchFieldError encountered, playing Wither noise instead.");
|
||||||
|
player.playSound(player.getLocation(), Sound.ENTITY_WITHER_DEATH, 1, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Bukkit.broadcastMessage(strings[0] + " has been resurrected manually by an admin!");
|
Bukkit.broadcastMessage(strings[0] + " has been resurrected manually by an admin!");
|
||||||
removeDeath(resurrectPlayer);
|
removeDeath(resurrectPlayer);
|
||||||
|
|
|
@ -2,6 +2,9 @@ package net.brysonsteck.Resurrection.player;
|
||||||
|
|
||||||
import net.brysonsteck.Resurrection.startup.ParseSettings;
|
import net.brysonsteck.Resurrection.startup.ParseSettings;
|
||||||
import net.brysonsteck.Resurrection.Resurrection;
|
import net.brysonsteck.Resurrection.Resurrection;
|
||||||
|
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import org.bukkit.*;
|
import org.bukkit.*;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
|
@ -24,6 +27,7 @@ public class PlayerListener implements Listener {
|
||||||
//Hashtable<String, Location> playerSpawns = new Hashtable<>();
|
//Hashtable<String, Location> playerSpawns = new Hashtable<>();
|
||||||
ParseSettings parseSettings;
|
ParseSettings parseSettings;
|
||||||
boolean DEBUG;
|
boolean DEBUG;
|
||||||
|
Logger log = JavaPlugin.getProvidingPlugin(Resurrection.class).getLogger();
|
||||||
|
|
||||||
public PlayerListener(ParseSettings parseSettings) {
|
public PlayerListener(ParseSettings parseSettings) {
|
||||||
this.parseSettings = parseSettings;
|
this.parseSettings = parseSettings;
|
||||||
|
@ -55,7 +59,7 @@ public class PlayerListener implements Listener {
|
||||||
boolean dead = Boolean.parseBoolean(playerSplit[1]);
|
boolean dead = Boolean.parseBoolean(playerSplit[1]);
|
||||||
timeToResurrection = Long.parseLong(playerSplit[2]);
|
timeToResurrection = Long.parseLong(playerSplit[2]);
|
||||||
|
|
||||||
if (timeToResurrection < System.currentTimeMillis()) {
|
if (timeToResurrection < System.currentTimeMillis() && timeToResurrection != 0) {
|
||||||
dead = false;
|
dead = false;
|
||||||
playerSplit[1] = String.valueOf(dead);
|
playerSplit[1] = String.valueOf(dead);
|
||||||
timeToResurrection = 0;
|
timeToResurrection = 0;
|
||||||
|
@ -144,7 +148,12 @@ public class PlayerListener implements Listener {
|
||||||
p.teleport(spawn);
|
p.teleport(spawn);
|
||||||
}
|
}
|
||||||
for(Player p : Bukkit.getOnlinePlayers()){
|
for(Player p : Bukkit.getOnlinePlayers()){
|
||||||
|
try {
|
||||||
p.playSound(p.getLocation(), Sound.ENTITY_ENDER_DRAGON_GROWL, 1, 0);
|
p.playSound(p.getLocation(), Sound.ENTITY_ENDER_DRAGON_GROWL, 1, 0);
|
||||||
|
} catch (NoSuchFieldError e) {
|
||||||
|
log.warning("NoSuchFieldError encountered, playing Wither noise instead.");
|
||||||
|
p.playSound(p.getLocation(), Sound.ENTITY_WITHER_DEATH, 1, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}.runTaskLater(JavaPlugin.getProvidingPlugin(Resurrection.class), timeToResurrection);
|
}.runTaskLater(JavaPlugin.getProvidingPlugin(Resurrection.class), timeToResurrection);
|
||||||
|
@ -235,7 +244,12 @@ public class PlayerListener implements Listener {
|
||||||
p.teleport(spawn);
|
p.teleport(spawn);
|
||||||
}
|
}
|
||||||
for(Player p : Bukkit.getOnlinePlayers()){
|
for(Player p : Bukkit.getOnlinePlayers()){
|
||||||
|
try {
|
||||||
p.playSound(p.getLocation(), Sound.ENTITY_ENDER_DRAGON_GROWL, 1, 0);
|
p.playSound(p.getLocation(), Sound.ENTITY_ENDER_DRAGON_GROWL, 1, 0);
|
||||||
|
} catch (NoSuchFieldError e) {
|
||||||
|
log.warning("NoSuchFieldError encountered, playing Wither noise instead.");
|
||||||
|
p.playSound(p.getLocation(), Sound.ENTITY_WITHER_DEATH, 1, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}.runTaskLater(JavaPlugin.getProvidingPlugin(Resurrection.class), timeToResurrection);
|
}.runTaskLater(JavaPlugin.getProvidingPlugin(Resurrection.class), timeToResurrection);
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
main: net.brysonsteck.Resurrection.Resurrection
|
main: net.brysonsteck.Resurrection.Resurrection
|
||||||
name: Resurrection
|
name: Resurrection
|
||||||
author: 'Bryson Steck'
|
author: 'Bryson Steck'
|
||||||
version: '1.2'
|
version: '1.3'
|
||||||
website: https://brysonsteck.net/resurrection.html
|
website: https://brysonsteck.net/resurrection.html
|
||||||
description: Makes players wait large amounts of time before respawning!
|
description: Makes players wait large amounts of time before respawning!
|
||||||
database: false
|
database: false
|
||||||
|
|
Loading…
Add table
Reference in a new issue