Let's begin to make it good!

This commit is contained in:
Bl4ckSkull666 2019-10-12 13:56:34 +02:00
parent 0c214214c3
commit 5601ac9923
36 changed files with 1042 additions and 1125 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/dist/

File diff suppressed because it is too large Load Diff

View File

@ -1,8 +1,8 @@
build.xml.data.CRC32=2936ce4c build.xml.data.CRC32=2936ce4c
build.xml.script.CRC32=bd6b80d1 build.xml.script.CRC32=bd6b80d1
build.xml.stylesheet.CRC32=8064a381@1.79.1.48 build.xml.stylesheet.CRC32=f85dc8f2@1.90.1.48
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
nbproject/build-impl.xml.data.CRC32=2936ce4c nbproject/build-impl.xml.data.CRC32=2936ce4c
nbproject/build-impl.xml.script.CRC32=daa86fce nbproject/build-impl.xml.script.CRC32=cad2c6b6
nbproject/build-impl.xml.stylesheet.CRC32=05530350@1.79.1.48 nbproject/build-impl.xml.stylesheet.CRC32=3a2fa800@1.90.1.48

View File

@ -5,6 +5,7 @@ annotation.processing.run.all.processors=true
annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
application.title=Quake_1.9 application.title=Quake_1.9
application.vendor=Bl4ckSkull666 application.vendor=Bl4ckSkull666
auxiliary.org-netbeans-spi-editor-hints-projects.perProjectHintSettingsFile=nbproject/cfg_hints.xml
build.classes.dir=${build.dir}/classes build.classes.dir=${build.dir}/classes
build.classes.excludes=**/*.java,**/*.form build.classes.excludes=**/*.java,**/*.form
# This directory is removed when the project is cleaned: # This directory is removed when the project is cleaned:
@ -19,8 +20,12 @@ build.test.results.dir=${build.dir}/test/results
#debug.transport=dt_socket #debug.transport=dt_socket
debug.classpath=\ debug.classpath=\
${run.classpath} ${run.classpath}
debug.modulepath=\
${run.modulepath}
debug.test.classpath=\ debug.test.classpath=\
${run.test.classpath} ${run.test.classpath}
debug.test.modulepath=\
${run.test.modulepath}
# Files in build.classes.dir which should be excluded from distribution jar # Files in build.classes.dir which should be excluded from distribution jar
dist.archive.excludes= dist.archive.excludes=
# This directory is removed when the project is cleaned: # This directory is removed when the project is cleaned:
@ -29,30 +34,36 @@ dist.jar=${dist.dir}/Quake_1.9.jar
dist.javadoc.dir=${dist.dir}/javadoc dist.javadoc.dir=${dist.dir}/javadoc
endorsed.classpath= endorsed.classpath=
excludes= excludes=
file.reference.spigot-1.10.2.jar=D:\\AMC-Server.de\\JARs\\spigot-1.10.2.jar file.reference.spigot-1.12.1.jar=Z:\\Projekte\\AMC-Server.de\\JARs\\spigot-1.12.1.jar
file.reference.Vault_v.1.5.6.jar=../../AMC-Server.de/JARs/Vault_v.1.5.6.jar file.reference.spigot-1.14.4.jar=Z:\\Projekte\\Minecraft\\Jars\\Spigot\\spigot-1.14.4.jar
file.reference.WorldEdit_v6.1.3.jar=D:\\AMC-Server.de\\JARs\\WorldEdit_v6.1.3.jar file.reference.Vault_v1.7.2.jar=Z:\\Projekte\\Minecraft\\Jars\\1.14\\Vault_v1.7.2.jar
file.reference.WorldEdit_v6.1.jar=../../AMC-Server.de/JARs/WorldEdit_v6.1.jar file.reference.WorldEdit_v7.1.0-b4675.jar=Z:\\Projekte\\Minecraft\\Jars\\1.14\\WorldEdit_v7.1.0-b4675.jar
file.reference.WorldGuard_v6.1.jar=../../AMC-Server.de/JARs/WorldGuard_v6.1.jar file.reference.WorldGuard_v7.0.1-b1983.jar=Z:\\Projekte\\Minecraft\\Jars\\1.14\\WorldGuard_v7.0.1-b1983.jar
includes=** includes=**
jar.archive.disabled=${jnlp.enabled}
jar.compress=false jar.compress=false
jar.index=${jnlp.enabled}
javac.classpath=\ javac.classpath=\
${file.reference.WorldEdit_v6.1.jar}:\ ${file.reference.spigot-1.12.1.jar}:\
${file.reference.WorldGuard_v6.1.jar}:\ ${file.reference.spigot-1.14.4.jar}:\
${file.reference.Vault_v.1.5.6.jar}:\ ${file.reference.Vault_v1.7.2.jar}:\
${file.reference.WorldEdit_v6.1.3.jar}:\ ${file.reference.WorldEdit_v7.1.0-b4675.jar}:\
${file.reference.spigot-1.10.2.jar} ${file.reference.WorldGuard_v7.0.1-b1983.jar}
# Space-separated list of extra javac options # Space-separated list of extra javac options
javac.compilerargs= javac.compilerargs=
javac.deprecation=false javac.deprecation=false
javac.external.vm=true javac.external.vm=true
javac.modulepath=
javac.processormodulepath=
javac.processorpath=\ javac.processorpath=\
${javac.classpath} ${javac.classpath}
javac.source=1.7 javac.source=1.8
javac.target=1.7 javac.target=1.8
javac.test.classpath=\ javac.test.classpath=\
${javac.classpath}:\ ${javac.classpath}:\
${build.classes.dir} ${build.classes.dir}
javac.test.modulepath=\
${javac.modulepath}
javac.test.processorpath=\ javac.test.processorpath=\
${javac.test.classpath} ${javac.test.classpath}
javadoc.additionalparam= javadoc.additionalparam=
@ -66,7 +77,24 @@ javadoc.splitindex=true
javadoc.use=true javadoc.use=true
javadoc.version=false javadoc.version=false
javadoc.windowtitle= javadoc.windowtitle=
jnlp.codebase.type=no.codebase
jnlp.descriptor=application
jnlp.enabled=false
jnlp.mixed.code=default
jnlp.offline-allowed=false
jnlp.signed=false
jnlp.signing=
jnlp.signing.alias=
jnlp.signing.keystore=
main.class= main.class=
# Optional override of default Application-Library-Allowable-Codebase attribute identifying the locations where your signed RIA is expected to be found.
manifest.custom.application.library.allowable.codebase=
# Optional override of default Caller-Allowable-Codebase attribute identifying the domains from which JavaScript code can make calls to your RIA without security prompts.
manifest.custom.caller.allowable.codebase=
# Optional override of default Codebase manifest attribute, use to prevent RIAs from being repurposed
manifest.custom.codebase=
# Optional override of default Permissions manifest attribute (supported values: sandbox, all-permissions)
manifest.custom.permissions=
manifest.file=manifest.mf manifest.file=manifest.mf
meta.inf.dir=${src.dir}/META-INF meta.inf.dir=${src.dir}/META-INF
mkdist.disabled=false mkdist.disabled=false
@ -78,9 +106,13 @@ run.classpath=\
# You may also define separate properties like run-sys-prop.name=value instead of -Dname=value. # You may also define separate properties like run-sys-prop.name=value instead of -Dname=value.
# To set system properties for unit tests define test-sys-prop.name=value: # To set system properties for unit tests define test-sys-prop.name=value:
run.jvmargs= run.jvmargs=
run.modulepath=\
${javac.modulepath}
run.test.classpath=\ run.test.classpath=\
${javac.test.classpath}:\ ${javac.test.classpath}:\
${build.test.classes.dir} ${build.test.classes.dir}
run.test.modulepath=\
${javac.test.modulepath}
source.encoding=UTF-8 source.encoding=UTF-8
src.dir=src src.dir=src
test.src.dir=test test.src.dir=test

View File

@ -283,7 +283,7 @@ public abstract class Arena {
} }
public ItemStack getLeaveDoor() { public ItemStack getLeaveDoor() {
ItemStack coucou = new ItemStack(Material.WOOD_DOOR, 1); ItemStack coucou = new ItemStack(Material.DARK_OAK_DOOR);
ItemMeta coucou_meta = coucou.getItemMeta(); ItemMeta coucou_meta = coucou.getItemMeta();
coucou_meta.setDisplayName(_plugin._trad.get("Game.item.leave")); coucou_meta.setDisplayName(_plugin._trad.get("Game.item.leave"));
coucou.setItemMeta(coucou_meta); coucou.setItemMeta(coucou_meta);
@ -303,24 +303,25 @@ public abstract class Arena {
APlayer ashooter = getAPlayer(shooter); APlayer ashooter = getAPlayer(shooter);
APlayer avictim = getAPlayer(victim); APlayer avictim = getAPlayer(victim);
if (victim != shooter && !avictim.isInvincible()) { if (victim != shooter && !avictim.isInvincible()) {
Bukkit.getScheduler().scheduleSyncDelayedTask((Plugin)_plugin, new Runnable() { Bukkit.getScheduler().scheduleSyncDelayedTask(_plugin, new Runnable() {
@Override @Override
public void run() { public void run() {
getGainKill(shooter); getGainKill(shooter);
} }
}, 2); }, 2);
try { try {
_fw.playFirework(victim.getWorld(), victim.getLocation(), effect); _fw.playFirework(victim.getWorld(), victim.getLocation(), effect);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
kill(victim); kill(victim);
broadcast(_plugin._trad.get("Game.Arena.Message.Shot").replace("[SHOOTER]", shooter.getName()).replace("[KILLED]", victim.getName())); broadcast(_plugin._trad.get("Game.Arena.Message.Shot").replace("[SHOOTER]", shooter.getName()).replace("[KILLED]", victim.getName()));
++ashooter._score; ashooter._score++;
if (ashooter._score == _goal) { if (ashooter._score == _goal) {
Bukkit.getScheduler().scheduleSyncDelayedTask((Plugin)_plugin, new Runnable(){ Bukkit.getScheduler().scheduleSyncDelayedTask(_plugin, new Runnable() {
@Override @Override
public void run() { public void run() {
win(shooter); win(shooter);

View File

@ -1,6 +1,8 @@
package com.Geekpower14.Quake.Arena; package com.Geekpower14.Quake.Arena;
import com.Geekpower14.Quake.Quake; import com.Geekpower14.Quake.Quake;
import com.Geekpower14.Quake.Versions.GetSounds;
import com.Geekpower14.Quake.Versions.SelectVersion;
import org.bukkit.Sound; import org.bukkit.Sound;
public class Timer implements Runnable { public class Timer implements Runnable {
@ -15,6 +17,8 @@ public class Timer implements Runnable {
@Override @Override
public void run() { public void run() {
Sound _sound = GetSounds.GetNotePling();
if(_plugin.getServer().getOnlinePlayers().isEmpty()) if(_plugin.getServer().getOnlinePlayers().isEmpty())
return; return;
@ -28,18 +32,17 @@ public class Timer implements Runnable {
if(_arena._etat <= 5 && _arena._etat >= 1) { if(_arena._etat <= 5 && _arena._etat >= 1) {
_arena.broadcast(_plugin._trad.get("Game.Arena.Message.RemainTime").replace("[TIME]", "" + _arena._etat)); _arena.broadcast(_plugin._trad.get("Game.Arena.Message.RemainTime").replace("[TIME]", "" + _arena._etat));
_arena.playsound(Sound.BLOCK_NOTE_PLING, 0.6f, 50.0f); if(_sound != null)
//_arena.playsound(Sound.NOTE_PLING, 0.6f, 50.0f); _arena.playsound(_sound, 0.6f, 50.0f);
} }
if (_arena._etat == 0) { if (_arena._etat == 0) {
_arena.playsound(Sound.BLOCK_NOTE_PLING, 9.0f, 1.0f); if(_sound != null) {
_arena.playsound(Sound.BLOCK_NOTE_PLING, 9.0f, 5.0f); _arena.playsound(_sound, 9.0f, 1.0f);
_arena.playsound(Sound.BLOCK_NOTE_PLING, 9.0f, 10.0f); _arena.playsound(_sound, 9.0f, 5.0f);
_arena.playsound(_sound, 9.0f, 10.0f);
/*_arena.playsound(Sound.NOTE_PLING, 9.0f, 1.0f); }
_arena.playsound(Sound.NOTE_PLING, 9.0f, 5.0f);
_arena.playsound(Sound.NOTE_PLING, 9.0f, 10.0f);*/
_arena.broadcast(_plugin._trad.get("Game.Arena.Message.Start")); _arena.broadcast(_plugin._trad.get("Game.Arena.Message.Start"));
_arena.start(); _arena.start();

View File

@ -55,7 +55,7 @@ public class MyCommandExecutor implements CommandExecutor {
if(cmd.getName().equalsIgnoreCase("quake")) { if(cmd.getName().equalsIgnoreCase("quake")) {
if(args == null || args.length < 1) { if(args == null || args.length < 1) {
player.sendMessage(ChatColor.YELLOW + "Plugin By Geekpower14"); player.sendMessage(ChatColor.YELLOW + "Plugin By Geekpower14");
player.sendMessage(ChatColor.YELLOW + "Reloaded by Bl4ckSkull666 ( wwww.AMC-Server.de )"); player.sendMessage(ChatColor.YELLOW + "Reloaded by Bl4ckSkull666 ( wwww.Survival-Piraten.de )");
player.sendMessage(ChatColor.YELLOW + "Version: " + _plugin.getDescription().getVersion()); player.sendMessage(ChatColor.YELLOW + "Version: " + _plugin.getDescription().getVersion());
return true; return true;
} }

View File

@ -23,15 +23,19 @@ public class StopCommand implements BasicCommand {
public boolean onCommand(Player player, String[] args) { public boolean onCommand(Player player, String[] args) {
if (Quake.hasPermission(player, getPermission())) { if (Quake.hasPermission(player, getPermission())) {
Arena arena = null; Arena arena = null;
if (_plugin._am.exist(args[0])) { if(args.length == 0) {
} else if (_plugin._am.exist(args[0])) {
arena = _plugin._am.getArenabyName(args[0]); arena = _plugin._am.getArenabyName(args[0]);
} else if (args[0].matches("^\\d*$")) { } else if (args[0].matches("^\\d*$")) {
arena = _plugin._am.getArenabyID(Integer.parseInt(args[0])); arena = _plugin._am.getArenabyID(Integer.parseInt(args[0]));
} }
if (arena == null) { if (arena == null) {
player.sendMessage(ChatColor.RED + "Please type a good arena name ! !"); player.sendMessage(ChatColor.RED + "Please type a good arena name ! !");
return true; return true;
} }
arena.stop(); arena.stop();
player.sendMessage(ChatColor.RED + "Force stop for the arena : " + args[0]); player.sendMessage(ChatColor.RED + "Force stop for the arena : " + args[0]);
} else { } else {

View File

@ -5,34 +5,15 @@ import com.Geekpower14.Quake.Arena.Arena;
import com.Geekpower14.Quake.Quake; import com.Geekpower14.Quake.Quake;
import com.Geekpower14.Quake.Utils.FireworkEffectPlayer; import com.Geekpower14.Quake.Utils.FireworkEffectPlayer;
import com.Geekpower14.Quake.Utils.ScoreB; import com.Geekpower14.Quake.Utils.ScoreB;
import com.Geekpower14.Quake.Versions.SelectVersion;
import java.io.File; import java.io.File;
//1.8.8
//import net.minecraft.server.v1_8_R3.PacketPlayInClientCommand;
//import net.minecraft.server.v1_8_R3.PacketPlayInClientCommand.EnumClientCommand;
//1.9.2
//import net.minecraft.server.v1_9_R1.PacketPlayInClientCommand;
//import net.minecraft.server.v1_9_R1.PacketPlayInClientCommand.EnumClientCommand;
//1.9.4
//import net.minecraft.server.v1_9_R2.PacketPlayInClientCommand;
//import net.minecraft.server.v1_9_R2.PacketPlayInClientCommand.EnumClientCommand;
//1.10
import net.minecraft.server.v1_10_R1.PacketPlayInClientCommand;
import net.minecraft.server.v1_10_R1.PacketPlayInClientCommand.EnumClientCommand;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Color; import org.bukkit.Color;
import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.block.Sign; import org.bukkit.block.Sign;
//1.8.8
//import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
//1.9.2
//import org.bukkit.craftbukkit.v1_9_R1.entity.CraftPlayer;
//1.9.4
//import org.bukkit.craftbukkit.v1_9_R2.entity.CraftPlayer;
//1.10
import org.bukkit.craftbukkit.v1_10_R1.entity.CraftPlayer;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
@ -67,11 +48,11 @@ public class PlayerListener implements Listener {
public void onPlayerInteract(PlayerInteractEvent event) { public void onPlayerInteract(PlayerInteractEvent event) {
Player player = event.getPlayer(); Player player = event.getPlayer();
Action action = event.getAction(); Action action = event.getAction();
ItemStack hand = player.getItemInHand(); ItemStack hand = player.getInventory().getItemInMainHand();
Arena arena = _plugin._am.getArenabyPlayer(player); Arena arena = _plugin._am.getArenabyPlayer(player);
if(arena == null) { if(arena == null) {
Block block; Block block = event.getClickedBlock();
if ((action == Action.LEFT_CLICK_BLOCK || action == Action.RIGHT_CLICK_BLOCK) && _plugin._lobby.isinLobby(event.getClickedBlock().getLocation()) && (block = event.getClickedBlock()).getState() instanceof Sign) { if ((action == Action.LEFT_CLICK_BLOCK || action == Action.RIGHT_CLICK_BLOCK) && _plugin._lobby.isinLobby(event.getClickedBlock().getLocation()) && block.getState() instanceof Sign) {
Sign sign = (Sign)block.getState(); Sign sign = (Sign)block.getState();
if (sign.getLine(1).equals("")) { if (sign.getLine(1).equals("")) {
return; return;
@ -91,9 +72,23 @@ public class PlayerListener implements Listener {
} }
return; return;
} }
APlayer ap = arena.getAPlayer(player);
if (hand != null && hand.getType() == Material.WOOD_DOOR) { if(hand.getType() == Material.DARK_OAK_DOOR && hand.getItemMeta().hasDisplayName() && hand.getItemMeta().getDisplayName().toLowerCase().contains("exit")) {
if(arena != null) {
arena.leaveArena(player); arena.leaveArena(player);
} else {
if (_plugin._lobby._lobbyspawn != null) {
player.teleport(_plugin._lobby._lobbyspawn);
} else {
if(player.getBedLocation() != null)
player.teleport(player.getBedLocation());
else if(player.getBedSpawnLocation() != null)
player.teleport(player.getBedSpawnLocation());
else
player.teleport(player.getWorld().getSpawnLocation());
}
}
event.setCancelled(true);
} }
} }
@ -301,8 +296,10 @@ public class PlayerListener implements Listener {
@Override @Override
public void run() { public void run() {
try { try {
((CraftPlayer)player).getHandle().playerConnection.a(new PacketPlayInClientCommand(EnumClientCommand.PERFORM_RESPAWN)); SelectVersion.Respawn(player);
} catch (SecurityException | IllegalArgumentException t) { //PacketPlayInClientCommand ppicc = new PacketPlayInClientCommand(EnumClientCommand.PERFORM_RESPAWN);
//((CraftPlayer)player).getHandle().playerConnection.a(ppicc);
} catch (Exception t) {
t.printStackTrace(); t.printStackTrace();
} }
} }

View File

@ -4,7 +4,10 @@ import com.Geekpower14.Quake.Arena.Arena;
import com.Geekpower14.Quake.Arena.SArena; import com.Geekpower14.Quake.Arena.SArena;
import com.Geekpower14.Quake.Arena.TArena; import com.Geekpower14.Quake.Arena.TArena;
import com.Geekpower14.Quake.Quake; import com.Geekpower14.Quake.Quake;
import com.sk89q.worldedit.bukkit.selections.Selection; import com.sk89q.worldedit.LocalSession;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.bukkit.BukkitAdapter;
import com.sk89q.worldedit.regions.Region;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
@ -113,29 +116,20 @@ public class LobbyManager {
public Boolean addLobby(Player player) { public Boolean addLobby(Player player) {
String lobby = "lobby" + _locmin.size(); String lobby = "lobby" + _locmin.size();
Selection selection = _plugin._worldEdit.getSelection(player); try {
if (selection != null) { LocalSession ls = WorldEdit.getInstance().getSessionManager().get(BukkitAdapter.adapt(player));
//World world = selection.getWorld(); Region reg = ls.getSelection(BukkitAdapter.adapt(player.getWorld()));
Location un = selection.getMinimumPoint();
Location deux = selection.getMaximumPoint(); if(reg != null) {
/*String direction = ""; _locmin.put(lobby, BukkitAdapter.adapt(player.getWorld(), reg.getMinimumPoint()));
if (un.getX() == deux.getX()) { _locmax.put(lobby, BukkitAdapter.adapt(player.getWorld(), reg.getMaximumPoint()));
direction = "Z"; player.sendMessage(ChatColor.YELLOW + "Lobby " + _locmin.size() + " cr\u00e9e successful \u00e9s");
} else if (un.getZ() == deux.getZ()) {
direction = "X";
} else {
_plugin.log.warning("Pas m\u00eame X ou Z pour : " + lobby);
return false;
}*/
Location tempmin = un;
Location tempmax = deux;
_locmin.put(lobby, tempmin);
_locmax.put(lobby, tempmax);
player.sendMessage(ChatColor.YELLOW + "Lobby " + _locmin.size() + " cr\u00e9e avec succ\u00e9s");
initsign(); initsign();
return true; return true;
} }
player.sendMessage(ChatColor.RED + "Veuillez faire une s\u00e9lection d'abord !"); } catch(Exception ex) {
player.sendMessage(ChatColor.RED + "Internal error on region selection.");
}
return false; return false;
} }

View File

@ -10,8 +10,6 @@ import com.Geekpower14.Quake.Shop.IconMenuManager;
import com.Geekpower14.Quake.Shop.ShopManager; import com.Geekpower14.Quake.Shop.ShopManager;
import com.Geekpower14.Quake.Stuff.StuffManager; import com.Geekpower14.Quake.Stuff.StuffManager;
import com.Geekpower14.Quake.Trans.Translate; import com.Geekpower14.Quake.Trans.Translate;
import com.Geekpower14.Quake.Utils.ParticleEffects;
import com.Geekpower14.Quake.Utils.Reflection;
import com.Geekpower14.Quake.Utils.ScoreB; import com.Geekpower14.Quake.Utils.ScoreB;
import com.Geekpower14.Quake.Utils.Version; import com.Geekpower14.Quake.Utils.Version;
import com.sk89q.worldedit.bukkit.WorldEditPlugin; import com.sk89q.worldedit.bukkit.WorldEditPlugin;
@ -26,14 +24,12 @@ import org.bukkit.Bukkit;
import org.bukkit.Color; import org.bukkit.Color;
import org.bukkit.FireworkEffect; import org.bukkit.FireworkEffect;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.command.CommandExecutor;
import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;
import org.bukkit.entity.Firework; import org.bukkit.entity.Firework;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.HandlerList; import org.bukkit.event.HandlerList;
import org.bukkit.event.Listener;
import org.bukkit.inventory.meta.FireworkMeta; import org.bukkit.inventory.meta.FireworkMeta;
import org.bukkit.plugin.Plugin; import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
@ -42,7 +38,7 @@ import org.bukkit.scoreboard.Scoreboard;
public class Quake public class Quake
extends JavaPlugin { extends JavaPlugin {
public static boolean _debug = false; public static boolean _debug = false;
public static String _version = "3.0.0"; public static String _version = "3.4.0";
public static Version _ver = new Version(_version); public static Version _ver = new Version(_version);
public ArenaManager _am = null; public ArenaManager _am = null;
public LobbyManager _lobby = null; public LobbyManager _lobby = null;
@ -71,10 +67,13 @@ extends JavaPlugin {
_imm = new IconMenuManager((Plugin)this); _imm = new IconMenuManager((Plugin)this);
_board = Bukkit.getScoreboardManager().getNewScoreboard(); _board = Bukkit.getScoreboardManager().getNewScoreboard();
_config = YamlConfiguration.loadConfiguration((File)new File(getDataFolder(), "config.yml")); File confFile = new File(getDataFolder(), "config.yml");
_config = YamlConfiguration.loadConfiguration(confFile);
_shopWorlds.add("world"); _shopWorlds.add("world");
_ScoreWorlds.add("world"); _ScoreWorlds.add("world");
if(confFile.exists())
loadConfig(); loadConfig();
else
saveConfig(); saveConfig();
getDataFolder().mkdir(); getDataFolder().mkdir();
new File(getDataFolder().getPath() + "/arenas").mkdir(); new File(getDataFolder().getPath() + "/arenas").mkdir();
@ -130,7 +129,9 @@ extends JavaPlugin {
_config.set("debug", _debug); _config.set("debug", _debug);
_config.set("useVault", _useVault); _config.set("useVault", _useVault);
_config.set("shop.id", _shopId.name()); _config.set("shop.id", _shopId.name());
if(!_shopWorlds.isEmpty())
_config.set("shop.world", _shopWorlds); _config.set("shop.world", _shopWorlds);
if(!_ScoreWorlds.isEmpty())
_config.set("ScoreBoard.world", _ScoreWorlds); _config.set("ScoreBoard.world", _ScoreWorlds);
try { try {
_config.save(new File(getDataFolder(), "config.yml")); _config.save(new File(getDataFolder(), "config.yml"));
@ -149,18 +150,6 @@ extends JavaPlugin {
return p.hasPermission(perm); return p.hasPermission(perm);
} }
public static void sendTabName(Player p, String s, Boolean visible, int ping) {
try {
Object packet = (Object)Reflection.getNMSClass("PacketPlayOutPlayerInfo").newInstance();
ParticleEffects.ReflectionUtilities.setValue(packet, "a", s);
ParticleEffects.ReflectionUtilities.setValue(packet, "b", visible);
ParticleEffects.ReflectionUtilities.setValue(packet, "c", ping);
ParticleEffects.sendPacket(packet, p);
} catch (Exception e) {
e.printStackTrace();
}
}
public void win(final Player player) { public void win(final Player player) {
final int infoxp = Bukkit.getScheduler().scheduleSyncRepeatingTask(this, new Runnable() { final int infoxp = Bukkit.getScheduler().scheduleSyncRepeatingTask(this, new Runnable() {

View File

@ -7,6 +7,7 @@ import com.Geekpower14.Quake.Stuff.Armor.ArmorBasic;
import com.Geekpower14.Quake.Stuff.Hat.HatBasic; import com.Geekpower14.Quake.Stuff.Hat.HatBasic;
import com.Geekpower14.Quake.Stuff.Item.ItemBasic; import com.Geekpower14.Quake.Stuff.Item.ItemBasic;
import com.Geekpower14.Quake.Utils.IconMenu; import com.Geekpower14.Quake.Utils.IconMenu;
import com.Geekpower14.Quake.Versions.GetMaterials;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
@ -28,6 +29,17 @@ public class ShopManager {
} }
public void getMainShop(Player p) { public void getMainShop(Player p) {
Material DiaHoeMat = GetMaterials.GetDiamandHoe();
Material LeaCheMat = GetMaterials.GetLeatherChestplate();
Material JaOLanMat = GetMaterials.GetJackOLantern();
Material EmeralMat = GetMaterials.GetEmerald();
Material BedMat = GetMaterials.GetBed();
if(DiaHoeMat == null || LeaCheMat == null || JaOLanMat == null || EmeralMat == null || BedMat == null) {
p.sendMessage("It's happend an error on get Materials on getMainShop. Please Inform the Team or Bl4ckSkull666. Thank you ( https://www.Survival-Piraten.de )");
return;
}
_plugin._imm.create(p, "Quake Manager", 54, new IconMenu.OptionClickEventHandler() { _plugin._imm.create(p, "Quake Manager", 54, new IconMenu.OptionClickEventHandler() {
@Override @Override
@ -38,14 +50,20 @@ public class ShopManager {
Quake.getPlugin()._shop.Main_Manager(event.getPlayer(), event.getName()); Quake.getPlugin()._shop.Main_Manager(event.getPlayer(), event.getName());
} }
}); });
_plugin._imm.setOption(p, 0, new ItemStack(Material.DIAMOND_HOE, 1), _plugin._trad.get("Shop.ManagerHoe"), "Hoe_manager", new String[]{_plugin._trad.get("Shop.SelectHoe")}); _plugin._imm.setOption(p, 0, new ItemStack(DiaHoeMat, 1), _plugin._trad.get("Shop.ManagerHoe"), "Hoe_manager", new String[]{_plugin._trad.get("Shop.SelectHoe")});
_plugin._imm.setOption(p, 3, new ItemStack(Material.LEATHER_CHESTPLATE, 1), _plugin._trad.get("Shop.ManagerArmor"), "Armor_manager", new String[]{_plugin._trad.get("Shop.SelectArmor")}); _plugin._imm.setOption(p, 3, new ItemStack(LeaCheMat, 1), _plugin._trad.get("Shop.ManagerArmor"), "Armor_manager", new String[]{_plugin._trad.get("Shop.SelectArmor")});
_plugin._imm.setOption(p, 5, new ItemStack(Material.JACK_O_LANTERN, 1), _plugin._trad.get("Shop.ManagerHat"), "Hat_manager", new String[]{_plugin._trad.get("Shop.SelectHat")}); _plugin._imm.setOption(p, 5, new ItemStack(JaOLanMat, 1), _plugin._trad.get("Shop.ManagerHat"), "Hat_manager", new String[]{_plugin._trad.get("Shop.SelectHat")});
_plugin._imm.setOption(p, 8, new ItemStack(Material.EMERALD, 1), _plugin._trad.get("Shop.Shop"), "Shop", new String[]{_plugin._trad.get("Shop.BuyNewStuff")}); _plugin._imm.setOption(p, 8, new ItemStack(EmeralMat, 1), _plugin._trad.get("Shop.Shop"), "Shop", new String[]{_plugin._trad.get("Shop.BuyNewStuff")});
_plugin._imm.setOption(p, 49, new ItemStack(Material.BED, 1), _plugin._trad.get("Shop.Exit"), "Exit", new String[]{_plugin._trad.get("Shop.ExitDesc")}); _plugin._imm.setOption(p, 49, new ItemStack(BedMat, 1), _plugin._trad.get("Shop.Exit"), "Exit", new String[]{_plugin._trad.get("Shop.ExitDesc")});
} }
public void getHoeManager(Player player, int page) { public void getHoeManager(Player player, int page) {
Material BedMat = GetMaterials.GetBed();
if(BedMat == null) {
player.sendMessage("It's happend an error on get Materials on getHoeManager. Please Inform the Team or Bl4ckSkull666. Thank you ( https://www.Survival-Piraten.de )");
return;
}
APlayer.createConfig(player); APlayer.createConfig(player);
_plugin._imm.create(player, "Hoe Manager", 54, new IconMenu.OptionClickEventHandler(){ _plugin._imm.create(player, "Hoe Manager", 54, new IconMenu.OptionClickEventHandler(){
@ -69,10 +87,16 @@ public class ShopManager {
_plugin._imm.setOption(player, i, item.getItem(), item.getItem().getItemMeta().getDisplayName(), item._name, stockArr); _plugin._imm.setOption(player, i, item.getItem(), item.getItem().getItemMeta().getDisplayName(), item._name, stockArr);
++i; ++i;
} }
_plugin._imm.setOption(player, 49, new ItemStack(Material.BED, 1), _plugin._trad.get("Shop.navigation.home"), "Home", new String[]{_plugin._trad.get("Shop.navigation.homeDesc")}); _plugin._imm.setOption(player, 49, new ItemStack(BedMat, 1), _plugin._trad.get("Shop.navigation.home"), "Home", new String[]{_plugin._trad.get("Shop.navigation.homeDesc")});
} }
public void getHatManager(Player player, int page) { public void getHatManager(Player player, int page) {
Material BedMat = GetMaterials.GetBed();
if(BedMat == null) {
player.sendMessage("It's happend an error on get Materials on getHatManager. Please Inform the Team or Bl4ckSkull666. Thank you ( https://www.Survival-Piraten.de )");
return;
}
_plugin._imm.create(player, "Hat Manager", 54, new IconMenu.OptionClickEventHandler(){ _plugin._imm.create(player, "Hat Manager", 54, new IconMenu.OptionClickEventHandler(){
@Override @Override
@ -95,10 +119,16 @@ public class ShopManager {
_plugin._imm.setOption(player, i, item.getItem(), item.getItem().getItemMeta().getDisplayName(), item._name, stockArr); _plugin._imm.setOption(player, i, item.getItem(), item.getItem().getItemMeta().getDisplayName(), item._name, stockArr);
++i; ++i;
} }
_plugin._imm.setOption(player, 49, new ItemStack(Material.BED, 1), _plugin._trad.get("Shop.navigation.home"), "Home", new String[]{_plugin._trad.get("Shop.navigation.homeDesc")}); _plugin._imm.setOption(player, 49, new ItemStack(BedMat, 1), _plugin._trad.get("Shop.navigation.home"), "Home", new String[]{_plugin._trad.get("Shop.navigation.homeDesc")});
} }
public void getArmorManager(Player player, int page) { public void getArmorManager(Player player, int page) {
Material BedMat = GetMaterials.GetBed();
if(BedMat == null) {
player.sendMessage("It's happend an error on get Materials on getArmorManager. Please Inform the Team or Bl4ckSkull666. Thank you ( https://www.Survival-Piraten.de )");
return;
}
_plugin._imm.create(player, "Armor Manager", 54, new IconMenu.OptionClickEventHandler(){ _plugin._imm.create(player, "Armor Manager", 54, new IconMenu.OptionClickEventHandler(){
@Override @Override
@ -121,10 +151,18 @@ public class ShopManager {
_plugin._imm.setOption(player, i, item.getItem(), item.getItem().getItemMeta().getDisplayName(), item._name, stockArr); _plugin._imm.setOption(player, i, item.getItem(), item.getItem().getItemMeta().getDisplayName(), item._name, stockArr);
++i; ++i;
} }
_plugin._imm.setOption(player, 49, new ItemStack(Material.BED, 1), _plugin._trad.get("Shop.navigation.home"), "Home", new String[]{_plugin._trad.get("Shop.navigation.homeDesc")}); _plugin._imm.setOption(player, 49, new ItemStack(BedMat, 1), _plugin._trad.get("Shop.navigation.home"), "Home", new String[]{_plugin._trad.get("Shop.navigation.homeDesc")});
} }
public void getShopMenu(Player player, int page) { public void getShopMenu(Player player, int page) {
Material SignMat = GetMaterials.GetSign();
Material BedMat = GetMaterials.GetBed();
if(SignMat == null || BedMat == null) {
player.sendMessage("It's happend an error on get Materials on getShopMenu. Please Inform the Team or Bl4ckSkull666. Thank you ( https://www.Survival-Piraten.de )");
return;
}
int slot; int slot;
String name = "Shop"; String name = "Shop";
if (page > 0) { if (page > 0) {
@ -182,19 +220,25 @@ public class ShopManager {
i++; i++;
} }
if (page > 0) { if (page > 0) {
_plugin._imm.setOption(player, 45, new ItemStack(Material.SIGN, 1), _plugin._trad.get("Shop.navigation.previousPage"), "Page-" + (page - 1), new String[]{_plugin._trad.get("Shop.navigation.previousPageDesc")}); _plugin._imm.setOption(player, 45, new ItemStack(SignMat, 1), _plugin._trad.get("Shop.navigation.previousPage"), "Page-" + (page - 1), new String[]{_plugin._trad.get("Shop.navigation.previousPageDesc")});
} }
_plugin._imm.setOption(player, 49, new ItemStack(Material.BED, 1), _plugin._trad.get("Shop.navigation.home"), "Home", new String[]{_plugin._trad.get("Shop.navigation.homeDesc")}); _plugin._imm.setOption(player, 49, new ItemStack(BedMat, 1), _plugin._trad.get("Shop.navigation.home"), "Home", new String[]{_plugin._trad.get("Shop.navigation.homeDesc")});
Item so = getItemShop(player); Item so = getItemShop(player);
_plugin._imm.setOption(player, 50, so.getIcon(), so.getName(), "Nothing", so.getDescription()); _plugin._imm.setOption(player, 50, so.getIcon(), so.getName(), "Nothing", so.getDescription());
if (i == slot + 44) { if (i == slot + 44) {
_plugin._imm.setOption(player, 53, new ItemStack(Material.SIGN, 1), _plugin._trad.get("Shop.navigation.nextPage"), "Page-" + (page + 1), new String[]{_plugin._trad.get("Shop.navigation.nextPageDesc")}); _plugin._imm.setOption(player, 53, new ItemStack(SignMat, 1), _plugin._trad.get("Shop.navigation.nextPage"), "Page-" + (page + 1), new String[]{_plugin._trad.get("Shop.navigation.nextPageDesc")});
} }
} }
public void getShopItem(Player player) { public void getShopItem(Player player) {
Material EmeralMat = GetMaterials.GetEmerald();
if(EmeralMat == null) {
player.sendMessage("It's happend an error on get Materials on getShopItem. Please Inform the Team or Bl4ckSkull666. Thank you ( https://www.Survival-Piraten.de )");
return;
}
PlayerInventory i = player.getInventory(); PlayerInventory i = player.getInventory();
ItemStack coucou = new ItemStack(Material.EMERALD, 1); ItemStack coucou = new ItemStack(EmeralMat, 1);
ItemMeta coucou_meta = coucou.getItemMeta(); ItemMeta coucou_meta = coucou.getItemMeta();
coucou_meta.setDisplayName(_plugin._trad.get("Shop.item.name")); coucou_meta.setDisplayName(_plugin._trad.get("Shop.item.name"));
coucou.setItemMeta(coucou_meta); coucou.setItemMeta(coucou_meta);
@ -214,9 +258,14 @@ public class ShopManager {
} }
public Item getItemShop(Player player) { public Item getItemShop(Player player) {
Material EmeralMat = GetMaterials.GetEmerald();
if(EmeralMat == null) {
player.sendMessage("It's happend an error on get Materials on getItemShop. Please Inform the Team or Bl4ckSkull666. Thank you ( https://www.Survival-Piraten.de )");
return null;
}
EcoManager eco = _plugin._eco; EcoManager eco = _plugin._eco;
int coins = eco.getPlayerMoney(player); int coins = eco.getPlayerMoney(player);
return new Item("Shop", new ItemStack(Material.EMERALD, 1), "shop", new String[] {_plugin._trad.get("Shop.youHave"), "" + ChatColor.GOLD + coins + " " + _plugin._trad.get("Shop.Coins.name")}, 0, 0); return new Item("Shop", new ItemStack(EmeralMat, 1), "shop", new String[] {_plugin._trad.get("Shop.youHave"), "" + ChatColor.GOLD + coins + " " + _plugin._trad.get("Shop.Coins.name")}, 0, 0);
} }
public void openShop(final Player p) { public void openShop(final Player p) {

View File

@ -3,8 +3,10 @@ package com.Geekpower14.Quake.Stuff.Hat;
import com.Geekpower14.Quake.Trans.Translate; import com.Geekpower14.Quake.Trans.Translate;
import java.io.File; import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.OfflinePlayer;
import org.bukkit.SkullType; import org.bukkit.SkullType;
import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.configuration.file.YamlConfiguration;
@ -31,9 +33,11 @@ public class HatCustomFile extends HatBasic implements Listener {
} }
public static ItemStack Skull(String skullOwner) { public static ItemStack Skull(String skullOwner) {
ItemStack skull = new ItemStack(Material.SKULL_ITEM, 1, (short)SkullType.PLAYER.ordinal()); ItemStack skull = new ItemStack(Material.PLAYER_HEAD, 1);
SkullMeta skullMeta = (SkullMeta)skull.getItemMeta(); SkullMeta skullMeta = (SkullMeta)skull.getItemMeta();
skullMeta.setOwner(skullOwner); OfflinePlayer op = Bukkit.getOfflinePlayer(skullOwner);
if(op != null)
skullMeta.setOwningPlayer(op);
skull.setItemMeta((ItemMeta)skullMeta); skull.setItemMeta((ItemMeta)skullMeta);
return skull; return skull;
} }

View File

@ -20,7 +20,7 @@ public class GoldHoe extends ItemBasic implements Listener {
@Override @Override
public ItemStack getItem() { public ItemStack getItem() {
ItemStack item = defaultItem(Material.GOLD_HOE, _Time); ItemStack item = defaultItem(Material.GOLDEN_HOE, _Time);
return item; return item;
} }

View File

@ -4,16 +4,15 @@ import com.Geekpower14.Quake.Arena.APlayer;
import com.Geekpower14.Quake.Arena.Arena; import com.Geekpower14.Quake.Arena.Arena;
import com.Geekpower14.Quake.Quake; import com.Geekpower14.Quake.Quake;
import com.Geekpower14.Quake.Utils.FireworkEffectPlayer; import com.Geekpower14.Quake.Utils.FireworkEffectPlayer;
import com.Geekpower14.Quake.Utils.ParticleEffects;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.FireworkEffect; import org.bukkit.FireworkEffect;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.Particle;
import org.bukkit.Sound; import org.bukkit.Sound;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.configuration.file.YamlConfiguration;
@ -103,12 +102,6 @@ public abstract class ItemBasic implements Listener {
player.getWorld().playSound(player.getLocation(), Sound.ENTITY_GENERIC_EXPLODE, 0.1f, 1.3f); player.getWorld().playSound(player.getLocation(), Sound.ENTITY_GENERIC_EXPLODE, 0.1f, 1.3f);
player.getWorld().playSound(player.getLocation(), Sound.ENTITY_GENERIC_EXPLODE, 0.1f, 1.2f); player.getWorld().playSound(player.getLocation(), Sound.ENTITY_GENERIC_EXPLODE, 0.1f, 1.2f);
/*player.getWorld().playSound(player.getLocation(), org.bukkit.Sound.EXPLODE, 0.1f, 2.0f);
player.getWorld().playSound(player.getLocation(), Sound.EXPLODE, 0.1f, 1.5f);
player.getWorld().playSound(player.getLocation(), Sound.EXPLODE, 0.1f, 1.4f);
player.getWorld().playSound(player.getLocation(), Sound.EXPLODE, 0.1f, 1.3f);
player.getWorld().playSound(player.getLocation(), Sound.EXPLODE, 0.1f, 1.2f);*/
if (compte == 2) { if (compte == 2) {
arena.broadcast(_plugin._trad.get("Game.Arena.Kill.Double")); arena.broadcast(_plugin._trad.get("Game.Arena.Kill.Double"));
} else if (compte == 3) { } else if (compte == 3) {
@ -148,14 +141,7 @@ public abstract class ItemBasic implements Listener {
double lx = loc.getX(); double lx = loc.getX();
double ly = loc.getY(); double ly = loc.getY();
double lz = loc.getZ(); double lz = loc.getZ();
for(APlayer apa: arena._players.values()) { loc.getWorld().spawnParticle(Particle.FIREWORKS_SPARK, loc, 0, 0.1D, 0.1D, 0.1D, 0.05D);
try {
ParticleEffects.FIREWORKS_SPARK.sendToPlayer(apa.getPlayer(), loc, 0.1f, 0.1f, 0.1f, 0.05f, 2);
} catch (Exception e) {
e.printStackTrace();
}
}
for(Player possibleTarget : targets) { for(Player possibleTarget : targets) {
if(possibleTarget.getUniqueId() == player.getUniqueId()) if(possibleTarget.getUniqueId() == player.getUniqueId())
continue; continue;

View File

@ -36,7 +36,7 @@ public class WoodenHoe extends ItemBasic implements Listener {
@Override @Override
public ItemStack getItem() { public ItemStack getItem() {
ItemStack item = defaultItem(Material.WOOD_HOE, _Time); ItemStack item = defaultItem(Material.WOODEN_HOE, _Time);
return item; return item;
} }

View File

@ -1,6 +1,9 @@
package com.Geekpower14.Quake.Utils; package com.Geekpower14.Quake.Utils;
import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List;
import java.util.UUID;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
@ -47,7 +50,11 @@ public class IconMenu implements Listener {
return this; return this;
} }
private List<UUID> _openInventories = new ArrayList<>();
public void open(Player player) { public void open(Player player) {
if(_openInventories.contains(player.getUniqueId()))
_openInventories.remove(player.getUniqueId());
Inventory inventory = Bukkit.createInventory((InventoryHolder)player, (int)_size, (String)_name); Inventory inventory = Bukkit.createInventory((InventoryHolder)player, (int)_size, (String)_name);
int i = 0; int i = 0;
while (i < _optionIcons.length) { while (i < _optionIcons.length) {
@ -56,10 +63,14 @@ public class IconMenu implements Listener {
} }
++i; ++i;
} }
_openInventories.add(player.getUniqueId());
player.openInventory(inventory); player.openInventory(inventory);
} }
public void reopen(Player p) { public void reopen(Player p) {
if(_openInventories.contains(p.getUniqueId()))
_openInventories.remove(p.getUniqueId());
int i = 0; int i = 0;
while (i < _optionIcons.length) { while (i < _optionIcons.length) {
if (_optionIcons[i] != null) { if (_optionIcons[i] != null) {
@ -67,6 +78,7 @@ public class IconMenu implements Listener {
} }
++i; ++i;
} }
_openInventories.add(p.getUniqueId());
} }
public void setAutoDestroy(boolean autodestroy) { public void setAutoDestroy(boolean autodestroy) {
@ -87,19 +99,29 @@ public class IconMenu implements Listener {
} }
public void onInventoryClose(InventoryCloseEvent event) { public void onInventoryClose(InventoryCloseEvent event) {
if (!event.getInventory().getName().equals(_name)) { if(!(event.getPlayer() instanceof Player))
return; return;
}
Player p = (Player)event.getPlayer();
if(!_openInventories.contains(p.getUniqueId()))
return;
if(_autodestroy) { if(_autodestroy) {
destroy(); destroy();
} }
_openInventories.remove(p.getUniqueId());
} }
public void onInventoryClick(InventoryClickEvent event) { public void onInventoryClick(InventoryClickEvent event) {
if (!event.getInventory().getName().equals(_name)) { if(!(event.getInventory().getHolder() instanceof Player))
return;
Player p = (Player)event.getWhoClicked();
if(p == null || !_openInventories.contains(p.getUniqueId())) {
event.setCancelled(true);
return; return;
} }
event.setCancelled(true);
int slot = event.getRawSlot(); int slot = event.getRawSlot();
if (slot >= 0 && slot < _size && _optionNames[slot] != null) { if (slot >= 0 && slot < _size && _optionNames[slot] != null) {
if (_optionRegs[slot].equals("") || _optionRegs[slot].trim().equals("-cancel-")) { if (_optionRegs[slot].equals("") || _optionRegs[slot].trim().equals("-cancel-")) {
@ -110,7 +132,6 @@ public class IconMenu implements Listener {
OptionClickEvent e = new OptionClickEvent((Player)event.getWhoClicked(), slot, _optionRegs[slot], this, event.isRightClick(), event.isLeftClick(), event.isShiftClick()); OptionClickEvent e = new OptionClickEvent((Player)event.getWhoClicked(), slot, _optionRegs[slot], this, event.isRightClick(), event.isLeftClick(), event.isShiftClick());
_handler.onOptionClick(e); _handler.onOptionClick(e);
if (e.willClose()) { if (e.willClose()) {
final Player p = (Player)event.getWhoClicked();
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() { Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
@Override @Override

View File

@ -11,7 +11,7 @@ import org.json.JSONException;
import org.json.JSONObject; import org.json.JSONObject;
public class BookSerialization { public class BookSerialization {
protected BookSerialization() { /*protected BookSerialization() {
} }
public static BookMeta getBookMeta(String json) { public static BookMeta getBookMeta(String json) {
@ -167,6 +167,6 @@ public class BookSerialization {
e.printStackTrace(); e.printStackTrace();
return null; return null;
} }
} }*/
} }

View File

@ -2,23 +2,24 @@ package com.Geekpower14.Quake.Utils.InvSerialization;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import org.bukkit.NamespacedKey;
import org.bukkit.enchantments.Enchantment; import org.bukkit.enchantments.Enchantment;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
public class EnchantmentSerialization { public class EnchantmentSerialization {
protected EnchantmentSerialization() { /*protected EnchantmentSerialization() {
} }
public static String serializeEnchantments(Map<Enchantment, Integer> enchantments) { public static String serializeEnchantments(Map<Enchantment, Integer> enchantments) {
String serialized = ""; String serialized = "";
for (Enchantment e : enchantments.keySet()) { for (Enchantment e : enchantments.keySet()) {
serialized = serialized + e.getId() + ":" + enchantments.get((Object)e) + ";"; serialized = serialized + e.getKey().getNamespace() + ":" + enchantments.get(e) + ";";
} }
return serialized; return serialized;
} }
public static Map<Enchantment, Integer> getEnchantments(String serializedEnchants) { public static Map<Enchantment, Integer> getEnchantments(String serializedEnchants) {
HashMap<Enchantment, Integer> enchantments = new HashMap<Enchantment, Integer>(); HashMap<Enchantment, Integer> enchantments = new HashMap<>();
if (serializedEnchants.isEmpty()) { if (serializedEnchants.isEmpty()) {
return enchantments; return enchantments;
} }
@ -28,15 +29,12 @@ public class EnchantmentSerialization {
if (ench.length < 2) { if (ench.length < 2) {
throw new IllegalArgumentException(serializedEnchants + " - Enchantment " + i + " (" + enchants[i] + "): split must at least have a length of 2"); throw new IllegalArgumentException(serializedEnchants + " - Enchantment " + i + " (" + enchants[i] + "): split must at least have a length of 2");
} }
if (!Util.isNum(ench[0])) {
throw new IllegalArgumentException(serializedEnchants + " - Enchantment " + i + " (" + enchants[i] + "): id is not an integer");
}
if (!Util.isNum(ench[1])) { if (!Util.isNum(ench[1])) {
throw new IllegalArgumentException(serializedEnchants + " - Enchantment " + i + " (" + enchants[i] + "): level is not an integer"); throw new IllegalArgumentException(serializedEnchants + " - Enchantment " + i + " (" + enchants[i] + "): level is not an integer");
} }
int id = Integer.parseInt(ench[0]); String id = ench[0];
int level = Integer.parseInt(ench[1]); int level = Integer.parseInt(ench[1]);
Enchantment e = Enchantment.getById((int)id); Enchantment e = Enchantment.getByKey(NamespacedKey.minecraft(id));
if (e == null) { if (e == null) {
throw new IllegalArgumentException(serializedEnchants + " - Enchantment " + i + " (" + enchants[i] + "): no Enchantment with id of " + id); throw new IllegalArgumentException(serializedEnchants + " - Enchantment " + i + " (" + enchants[i] + "): no Enchantment with id of " + id);
} }
@ -45,8 +43,8 @@ public class EnchantmentSerialization {
return enchantments; return enchantments;
} }
public static Map<Enchantment, Integer> getEnchantsFromOldFormat(String oldFormat) { /*public static Map<Enchantment, Integer> getEnchantsFromOldFormat(String oldFormat) {
HashMap<Enchantment, Integer> enchants = new HashMap<Enchantment, Integer>(); HashMap<Enchantment, Integer> enchants = new HashMap<>();
if (oldFormat.length() == 0) { if (oldFormat.length() == 0) {
return enchants; return enchants;
} }
@ -55,7 +53,7 @@ public class EnchantmentSerialization {
for (int i = 0; i < nums.length(); i += 3) { for (int i = 0; i < nums.length(); i += 3) {
int enchantId = Integer.parseInt(nums.substring(i, i + 2)); int enchantId = Integer.parseInt(nums.substring(i, i + 2));
int enchantLevel = Integer.parseInt("" + nums.charAt(i + 2) + ""); int enchantLevel = Integer.parseInt("" + nums.charAt(i + 2) + "");
Enchantment ench = Enchantment.getById((int)enchantId); Enchantment ench = Enchantment.getByKey(NamespacedKey.minecraft(enchantId));
enchants.put(ench, enchantLevel); enchants.put(ench, enchantLevel);
} }
return enchants; return enchants;
@ -73,6 +71,6 @@ public class EnchantmentSerialization {
public static void addEnchantments(String code, ItemStack items) { public static void addEnchantments(String code, ItemStack items) {
items.addUnsafeEnchantments(EnchantmentSerialization.getEnchantments(code)); items.addUnsafeEnchantments(EnchantmentSerialization.getEnchantments(code));
} }*/
} }

View File

@ -9,7 +9,7 @@ import org.json.JSONException;
import org.json.JSONObject; import org.json.JSONObject;
public class FireworkSerialization { public class FireworkSerialization {
protected FireworkSerialization() { /*protected FireworkSerialization() {
} }
public static FireworkMeta getFireworkMeta(String json) { public static FireworkMeta getFireworkMeta(String json) {
@ -62,6 +62,6 @@ public class FireworkSerialization {
public static String serializeFireworkMetaAsString(FireworkMeta meta, boolean pretty, int indentFactor) { public static String serializeFireworkMetaAsString(FireworkMeta meta, boolean pretty, int indentFactor) {
return Serializer.toString(FireworkSerialization.serializeFireworkMeta(meta), pretty, indentFactor); return Serializer.toString(FireworkSerialization.serializeFireworkMeta(meta), pretty, indentFactor);
} }*/
} }

View File

@ -8,7 +8,7 @@ import org.json.JSONException;
import org.json.JSONObject; import org.json.JSONObject;
public class HorseSerialization { public class HorseSerialization {
protected HorseSerialization() { /*protected HorseSerialization() {
} }
public static JSONObject serializeHorse(Horse horse) { public static JSONObject serializeHorse(Horse horse) {
@ -96,6 +96,6 @@ public class HorseSerialization {
public static boolean shouldSerialize(String key) { public static boolean shouldSerialize(String key) {
return SerializationConfig.getShouldSerialize("horse." + key); return SerializationConfig.getShouldSerialize("horse." + key);
} }*/
} }

View File

@ -13,7 +13,7 @@ import org.json.JSONException;
import org.json.JSONObject; import org.json.JSONObject;
public class InventorySerialization { public class InventorySerialization {
protected InventorySerialization() { /*protected InventorySerialization() {
} }
public static JSONArray serializeInventory(Inventory inv) { public static JSONArray serializeInventory(Inventory inv) {
@ -211,6 +211,6 @@ public class InventorySerialization {
catch (JSONException e) { catch (JSONException e) {
e.printStackTrace(); e.printStackTrace();
} }
} }*/
} }

View File

@ -9,7 +9,7 @@ import org.json.JSONException;
import org.json.JSONObject; import org.json.JSONObject;
public class LivingEntitySerialization { public class LivingEntitySerialization {
protected LivingEntitySerialization() { /*protected LivingEntitySerialization() {
} }
public static JSONObject serializeEntity(LivingEntity entity) { public static JSONObject serializeEntity(LivingEntity entity) {
@ -99,6 +99,6 @@ public class LivingEntitySerialization {
public static boolean shouldSerialize(String key) { public static boolean shouldSerialize(String key) {
return SerializationConfig.getShouldSerialize("living-entity." + key); return SerializationConfig.getShouldSerialize("living-entity." + key);
} }*/
} }

View File

@ -7,7 +7,7 @@ import org.json.JSONException;
import org.json.JSONObject; import org.json.JSONObject;
public class OcelotSerialization { public class OcelotSerialization {
protected OcelotSerialization() { /*protected OcelotSerialization() {
} }
public static JSONObject serializeOcelot(Ocelot ocelot) { public static JSONObject serializeOcelot(Ocelot ocelot) {
@ -71,6 +71,6 @@ public class OcelotSerialization {
public static boolean shouldSerialize(String key) { public static boolean shouldSerialize(String key) {
return SerializationConfig.getShouldSerialize("ocelot." + key); return SerializationConfig.getShouldSerialize("ocelot." + key);
} }*/
} }

View File

@ -5,7 +5,7 @@ import org.json.JSONException;
import org.json.JSONObject; import org.json.JSONObject;
public class PlayerSerialization { public class PlayerSerialization {
protected PlayerSerialization() { /*protected PlayerSerialization() {
} }
public static JSONObject serializePlayer(Player player) { public static JSONObject serializePlayer(Player player) {
@ -77,6 +77,6 @@ public class PlayerSerialization {
public static boolean shouldSerialize(String key) { public static boolean shouldSerialize(String key) {
return SerializationConfig.getShouldSerialize("player." + key); return SerializationConfig.getShouldSerialize("player." + key);
} }*/
} }

View File

@ -17,7 +17,7 @@ import org.json.JSONException;
import org.json.JSONObject; import org.json.JSONObject;
public class SingleItemSerialization { public class SingleItemSerialization {
protected SingleItemSerialization() { /*protected SingleItemSerialization() {
} }
public static JSONObject serializeItemInInventory(ItemStack items, int index) { public static JSONObject serializeItemInInventory(ItemStack items, int index) {
@ -240,6 +240,6 @@ public class SingleItemSerialization {
e.printStackTrace(); e.printStackTrace();
return null; return null;
} }
} }*/
} }

View File

@ -7,7 +7,7 @@ import org.json.JSONException;
import org.json.JSONObject; import org.json.JSONObject;
public class SkullSerialization { public class SkullSerialization {
protected SkullSerialization() { /*protected SkullSerialization() {
} }
public static JSONObject serializeSkull(SkullMeta meta) { public static JSONObject serializeSkull(SkullMeta meta) {
@ -68,6 +68,6 @@ public class SkullSerialization {
e.printStackTrace(); e.printStackTrace();
return null; return null;
} }
} }*/
} }

View File

@ -9,7 +9,7 @@ import org.json.JSONException;
import org.json.JSONObject; import org.json.JSONObject;
public class WolfSerialization { public class WolfSerialization {
protected WolfSerialization() { /*protected WolfSerialization() {
} }
public static JSONObject serializeWolf(Wolf wolf) { public static JSONObject serializeWolf(Wolf wolf) {
@ -73,6 +73,6 @@ public class WolfSerialization {
public static boolean shouldSerialize(String key) { public static boolean shouldSerialize(String key) {
return SerializationConfig.getShouldSerialize("wolf." + key); return SerializationConfig.getShouldSerialize("wolf." + key);
} }*/
} }

View File

@ -1,661 +0,0 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.Geekpower14.Quake.Utils;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Collection;
//1.8.8
//import net.minecraft.server.v1_9_R1.EnumParticle;
//1.9.2
//import net.minecraft.server.v1_9_R1.EnumParticle;
//1.9.4
//import net.minecraft.server.v1_9_R2.EnumParticle;
//1.10
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.entity.Player;
public enum ParticleEffects {
HUGE_EXPLOSION("hugeexplosion", "EXPLOSION_HUGE"),
LARGE_EXPLODE("largeexplode", "EXPLOSION_LARGE"),
BUBBLE("bubble", "WATER_BUBBLE"),
SUSPEND("suspended", "SUSPENDED"),
DEPTH_SUSPEND("depthsuspend", "SUSPENDED_DEPTH"),
MAGIC_CRIT("magicCrit", "CRIT_MAGIC"),
MOB_SPELL("mobSpell", "SPELL_MOB", true),
MOB_SPELL_AMBIENT("mobSpellAmbient", "SPELL_MOB_AMBIENT"),
INSTANT_SPELL("instantSpell", "SPELL_INSTANT"),
WITCH_MAGIC("witchMagic", "SPELL_WITCH"),
EXPLODE("explode", "EXPLOSION_NORMAL"),
SPLASH("splash", "WATER_SPLASH"),
LARGE_SMOKE("largesmoke", "SMOKE_LARGE"),
RED_DUST("reddust", "REDSTONE", true),
SNOWBALL_POOF("snowballpoof", "SNOWBALL"),
ANGRY_VILLAGER("angryVillager", "VILLAGER_ANGRY"),
HAPPY_VILLAGER("happyVillager", "VILLAGER_HAPPY"),
EXPLOSION_NORMAL(EXPLODE.getName()),
EXPLOSION_LARGE(LARGE_EXPLODE.getName()),
EXPLOSION_HUGE(HUGE_EXPLOSION.getName()),
FIREWORKS_SPARK("fireworksSpark"),
WATER_BUBBLE(BUBBLE.getName()),
WATER_SPLASH(SPLASH.getName()),
WATER_WAKE("wake"),
SUSPENDED(SUSPEND.getName()),
SUSPENDED_DEPTH(DEPTH_SUSPEND.getName()),
CRIT("crit"),
CRIT_MAGIC(MAGIC_CRIT.getName()),
SMOKE_NORMAL("smoke"),
SMOKE_LARGE(LARGE_SMOKE.getName()),
SPELL("spell"),
SPELL_INSTANT(INSTANT_SPELL.getName()),
SPELL_MOB(MOB_SPELL.getName(), true),
SPELL_MOB_AMBIENT(MOB_SPELL_AMBIENT.getName()),
SPELL_WITCH(WITCH_MAGIC.getName()),
DRIP_WATER("dripWater"),
DRIP_LAVA("dripLava"),
VILLAGER_ANGRY(ANGRY_VILLAGER.getName()),
VILLAGER_HAPPY(HAPPY_VILLAGER.getName()),
TOWN_AURA("townaura"), NOTE("note", true),
PORTAL("portal"),
ENCHANTMENT_TABLE("enchantmenttable"),
FLAME("flame"),
LAVA("lava"),
FOOTSTEP("footstep"),
CLOUD("cloud"),
REDSTONE("reddust", true),
SNOWBALL("snowballpoof"),
SNOW_SHOVEL("snowshovel"),
SLIME("slime"),
HEART("heart"),
BARRIER("barrier"),
ITEM_CRACK("iconcrack_"),
BLOCK_CRACK("blockcrack_"),
BLOCK_DUST("blockdust_"),
WATER_DROP("droplet"),
ITEM_TAKE("take"),
MOB_APPEARANCE("mobappearance");
private final String _particleName;
private final String _enumValue;
private final boolean _hasColor;
private static Class<?> _nmsPacketPlayOutParticle;
private static Class<?> _nmsEnumParticle;
private static int _particleRange;
private static Class<?> _nmsPlayerConnection;
private static Class<?> _nmsEntityPlayer;
private static Class<?> _ioNettyChannel;
private static Method _nmsNetworkGetVersion;
private static Field _nmsFieldPlayerConnection;
private static Field _nmsFieldNetworkManager;
private static Field _nmsFieldNetworkManagerI;
private static Field _nmsFieldNetworkManagerM;
private ParticleEffects(String particleName, String enumValue, boolean hasColor) {
_particleName = particleName;
_enumValue = enumValue;
_hasColor = hasColor;
}
private ParticleEffects(String particleName, String enumValue) {
_particleName = particleName;
_enumValue = enumValue;
_hasColor = false;
}
private ParticleEffects(String particleName) {
_particleName = particleName;
_enumValue = null;
_hasColor = false;
}
private ParticleEffects(String particleName, boolean hasColor) {
_particleName = particleName;
_enumValue = null;
_hasColor = hasColor;
}
public String getName() {
return _particleName;
}
public boolean hasColor() {
return _hasColor;
}
public static void setRange(int range) {
if(range < 0) {
throw new IllegalArgumentException("Range must be positive!");
}
_particleRange = range;
}
public static int getRange() {
return _particleRange;
}
private void sendToPlayer(Player player, Location location, float offsetX, float offsetY, float offsetZ, float speed, int count, int... extra) throws Exception {
sendToPlayer(player, location, offsetX, offsetY, offsetZ, speed, count, false, extra);
}
private void sendToPlayer(Player player, Location location, float offsetX, float offsetY, float offsetZ, float speed, int count, boolean force, int... extra) throws Exception {
if((!force) && (!isPlayerInRange(player, location))) {
return;
}
//if(ReflectionUtilities.getVersion().contains("v1_8")) {
try {
if(_nmsEnumParticle == null)
_nmsEnumParticle = ReflectionUtilities.getNMSClass("EnumParticle");
if(this == BLOCK_CRACK) {
int id = 0;
int data = 0;
if (extra.length > 0) {
id = extra[0];
}
if (extra.length > 1) {
data = extra[1];
}
extra = new int[] { id, id | data << 12 };
}
Object packet = _nmsPacketPlayOutParticle.getConstructor(new Class[] { _nmsEnumParticle, Boolean.TYPE, Float.TYPE, Float.TYPE, Float.TYPE, Float.TYPE, Float.TYPE, Float.TYPE, Float.TYPE, Integer.TYPE, int[].class }).newInstance(new Object[] { getEnum(_nmsEnumParticle.getName() + "." + (_enumValue != null ? _enumValue : name().toUpperCase())), true, (float)location.getX(), (float)location.getY(), (float)location.getZ(), offsetX, offsetY, offsetZ, speed, count, extra });
Object handle = ReflectionUtilities.getHandle(player);
Object connection = ReflectionUtilities.getField(handle.getClass(), "playerConnection").get(handle);
ReflectionUtilities.getMethod(connection.getClass(), "sendPacket", new Class[0]).invoke(connection, new Object[] { packet });
} catch (Exception e) {
throw e;
}
/*} else {
try {
if(_particleName == null)
_particleName = name().toLowerCase();
String name = _particleName;
if((this == BLOCK_CRACK) || (this == ITEM_CRACK) || (this == BLOCK_DUST)) {
int id = 0;
int data = 0;
if(extra.length > 0)
id = extra[0];
if(extra.length > 1)
data = extra[1];
name = name + id + "_" + data;
}
Object packet = _nmsPacketPlayOutParticle.getConstructor(new Class[] { String.class, Float.TYPE, Float.TYPE, Float.TYPE, Float.TYPE, Float.TYPE, Float.TYPE, Float.TYPE, Integer.TYPE }).newInstance(new Object[] { name, (float)location.getX(), (float)location.getY(), (float)location.getZ(), offsetX, offsetY, offsetZ, speed, count});
Object handle = ReflectionUtilities.getHandle(player);
Object connection = ReflectionUtilities.getField(handle.getClass(), "playerConnection").get(handle);
ReflectionUtilities.getMethod(connection.getClass(), "sendPacket", new Class[0]).invoke(connection, new Object[] { packet });
} catch (Exception e) {
throw e;
}
}*/
}
public void sendToPlayer(Player player, Location location, float offsetX, float offsetY, float offsetZ, float speed, int count, boolean force) throws Exception {
sendToPlayer(player, location, offsetX, offsetY, offsetZ, speed, count, force, new int[0]);
}
public void sendToPlayer(Player player, Location location, float offsetX, float offsetY, float offsetZ, float speed, int count) throws Exception {
sendToPlayer(player, location, offsetX, offsetY, offsetZ, speed, count, false);
}
public void sendToPlayers(Collection<? extends Player> players, Location location, float offsetX, float offsetY, float offsetZ, float speed, int count) throws Exception {
for(Player p : players)
sendToPlayer(p, location, offsetX, offsetY, offsetZ, speed, count);
}
public void sendToPlayers(Collection<? extends Player> players, Location location, float offsetX, float offsetY, float offsetZ, float speed, int count, boolean force) throws Exception {
for(Player p : players)
sendToPlayer(p, location, offsetX, offsetY, offsetZ, speed, count, force);
}
public void sendToPlayers(Player[] players, Location location, float offsetX, float offsetY, float offsetZ, float speed, int count) throws Exception {
for (Player p : players)
sendToPlayer(p, location, offsetX, offsetY, offsetZ, speed, count);
}
public void sendColor(Player p, Location location, org.bukkit.Color color) throws Exception {
if(!_hasColor)
return;
sendToPlayer(p, location, getColor(color.getRed()), getColor(color.getGreen()), getColor(color.getBlue()), 1.0F, 0);
}
public void sendColor(Player p, Location location, org.bukkit.Color color, boolean force) throws Exception {
if(!_hasColor)
return;
sendToPlayer(p, location, getColor(color.getRed()), getColor(color.getGreen()), getColor(color.getBlue()), 1.0F, 0, force);
}
@Deprecated
public void sendColor(Player p, Location location, java.awt.Color color) throws Exception {
if(!_hasColor)
return;
sendToPlayer(p, location, getColor(color.getRed()), getColor(color.getGreen()), getColor(color.getBlue()), 1.0F, 0);
}
public void sendColor(Player p, Location location, java.awt.Color color, boolean force) throws Exception {
if(!_hasColor)
return;
sendToPlayer(p, location, getColor(color.getRed()), getColor(color.getGreen()), getColor(color.getBlue()), 1.0F, 0, force);
}
@Deprecated
public void sendColor(Collection<? extends Player> players, Location location, java.awt.Color color) throws Exception {
if(!_hasColor)
return;
for(Player p : players)
sendColor(p, location, color);
}
public void sendColor(Collection<? extends Player> players, Location location, java.awt.Color color, boolean force) throws Exception {
if(!_hasColor)
return;
for(Player p : players)
sendColor(p, location, color, force);
}
public void sendColor(Collection<? extends Player> players, Location location, org.bukkit.Color color) throws Exception {
if(!_hasColor)
return;
for(Player p : players)
sendColor(p, location, color);
}
@Deprecated
public void sendColor(Collection<? extends Player> players, Location location, org.bukkit.Color color, boolean force) throws Exception {
if(!_hasColor)
return;
for(Player p : players)
sendColor(p, location, color, force);
}
@Deprecated
public void sendColor(Player[] players, Location location, org.bukkit.Color color) throws Exception {
if(!_hasColor)
return;
for(Player p : players)
sendColor(p, location, color);
}
@Deprecated
public void sendColor(Player[] players, Location location, java.awt.Color color) throws Exception {
if(!_hasColor)
return;
for(Player p : players)
sendColor(p, location, color);
}
protected float getColor(float value) {
if(value <= 0.0F)
value = -1.0F;
return value / 255.0F;
}
public static void sendPacket(Object packet, Player player) {
try {
Object nms_player = _nmsNetworkGetVersion.invoke(player, new Object[0]);
Object nms_connection = _nmsFieldPlayerConnection.get(nms_player);
_nmsNetworkGetVersion.invoke(nms_connection, packet);
} catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
e.printStackTrace();
}
}
@Deprecated
public void sendBlockCrack(Player player, Location location, int id, byte data, float offsetX, float offsetY, float offsetZ, float speed, int count)
throws Exception
{
if (this != BLOCK_CRACK) {
throw new IllegalArgumentException("This method is only available for BLOCK_CRACK!");
}
sendToPlayer(player, location, offsetX, offsetY, offsetZ, speed, count, new int[] { id, data });
}
public void sendBlockCrack(Player player, Location location, int id, byte data, float offsetX, float offsetY, float offsetZ, float speed, int count, boolean force)
throws Exception
{
if (this != BLOCK_CRACK) {
throw new IllegalArgumentException("This method is only available for BLOCK_CRACK!");
}
sendToPlayer(player, location, offsetX, offsetY, offsetZ, speed, count, force, new int[] { id, data });
}
@Deprecated
public void sendBlockCrack(Collection<? extends Player> players, Location location, int id, byte data, float offsetX, float offsetY, float offsetZ, float speed, int count)
throws Exception
{
if (this != BLOCK_CRACK) {
throw new IllegalArgumentException("This method is only available for BLOCK_CRACK!");
}
for (Player p : players) {
sendBlockCrack(p, location, id, data, offsetX, offsetY, offsetZ, speed, count);
}
}
public void sendBlockCrack(Collection<? extends Player> players, Location location, int id, byte data, float offsetX, float offsetY, float offsetZ, float speed, int count, boolean force)
throws Exception
{
if (this != BLOCK_CRACK) {
throw new IllegalArgumentException("This method is only available for BLOCK_CRACK!");
}
for (Player p : players) {
sendBlockCrack(p, location, id, data, offsetX, offsetY, offsetZ, speed, count, force);
}
}
@Deprecated
public void sendBlockCrack(Player[] players, Location location, int id, byte data, float offsetX, float offsetY, float offsetZ, float speed, int count)
throws Exception
{
if (this != BLOCK_CRACK) {
throw new IllegalArgumentException("This method is only available for BLOCK_CRACK!");
}
for (Player p : players) {
sendBlockCrack(p, location, id, data, offsetX, offsetY, offsetZ, speed, count);
}
}
@Deprecated
public void sendItemCrack(Player player, Location location, int id, byte data, float offsetX, float offsetY, float offsetZ, float speed, int count)
throws Exception
{
if (this != ITEM_CRACK) {
throw new IllegalArgumentException("This method is only available for ITEM_CRACK!");
}
sendToPlayer(player, location, offsetX, offsetY, offsetZ, speed, count, new int[] { id, data });
}
public void sendItemCrack(Player player, Location location, int id, byte data, float offsetX, float offsetY, float offsetZ, float speed, int count, boolean force)
throws Exception
{
if (this != ITEM_CRACK) {
throw new IllegalArgumentException("This method is only available for ITEM_CRACK!");
}
sendToPlayer(player, location, offsetX, offsetY, offsetZ, speed, count, force, new int[] { id, data });
}
@Deprecated
public void sendItemCrack(Collection<? extends Player> players, Location location, int id, byte data, float offsetX, float offsetY, float offsetZ, float speed, int count)
throws Exception
{
if (this != ITEM_CRACK) {
throw new IllegalArgumentException("This method is only available for ITEM_CRACK!");
}
for (Player p : players) {
sendItemCrack(p, location, id, data, offsetX, offsetY, offsetZ, speed, count);
}
}
public void sendItemCrack(Collection<? extends Player> players, Location location, int id, byte data, float offsetX, float offsetY, float offsetZ, float speed, int count, boolean force)
throws Exception
{
if (this != ITEM_CRACK) {
throw new IllegalArgumentException("This method is only available for ITEM_CRACK!");
}
for (Player p : players) {
sendItemCrack(p, location, id, data, offsetX, offsetY, offsetZ, speed, count, force);
}
}
@Deprecated
public void sendItemCrack(Player[] players, Location location, int id, byte data, float offsetX, float offsetY, float offsetZ, float speed, int count)
throws Exception
{
if (this != ITEM_CRACK) {
throw new IllegalArgumentException("This method is only available for ITEM_CRACK!");
}
for (Player p : players) {
sendItemCrack(p, location, id, data, offsetX, offsetY, offsetZ, speed, count);
}
}
@Deprecated
public void sendBlockDust(Player p, Location location, int id, float offsetX, float offsetY, float offsetZ, float speed, int count)
throws Exception
{
if (this != BLOCK_DUST) {
throw new IllegalArgumentException("This method is only available for BLOCK_DUST!");
}
sendToPlayer(p, location, offsetX, offsetY, offsetZ, speed, count, new int[] { id });
}
public void sendBlockDust(Player p, Location location, int id, float offsetX, float offsetY, float offsetZ, float speed, int count, boolean force)
throws Exception
{
if (this != BLOCK_DUST) {
throw new IllegalArgumentException("This method is only available for BLOCK_DUST!");
}
sendToPlayer(p, location, offsetX, offsetY, offsetZ, speed, count, force, new int[] { id });
}
@Deprecated
public void sendBlockDust(Collection<? extends Player> players, Location location, int id, float offsetX, float offsetY, float offsetZ, float speed, int count)
throws Exception
{
if (this != BLOCK_DUST) {
throw new IllegalArgumentException("This method is only available for BLOCK_DUST!");
}
for (Player p : players) {
sendBlockDust(p, location, id, offsetX, offsetY, offsetZ, speed, count);
}
}
public void sendBlockDust(Collection<? extends Player> players, Location location, int id, float offsetX, float offsetY, float offsetZ, float speed, int count, boolean force)
throws Exception
{
if (this != BLOCK_DUST) {
throw new IllegalArgumentException("This method is only available for BLOCK_DUST!");
}
for (Player p : players) {
sendBlockDust(p, location, id, offsetX, offsetY, offsetZ, speed, count, force);
}
}
@Deprecated
public void sendBlockDust(Player[] players, Location location, int id, float offsetX, float offsetY, float offsetZ, float speed, int count)
throws Exception
{
if (this != BLOCK_DUST) {
throw new IllegalArgumentException("This method is only available for BLOCK_DUST!");
}
for (Player p : players) {
sendBlockDust(p, location, id, offsetX, offsetY, offsetZ, speed, count);
}
}
protected static int getVersion(Player p)
{
try
{
Object handle = ReflectionUtilities.getHandle(p);
Object connection = _nmsFieldPlayerConnection.get(handle);
Object network = _nmsFieldNetworkManager.get(connection);
Object channel;
if (ReflectionUtilities.getVersion().contains("1_7")) {
channel = _nmsFieldNetworkManagerM.get(network);
} else {
channel = _nmsFieldNetworkManagerI.get(network);
}
Object version = ReflectionUtilities.getVersion().contains("1_7") ? _nmsNetworkGetVersion.invoke(network, new Object[] { channel }) : Integer.valueOf(47);
return ((Integer)version).intValue();
}
catch (Exception e)
{
e.printStackTrace();
}
return 0;
}
static
{
_nmsPacketPlayOutParticle = ReflectionUtilities.getNMSClass("PacketPlayOutWorldParticles");
_particleRange = 25;
String ver = ReflectionUtilities.getVersion();
try
{
_nmsPlayerConnection = ReflectionUtilities.getNMSClass("PlayerConnection");
_nmsEntityPlayer = ReflectionUtilities.getNMSClass("EntityPlayer");
_ioNettyChannel = ver.contains("1_7") ? Class.forName("net.minecraft.util.io.netty.channel.Channel") : Class.forName("io.netty.channel.Channel");
_nmsFieldPlayerConnection = ReflectionUtilities.getField(_nmsEntityPlayer, "playerConnection");
_nmsFieldNetworkManager = ReflectionUtilities.getField(_nmsPlayerConnection, "networkManager");
_nmsFieldNetworkManagerI = ReflectionUtilities.getField(_nmsFieldNetworkManager.getType(), "i");
_nmsFieldNetworkManagerM = ReflectionUtilities.getField(_nmsFieldNetworkManager.getType(), "m");
_nmsNetworkGetVersion = ReflectionUtilities.getMethod(_nmsFieldNetworkManager.getType(), "getVersion", new Class[] { _ioNettyChannel });
}
catch (Exception e)
{
System.err.println("[ParticleLIB] Error while loading: " + e.getMessage());
e.printStackTrace(System.err);
Bukkit.getPluginManager().disablePlugin(Bukkit.getPluginManager().getPlugin("ParticleLIB"));
}
}
private static Enum<?> getEnum(String enumFullName) {
String[] x = enumFullName.split("\\.(?=[^\\.]+$)");
if (x.length == 2)
{
String enumClassName = x[0];
String enumName = x[1];
try {
Class<Enum> cl = (Class<Enum>)Class.forName(enumClassName);
return Enum.valueOf(cl, enumName);
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
}
return null;
}
public static boolean isPlayerInRange(Player p, Location center)
{
double distance = 0.0D;
if (!p.getLocation().getWorld().equals(center.getWorld())) {
return false;
}
if ((distance = center.distanceSquared(p.getLocation())) > Double.MAX_VALUE) {
return false;
}
return distance < _particleRange * _particleRange;
}
public static class ReflectionUtilities
{
public static void setValue(Object instance, String fieldName, Object value)
throws Exception
{
Field field = instance.getClass().getDeclaredField(fieldName);
field.setAccessible(true);
field.set(instance, value);
}
public static Object getValue(Object instance, String fieldName)
throws Exception
{
Field field = instance.getClass().getDeclaredField(fieldName);
field.setAccessible(true);
return field.get(instance);
}
public static String getVersion()
{
String name = Bukkit.getServer().getClass().getPackage().getName();
String version = name.substring(name.lastIndexOf('.') + 1) + ".";
return version;
}
public static Class<?> getNMSClass(String className)
{
String fullName = "net.minecraft.server." + getVersion() + className;
Class<?> clazz = null;
try
{
clazz = Class.forName(fullName);
}
catch (Exception e)
{
e.printStackTrace();
}
return clazz;
}
public static Class<?> getOBCClass(String className)
{
String fullName = "org.bukkit.craftbukkit." + getVersion() + className;
Class<?> clazz = null;
try
{
clazz = Class.forName(fullName);
}
catch (Exception e)
{
e.printStackTrace();
}
return clazz;
}
public static Object getHandle(Object obj)
{
try
{
return getMethod(obj.getClass(), "getHandle", new Class[0]).invoke(obj, new Object[0]);
}
catch (Exception e)
{
e.printStackTrace();
}
return null;
}
public static Field getField(Class<?> clazz, String name)
{
try
{
Field field = clazz.getDeclaredField(name);
field.setAccessible(true);
return field;
}
catch (Exception e)
{
e.printStackTrace();
}
return null;
}
public static Method getMethod(Class<?> clazz, String name, Class<?>... args)
{
for (Method m : clazz.getMethods()) {
if ((m.getName().equals(name)) && ((args.length == 0) || (ClassListEqual(args, m.getParameterTypes()))))
{
m.setAccessible(true);
return m;
}
}
return null;
}
public static boolean ClassListEqual(Class<?>[] l1, Class<?>[] l2)
{
boolean equal = true;
if (l1.length != l2.length) {
return false;
}
for (int i = 0; i < l1.length; i++) {
if (l1[i] != l2[i])
{
equal = false;
break;
}
}
return equal;
}
}
}

View File

@ -1,114 +0,0 @@
/*
* Decompiled with CFR 0_114.
*
* Could not load the following classes:
* org.bukkit.Bukkit
*/
package com.Geekpower14.Quake.Utils;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import org.bukkit.Bukkit;
public class Reflection {
public static String getVersion() {
String name = Bukkit.getServer().getClass().getPackage().getName();
String version = String.valueOf(name.substring(name.lastIndexOf(46) + 1)) + ".";
return version;
}
public static Class<?> getNMSClass(String className) {
String fullName = "net.minecraft.server." + Reflection.getVersion() + className;
Class clazz = null;
try {
clazz = Class.forName(fullName);
}
catch (Exception e) {
e.printStackTrace();
}
return clazz;
}
public static Enum<?> getNMSEnum(String className) {
String enumFullName = "net.minecraft.server." + Reflection.getVersion() + className;
String[] x = enumFullName.split("\\.(?=[^\\.]+$)");
if (x.length == 2) {
String enumClassName = x[0];
String enumName = x[1];
try {
Class cl = Class.forName(enumClassName);
return Enum.valueOf(cl, enumName);
}
catch (ClassNotFoundException e) {
e.printStackTrace();
}
}
return null;
}
public static Class<?> getOBCClass(String className) {
String fullName = "org.bukkit.craftbukkit." + Reflection.getVersion() + className;
Class clazz = null;
try {
clazz = Class.forName(fullName);
}
catch (Exception e) {
e.printStackTrace();
}
return clazz;
}
public static Object getHandle(Object obj) {
try {
return Reflection.getMethod(obj.getClass(), "getHandle", new Class[0]).invoke(obj, new Object[0]);
}
catch (Exception e) {
e.printStackTrace();
return null;
}
}
public static Field getField(Class<?> clazz, String name) {
try {
Field field = clazz.getDeclaredField(name);
field.setAccessible(true);
return field;
}
catch (Exception e) {
e.printStackTrace();
return null;
}
}
public static Method getMethod(Class<?> clazz, String name, Class<?> ... args) {
Method[] arrmethod = clazz.getMethods();
int n = arrmethod.length;
int n2 = 0;
while (n2 < n) {
Method m = arrmethod[n2];
if (m.getName().equals(name) && (args.length == 0 || Reflection.ClassListEqual(args, m.getParameterTypes()))) {
m.setAccessible(true);
return m;
}
++n2;
}
return null;
}
public static boolean ClassListEqual(Class<?>[] l1, Class<?>[] l2) {
boolean equal = true;
if (l1.length != l2.length) {
return false;
}
int i = 0;
while (i < l1.length) {
if (l1[i] != l2[i]) {
equal = false;
break;
}
++i;
}
return equal;
}
}

View File

@ -0,0 +1,166 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.Geekpower14.Quake.Versions;
import com.Geekpower14.Quake.Quake;
import org.bukkit.Material;
/**
*
* @author Bl4ckSkull666
*/
public class GetMaterials {
private static Material _sign = null;
private static Material _bed = null;
private static Material _hoeDiamand = null;
private static Material _leatherChestPlate = null;
private static Material _jackOLantern = null;
private static Material _emerald = null;
public static Material GetSign() {
if(_sign == null) {
if(Quake.getPlugin()._config.isString("materials.sign")) {
String mat = Quake.getPlugin()._config.getString("materials.sign");
for(Material m: Material.values()) {
if(m.name().equalsIgnoreCase(mat)) {
_sign = m;
break;
}
}
}
if(_sign == null) {
for(Material m: Material.values()) {
if(m.name().equalsIgnoreCase("SIGN") || m.name().equalsIgnoreCase("OAK_SIGN")) {
_sign = m;
break;
}
}
}
}
return _sign;
}
public static Material GetBed() {
if(_bed == null) {
if(Quake.getPlugin()._config.isString("materials.bed")) {
String mat = Quake.getPlugin()._config.getString("materials.bed");
for(Material m: Material.values()) {
if(m.name().equalsIgnoreCase(mat)) {
_bed = m;
break;
}
}
}
if(_bed == null) {
for(Material m: Material.values()) {
if(m.name().equalsIgnoreCase("BED") || m.name().equalsIgnoreCase("RED_BED")) {
_bed = m;
break;
}
}
}
}
return _bed;
}
public static Material GetDiamandHoe() {
if(_hoeDiamand == null) {
if(Quake.getPlugin()._config.isString("materials.diamond_hoe")) {
String mat = Quake.getPlugin()._config.getString("materials.diamond_hoe");
for(Material m: Material.values()) {
if(m.name().equalsIgnoreCase(mat)) {
_hoeDiamand = m;
break;
}
}
}
if(_hoeDiamand == null) {
for(Material m: Material.values()) {
if(m.name().equalsIgnoreCase("DIAMOND_HOE")) {
_hoeDiamand = m;
break;
}
}
}
}
return _hoeDiamand;
}
public static Material GetLeatherChestplate() {
if(_leatherChestPlate == null) {
if(Quake.getPlugin()._config.isString("materials.leather_chestplate")) {
String mat = Quake.getPlugin()._config.getString("materials.leather_chestplate");
for(Material m: Material.values()) {
if(m.name().equalsIgnoreCase(mat)) {
_leatherChestPlate = m;
break;
}
}
}
if(_leatherChestPlate == null) {
for(Material m: Material.values()) {
if(m.name().equalsIgnoreCase("LEATHER_CHESTPLATE")) {
_leatherChestPlate = m;
break;
}
}
}
}
return _leatherChestPlate;
}
public static Material GetJackOLantern() {
if(_jackOLantern == null) {
if(Quake.getPlugin()._config.isString("materials.jack_o_lantern")) {
String mat = Quake.getPlugin()._config.getString("materials.jack_o_lantern");
for(Material m: Material.values()) {
if(m.name().equalsIgnoreCase(mat)) {
_jackOLantern = m;
break;
}
}
}
if(_jackOLantern == null) {
for(Material m: Material.values()) {
if(m.name().equalsIgnoreCase("JACK_O_LANTERN")) {
_jackOLantern = m;
break;
}
}
}
}
return _jackOLantern;
}
public static Material GetEmerald() {
if(_emerald == null) {
if(Quake.getPlugin()._config.isString("materials.emerald")) {
String mat = Quake.getPlugin()._config.getString("materials.emerald");
for(Material m: Material.values()) {
if(m.name().equalsIgnoreCase(mat)) {
_emerald = m;
break;
}
}
}
if(_emerald == null) {
for(Material m: Material.values()) {
if(m.name().equalsIgnoreCase("EMERALD")) {
_emerald = m;
break;
}
}
}
}
return _emerald;
}
}

View File

@ -0,0 +1,42 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.Geekpower14.Quake.Versions;
import com.Geekpower14.Quake.Quake;
import org.bukkit.Sound;
/**
*
* @author Bl4ckSkull666
*/
public class GetSounds {
private static Sound _pling = null;
public static Sound GetNotePling() {
if(_pling == null) {
if(Quake.getPlugin()._config.isString("sounds.pling")) {
String search = Quake.getPlugin()._config.getString("sounds.pling");
for(Sound s: Sound.values()) {
if(s.name().equalsIgnoreCase(search)) {
_pling = s;
break;
}
}
}
if(_pling == null) {
for(Sound s: Sound.values()) {
if(s.name().equalsIgnoreCase("NOTE_PLING") ||
s.name().equalsIgnoreCase("BLOCK_NOTE_PLING") ||
s.name().equalsIgnoreCase("BLOCK_NOTE_BLOCK_PLING")) {
_pling = s;
break;
}
}
}
}
return _pling;
}
}

View File

@ -0,0 +1,25 @@
package com.Geekpower14.Quake.Versions;
import com.Geekpower14.Quake.Arena.Arena;
import net.minecraft.server.v1_14_R1.PacketPlayInClientCommand;
import org.bukkit.Sound;
import org.bukkit.craftbukkit.v1_14_R1.entity.CraftPlayer;
import org.bukkit.entity.Player;
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author Bl4ckSkull666
*/
public class R1_14_1 {
public static void Respawn(Player p) throws Exception {
PacketPlayInClientCommand ppicc = new PacketPlayInClientCommand(PacketPlayInClientCommand.EnumClientCommand.PERFORM_RESPAWN);
((CraftPlayer)p).getHandle().playerConnection.a(ppicc);
}
}

View File

@ -0,0 +1,28 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.Geekpower14.Quake.Versions;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
/**
*
* @author Bl4ckSkull666
*/
public class SelectVersion {
private static String getVersion() {
String p = Bukkit.getServer().getClass().getPackage().getName();
return p.substring(p.lastIndexOf('.') + 1);
}
public static void Respawn(Player p) throws Exception {
switch(getVersion()) {
case "v1_14_R1":
R1_14_1.Respawn(p);
break;
}
}
}

View File

@ -1,8 +1,11 @@
name: Quake name: Quake
author: Geekpower14 authors: [Geekpower14, Bl4ckSkull666]
main: com.Geekpower14.Quake.Quake main: com.Geekpower14.Quake.Quake
version: 3.0.0 version: 3.4.0
api-version: 1.14
depend: [WorldEdit,Vault] depend: [WorldEdit,Vault]
softdepend: [Multiverse-Core]
website: https://www.survival-piraten.de
commands: commands:
quake: quake:
description: Quake command description: Quake command