finished and fixed all base features
This commit is contained in:
parent
4d2f0d24d1
commit
017697914c
24
README.md
24
README.md
@ -11,27 +11,3 @@ I am using the most recent stable Minecraft spigot versions and cannot guarantee
|
|||||||
## License
|
## License
|
||||||
You are free to use this plugin on your server but, you have to mention me as the author and have to keep credit notices I placed inside the plugin.
|
You are free to use this plugin on your server but, you have to mention me as the author and have to keep credit notices I placed inside the plugin.
|
||||||
|
|
||||||
## Current Roadmap
|
|
||||||
Because this plugin currently is in its early development phase I will update this to more interesting features down the road
|
|
||||||
my main goal, for now, is to get a stable plugin to host on servers without issues.
|
|
||||||
- [X] Getting the Plugin to start
|
|
||||||
- [X] Player Amount detection works
|
|
||||||
- [X] Getting the Game to start
|
|
||||||
- [X] Countdown works
|
|
||||||
- [X] All players get a trident assigned
|
|
||||||
- [X] Trident gets properly reset to Thrower (when not dead)
|
|
||||||
- [X] Error occurs when trident hits ground
|
|
||||||
- [ ] does not detect if player somehow remains with tridents
|
|
||||||
- was worked arround by moving players to spectator
|
|
||||||
- [X] Playerdeath Detection works
|
|
||||||
- [X] Alive Counter works
|
|
||||||
- Appears not to track at all
|
|
||||||
- [X] Game winer routine works
|
|
||||||
- death detection is nonfunctional
|
|
||||||
- [X] config gets created
|
|
||||||
- [X] config gets loaded
|
|
||||||
- [ ] minimal players get loaded from config
|
|
||||||
- [X] Writing Spawnpoints into the config works
|
|
||||||
- [ ] Reading Locations from config works
|
|
||||||
- [ ] Players will be teleported to the location wanted
|
|
||||||
- [ ] Player items do not drop on death and get removed
|
|
20
config.yml
20
config.yml
@ -1,7 +1,25 @@
|
|||||||
# general
|
# general
|
||||||
prefix: null
|
prefix: null
|
||||||
minplayers: 2
|
minplayers: 2
|
||||||
|
# The language selected here can only be changed by reloading the plugin
|
||||||
|
# the language must equal the language file in ../lang
|
||||||
|
# by default avaiable are: de-ger, en-us
|
||||||
|
language: "en-us"
|
||||||
|
autorestart: false
|
||||||
|
lobby-auto-queue: true
|
||||||
|
force-on-spawn: true
|
||||||
|
lobby-server: "lobby"
|
||||||
|
|
||||||
# spawn points
|
# spawn points
|
||||||
lobby: null
|
lobby: null
|
||||||
arena: null
|
arena: null
|
||||||
|
|
||||||
|
# Permissions
|
||||||
|
admin:
|
||||||
|
all: "tw.admin"
|
||||||
|
setlocation:
|
||||||
|
all: "tw.admin.setlocation"
|
||||||
|
lobby: "tw.admin.setlocation.lobby"
|
||||||
|
arena: "tw.admin.setlocation.arena"
|
||||||
|
start: "tw.admin.start"
|
||||||
|
stop: "tw.admin.stop"
|
30
list.md
Normal file
30
list.md
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
- [X] Getting the Plugin to start
|
||||||
|
- [X] Player Amount detection works
|
||||||
|
- [X] Getting the Game to start
|
||||||
|
- [X] Countdown works
|
||||||
|
- [X] All players get a trident assigned
|
||||||
|
- [X] Trident gets properly reset to Thrower (when not dead)
|
||||||
|
- [X] Error occurs when trident hits ground
|
||||||
|
- [X] does not detect if player somehow remains with tridents
|
||||||
|
- [X] Playerdeath Detection works
|
||||||
|
- [X] Alive Counter works
|
||||||
|
- [X] Game winer routine works
|
||||||
|
- [X] config gets created
|
||||||
|
- [X] config gets loaded
|
||||||
|
- [X] minimal players get loaded from config
|
||||||
|
- [X] Writing Spawnpoints into the config works
|
||||||
|
- [X] Reading Locations from config works
|
||||||
|
- [X] Players will be teleported to the location wanted
|
||||||
|
- [X] Player items do not drop on death and get removed
|
||||||
|
- [X] Sounds get played when they are supposed to
|
||||||
|
- [ ] Players that join while game is active will be set to spectator
|
||||||
|
- [ ] Players that leave the round will be removed from tracking
|
||||||
|
- [X] Fix that players lose their tridents when dying but not through trident damage
|
||||||
|
- [ ] Permissions are loaded from config
|
||||||
|
- [ ] Permission detection works
|
||||||
|
- [X] Language files are generated when not present
|
||||||
|
- [X] Language will be read from config
|
||||||
|
- [X] Loads correct language file based from configuration
|
||||||
|
- [X] Variables get used properly
|
||||||
|
- [X] Messages get used properly
|
||||||
|
- [ ] All Messages are implemented
|
71
src/main/java/de/steev/Tridentwar/Handlers/FileHandler.java
Normal file
71
src/main/java/de/steev/Tridentwar/Handlers/FileHandler.java
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
package de.steev.Tridentwar.Handlers;
|
||||||
|
|
||||||
|
import de.steev.Tridentwar.manager.GameManager;
|
||||||
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
import java.net.URL;
|
||||||
|
|
||||||
|
/** creates the default message files found in resources/langs */
|
||||||
|
public class FileHandler {
|
||||||
|
private GameManager gameManager;
|
||||||
|
public FileHandler(GameManager gameManager){
|
||||||
|
this.gameManager = gameManager;
|
||||||
|
File de = new File(this.gameManager.getPlugin().getDataFolder() + "/langs/de-ger.yml");
|
||||||
|
File en = new File(this.gameManager.getPlugin().getDataFolder() + "/langs/en-us.yml");
|
||||||
|
if(!de.exists()) { genFile("langs/de-ger.yml"); }
|
||||||
|
if(!en.exists()) { genFile("langs/en-us.yml"); }
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* generates specified language.yml
|
||||||
|
* @param path the intended file path
|
||||||
|
*/
|
||||||
|
public void genFile(String path){
|
||||||
|
URL resource = getClass().getClassLoader().getResource(path);
|
||||||
|
if (resource == null) {
|
||||||
|
System.out.println("Language file is not present or misspelled");
|
||||||
|
throw new IllegalArgumentException("file not found!");
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
File export = new File(this.gameManager.getPlugin().getDataFolder(), path);
|
||||||
|
FileConfiguration exportConfig = YamlConfiguration.loadConfiguration(new InputStreamReader(this.gameManager.getPlugin().getResource(path)));
|
||||||
|
exportConfig.save(export);
|
||||||
|
} catch (Exception e) {
|
||||||
|
System.out.println("Error while Generating file \nException: " + e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* proccesses variables from config
|
||||||
|
* @param message the message to work with
|
||||||
|
* @param player if given a player to use in message
|
||||||
|
* @param loc a given location
|
||||||
|
* @return processed string
|
||||||
|
*/
|
||||||
|
public String replaceVars(String message, @Nullable Player player, @Nullable String loc){
|
||||||
|
String msg;
|
||||||
|
String location;
|
||||||
|
|
||||||
|
// failsafe to prevent location from beeing null
|
||||||
|
if(loc == null) { location = "undefined"; } else { location = loc; }
|
||||||
|
|
||||||
|
// Processes given messages
|
||||||
|
if (player != null) {
|
||||||
|
msg = message.replace("%winner%", player.getDisplayName())
|
||||||
|
.replace("%min%","" + this.gameManager.getPlugin().config.getInt("minplayers"))
|
||||||
|
.replace("%default%", this.gameManager.getPlugin().config.getString("lobby-server").toString())
|
||||||
|
.replace("%location%", location);
|
||||||
|
} else {
|
||||||
|
msg = message.replace("%min%","" + this.gameManager.getPlugin().config.getInt("minplayers"))
|
||||||
|
.replace("%default%", this.gameManager.getPlugin().config.getString("lobby-server").toString())
|
||||||
|
.replace("%location%", location);
|
||||||
|
}
|
||||||
|
return msg;
|
||||||
|
}
|
||||||
|
}
|
@ -1,32 +1,56 @@
|
|||||||
package de.steev.Tridentwar;
|
package de.steev.Tridentwar;
|
||||||
|
|
||||||
import de.steev.Tridentwar.commands.TridentwarCommand;
|
import de.steev.Tridentwar.commands.TridentwarCommand;
|
||||||
import de.steev.Tridentwar.listeners.PlayerDeathListener;
|
import de.steev.Tridentwar.listeners.*;
|
||||||
import de.steev.Tridentwar.listeners.ProjectileHitListener;
|
|
||||||
import de.steev.Tridentwar.listeners.ProjectileLaunchListener;
|
|
||||||
import de.steev.Tridentwar.manager.GameManager;
|
import de.steev.Tridentwar.manager.GameManager;
|
||||||
import org.bukkit.configuration.file.FileConfiguration;
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
import org.bukkit.plugin.messaging.PluginMessageListener;
|
||||||
|
|
||||||
public class Tridentwar extends JavaPlugin {
|
import java.io.File;
|
||||||
|
|
||||||
|
public class Tridentwar extends JavaPlugin implements PluginMessageListener {
|
||||||
private GameManager gameManager;
|
private GameManager gameManager;
|
||||||
public FileConfiguration config = this.getConfig();
|
public FileConfiguration config;
|
||||||
|
public File languagedata;
|
||||||
|
public FileConfiguration languageDataConfig;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEnable(){
|
public void onEnable(){
|
||||||
super.onEnable();
|
super.onEnable();
|
||||||
|
config = this.getConfig();
|
||||||
this.gameManager = new GameManager(this);
|
this.gameManager = new GameManager(this);
|
||||||
getServer().getPluginManager().registerEvents(new ProjectileLaunchListener(this.gameManager, this), this);
|
getServer().getPluginManager().registerEvents(new ProjectileLaunchListener(this.gameManager, this), this);
|
||||||
getServer().getPluginManager().registerEvents(new ProjectileHitListener(this.gameManager), this);
|
getServer().getPluginManager().registerEvents(new ProjectileHitListener(this.gameManager), this);
|
||||||
getServer().getPluginManager().registerEvents(new PlayerDeathListener(this.gameManager), this);
|
getServer().getPluginManager().registerEvents(new EntityDamageListener(this.gameManager), this);
|
||||||
|
getServer().getPluginManager().registerEvents(new PlayerDamageListener(this.gameManager), this);
|
||||||
|
getServer().getPluginManager().registerEvents(new JoinListener(this.gameManager), this);
|
||||||
|
getServer().getPluginManager().registerEvents(new LeaveListener(this.gameManager), this);
|
||||||
getCommand("tw").setExecutor(new TridentwarCommand(this.gameManager));
|
getCommand("tw").setExecutor(new TridentwarCommand(this.gameManager));
|
||||||
|
|
||||||
|
this.getServer().getMessenger().registerOutgoingPluginChannel(this, "BungeeCord");
|
||||||
|
this.getServer().getMessenger().registerIncomingPluginChannel(this, "BungeeCord", this);
|
||||||
|
|
||||||
this.saveDefaultConfig();
|
this.saveDefaultConfig();
|
||||||
|
|
||||||
|
languagedata = new File(this.getDataFolder(), "langs/" + config.getString("language") + ".yml");
|
||||||
|
languageDataConfig = YamlConfiguration.loadConfiguration(languagedata);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDisable(){
|
public void onDisable(){
|
||||||
super.onDisable();
|
super.onDisable();
|
||||||
this.saveDefaultConfig();
|
this.saveDefaultConfig();
|
||||||
|
this.getServer().getMessenger().unregisterOutgoingPluginChannel(this);
|
||||||
|
this.getServer().getMessenger().unregisterIncomingPluginChannel(this);
|
||||||
gameManager.cleanup();
|
gameManager.cleanup();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPluginMessageReceived(String channel, Player player, byte[] bytes) {
|
||||||
|
if (!channel.equals("BungeeCord")) { return; }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,9 @@ package de.steev.Tridentwar.commands;
|
|||||||
|
|
||||||
import de.steev.Tridentwar.manager.GameManager;
|
import de.steev.Tridentwar.manager.GameManager;
|
||||||
import de.steev.Tridentwar.manager.GameState;
|
import de.steev.Tridentwar.manager.GameState;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.GameMode;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandExecutor;
|
import org.bukkit.command.CommandExecutor;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
@ -16,44 +19,70 @@ public class TridentwarCommand implements CommandExecutor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean onCommand(CommandSender commandSender, Command command, String s, String[] args) {
|
public boolean onCommand(CommandSender commandSender, Command command, String s, String[] args) {
|
||||||
|
Player sender = Bukkit.getServer().getPlayer(commandSender.getName());
|
||||||
|
// TODO: Replace placeholder messages with messages from language files
|
||||||
if(args.length >= 1) {
|
if(args.length >= 1) {
|
||||||
switch (args[0].toLowerCase()){
|
switch (args[0].toLowerCase()){
|
||||||
default:
|
case "getgamestate": commandSender.sendMessage("current gamestate" + this.gameManager.getGameState()); break;
|
||||||
commandSender.sendMessage("use args: start");
|
case "leave":
|
||||||
|
this.gameManager.getPlayerManager().moveFromServer(this.gameManager.getPlugin().config.getString("lobby-server"), sender);
|
||||||
|
break;
|
||||||
|
case "spectate":
|
||||||
|
if(this.gameManager.gameState == GameState.ACTIVE) {
|
||||||
|
sender.setGameMode(GameMode.SPECTATOR);
|
||||||
|
this.gameManager.getPlayerManager().playerDeath();
|
||||||
|
} else {
|
||||||
|
sender.sendMessage(ChatColor.translateAlternateColorCodes('&', this.gameManager.getPlugin().languageDataConfig.getString("error.no-game-running")));
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case "start":
|
case "start":
|
||||||
System.out.println("start thing: " + args[0]);
|
if(commandSender.hasPermission(this.gameManager.getPlugin().config.getString("admin.start")) ||
|
||||||
gameManager.setGameState(GameState.STARTING);
|
commandSender.hasPermission(this.gameManager.getPlugin().config.getString("admin.all"))) {
|
||||||
|
gameManager.setGameState(GameState.STARTING);
|
||||||
|
} else {
|
||||||
|
// Get permission error message from config
|
||||||
|
// Tell the user
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
/**
|
case "stop":
|
||||||
* dev command for returning running gamestate
|
if(commandSender.hasPermission(this.gameManager.getPlugin().config.getString("admin.stop")) ||
|
||||||
* @deprecated this command will be removed once state management works properly
|
commandSender.hasPermission(this.gameManager.getPlugin().config.getString("admin.all"))) {
|
||||||
*/
|
gameManager.setGameState(GameState.STOPPING);
|
||||||
case "getstate":
|
} else {
|
||||||
commandSender.sendMessage("Current State: " + gameManager.gameState);
|
// Get permission error message from config
|
||||||
|
// Tell the user
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case "setlocation":
|
case "setlocation":
|
||||||
System.out.println("loc thing" + args[1]);
|
System.out.println("loc thing" + args[1]);
|
||||||
if(args.length <= 2){
|
if(args.length <= 2){
|
||||||
switch (args[1].toLowerCase()){
|
switch (args[1].toLowerCase()){
|
||||||
default:
|
|
||||||
commandSender.sendMessage("wrong or undefined location type");
|
|
||||||
break;
|
|
||||||
case "lobby":
|
case "lobby":
|
||||||
try {
|
if(commandSender.hasPermission(this.gameManager.getPlugin().config.getString("admin.setlocation.all")) ||
|
||||||
this.gameManager.setLocation("lobby", ((Player)commandSender).getLocation());
|
commandSender.hasPermission(this.gameManager.getPlugin().config.getString("admin.setlocation.lobby")) ||
|
||||||
commandSender.sendMessage("lobby set");
|
commandSender.hasPermission(this.gameManager.getPlugin().config.getString("admin.all"))) {
|
||||||
}catch (Exception ex) {
|
try {
|
||||||
commandSender.sendMessage("Error while setting location");
|
this.gameManager.setLocation("lobby", ((Player) commandSender).getLocation());
|
||||||
|
commandSender.sendMessage("lobby set");
|
||||||
|
} catch (Exception ex) {
|
||||||
|
commandSender.sendMessage("Error while setting location");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "arena":
|
case "arena":
|
||||||
try {
|
if(commandSender.hasPermission(this.gameManager.getPlugin().config.getString("admin.setlocation.all")) ||
|
||||||
this.gameManager.setLocation("arena", ((Player)commandSender).getLocation());
|
commandSender.hasPermission(this.gameManager.getPlugin().config.getString("admin.setlocation.arena")) ||
|
||||||
commandSender.sendMessage("lobby set");
|
commandSender.hasPermission(this.gameManager.getPlugin().config.getString("admin.all"))) {
|
||||||
}catch (Exception ex) {
|
try {
|
||||||
commandSender.sendMessage("Error while setting location");
|
this.gameManager.setLocation("arena", ((Player) commandSender).getLocation());
|
||||||
|
commandSender.sendMessage("arena set");
|
||||||
|
} catch (Exception ex) {
|
||||||
|
commandSender.sendMessage("Error while setting location");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,43 @@
|
|||||||
|
package de.steev.Tridentwar.listeners;
|
||||||
|
|
||||||
|
import de.steev.Tridentwar.manager.GameManager;
|
||||||
|
import de.steev.Tridentwar.manager.GameState;
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.GameMode;
|
||||||
|
import org.bukkit.Sound;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
|
import org.bukkit.event.entity.EntityDamageEvent;
|
||||||
|
|
||||||
|
public class EntityDamageListener implements Listener {
|
||||||
|
private GameManager gameManager;
|
||||||
|
|
||||||
|
public EntityDamageListener(GameManager gameManager) { this.gameManager = gameManager; }
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onEntityDamage(EntityDamageEvent event) {
|
||||||
|
if(this.gameManager.gameState == GameState.ACTIVE) {
|
||||||
|
if(event.getEntity() instanceof Player) {
|
||||||
|
if (event.getCause() == EntityDamageEvent.DamageCause.PROJECTILE ||
|
||||||
|
event.getCause() == EntityDamageEvent.DamageCause.ENTITY_ATTACK ||
|
||||||
|
event.getCause() == EntityDamageEvent.DamageCause.ENTITY_SWEEP_ATTACK
|
||||||
|
) return;
|
||||||
|
|
||||||
|
if((((Player) event.getEntity()).getHealth() - event.getDamage()) <= 0){
|
||||||
|
event.setCancelled(true);
|
||||||
|
((Player)event.getEntity()).getInventory().clear();
|
||||||
|
((Player)event.getEntity()).setGameMode(GameMode.SPECTATOR);
|
||||||
|
|
||||||
|
// proper messaging
|
||||||
|
((Player)event.getEntity()).sendTitle( ChatColor.translateAlternateColorCodes('&',this.gameManager.getPlugin().languageDataConfig.getString("titles.death.top")),
|
||||||
|
ChatColor.translateAlternateColorCodes('&',this.gameManager.getPlugin().languageDataConfig.getString("titles.death.bottom")), 1, 100, 1);
|
||||||
|
((Player)event.getEntity()).playSound(((Player)event.getEntity()).getLocation(), Sound.ENTITY_ENDER_DRAGON_GROWL, 5,1);
|
||||||
|
|
||||||
|
// Tracks death inside of the plugin
|
||||||
|
this.gameManager.getPlayerManager().playerDeath();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,35 @@
|
|||||||
|
package de.steev.Tridentwar.listeners;
|
||||||
|
|
||||||
|
import de.steev.Tridentwar.manager.GameManager;
|
||||||
|
import de.steev.Tridentwar.manager.GameState;
|
||||||
|
import org.bukkit.Effect;
|
||||||
|
import org.bukkit.GameMode;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
|
import org.bukkit.event.player.PlayerJoinEvent;
|
||||||
|
|
||||||
|
public class JoinListener implements Listener {
|
||||||
|
private GameManager gameManager;
|
||||||
|
|
||||||
|
public JoinListener(GameManager gameManager) { this.gameManager = gameManager; }
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onPlayerJoin(PlayerJoinEvent event){
|
||||||
|
if(this.gameManager.getPlugin().config.getBoolean("force-on-spawn")) {
|
||||||
|
this.gameManager.getPlayerManager().setGameMode(event.getPlayer(), GameMode.SURVIVAL);
|
||||||
|
this.gameManager.getPlayerManager().setPlayerHealth(event.getPlayer(), 20);
|
||||||
|
}
|
||||||
|
if(this.gameManager.gameState == GameState.ACTIVE) {
|
||||||
|
this.gameManager.getPlayerManager().setGameMode(event.getPlayer(), GameMode.SPECTATOR);
|
||||||
|
this.gameManager.getPlayerManager().teleportPlayer(event.getPlayer(), this.gameManager.getPlugin().config.getLocation("arena"));
|
||||||
|
event.getPlayer().playEffect(event.getPlayer().getLocation(), Effect.RECORD_PLAY, Material.MUSIC_DISC_STAL);
|
||||||
|
} else if(this.gameManager.gameState == GameState.LOBBY && this.gameManager.getPlugin().config.getBoolean("lobby-auto-queue")) {
|
||||||
|
if(this.gameManager.getPlugin().config.getBoolean("force-on-spawn")) {
|
||||||
|
this.gameManager.getPlayerManager().setGameMode(event.getPlayer(), GameMode.SURVIVAL);
|
||||||
|
this.gameManager.getPlayerManager().setPlayerHealth(event.getPlayer(), 20);
|
||||||
|
}
|
||||||
|
this.gameManager.setGameState(GameState.WAITING);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,23 @@
|
|||||||
|
package de.steev.Tridentwar.listeners;
|
||||||
|
|
||||||
|
import de.steev.Tridentwar.manager.GameManager;
|
||||||
|
import de.steev.Tridentwar.manager.GameState;
|
||||||
|
import org.bukkit.GameMode;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
|
import org.bukkit.event.player.PlayerQuitEvent;
|
||||||
|
|
||||||
|
public class LeaveListener implements Listener {
|
||||||
|
private GameManager gameManager;
|
||||||
|
|
||||||
|
public LeaveListener(GameManager gameManager) { this.gameManager = gameManager; }
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onPlayerQuit(PlayerQuitEvent event) {
|
||||||
|
if(this.gameManager.gameState == GameState.ACTIVE) {
|
||||||
|
if(event.getPlayer().getGameMode() == GameMode.SURVIVAL) {
|
||||||
|
this.gameManager.getPlayerManager().playerDeath();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,46 @@
|
|||||||
|
package de.steev.Tridentwar.listeners;
|
||||||
|
|
||||||
|
import de.steev.Tridentwar.manager.GameManager;
|
||||||
|
import de.steev.Tridentwar.manager.GameState;
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.GameMode;
|
||||||
|
import org.bukkit.Sound;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.entity.Trident;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
|
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||||
|
|
||||||
|
public class PlayerDamageListener implements Listener {
|
||||||
|
private GameManager gameManager;
|
||||||
|
|
||||||
|
public PlayerDamageListener(GameManager gameManager) { this.gameManager = gameManager; }
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onPlayerDamage(EntityDamageByEntityEvent event) {
|
||||||
|
if(this.gameManager.gameState == GameState.ACTIVE) {
|
||||||
|
if(event.getEntity() instanceof Player) {
|
||||||
|
if(event.getDamager() instanceof Trident) {
|
||||||
|
Player dead = ((Player)event.getEntity());
|
||||||
|
if((dead.getHealth() - event.getDamage()) <= 0) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
dead.getInventory().clear();
|
||||||
|
dead.setGameMode(GameMode.SPECTATOR);
|
||||||
|
|
||||||
|
// proper messaging
|
||||||
|
dead.sendTitle( ChatColor.translateAlternateColorCodes('&',this.gameManager.getPlugin().languageDataConfig.getString("titles.death.top")),
|
||||||
|
ChatColor.translateAlternateColorCodes('&',this.gameManager.getPlugin().languageDataConfig.getString("titles.death.bottom")), 1, 100, 1);
|
||||||
|
dead.playSound(dead.getLocation(), Sound.ENTITY_ENDER_DRAGON_GROWL, 5,1);
|
||||||
|
|
||||||
|
// Confirmes Kill
|
||||||
|
((Player)((Trident)event.getDamager()).getShooter()).playSound(((Player)((Trident)event.getDamager()).getShooter()).getLocation(), Sound.ENTITY_VILLAGER_YES, 10, 1);
|
||||||
|
|
||||||
|
this.gameManager.getPlayerManager().playerDeath();
|
||||||
|
}
|
||||||
|
} else if (event.getDamager() instanceof Player) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,34 +0,0 @@
|
|||||||
package de.steev.Tridentwar.listeners;
|
|
||||||
|
|
||||||
import de.steev.Tridentwar.manager.GameManager;
|
|
||||||
import de.steev.Tridentwar.manager.GameState;
|
|
||||||
import org.bukkit.GameMode;
|
|
||||||
import org.bukkit.Sound;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.event.EventHandler;
|
|
||||||
import org.bukkit.event.Listener;
|
|
||||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
|
||||||
|
|
||||||
public class PlayerDeathListener implements Listener {
|
|
||||||
private GameManager gameManager;
|
|
||||||
|
|
||||||
public PlayerDeathListener(GameManager gameManager) { this.gameManager = gameManager; }
|
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void onPlayerDamage(EntityDamageByEntityEvent event) {
|
|
||||||
if(this.gameManager.gameState == GameState.ACTIVE) {
|
|
||||||
this.gameManager.getPlayerManager().playerDeath();
|
|
||||||
if(event.getEntity() instanceof Player) {
|
|
||||||
Player dead = ((Player)event.getEntity());
|
|
||||||
if(dead.getHealth() < 1) {
|
|
||||||
dead.getInventory().clear();
|
|
||||||
dead.setGameMode(GameMode.SPECTATOR);
|
|
||||||
// proper messaging
|
|
||||||
dead.sendTitle("Dead", "you Died", 1, 100, 1);
|
|
||||||
dead.playSound(dead.getLocation(), Sound.ENTITY_ENDER_DRAGON_DEATH, 5,1);
|
|
||||||
dead.sendMessage("Du bist gestorben");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -5,6 +5,7 @@ import de.steev.Tridentwar.manager.GameState;
|
|||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.Sound;
|
import org.bukkit.Sound;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.entity.Trident;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.entity.ProjectileHitEvent;
|
import org.bukkit.event.entity.ProjectileHitEvent;
|
||||||
@ -20,15 +21,20 @@ public class ProjectileHitListener implements Listener {
|
|||||||
@EventHandler
|
@EventHandler
|
||||||
public void onTridentHit(ProjectileHitEvent event){
|
public void onTridentHit(ProjectileHitEvent event){
|
||||||
if (this.gameManager.gameState == GameState.ACTIVE) {
|
if (this.gameManager.gameState == GameState.ACTIVE) {
|
||||||
if(this.gameManager.getTridentManager().getTask((Player)event.getEntity().getShooter()) != null) {
|
|
||||||
this.gameManager.getTridentManager().getTask((Player) event.getEntity().getShooter()).cancel();
|
|
||||||
this.gameManager.getTridentManager().removeTridentTast((Player) event.getEntity().getShooter());
|
|
||||||
}
|
|
||||||
|
|
||||||
if(event.getHitEntity() instanceof Player) ((Player) event.getEntity().getShooter()).playSound(((Player) event.getEntity().getShooter()).getLocation(), Sound.ENTITY_ARROW_HIT_PLAYER, 1f, 0.5f);
|
// Removes trident task when not needed
|
||||||
|
this.gameManager.getTridentManager().removeTridentTask((Player) event.getEntity().getShooter());
|
||||||
|
|
||||||
|
// Resets tridents to player
|
||||||
event.getEntity().remove();
|
event.getEntity().remove();
|
||||||
((Player) event.getEntity().getShooter()).getInventory().addItem(new ItemStack(Material.TRIDENT));
|
((Player) event.getEntity().getShooter()).getInventory().addItem(new ItemStack(Material.TRIDENT));
|
||||||
|
|
||||||
|
// tracks if the hit target was a player
|
||||||
|
if (event.getHitEntity() instanceof Player) {
|
||||||
|
if(this.gameManager.getTridentManager().getTask((Player)event.getEntity().getShooter()) != null) {
|
||||||
|
((Player) ((Trident)event.getEntity()).getShooter()).playSound(((Player) ((Trident)event.getEntity()).getShooter()).getLocation(), Sound.ENTITY_ARROW_HIT_PLAYER, 10, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
package de.steev.Tridentwar.manager;
|
package de.steev.Tridentwar.manager;
|
||||||
|
|
||||||
|
import de.steev.Tridentwar.Handlers.FileHandler;
|
||||||
import de.steev.Tridentwar.Tridentwar;
|
import de.steev.Tridentwar.Tridentwar;
|
||||||
import de.steev.Tridentwar.tasks.GameStartCountdownTask;
|
import de.steev.Tridentwar.tasks.GameStartCountdownTask;
|
||||||
import org.bukkit.Bukkit;
|
import de.steev.Tridentwar.tasks.LobbyWaitingTask;
|
||||||
import org.bukkit.GameMode;
|
import org.bukkit.*;
|
||||||
import org.bukkit.Location;
|
|
||||||
import org.bukkit.configuration.file.FileConfiguration;
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
|
|
||||||
public class GameManager {
|
public class GameManager {
|
||||||
private final Tridentwar plugin;
|
private final Tridentwar plugin;
|
||||||
@ -15,7 +15,10 @@ public class GameManager {
|
|||||||
public GameState gameState = GameState.LOBBY;
|
public GameState gameState = GameState.LOBBY;
|
||||||
private PlayerManager playerManager;
|
private PlayerManager playerManager;
|
||||||
private MessageManager messageManager;
|
private MessageManager messageManager;
|
||||||
|
private FileHandler fileHandler;
|
||||||
|
private LobbyWaitingTask lobbyWaitingTask;
|
||||||
|
private boolean isWaiting = false;
|
||||||
|
private Effect record;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles the entire Game
|
* Handles the entire Game
|
||||||
@ -26,6 +29,8 @@ public class GameManager {
|
|||||||
this.tridentManager = new TridentManager(this);
|
this.tridentManager = new TridentManager(this);
|
||||||
this.playerManager = new PlayerManager(this);
|
this.playerManager = new PlayerManager(this);
|
||||||
this.messageManager = new MessageManager(this);
|
this.messageManager = new MessageManager(this);
|
||||||
|
this.fileHandler = new FileHandler(this);
|
||||||
|
this.lobbyWaitingTask = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -38,54 +43,137 @@ public class GameManager {
|
|||||||
|
|
||||||
switch (gameState){
|
switch (gameState){
|
||||||
case ACTIVE:
|
case ACTIVE:
|
||||||
Bukkit.broadcastMessage("Active!");
|
isWaiting = false;
|
||||||
|
this.playerManager.setGameModes(GameMode.SURVIVAL);
|
||||||
|
this.playerManager.setPlayersHealth(20F);
|
||||||
this.playerManager.setAlive(Bukkit.getOnlinePlayers().size());
|
this.playerManager.setAlive(Bukkit.getOnlinePlayers().size());
|
||||||
this.playerManager.giveKits();
|
this.playerManager.giveKits();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case STARTING:
|
case STARTING:
|
||||||
if(Bukkit.getOnlinePlayers().size() < this.plugin.config.getInt("minplayers")) {
|
if(Bukkit.getOnlinePlayers().size() < this.plugin.config.getInt("minplayers")) {
|
||||||
// Message about minimal player count not beeing reached
|
// Message about minimal player count not beeing reached
|
||||||
Bukkit.broadcastMessage("Game cannot be started with a single player");
|
Bukkit.broadcastMessage(ChatColor.translateAlternateColorCodes('&',this.fileHandler.replaceVars(this.plugin.languageDataConfig.getString("error.not-enough-players"), null, null)));
|
||||||
|
this.setGameState(GameState.LOBBY);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Bukkit.broadcastMessage("Starting!");
|
this.lobbyWaitingTask = null;
|
||||||
this.gameStartCountdownTask = new GameStartCountdownTask(this);
|
this.gameStartCountdownTask = new GameStartCountdownTask(this);
|
||||||
this.gameStartCountdownTask.runTaskTimer(plugin, 0 , 20);
|
this.gameStartCountdownTask.runTaskTimer(plugin, 0 , 20);
|
||||||
// teleport players
|
if(this.plugin.config.getLocation("arena") == null) {
|
||||||
playerManager.teleportPlayers(this.plugin.config.getLocation("arena"));
|
Bukkit.broadcastMessage(ChatColor.translateAlternateColorCodes('&',this.fileHandler.replaceVars(this.plugin.languageDataConfig.getString("error.location-not-found"), null, null)));
|
||||||
|
} else {
|
||||||
|
playerManager.teleportPlayers(this.plugin.config.getLocation("arena"));
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case WAITING:
|
||||||
|
if(!isWaiting) {
|
||||||
|
lobbyWaitingTask = new LobbyWaitingTask(this);
|
||||||
|
lobbyWaitingTask.runTaskTimer(plugin, 0, 20);
|
||||||
|
isWaiting = true;
|
||||||
|
} else {
|
||||||
|
Bukkit.broadcastMessage(ChatColor.translateAlternateColorCodes('&',plugin.languageDataConfig.getString("error.is-already-waiting")));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case LOBBY:
|
case LOBBY:
|
||||||
playerManager.teleportPlayers(this.plugin.config.getLocation("lobby"));
|
playerManager.setGameModes(GameMode.SURVIVAL);
|
||||||
|
if(this.plugin.config.getLocation("arena") == null) {
|
||||||
|
Bukkit.broadcastMessage(ChatColor.translateAlternateColorCodes('&',this.fileHandler.replaceVars(this.plugin.languageDataConfig.getString("error.location-not-found"), null, null)));
|
||||||
|
} else {
|
||||||
|
playerManager.teleportPlayers(this.plugin.config.getLocation("lobby"));
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WON:
|
case WON:
|
||||||
Bukkit.broadcastMessage("Game has been won");
|
|
||||||
for (Player p : Bukkit.getOnlinePlayers()) {
|
for (Player p : Bukkit.getOnlinePlayers()) {
|
||||||
if(p.getGameMode() == GameMode.SURVIVAL) {
|
if(p.getGameMode() == GameMode.SURVIVAL) {
|
||||||
this.messageManager.broadCastTitle("Game ends", p.getDisplayName() + " has won the game");
|
this.messageManager.broadCastTitle(ChatColor.translateAlternateColorCodes('&',this.plugin.languageDataConfig.getString("titles.won.top")),
|
||||||
|
ChatColor.translateAlternateColorCodes('&',this.fileHandler.replaceVars(this.plugin.languageDataConfig.getString("titles.won.bottom"), p, null)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
playerManager.teleportPlayers(this.plugin.config.getLocation("lobby"));
|
tridentManager.clearTasks();
|
||||||
setGameState(GameState.STOPPING);
|
if(this.plugin.config.getLocation("lobby") == null) {
|
||||||
|
Bukkit.broadcastMessage(ChatColor.translateAlternateColorCodes('&',this.fileHandler.replaceVars(this.plugin.languageDataConfig.getString("error.location-not-found"), null, null)));
|
||||||
|
} else {
|
||||||
|
playerManager.teleportPlayers(this.plugin.config.getLocation("lobby"));
|
||||||
|
}
|
||||||
|
new BukkitRunnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
setGameState(GameState.STOPPING);
|
||||||
|
}
|
||||||
|
}.runTaskLater(plugin, 120);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case STOPPING:
|
case STOPPING:
|
||||||
this.messageManager.broadCastTitle("Round stops", "You will be moved back to hub");
|
if(isWaiting) isWaiting = false;
|
||||||
|
this.messageManager.broadCastTitle(ChatColor.translateAlternateColorCodes('&',this.plugin.languageDataConfig.getString("titles.stopping.top")),
|
||||||
|
ChatColor.translateAlternateColorCodes('&', this.fileHandler.replaceVars(this.plugin.languageDataConfig.getString("titles.stopping.bottom"), null, "Hub")));
|
||||||
this.playerManager.removeKits();
|
this.playerManager.removeKits();
|
||||||
// move players back to hub
|
|
||||||
Bukkit.broadcastMessage("Stopping Game");
|
new BukkitRunnable() {
|
||||||
setGameState(GameState.LOBBY);
|
@Override
|
||||||
|
public void run() {
|
||||||
|
// Move players to Hub
|
||||||
|
Bukkit.getOnlinePlayers().forEach(player -> playerManager.moveFromServer(plugin.config.getString("lobby-server"), player));
|
||||||
|
}
|
||||||
|
}.runTaskLater(plugin, 100);
|
||||||
|
|
||||||
|
if (plugin.config.getBoolean("autorestart")) {
|
||||||
|
Bukkit.getServer().dispatchCommand(plugin.getServer().getConsoleSender(), "restart");
|
||||||
|
}
|
||||||
|
|
||||||
|
this.setGameState(GameState.LOBBY);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ABORTING:
|
case ABORTING:
|
||||||
this.messageManager.broadCastTitle("Round aborting", "You will be moved back to hub");
|
if(isWaiting) isWaiting = false;
|
||||||
|
this.messageManager.broadCastTitle(ChatColor.translateAlternateColorCodes('&',this.plugin.languageDataConfig.getString("titles.aborted.top")),
|
||||||
|
ChatColor.translateAlternateColorCodes('&',this.fileHandler.replaceVars(this.plugin.languageDataConfig.getString("titles.aborted.bottom"), null, "Hub")));
|
||||||
this.playerManager.removeKits();
|
this.playerManager.removeKits();
|
||||||
// move players back to hub
|
tridentManager.clearTasks();
|
||||||
Bukkit.broadcastMessage("No Player Alive game aborts");
|
|
||||||
setGameState(GameState.LOBBY);
|
// Move players to Hub
|
||||||
|
Bukkit.getOnlinePlayers().forEach(player -> playerManager.moveFromServer(this.plugin.config.getString("lobby-server"), player));
|
||||||
|
|
||||||
|
if (plugin.config.getBoolean("autorestart")) {
|
||||||
|
Bukkit.getServer().dispatchCommand(plugin.getServer().getConsoleSender(), "restart");
|
||||||
|
}
|
||||||
|
|
||||||
|
this.setGameState(GameState.LOBBY);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void cleanup(){}
|
public void cleanup(){}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the current lobby wayiting task
|
||||||
|
* @return LobbywaitingTask instance
|
||||||
|
*/
|
||||||
|
public LobbyWaitingTask getLobbyWaitingTask() { return lobbyWaitingTask; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gives back the current messageManager instance
|
||||||
|
* @return the messageManager
|
||||||
|
*/
|
||||||
|
public MessageManager getMessageManager() { return messageManager; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* sets the active lobbywaiting task
|
||||||
|
* @param lobbyWaitingTask the current task for waiting in the lobby
|
||||||
|
*/
|
||||||
|
public void setLobbyWaitingTask(LobbyWaitingTask lobbyWaitingTask) { this.lobbyWaitingTask = lobbyWaitingTask; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* returns filehandler of running plugin instance
|
||||||
|
* @return the filehandler instance
|
||||||
|
*/
|
||||||
|
public FileHandler getFileHandler() { return fileHandler; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* local trident manager
|
* local trident manager
|
||||||
* @retur tridentManager instance
|
* @retur tridentManager instance
|
||||||
@ -116,7 +204,6 @@ public class GameManager {
|
|||||||
* @param loc the location to set
|
* @param loc the location to set
|
||||||
*/
|
*/
|
||||||
public void setLocation(String path, Location loc) {
|
public void setLocation(String path, Location loc) {
|
||||||
System.out.println("Location: " + loc);
|
|
||||||
plugin.config.set(path, loc);
|
plugin.config.set(path, loc);
|
||||||
plugin.saveConfig();
|
plugin.saveConfig();
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,13 @@
|
|||||||
package de.steev.Tridentwar.manager;
|
package de.steev.Tridentwar.manager;
|
||||||
|
|
||||||
|
import net.md_5.bungee.api.ChatMessageType;
|
||||||
|
import net.md_5.bungee.api.chat.TextComponent;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import java.awt.*;
|
||||||
|
|
||||||
public class MessageManager {
|
public class MessageManager {
|
||||||
private GameManager gameManager;
|
private GameManager gameManager;
|
||||||
|
|
||||||
@ -14,6 +19,25 @@ public class MessageManager {
|
|||||||
this.gameManager = gameManager;
|
this.gameManager = gameManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* sends a player a message to the actionbar
|
||||||
|
* @param p the player
|
||||||
|
* @param message the message to send
|
||||||
|
*/
|
||||||
|
public void setXPBar(Player p, String message){
|
||||||
|
p.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Broadcasts messages to the Actionbar
|
||||||
|
* @param message the message to broadcast
|
||||||
|
*/
|
||||||
|
public void broadCastXPBar(String message){
|
||||||
|
for(Player p : Bukkit.getOnlinePlayers()) {
|
||||||
|
setXPBar(p, message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Broadcasts a title message to all players online
|
* Broadcasts a title message to all players online
|
||||||
* @param header the Big header of the title
|
* @param header the Big header of the title
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package de.steev.Tridentwar.manager;
|
package de.steev.Tridentwar.manager;
|
||||||
|
|
||||||
|
import com.google.common.io.ByteArrayDataOutput;
|
||||||
|
import com.google.common.io.ByteStreams;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
@ -7,21 +9,27 @@ import org.bukkit.Material;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
public class PlayerManager {
|
public class PlayerManager {
|
||||||
private GameManager gameManager;
|
private GameManager gameManager;
|
||||||
/** The amount of players yet alife */
|
/** The amount of players yet alife */
|
||||||
private int alive = 0;
|
private int alive = 0;
|
||||||
|
/** Keeps track of all kills */
|
||||||
|
private HashMap<Player, Integer> kills;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles all player related functions
|
* Handles all player related functions
|
||||||
* @param gameManager The Local Gamemanager instance
|
* @param gameManager The Local Gamemanager instance
|
||||||
*/
|
*/
|
||||||
public PlayerManager(GameManager gameManager) {
|
public PlayerManager(GameManager gameManager) {
|
||||||
this.gameManager = gameManager;
|
this.gameManager = gameManager;
|
||||||
|
this.kills = new HashMap<Player, Integer>();
|
||||||
}
|
}
|
||||||
/** Give a kit to all Players in Survivalmode */
|
/** Give a kit to all Players in Survivalmode */
|
||||||
public void giveKits() { Bukkit.getOnlinePlayers().stream().filter(player -> player.getGameMode() == GameMode.SURVIVAL).forEach(this::giveKit); }
|
public void giveKits() { Bukkit.getOnlinePlayers().stream().filter(player -> player.getGameMode() == GameMode.SURVIVAL).forEach(this::giveKit); }
|
||||||
/** Removes a kit from all Players in Survivalmode */
|
/** Removes a kit from all Players in Survivalmode */
|
||||||
public void removeKits() { Bukkit.getOnlinePlayers().stream().filter(player -> player.getGameMode() == GameMode.SURVIVAL).forEach(this::giveKit); }
|
public void removeKits() { Bukkit.getOnlinePlayers().stream().filter(player -> player.getGameMode() == GameMode.SURVIVAL).forEach(this::removeKit); }
|
||||||
/** Gives a specified kit in this case hardcoded to specified players */
|
/** Gives a specified kit in this case hardcoded to specified players */
|
||||||
public void giveKit(Player player){ player.getInventory().addItem(new ItemStack(Material.TRIDENT)); }
|
public void giveKit(Player player){ player.getInventory().addItem(new ItemStack(Material.TRIDENT)); }
|
||||||
/** Revmoes a specified kit in this case hardcoded from a specified player */
|
/** Revmoes a specified kit in this case hardcoded from a specified player */
|
||||||
@ -46,7 +54,9 @@ public class PlayerManager {
|
|||||||
* @param player the wanted player
|
* @param player the wanted player
|
||||||
* @param loc the wanted location
|
* @param loc the wanted location
|
||||||
*/
|
*/
|
||||||
public void teleportPlayer(Player player, Location loc) { player.teleport(loc); }
|
public void teleportPlayer(Player player, Location loc) {
|
||||||
|
player.teleport(loc);
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* teleports all player to a given location
|
* teleports all player to a given location
|
||||||
* @param loc
|
* @param loc
|
||||||
@ -58,17 +68,45 @@ public class PlayerManager {
|
|||||||
}
|
}
|
||||||
/** Handles Player death */
|
/** Handles Player death */
|
||||||
public void playerDeath(){
|
public void playerDeath(){
|
||||||
System.out.println("Before death: " + this.alive);
|
|
||||||
this.alive--;
|
this.alive--;
|
||||||
System.out.println("After death: " + this.alive);
|
|
||||||
if(this.alive == 1) {
|
if(this.alive == 1) {
|
||||||
System.out.println("game ends with winner");
|
|
||||||
this.gameManager.setGameState(GameState.WON);
|
this.gameManager.setGameState(GameState.WON);
|
||||||
} else if(this.alive == 0) {
|
} else if(this.alive == 0) {
|
||||||
System.out.println("game gets aborted");
|
|
||||||
this.gameManager.setGameState(GameState.ABORTING);
|
this.gameManager.setGameState(GameState.ABORTING);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates or sets a players kills
|
||||||
|
* @param p the player
|
||||||
|
*/
|
||||||
|
public void addKill(Player p){
|
||||||
|
if(this.kills.containsKey(p)){
|
||||||
|
this.kills.replace(p, this.kills.get(p)+1);
|
||||||
|
} else {
|
||||||
|
this.kills.put(p, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gives back a players kills
|
||||||
|
* @param p the players
|
||||||
|
* @return int amout of kills a player has
|
||||||
|
*/
|
||||||
|
public int getKills(Player p){ return this.kills.get(p); }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Moves a player from a server to another
|
||||||
|
* @param dest the destination
|
||||||
|
* @param target the player to send
|
||||||
|
*/
|
||||||
|
public void moveFromServer(String dest, Player target) {
|
||||||
|
ByteArrayDataOutput aOut = ByteStreams.newDataOutput();
|
||||||
|
aOut.writeUTF("Connect");
|
||||||
|
aOut.writeUTF(dest);
|
||||||
|
target.sendPluginMessage(this.gameManager.getPlugin(), "BungeeCord", aOut.toByteArray());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the amout of alive players
|
* Gets the amout of alive players
|
||||||
* @return Integert amout of alive players
|
* @return Integert amout of alive players
|
||||||
@ -79,4 +117,17 @@ public class PlayerManager {
|
|||||||
* @param alive amount of yet alive players
|
* @param alive amount of yet alive players
|
||||||
*/
|
*/
|
||||||
public void setAlive(int alive) { this.alive = alive; }
|
public void setAlive(int alive) { this.alive = alive; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the player health on set value
|
||||||
|
* @param Life defined life a player should have
|
||||||
|
*/
|
||||||
|
public void setPlayersHealth(float Life) { for(Player p : Bukkit.getOnlinePlayers()) { setPlayerHealth(p,Life); }}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets a player healt
|
||||||
|
* @param p the player
|
||||||
|
* @param Life the amout of life he should get
|
||||||
|
*/
|
||||||
|
public void setPlayerHealth(Player p, float Life) { p.setHealth(Life);}
|
||||||
}
|
}
|
||||||
|
@ -30,5 +30,5 @@ public class SoundManager {
|
|||||||
* @param volume How loud the Sound will be
|
* @param volume How loud the Sound will be
|
||||||
* @param pitch How pitched the sound is
|
* @param pitch How pitched the sound is
|
||||||
*/
|
*/
|
||||||
public void broadCastSound (Sound sound, float volume, float pitch) { Bukkit.getOnlinePlayers().forEach(player -> playSound(player,sound, volume, pitch)); }
|
public void broadCastSound (Sound sound, float volume, float pitch) { for(Player p : Bukkit.getOnlinePlayers()) playSound(p,sound, volume, pitch); }
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ import de.steev.Tridentwar.tasks.TridentResetTask;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
public class TridentManager {
|
public class TridentManager {
|
||||||
/** collects all TridentResetTask bound to a player */
|
/** collects all TridentResetTask bound to a player */
|
||||||
@ -30,9 +31,21 @@ public class TridentManager {
|
|||||||
*/
|
*/
|
||||||
public TridentResetTask getTask (Player thrower) { return tasks.get(thrower); }
|
public TridentResetTask getTask (Player thrower) { return tasks.get(thrower); }
|
||||||
|
|
||||||
|
/** clears triendt tasks */
|
||||||
|
public void clearTasks() {
|
||||||
|
for(Map.Entry<Player, TridentResetTask> t : tasks.entrySet()) {
|
||||||
|
TridentResetTask task = t.getValue();
|
||||||
|
task.cancel();
|
||||||
|
}
|
||||||
|
System.out.println("DEBUG: Trident tasks have been cleared");
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes a TridentResetTask of a given player
|
* Removes a TridentResetTask of a given player
|
||||||
* @param thrower the thrower of which the TridentResetTask should be removed from
|
* @param thrower the thrower of which the TridentResetTask should be removed from
|
||||||
*/
|
*/
|
||||||
public void removeTridentTast(Player thrower) { tasks.remove(thrower); }
|
public void removeTridentTask(Player thrower) {
|
||||||
|
getTask(thrower).cancel();
|
||||||
|
tasks.remove(thrower);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,47 @@
|
|||||||
|
package de.steev.Tridentwar.tasks;
|
||||||
|
|
||||||
|
import de.steev.Tridentwar.manager.GameManager;
|
||||||
|
import de.steev.Tridentwar.manager.GameState;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
|
|
||||||
|
public class LobbyWaitingTask extends BukkitRunnable {
|
||||||
|
private GameManager gameManager;
|
||||||
|
public LobbyWaitingTask(GameManager gameManager) {
|
||||||
|
this.gameManager = gameManager;
|
||||||
|
System.out.println("DEBUG: Lobby is Waiting");
|
||||||
|
}
|
||||||
|
|
||||||
|
private int timeLeft = 30;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
timeLeft--;
|
||||||
|
this.gameManager.getMessageManager().broadCastXPBar(ChatColor.translateAlternateColorCodes('&', this.gameManager.getPlugin().languageDataConfig.getString("game.countdown") + timeLeft));
|
||||||
|
if (timeLeft > 10) {
|
||||||
|
switch (timeLeft) {
|
||||||
|
case 30: Bukkit.broadcastMessage(ChatColor.translateAlternateColorCodes('&', this.gameManager.getPlugin().languageDataConfig.getString("game.countdown") + timeLeft)); break;
|
||||||
|
case 25: Bukkit.broadcastMessage(ChatColor.translateAlternateColorCodes('&', this.gameManager.getPlugin().languageDataConfig.getString("game.countdown") + timeLeft)); break;
|
||||||
|
case 20: Bukkit.broadcastMessage(ChatColor.translateAlternateColorCodes('&', this.gameManager.getPlugin().languageDataConfig.getString("game.countdown") + timeLeft)); break;
|
||||||
|
case 15: Bukkit.broadcastMessage(ChatColor.translateAlternateColorCodes('&', this.gameManager.getPlugin().languageDataConfig.getString("game.countdown") + timeLeft)); break;
|
||||||
|
}
|
||||||
|
} else if(timeLeft <= 10) {
|
||||||
|
Bukkit.broadcastMessage(ChatColor.translateAlternateColorCodes('&', this.gameManager.getPlugin().languageDataConfig.getString("game.countdown") + timeLeft));
|
||||||
|
|
||||||
|
if(timeLeft <= 0) {
|
||||||
|
if(Bukkit.getOnlinePlayers().size() < this.gameManager.getPlugin().config.getInt("minplayers")) {
|
||||||
|
Bukkit.broadcastMessage(ChatColor.translateAlternateColorCodes('&',
|
||||||
|
this.gameManager.getFileHandler().replaceVars(this.gameManager.getPlugin().languageDataConfig.getString("error.not-enough-players"), null, null)));
|
||||||
|
this.gameManager.setGameState(GameState.ABORTING);
|
||||||
|
} else {
|
||||||
|
Bukkit.broadcastMessage(ChatColor.translateAlternateColorCodes('&',
|
||||||
|
this.gameManager.getFileHandler().replaceVars(this.gameManager.getPlugin().languageDataConfig.getString("game.starting"), null, null)));
|
||||||
|
gameManager.setGameState(GameState.STARTING);
|
||||||
|
}
|
||||||
|
cancel();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,6 +1,9 @@
|
|||||||
package de.steev.Tridentwar.tasks;
|
package de.steev.Tridentwar.tasks;
|
||||||
|
|
||||||
import de.steev.Tridentwar.manager.GameManager;
|
import de.steev.Tridentwar.manager.GameManager;
|
||||||
|
import de.steev.Tridentwar.manager.GameState;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -10,20 +13,42 @@ import org.bukkit.scheduler.BukkitRunnable;
|
|||||||
public class TridentResetTask extends BukkitRunnable {
|
public class TridentResetTask extends BukkitRunnable {
|
||||||
|
|
||||||
private GameManager gameManager;
|
private GameManager gameManager;
|
||||||
private Player thrower;
|
|
||||||
private Entity projektile;
|
|
||||||
|
|
||||||
public TridentResetTask (GameManager gameManager, Player thrower, Entity projektile) {
|
public TridentResetTask (GameManager gameManager, Player thrower, Entity projektile) {
|
||||||
this.gameManager = gameManager;
|
this.gameManager = gameManager;
|
||||||
this.thrower = thrower;
|
|
||||||
this.projektile = projektile;
|
|
||||||
System.out.println("Trident Reset task started");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private int timeLeft = 30;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
projektile.remove();
|
timeLeft--;
|
||||||
thrower.getInventory().addItem(new ItemStack(Material.TRIDENT));
|
if(timeLeft >= 10) {
|
||||||
System.out.println("Trident Reset task executed");
|
switch (timeLeft) {
|
||||||
|
case 30: Bukkit.broadcastMessage(ChatColor.translateAlternateColorCodes('&',this.gameManager.getPlugin().languageDataConfig.getString("game.countdown"))); break;
|
||||||
|
case 25: Bukkit.broadcastMessage(ChatColor.translateAlternateColorCodes('&',this.gameManager.getPlugin().languageDataConfig.getString("game.countdown"))); break;
|
||||||
|
case 20: Bukkit.broadcastMessage(ChatColor.translateAlternateColorCodes('&',this.gameManager.getPlugin().languageDataConfig.getString("game.countdown"))); break;
|
||||||
|
case 15: Bukkit.broadcastMessage(ChatColor.translateAlternateColorCodes('&',this.gameManager.getPlugin().languageDataConfig.getString("game.countdown"))); break;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Bukkit.broadcastMessage(ChatColor.translateAlternateColorCodes('&',this.gameManager.getPlugin().languageDataConfig.getString("game.countdown")));
|
||||||
|
|
||||||
|
if(Bukkit.getOnlinePlayers().size() < this.gameManager.getPlugin().config.getInt("minplayers")) {
|
||||||
|
Bukkit.broadcastMessage(ChatColor.translateAlternateColorCodes('&',this.gameManager.getPlugin().languageDataConfig.getString("error.not-enough-players")));
|
||||||
|
}
|
||||||
|
|
||||||
|
if(timeLeft <= 0) {
|
||||||
|
if(Bukkit.getOnlinePlayers().size() < this.gameManager.getPlugin().config.getInt("minplayers")) {
|
||||||
|
Bukkit.broadcastMessage(ChatColor.translateAlternateColorCodes('&',this.gameManager.getPlugin().languageDataConfig.getString("error.not-enough-players")));
|
||||||
|
cancel();
|
||||||
|
this.gameManager.setGameState(GameState.ABORTING);
|
||||||
|
} else {
|
||||||
|
cancel();
|
||||||
|
gameManager.setGameState(GameState.ACTIVE);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
25
src/main/resources/langs/de-ger.yml
Normal file
25
src/main/resources/langs/de-ger.yml
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
error:
|
||||||
|
invalid-permission: "&cDir fehlen die nötigen Rechte um das zutun!"
|
||||||
|
location-set-error: "&cDer Ort konnte nicht eingestellt werden!"
|
||||||
|
not-enough-players: "&cEs müssen mindestens &n%min% &cSpieler am Spiel teilnehmen!"
|
||||||
|
location-not-found: "&c%location% Konnte nicht geladen werden"
|
||||||
|
is-already-waiting: "&cEin Fehler ist aufgetreten! Die Lobby wartet bereits auf Spieler!"
|
||||||
|
no-game-running: "&cDu kannst keiner inaktiven Runde zuschauen"
|
||||||
|
dev:
|
||||||
|
location-set: "&a%location% wurde gesetzt"
|
||||||
|
game:
|
||||||
|
starting: "Spiel startet!"
|
||||||
|
countdown: "Spiel beginnt in: "
|
||||||
|
titles:
|
||||||
|
won:
|
||||||
|
top: "&aSpiel Ende!"
|
||||||
|
bottom: "&6%winner% hat das Spiel gewonnen!"
|
||||||
|
death:
|
||||||
|
top: "&cDu bist Tot!"
|
||||||
|
bottom: "&6Diese Runde, hast du verloren."
|
||||||
|
stopping:
|
||||||
|
top: "&eSpiel angehalten!"
|
||||||
|
bottom: "&6&6Du wirst auf den &6&n%default% Server verschoben!"
|
||||||
|
aborted:
|
||||||
|
top: "&c&lSpiel Abgebrochen!"
|
||||||
|
bottom: "&6Du wirst zurück auf den &n%default% Server verschoben!"
|
25
src/main/resources/langs/en-us.yml
Normal file
25
src/main/resources/langs/en-us.yml
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
error:
|
||||||
|
invalid-permission: "&cYou are not permitted to use that command!"
|
||||||
|
location-set-error: "&cthe location could not be set!"
|
||||||
|
not-enough-players: "&cNot enough players &n%min% &cplayers needed to start!"
|
||||||
|
location-not-found: "&c%location% was not found"
|
||||||
|
is-already-waiting: "&can Error occured the lobby already is waiting"
|
||||||
|
no-game-running: "&cYou cannot spectate on a not running game"
|
||||||
|
dev:
|
||||||
|
location-set: "&a%location% has been set!"
|
||||||
|
game:
|
||||||
|
starting: "Game is starting"
|
||||||
|
countdown: "starting in: "
|
||||||
|
titles:
|
||||||
|
death:
|
||||||
|
top: "&cYou Died!"
|
||||||
|
bottom: "&6You have lost this Round!"
|
||||||
|
won:
|
||||||
|
top: "&aGame Ends!"
|
||||||
|
bottom: "&6%winner% has won the game"
|
||||||
|
stopping:
|
||||||
|
top: "&eGame Stopps!"
|
||||||
|
bottom: "&6&6You will be moved back to &6&n%default%"
|
||||||
|
aborted:
|
||||||
|
top: "&c&lGame Aborting!"
|
||||||
|
bottom: "&6You will be moved back to &n%default%"
|
75
trace.txt
Normal file
75
trace.txt
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
[23:18:00 ERROR]: Could not pass event EntityDamageByEntityEvent to TridentWar v0.1
|
||||||
|
java.lang.ClassCastException: class org.bukkit.craftbukkit.v1_18_R1.entity.CraftTrident cannot be cast to class org.bukkit.entity.Player (org.bukkit.craftbukkit.v1_18_R1.entity.CraftTrident and org.bukkit.entity.Player are in unnamed module of loader java.net.URLClassLoader @484b61fc)
|
||||||
|
at de.steev.Tridentwar.listeners.PlayerDeathListener.onPlayerDamage(PlayerDeathListener.java:34) ~[Tridentwar.jar:?]
|
||||||
|
at com.destroystokyo.paper.event.executor.asm.generated.GeneratedEventExecutor18.execute(Unknown Source) ~[?:?]
|
||||||
|
at org.bukkit.plugin.EventExecutor.lambda$create$1(EventExecutor.java:69) ~[paper-api-1.18.1-R0.1-SNAPSHOT.jar:?]
|
||||||
|
at co.aikar.timings.TimedEventExecutor.execute(TimedEventExecutor.java:80) ~[paper-api-1.18.1-R0.1-SNAPSHOT.jar:git-Paper-105]
|
||||||
|
at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:70) ~[paper-api-1.18.1-R0.1-SNAPSHOT.jar:?]
|
||||||
|
at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:628) ~[paper-api-1.18.1-R0.1-SNAPSHOT.jar:?]
|
||||||
|
at org.bukkit.craftbukkit.v1_18_R1.event.CraftEventFactory.callEvent(CraftEventFactory.java:247) ~[paper-1.18.1.jar:git-Paper-105]
|
||||||
|
at org.bukkit.craftbukkit.v1_18_R1.event.CraftEventFactory.callEntityDamageEvent(CraftEventFactory.java:1122) ~[paper-1.18.1.jar:git-Paper-105]
|
||||||
|
at org.bukkit.craftbukkit.v1_18_R1.event.CraftEventFactory.handleEntityDamageEvent(CraftEventFactory.java:998) ~[paper-1.18.1.jar:git-Paper-105]
|
||||||
|
at org.bukkit.craftbukkit.v1_18_R1.event.CraftEventFactory.handleEntityDamageEvent(CraftEventFactory.java:954) ~[paper-1.18.1.jar:git-Paper-105]
|
||||||
|
at org.bukkit.craftbukkit.v1_18_R1.event.CraftEventFactory.handleLivingEntityDamageEvent(CraftEventFactory.java:1154) ~[paper-1.18.1.jar:git-Paper-105]
|
||||||
|
at net.minecraft.world.entity.LivingEntity.damageEntity0(LivingEntity.java:2055) ~[?:?]
|
||||||
|
at net.minecraft.world.entity.player.Player.damageEntity0(Player.java:1016) ~[?:?]
|
||||||
|
at net.minecraft.world.entity.LivingEntity.hurt(LivingEntity.java:1345) ~[?:?]
|
||||||
|
at net.minecraft.world.entity.player.Player.hurt(Player.java:923) ~[?:?]
|
||||||
|
at net.minecraft.server.level.ServerPlayer.hurt(ServerPlayer.java:1027) ~[?:?]
|
||||||
|
at net.minecraft.world.entity.projectile.ThrownTrident.onHitEntity(ThrownTrident.java:131) ~[?:?]
|
||||||
|
at net.minecraft.world.entity.projectile.Projectile.onHit(Projectile.java:181) ~[?:?]
|
||||||
|
at net.minecraft.world.entity.projectile.Projectile.preOnHit(Projectile.java:172) ~[?:?]
|
||||||
|
at net.minecraft.world.entity.projectile.AbstractArrow.tick(AbstractArrow.java:241) ~[?:?]
|
||||||
|
at net.minecraft.world.entity.projectile.ThrownTrident.tick(ThrownTrident.java:90) ~[?:?]
|
||||||
|
at net.minecraft.server.level.ServerLevel.tickNonPassenger(ServerLevel.java:1128) ~[?:?]
|
||||||
|
at net.minecraft.world.level.Level.guardEntityTick(Level.java:970) ~[?:?]
|
||||||
|
at net.minecraft.server.level.ServerLevel.lambda$tick$5(ServerLevel.java:670) ~[?:?]
|
||||||
|
at net.minecraft.world.level.entity.EntityTickList.forEach(EntityTickList.java:43) ~[paper-1.18.1.jar:git-Paper-105]
|
||||||
|
at net.minecraft.server.level.ServerLevel.tick(ServerLevel.java:650) ~[?:?]
|
||||||
|
at net.minecraft.server.MinecraftServer.tickChildren(MinecraftServer.java:1607) ~[paper-1.18.1.jar:git-Paper-105]
|
||||||
|
at net.minecraft.server.dedicated.DedicatedServer.tickChildren(DedicatedServer.java:480) ~[paper-1.18.1.jar:git-Paper-105]
|
||||||
|
at net.minecraft.server.MinecraftServer.tickServer(MinecraftServer.java:1470) ~[paper-1.18.1.jar:git-Paper-105]
|
||||||
|
at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1264) ~[paper-1.18.1.jar:git-Paper-105]
|
||||||
|
at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:317) ~[paper-1.18.1.jar:git-Paper-105]
|
||||||
|
at java.lang.Thread.run(Thread.java:833) ~[?:?]
|
||||||
|
|
||||||
|
[23:18:00 INFO]: Chajax was impaled by The_Steev
|
||||||
|
[23:18:02 INFO]: [TridentWar] [STDOUT] Trident Reset task started
|
||||||
|
[23:18:02 INFO]: DEBUG: The_Steev Health: 8.0
|
||||||
|
[23:18:02 INFO]: DEBUG: The_SteevDIED
|
||||||
|
[23:18:02 ERROR]: Could not pass event EntityDamageByEntityEvent to TridentWar v0.1
|
||||||
|
|
||||||
|
java.lang.ClassCastException: class org.bukkit.craftbukkit.v1_18_R1.entity.CraftTrident cannot be cast to class org.bukkit.entity.Player (org.bukkit.craftbukkit.v1_18_R1.entity.CraftTrident and org.bukkit.entity.Player are in unnamed module of loader java.net.URLClassLoader @484b61fc)
|
||||||
|
at de.steev.Tridentwar.listeners.PlayerDeathListener.onPlayerDamage(PlayerDeathListener.java:34) ~[Tridentwar.jar:?]
|
||||||
|
at com.destroystokyo.paper.event.executor.asm.generated.GeneratedEventExecutor18.execute(Unknown Source) ~[?:?]
|
||||||
|
at org.bukkit.plugin.EventExecutor.lambda$create$1(EventExecutor.java:69) ~[paper-api-1.18.1-R0.1-SNAPSHOT.jar:?]
|
||||||
|
at co.aikar.timings.TimedEventExecutor.execute(TimedEventExecutor.java:80) ~[paper-api-1.18.1-R0.1-SNAPSHOT.jar:git-Paper-105]
|
||||||
|
at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:70) ~[paper-api-1.18.1-R0.1-SNAPSHOT.jar:?]
|
||||||
|
at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:628) ~[paper-api-1.18.1-R0.1-SNAPSHOT.jar:?]
|
||||||
|
at org.bukkit.craftbukkit.v1_18_R1.event.CraftEventFactory.callEvent(CraftEventFactory.java:247) ~[paper-1.18.1.jar:git-Paper-105]
|
||||||
|
at org.bukkit.craftbukkit.v1_18_R1.event.CraftEventFactory.callEntityDamageEvent(CraftEventFactory.java:1122) ~[paper-1.18.1.jar:git-Paper-105]
|
||||||
|
at org.bukkit.craftbukkit.v1_18_R1.event.CraftEventFactory.handleEntityDamageEvent(CraftEventFactory.java:998) ~[paper-1.18.1.jar:git-Paper-105]
|
||||||
|
at org.bukkit.craftbukkit.v1_18_R1.event.CraftEventFactory.handleEntityDamageEvent(CraftEventFactory.java:954) ~[paper-1.18.1.jar:git-Paper-105]
|
||||||
|
at org.bukkit.craftbukkit.v1_18_R1.event.CraftEventFactory.handleLivingEntityDamageEvent(CraftEventFactory.java:1154) ~[paper-1.18.1.jar:git-Paper-105]
|
||||||
|
at net.minecraft.world.entity.LivingEntity.damageEntity0(LivingEntity.java:2055) ~[?:?]
|
||||||
|
at net.minecraft.world.entity.player.Player.damageEntity0(Player.java:1016) ~[?:?]
|
||||||
|
at net.minecraft.world.entity.LivingEntity.hurt(LivingEntity.java:1345) ~[?:?]
|
||||||
|
at net.minecraft.world.entity.player.Player.hurt(Player.java:923) ~[?:?]
|
||||||
|
at net.minecraft.server.level.ServerPlayer.hurt(ServerPlayer.java:1027) ~[?:?]
|
||||||
|
at net.minecraft.world.entity.projectile.ThrownTrident.onHitEntity(ThrownTrident.java:131) ~[?:?]
|
||||||
|
at net.minecraft.world.entity.projectile.Projectile.onHit(Projectile.java:181) ~[?:?]
|
||||||
|
at net.minecraft.world.entity.projectile.Projectile.preOnHit(Projectile.java:172) ~[?:?]
|
||||||
|
at net.minecraft.world.entity.projectile.AbstractArrow.tick(AbstractArrow.java:241) ~[?:?]
|
||||||
|
at net.minecraft.world.entity.projectile.ThrownTrident.tick(ThrownTrident.java:90) ~[?:?]
|
||||||
|
at net.minecraft.server.level.ServerLevel.tickNonPassenger(ServerLevel.java:1128) ~[?:?]
|
||||||
|
at net.minecraft.world.level.Level.guardEntityTick(Level.java:970) ~[?:?]
|
||||||
|
at net.minecraft.server.level.ServerLevel.lambda$tick$5(ServerLevel.java:670) ~[?:?]
|
||||||
|
at net.minecraft.world.level.entity.EntityTickList.forEach(EntityTickList.java:43) ~[paper-1.18.1.jar:git-Paper-105]
|
||||||
|
at net.minecraft.server.level.ServerLevel.tick(ServerLevel.java:650) ~[?:?]
|
||||||
|
at net.minecraft.server.MinecraftServer.tickChildren(MinecraftServer.java:1607) ~[paper-1.18.1.jar:git-Paper-105]
|
||||||
|
at net.minecraft.server.dedicated.DedicatedServer.tickChildren(DedicatedServer.java:480) ~[paper-1.18.1.jar:git-Paper-105]
|
||||||
|
at net.minecraft.server.MinecraftServer.tickServer(MinecraftServer.java:1470) ~[paper-1.18.1.jar:git-Paper-105]
|
||||||
|
at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1264) ~[paper-1.18.1.jar:git-Paper-105]
|
||||||
|
at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:317) ~[paper-1.18.1.jar:git-Paper-105]
|
||||||
|
at java.lang.Thread.run(Thread.java:833) ~[?:?]
|
||||||
|
[23:18:02 INFO]: The_Steev was impaled by munio73
|
Loading…
x
Reference in New Issue
Block a user