Now the Bugfix Files ! This are the files from 19-3-2013
This commit is contained in:
parent
7d0592db03
commit
3010db6370
@ -25,80 +25,41 @@ public class BlockStorage implements Listener {
|
|||||||
public BlockStorage(Main m) {
|
public BlockStorage(Main m) {
|
||||||
this.plugin = m;
|
this.plugin = m;
|
||||||
}
|
}
|
||||||
@EventHandler(priority = EventPriority.MONITOR)
|
@EventHandler(priority=EventPriority.MONITOR)
|
||||||
public void BlockBreak(BlockBreakEvent event){
|
public void BlockBreak(BlockBreakEvent event) {
|
||||||
Block b = event.getBlock();
|
Block b = event.getBlock();
|
||||||
Player p = event.getPlayer();
|
Player p = event.getPlayer();
|
||||||
String pname = p.getName();
|
String pname = p.getName();
|
||||||
if(plugin.getArena(p)!= null){
|
boolean protall = false;
|
||||||
int a = plugin.getArena(p);
|
if (plugin.config.getString("Protected_Arena_Allways").equalsIgnoreCase("True")) { /* Jeppa Fix/Add */
|
||||||
if(!event.isCancelled()){
|
protall = true;
|
||||||
if(plugin.Playing.get(a).contains(pname)){
|
}
|
||||||
if(plugin.config.getString("Protected_Arena").equalsIgnoreCase("True")){
|
if ((plugin.getArena(p) != null) || (protall)) { /* Bug1a */
|
||||||
p.sendMessage(ChatColor.RED + "You can't break blocks while playing!");
|
//int a = this.plugin.getArena(p).intValue();
|
||||||
}
|
int a = 1; //Jeppa: define a default (may be needed if protall is true)
|
||||||
if(plugin.canjoin.get(a)){
|
if (plugin.getArena(p) != null) a = plugin.getArena(p);
|
||||||
if(plugin.config.getStringList("worlds").isEmpty() || (!plugin.config.getStringList("worlds").isEmpty() && plugin.config.getStringList("worlds").contains(p.getWorld().getName()))){
|
if ((!event.isCancelled()) && (((plugin.Playing.get(a)).contains(pname)) || (protall))) /* Bug1a */
|
||||||
if(!plugin.management.getBoolean("blocks.useWhitelistAsBlacklist")){
|
{
|
||||||
if(!plugin.management.getIntegerList("blocks.whitelist").isEmpty()){
|
if (plugin.config.getString("Protected_Arena").equalsIgnoreCase("True")) {
|
||||||
if(!plugin.management.getIntegerList("blocks.whitelist").contains(b.getTypeId())){
|
event.setCancelled(true); /* Jeppa fix Bug1 */
|
||||||
event.setCancelled(true);
|
p.sendMessage(ChatColor.RED + "You can't break blocks while playing!");
|
||||||
p.sendMessage(ChatColor.RED + "That is an illegal block!");
|
} else if ((((plugin.canjoin.get(a))) || (protall)) && ((plugin.config.getStringList("worlds").isEmpty()) || ((!plugin.config.getStringList("worlds").isEmpty()) && (plugin.config.getStringList("worlds").contains(p.getWorld().getName()))))) { /* Klammer fehlte! */
|
||||||
}else if(plugin.management.getIntegerList("blocks.whitelist").contains(b.getTypeId())){
|
if (((plugin.management.getIntegerList("blocks.whitelist").isEmpty()) || ((!plugin.management.getIntegerList("blocks.whitelist").isEmpty()) && (!plugin.management.getIntegerList("blocks.whitelist").contains(Integer.valueOf(b.getTypeId()))))) ^ (plugin.management.getBoolean("blocks.useWhitelistAsBlacklist"))) {
|
||||||
String w = b.getWorld().getName();
|
event.setCancelled(true);
|
||||||
int x = b.getX();
|
p.sendMessage(ChatColor.RED + "That is an illegal block!");
|
||||||
int y = b.getY();
|
} else {
|
||||||
int z = b.getZ();
|
String w = b.getWorld().getName();
|
||||||
int d = b.getTypeId();
|
int x = b.getX();
|
||||||
byte m = b.getData();
|
int y = b.getY();
|
||||||
String coords = w + "," + x + "," + y + "," + z + "," + d + "," + m + "," + a;
|
int z = b.getZ();
|
||||||
List<String> blocks = plugin.data.getStringList("Blocks_Destroyed");
|
int d = b.getTypeId();
|
||||||
if(!plugin.data.getStringList("Blocks_Placed").contains(w + "," + x + "," + y + "," + z + "," + a)){
|
byte m = b.getData();
|
||||||
blocks.add(coords);
|
String coords = w + "," + x + "," + y + "," + z + "," + d + "," + m + "," + a;
|
||||||
plugin.data.set("Blocks_Destroyed", blocks);
|
List<String> blocks = plugin.data.getStringList("Blocks_Destroyed");
|
||||||
plugin.saveData();
|
if (!plugin.data.getStringList("Blocks_Placed").contains(w + "," + x + "," + y + "," + z + "," + a)) {
|
||||||
}
|
blocks.add(coords);
|
||||||
}
|
plugin.data.set("Blocks_Destroyed", blocks);
|
||||||
}else{
|
plugin.saveData();
|
||||||
event.setCancelled(true);
|
|
||||||
p.sendMessage(ChatColor.RED + "That is an illegal block!");
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
if(!plugin.management.getIntegerList("blocks.whitelist").isEmpty()){
|
|
||||||
if(!plugin.management.getIntegerList("blocks.whitelist").contains(b.getTypeId())){
|
|
||||||
String w = b.getWorld().getName();
|
|
||||||
int x = b.getX();
|
|
||||||
int y = b.getY();
|
|
||||||
int z = b.getZ();
|
|
||||||
int d = b.getTypeId();
|
|
||||||
byte m = b.getData();
|
|
||||||
String coords = w + "," + x + "," + y + "," + z + "," + d + "," + m + "," + a;
|
|
||||||
List<String> blocks = plugin.data.getStringList("Blocks_Destroyed");
|
|
||||||
if(!plugin.data.getStringList("Blocks_Placed").contains(w + "," + x + "," + y + "," + z + "," + a)){
|
|
||||||
blocks.add(coords);
|
|
||||||
plugin.data.set("Blocks_Destroyed", blocks);
|
|
||||||
plugin.saveData();
|
|
||||||
}
|
|
||||||
}else if(plugin.management.getIntegerList("blocks.whitelist").contains(b.getTypeId())){
|
|
||||||
event.setCancelled(true);
|
|
||||||
p.sendMessage(ChatColor.RED + "That is an illegal block");
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
String w = b.getWorld().getName();
|
|
||||||
int x = b.getX();
|
|
||||||
int y = b.getY();
|
|
||||||
int z = b.getZ();
|
|
||||||
int d = b.getTypeId();
|
|
||||||
byte m = b.getData();
|
|
||||||
String coords = w + "," + x + "," + y + "," + z + "," + d + "," + m + "," + a;
|
|
||||||
List<String> blocks = plugin.data.getStringList("Blocks_Destroyed");
|
|
||||||
if(!plugin.data.getStringList("Blocks_Placed").contains(w + "," + x + "," + y + "," + z + "," + a)){
|
|
||||||
blocks.add(coords);
|
|
||||||
plugin.data.set("Blocks_Destroyed", blocks);
|
|
||||||
plugin.saveData();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,14 +20,19 @@ public class CommandBlock implements Listener {
|
|||||||
String pname = p.getName();
|
String pname = p.getName();
|
||||||
int i = 0;
|
int i = 0;
|
||||||
int x = 0;
|
int x = 0;
|
||||||
|
boolean found = false;
|
||||||
for(x = 1; x < plugin.Watching.size(); x++){
|
for(x = 1; x < plugin.Watching.size(); x++){
|
||||||
if(plugin.Watching.get(x).contains(p.getName())){
|
if(plugin.Watching.get(x).contains(p.getName())){
|
||||||
if(!p.hasPermission("HungerArena.UseCommands")){
|
if(!p.hasPermission("HungerArena.UseCommands")){
|
||||||
if(!plugin.management.getStringList("commands.whitelist").isEmpty()){
|
if(!plugin.management.getStringList("commands.whitelist").isEmpty()){
|
||||||
for(String whitelist: plugin.management.getStringList("commands.whitelist")){
|
for(String whitelist: plugin.management.getStringList("commands.whitelist")){
|
||||||
|
if(cmd.toLowerCase().startsWith(whitelist.toLowerCase())){ // Jeppa: check for ALL whitelist commands
|
||||||
|
found = true;
|
||||||
|
i = plugin.management.getStringList("commands.whitelist").size()-1;
|
||||||
|
}
|
||||||
i = i+1;
|
i = i+1;
|
||||||
if(i== plugin.management.getStringList("commands.whitelist").size()){
|
if(i== plugin.management.getStringList("commands.whitelist").size()){
|
||||||
if(!cmd.toLowerCase().startsWith(whitelist.toLowerCase()) || !cmd.toLowerCase().startsWith("/ha")){
|
if(!found && !cmd.toLowerCase().startsWith("/ha")){ //Jeppa: must be && ;)
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
p.sendMessage(ChatColor.RED + "You are only allowed to perform the following commands:");
|
p.sendMessage(ChatColor.RED + "You are only allowed to perform the following commands:");
|
||||||
for(String whitelistfull: plugin.management.getStringList("commands.whitelist")){
|
for(String whitelistfull: plugin.management.getStringList("commands.whitelist")){
|
||||||
@ -70,9 +75,13 @@ public class CommandBlock implements Listener {
|
|||||||
if(!p.hasPermission("HungerArena.UseCommands")){
|
if(!p.hasPermission("HungerArena.UseCommands")){
|
||||||
if(!plugin.management.getStringList("commands.whitelist").isEmpty()){
|
if(!plugin.management.getStringList("commands.whitelist").isEmpty()){
|
||||||
for(String whitelist: plugin.management.getStringList("commands.whitelist")){
|
for(String whitelist: plugin.management.getStringList("commands.whitelist")){
|
||||||
|
if(cmd.toLowerCase().startsWith(whitelist.toLowerCase())){
|
||||||
|
found = true;
|
||||||
|
i = plugin.management.getStringList("commands.whitelist").size()-1;
|
||||||
|
}
|
||||||
i = i+1;
|
i = i+1;
|
||||||
if(i== plugin.management.getStringList("commands.whitelist").size()){
|
if(i== plugin.management.getStringList("commands.whitelist").size()){ // Abbruch bei max. Anzahl
|
||||||
if(!cmd.toLowerCase().startsWith(whitelist.toLowerCase()) || !cmd.toLowerCase().startsWith("/ha")){
|
if(!found && !cmd.toLowerCase().startsWith("/ha")){ // with the two invertet forms it must be && ;)
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
p.sendMessage(ChatColor.RED + "You are only allowed to perform the following commands:");
|
p.sendMessage(ChatColor.RED + "You are only allowed to perform the following commands:");
|
||||||
for(String whitelistfull: plugin.management.getStringList("commands.whitelist")){
|
for(String whitelistfull: plugin.management.getStringList("commands.whitelist")){
|
||||||
@ -109,6 +118,7 @@ public class CommandBlock implements Listener {
|
|||||||
p.sendMessage("You have perms for all commands except this one!");
|
p.sendMessage("You have perms for all commands except this one!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//commands while not playing...
|
||||||
}else if(cmd.toLowerCase().equals("/back")){
|
}else if(cmd.toLowerCase().equals("/back")){
|
||||||
for(i = 1; i < plugin.Dead.size(); i++){
|
for(i = 1; i < plugin.Dead.size(); i++){
|
||||||
if(plugin.Dead.get(i).contains(pname) && plugin.canjoin.get(i))
|
if(plugin.Dead.get(i).contains(pname) && plugin.canjoin.get(i))
|
||||||
|
@ -14,6 +14,7 @@ import org.bukkit.command.CommandExecutor;
|
|||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.command.ConsoleCommandSender;
|
import org.bukkit.command.ConsoleCommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.HandlerList; //Jeppa : add for eventremoval...
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.potion.PotionEffect;
|
import org.bukkit.potion.PotionEffect;
|
||||||
import org.bukkit.potion.PotionEffectType;
|
import org.bukkit.potion.PotionEffectType;
|
||||||
@ -507,11 +508,11 @@ public class HaCommands implements CommandExecutor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}else if(args[0].equalsIgnoreCase("Ready")){
|
}else if(args[0].equalsIgnoreCase("Ready")){
|
||||||
p.sendMessage(String.valueOf(plugin.getArena(p)));
|
// p.sendMessage("debug: Arena: " + String.valueOf(plugin.getArena(p))); // Jeppa: das ist debug!
|
||||||
if(plugin.getArena(p)!= null){
|
if(plugin.getArena(p)!= null){
|
||||||
a = plugin.getArena(p);
|
a = plugin.getArena(p);
|
||||||
for(String s:plugin.Playing.get(a))
|
// for(String s:plugin.Playing.get(a)) // Jeppa: das ist debug!
|
||||||
p.sendMessage(s);
|
// p.sendMessage("Debug: Player:"+a+" : " + s); // Jeppa: das ist debug!
|
||||||
if(plugin.Playing.get(a).contains(pname)){
|
if(plugin.Playing.get(a).contains(pname)){
|
||||||
if(plugin.Ready.get(a).contains(pname)){
|
if(plugin.Ready.get(a).contains(pname)){
|
||||||
p.sendMessage(ChatColor.RED + "You're already ready!");
|
p.sendMessage(ChatColor.RED + "You're already ready!");
|
||||||
@ -733,18 +734,38 @@ public class HaCommands implements CommandExecutor {
|
|||||||
}else{
|
}else{
|
||||||
p.sendMessage(ChatColor.RED + "You don't have permission!");
|
p.sendMessage(ChatColor.RED + "You don't have permission!");
|
||||||
}
|
}
|
||||||
}else if(args[0].equalsIgnoreCase("Restart")){
|
}else if(args[0].equalsIgnoreCase("Restart")){ //Jeppa: fixed reopen , merged routines, added respawn
|
||||||
int b = 0;
|
int b = 0;
|
||||||
if(p.hasPermission("HungerArena.Restart")){
|
if(p.hasPermission("HungerArena.Restart")){
|
||||||
|
// Jeppa: merged the two routines and fixed reopen bug...
|
||||||
|
i = 1; // default first arena
|
||||||
|
int e = plugin.open.size(); // default amount number of arenas
|
||||||
if(args.length>= 2){
|
if(args.length>= 2){
|
||||||
a = Integer.parseInt(args[1]);
|
i = Integer.parseInt(args[1]); // replace i with commandvalue
|
||||||
for(b = 0; b < plugin.Watching.get(a).size(); b++){
|
if(i > e) i=e; // dirty fix for wrong args in command...
|
||||||
String s = plugin.Watching.get(a).get(b);
|
if(i < 1) i=1; // dirty fix for wrong args in command...
|
||||||
Player spectator = plugin.getServer().getPlayerExact(s);
|
e = i; // loop i to i ;)
|
||||||
spectator.setAllowFlight(false);
|
}
|
||||||
spectator.teleport(Spawn);
|
for(a = i; a <= e; a++){
|
||||||
for(Player online:plugin.getServer().getOnlinePlayers()){
|
//Jeppa: Routine dazu: erweitert um Teleport der Player!!!!!
|
||||||
online.showPlayer(spectator);
|
if(plugin.Playing.get(a).size() > 0){ // Jeppa: fix
|
||||||
|
for(b = 0; b < plugin.Playing.get(a).size(); b++){
|
||||||
|
String s = plugin.Playing.get(a).get(b);
|
||||||
|
Player tributes = plugin.getServer().getPlayerExact(s);
|
||||||
|
clearInv(tributes);
|
||||||
|
tributes.teleport(tributes.getWorld().getSpawnLocation());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// ^^
|
||||||
|
if(plugin.Watching.get(a).size() > 0){ // Jeppa: fix
|
||||||
|
for(b = 0; b < plugin.Watching.get(a).size(); b++){
|
||||||
|
String s = plugin.Watching.get(a).get(b);
|
||||||
|
Player spectator = plugin.getServer().getPlayerExact(s);
|
||||||
|
spectator.setAllowFlight(false);
|
||||||
|
spectator.teleport(Spawn);
|
||||||
|
for(Player online:plugin.getServer().getOnlinePlayers()){
|
||||||
|
online.showPlayer(spectator);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
plugin.Dead.get(a).clear();
|
plugin.Dead.get(a).clear();
|
||||||
@ -810,71 +831,6 @@ public class HaCommands implements CommandExecutor {
|
|||||||
plugin.saveData();
|
plugin.saveData();
|
||||||
p.performCommand("ha refill " + a);
|
p.performCommand("ha refill " + a);
|
||||||
p.sendMessage(ChatColor.AQUA + "Arena " + a + " has been reset!");
|
p.sendMessage(ChatColor.AQUA + "Arena " + a + " has been reset!");
|
||||||
}else{
|
|
||||||
for(i = 1; i <= plugin.Watching.size(); i++){
|
|
||||||
for(b = 0; b <= plugin.Watching.get(i).size(); b++){
|
|
||||||
if(plugin.Watching.get(i).get(b)!= null){
|
|
||||||
String s = plugin.Watching.get(i).get(b);
|
|
||||||
Player spectator = plugin.getServer().getPlayerExact(s);
|
|
||||||
spectator.setAllowFlight(false);
|
|
||||||
spectator.teleport(Spawn);
|
|
||||||
for(Player online:plugin.getServer().getOnlinePlayers()){
|
|
||||||
online.showPlayer(spectator);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
plugin.Dead.clear();
|
|
||||||
plugin.Quit.clear();
|
|
||||||
plugin.Watching.clear();
|
|
||||||
plugin.Frozen.clear();
|
|
||||||
plugin.Ready.clear();
|
|
||||||
plugin.NeedConfirm.clear();
|
|
||||||
plugin.Out.clear();
|
|
||||||
plugin.Playing.clear();
|
|
||||||
plugin.inArena.clear();
|
|
||||||
for(i = 1; i <= plugin.canjoin.size(); i++){
|
|
||||||
plugin.canjoin.put(i, false);
|
|
||||||
}
|
|
||||||
for(i = 1; i <= plugin.open.size(); i++){
|
|
||||||
plugin.open.put(i, true);
|
|
||||||
}
|
|
||||||
List<String> blocksbroken = plugin.data.getStringList("Blocks_Destroyed");
|
|
||||||
List<String> blocksplaced = plugin.data.getStringList("Blocks_Placed");
|
|
||||||
for(String blocks:blocksplaced){
|
|
||||||
String[] coords = blocks.split(",");
|
|
||||||
World w = plugin.getServer().getWorld(coords[0]);
|
|
||||||
double x = Double.parseDouble(coords[1]);
|
|
||||||
double y = Double.parseDouble(coords[2]);
|
|
||||||
double z = Double.parseDouble(coords[3]);
|
|
||||||
int d = 0;
|
|
||||||
byte m = 0;
|
|
||||||
Location blockl = new Location(w, x, y, z);
|
|
||||||
Block block = w.getBlockAt(blockl);
|
|
||||||
block.setTypeIdAndData(d, m, true);
|
|
||||||
block.getState().update();
|
|
||||||
}
|
|
||||||
for(String blocks:blocksbroken){
|
|
||||||
String[] coords = blocks.split(",");
|
|
||||||
World w = plugin.getServer().getWorld(coords[0]);
|
|
||||||
double x = Double.parseDouble(coords[1]);
|
|
||||||
double y = Double.parseDouble(coords[2]);
|
|
||||||
double z = Double.parseDouble(coords[3]);
|
|
||||||
int d = Integer.parseInt(coords[4]);
|
|
||||||
byte m = Byte.parseByte(coords[5]);
|
|
||||||
Location blockl = new Location(w, x, y, z);
|
|
||||||
Block block = w.getBlockAt(blockl);
|
|
||||||
block.setTypeIdAndData(d, m, true);
|
|
||||||
block.getState().update();
|
|
||||||
}
|
|
||||||
blocksplaced.clear();
|
|
||||||
blocksbroken.clear();
|
|
||||||
plugin.data.set("Blocks_Destroyed", blocksbroken);
|
|
||||||
plugin.data.set("Blocks_Placed", blocksplaced);
|
|
||||||
plugin.data.options().copyDefaults();
|
|
||||||
plugin.saveData();
|
|
||||||
p.performCommand("ha refill");
|
|
||||||
p.sendMessage(ChatColor.AQUA + "All games have been reset!");
|
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
p.sendMessage(ChatColor.RED + "You don't have permission!");
|
p.sendMessage(ChatColor.RED + "You don't have permission!");
|
||||||
@ -882,8 +838,16 @@ public class HaCommands implements CommandExecutor {
|
|||||||
/////////////////////////////////// Toggle //////////////////////////////////////////////////
|
/////////////////////////////////// Toggle //////////////////////////////////////////////////
|
||||||
}else if(args[0].equalsIgnoreCase("close")){
|
}else if(args[0].equalsIgnoreCase("close")){
|
||||||
if(p.hasPermission("HungerArena.toggle")){
|
if(p.hasPermission("HungerArena.toggle")){
|
||||||
|
// Jeppa: merged the two routines and fixed reopen bug...
|
||||||
|
i = 1; // default first arena
|
||||||
|
int e = plugin.open.size(); // default amount number of arenas
|
||||||
if(args.length>= 2){
|
if(args.length>= 2){
|
||||||
a = Integer.parseInt(args[1]);
|
i = Integer.parseInt(args[1]); // replace i with commandvalue
|
||||||
|
if(i > e) i=e; // dirty fix for wrong args in command...
|
||||||
|
if(i < 1) i=1; // dirty fix for wrong args in command...
|
||||||
|
e = i; // loop i to i ;)
|
||||||
|
}
|
||||||
|
for(a = i; a <= e; a++){
|
||||||
if(plugin.open.get(a)){
|
if(plugin.open.get(a)){
|
||||||
plugin.open.put(a, false);
|
plugin.open.put(a, false);
|
||||||
if(plugin.Playing.get(a)!= null){
|
if(plugin.Playing.get(a)!= null){
|
||||||
@ -917,42 +881,6 @@ public class HaCommands implements CommandExecutor {
|
|||||||
}else{
|
}else{
|
||||||
p.sendMessage(ChatColor.RED + "Arena " + a + " already closed, type /ha open to re-open them!");
|
p.sendMessage(ChatColor.RED + "Arena " + a + " already closed, type /ha open to re-open them!");
|
||||||
}
|
}
|
||||||
}else{
|
|
||||||
for(i = 1; i <= plugin.open.size(); i++){
|
|
||||||
if(plugin.open.get(i)){
|
|
||||||
plugin.open.put(i, false);
|
|
||||||
if(plugin.Playing.get(i)!= null){
|
|
||||||
for(String players: plugin.Playing.get(i)){
|
|
||||||
Player tributes = plugin.getServer().getPlayerExact(players);
|
|
||||||
clearInv(tributes);
|
|
||||||
tributes.teleport(tributes.getWorld().getSpawnLocation());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(plugin.Watching.get(i)!= null){
|
|
||||||
for(String sname: plugin.Watching.get(i)){
|
|
||||||
Player spectators = plugin.getServer().getPlayerExact(sname);
|
|
||||||
spectators.teleport(spectators.getWorld().getSpawnLocation());
|
|
||||||
spectators.setAllowFlight(false);
|
|
||||||
for(Player online:plugin.getServer().getOnlinePlayers()){
|
|
||||||
online.showPlayer(spectators);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
plugin.Dead.clear();
|
|
||||||
plugin.Quit.clear();
|
|
||||||
plugin.Watching.clear();
|
|
||||||
plugin.Frozen.clear();
|
|
||||||
plugin.Ready.clear();
|
|
||||||
plugin.NeedConfirm.clear();
|
|
||||||
plugin.Out.clear();
|
|
||||||
plugin.Playing.clear();
|
|
||||||
plugin.inArena.clear();
|
|
||||||
p.performCommand("ha refill");
|
|
||||||
p.sendMessage(ChatColor.GOLD + "Arena " + i + " Closed!");
|
|
||||||
}else{
|
|
||||||
p.sendMessage(ChatColor.RED + "Arena " + i + " already closed, type /ha open to re-open them!");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
p.sendMessage(ChatColor.RED + "No Perms!");
|
p.sendMessage(ChatColor.RED + "No Perms!");
|
||||||
@ -972,10 +900,10 @@ public class HaCommands implements CommandExecutor {
|
|||||||
if(!plugin.open.get(i)){
|
if(!plugin.open.get(i)){
|
||||||
plugin.open.put(i, true);
|
plugin.open.put(i, true);
|
||||||
p.sendMessage(ChatColor.GOLD + "Arena " + i + " Open!");
|
p.sendMessage(ChatColor.GOLD + "Arena " + i + " Open!");
|
||||||
i = i+1;
|
// i = i+1; // Jeppa: ???
|
||||||
}else{
|
}else{
|
||||||
p.sendMessage(ChatColor.RED + "Arena " + i + " already open, type /ha close to close them!");
|
p.sendMessage(ChatColor.RED + "Arena " + i + " already open, type /ha close to close them!");
|
||||||
i = i+1;
|
// i = i+1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -989,7 +917,8 @@ public class HaCommands implements CommandExecutor {
|
|||||||
plugin.Reward.clear();
|
plugin.Reward.clear();
|
||||||
plugin.Cost.clear();
|
plugin.Cost.clear();
|
||||||
plugin.Fee.clear();
|
plugin.Fee.clear();
|
||||||
plugin.onEnable();
|
HandlerList.unregisterAll(plugin); //Jeppa: Close all running Listeners before reopening them!
|
||||||
|
plugin.onEnable(); //Jeppa: with this in here all Listeners get re-registered again each "reload"! so f.e the Block-break will result in multiple lines in Data.yml ...
|
||||||
p.sendMessage(ChatColor.AQUA + "HungerArena Reloaded!");
|
p.sendMessage(ChatColor.AQUA + "HungerArena Reloaded!");
|
||||||
System.out.println(ChatColor.GREEN + pname + " reloaded HungerArena!");
|
System.out.println(ChatColor.GREEN + pname + " reloaded HungerArena!");
|
||||||
}else{
|
}else{
|
||||||
@ -1248,10 +1177,28 @@ public class HaCommands implements CommandExecutor {
|
|||||||
sender.sendMessage(ChatColor.GREEN + "All chests refilled!");
|
sender.sendMessage(ChatColor.GREEN + "All chests refilled!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}else if(args[0].equalsIgnoreCase("Restart")){
|
}else if(args[0].equalsIgnoreCase("Restart")){ //Jeppa: merged , fixed
|
||||||
int b = 0;
|
int b = 0;
|
||||||
|
// Jeppa: merged the two routines and fixed reopen bug...
|
||||||
|
i = 1; // default first arena
|
||||||
|
int e = plugin.open.size(); // default amount number of arenas
|
||||||
if(args.length>= 2){
|
if(args.length>= 2){
|
||||||
a = Integer.parseInt(args[1]);
|
i = Integer.parseInt(args[1]); // replace i with commandvalue
|
||||||
|
if(i > e) i=e; // dirty fix for wrong args in command...
|
||||||
|
if(i < 1) i=1; // dirty fix for wrong args in command...
|
||||||
|
e = i; // loop i to i ;)
|
||||||
|
}
|
||||||
|
for(a = i; a <= e; a++){
|
||||||
|
//Jeppa: Routine dazu: erweitert um Teleport der Player!!!!!
|
||||||
|
if(!plugin.Playing.get(a).isEmpty()){
|
||||||
|
for(b = 0; b < plugin.Playing.get(a).size(); b++){
|
||||||
|
String s = plugin.Playing.get(a).get(b);
|
||||||
|
Player tributes = plugin.getServer().getPlayerExact(s);
|
||||||
|
clearInv(tributes);
|
||||||
|
tributes.teleport(tributes.getWorld().getSpawnLocation());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// ^^
|
||||||
if(!plugin.Watching.get(a).isEmpty()){
|
if(!plugin.Watching.get(a).isEmpty()){
|
||||||
for(b = 0; b < plugin.Watching.get(a).size(); b++){
|
for(b = 0; b < plugin.Watching.get(a).size(); b++){
|
||||||
String s = plugin.Watching.get(a).get(b);
|
String s = plugin.Watching.get(a).get(b);
|
||||||
@ -1326,74 +1273,19 @@ public class HaCommands implements CommandExecutor {
|
|||||||
plugin.saveData();
|
plugin.saveData();
|
||||||
plugin.getServer().dispatchCommand(plugin.getServer().getConsoleSender(), "ha refill " + a);
|
plugin.getServer().dispatchCommand(plugin.getServer().getConsoleSender(), "ha refill " + a);
|
||||||
sender.sendMessage(ChatColor.AQUA + "Arena " + a + " has been reset!");
|
sender.sendMessage(ChatColor.AQUA + "Arena " + a + " has been reset!");
|
||||||
}else{
|
|
||||||
for(i = 1; i <= plugin.Watching.size(); i++){
|
|
||||||
for(b = 0; b < plugin.Watching.get(b).size(); b++){
|
|
||||||
String s = plugin.Watching.get(i).get(b);
|
|
||||||
Player spectator = plugin.getServer().getPlayerExact(s);
|
|
||||||
spectator.setAllowFlight(false);
|
|
||||||
spectator.teleport(Spawn);
|
|
||||||
for(Player online:plugin.getServer().getOnlinePlayers()){
|
|
||||||
online.showPlayer(spectator);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
plugin.Dead.clear();
|
|
||||||
plugin.Quit.clear();
|
|
||||||
plugin.Watching.clear();
|
|
||||||
plugin.Frozen.clear();
|
|
||||||
plugin.Ready.clear();
|
|
||||||
plugin.NeedConfirm.clear();
|
|
||||||
plugin.Out.clear();
|
|
||||||
plugin.Playing.clear();
|
|
||||||
plugin.inArena.clear();
|
|
||||||
for(i = 1; i <= plugin.canjoin.size(); i++){
|
|
||||||
plugin.canjoin.put(i, false);
|
|
||||||
}
|
|
||||||
for(i = 1; i <= plugin.open.size(); i++){
|
|
||||||
plugin.open.put(i, true);
|
|
||||||
}
|
|
||||||
List<String> blocksbroken = plugin.data.getStringList("Blocks_Destroyed");
|
|
||||||
List<String> blocksplaced = plugin.data.getStringList("Blocks_Placed");
|
|
||||||
for(String blocks:blocksplaced){
|
|
||||||
String[] coords = blocks.split(",");
|
|
||||||
World w = plugin.getServer().getWorld(coords[0]);
|
|
||||||
double x = Double.parseDouble(coords[1]);
|
|
||||||
double y = Double.parseDouble(coords[2]);
|
|
||||||
double z = Double.parseDouble(coords[3]);
|
|
||||||
int d = 0;
|
|
||||||
byte m = 0;
|
|
||||||
Location blockl = new Location(w, x, y, z);
|
|
||||||
Block block = w.getBlockAt(blockl);
|
|
||||||
block.setTypeIdAndData(d, m, true);
|
|
||||||
block.getState().update();
|
|
||||||
}
|
|
||||||
for(String blocks:blocksbroken){
|
|
||||||
String[] coords = blocks.split(",");
|
|
||||||
World w = plugin.getServer().getWorld(coords[0]);
|
|
||||||
double x = Double.parseDouble(coords[1]);
|
|
||||||
double y = Double.parseDouble(coords[2]);
|
|
||||||
double z = Double.parseDouble(coords[3]);
|
|
||||||
int d = Integer.parseInt(coords[4]);
|
|
||||||
byte m = Byte.parseByte(coords[5]);
|
|
||||||
Location blockl = new Location(w, x, y, z);
|
|
||||||
Block block = w.getBlockAt(blockl);
|
|
||||||
block.setTypeIdAndData(d, m, true);
|
|
||||||
block.getState().update();
|
|
||||||
}
|
|
||||||
blocksplaced.clear();
|
|
||||||
blocksbroken.clear();
|
|
||||||
plugin.data.set("Blocks_Destroyed", blocksbroken);
|
|
||||||
plugin.data.set("Blocks_Placed", blocksplaced);
|
|
||||||
plugin.data.options().copyDefaults();
|
|
||||||
plugin.saveData();
|
|
||||||
plugin.getServer().dispatchCommand(plugin.getServer().getConsoleSender(), "ha refill");
|
|
||||||
sender.sendMessage(ChatColor.AQUA + "All games have been reset!");
|
|
||||||
}
|
}
|
||||||
/////////////////////////////////// Toggle //////////////////////////////////////////////////
|
/////////////////////////////////// Toggle //////////////////////////////////////////////////
|
||||||
}else if(args[0].equalsIgnoreCase("close")){
|
}else if(args[0].equalsIgnoreCase("close")){
|
||||||
|
// Jeppa: merged the two routines and fixed reopen bug...
|
||||||
|
i = 1; // default first arena
|
||||||
|
int e = plugin.open.size(); // default amount number of arenas
|
||||||
if(args.length>= 2){
|
if(args.length>= 2){
|
||||||
a = Integer.parseInt(args[1]);
|
i = Integer.parseInt(args[1]); // replace i with commandvalue
|
||||||
|
if(i > e) i=e; // dirty fix for wrong args in command...
|
||||||
|
if(i < 1) i=1; // dirty fix for wrong args in command...
|
||||||
|
e = i; // loop i to i ;)
|
||||||
|
}
|
||||||
|
for(a = i; a <= e; a++){
|
||||||
if(plugin.open.get(a)){
|
if(plugin.open.get(a)){
|
||||||
plugin.open.put(a, false);
|
plugin.open.put(a, false);
|
||||||
if(plugin.Playing.get(a)!= null){
|
if(plugin.Playing.get(a)!= null){
|
||||||
@ -1427,44 +1319,8 @@ public class HaCommands implements CommandExecutor {
|
|||||||
}else{
|
}else{
|
||||||
sender.sendMessage(ChatColor.RED + "Arena " + a + " already closed, type /ha open to re-open them!");
|
sender.sendMessage(ChatColor.RED + "Arena " + a + " already closed, type /ha open to re-open them!");
|
||||||
}
|
}
|
||||||
}else{
|
|
||||||
for(i = 1; i <= plugin.open.size(); i++){
|
|
||||||
if(plugin.open.get(i)){
|
|
||||||
plugin.open.put(i, false);
|
|
||||||
if(plugin.Playing.get(i)!= null){
|
|
||||||
for(String players: plugin.Playing.get(i)){
|
|
||||||
Player tributes = plugin.getServer().getPlayerExact(players);
|
|
||||||
clearInv(tributes);
|
|
||||||
tributes.teleport(tributes.getWorld().getSpawnLocation());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(plugin.Watching.get(i)!= null){
|
|
||||||
for(String sname: plugin.Watching.get(i)){
|
|
||||||
Player spectators = plugin.getServer().getPlayerExact(sname);
|
|
||||||
spectators.teleport(spectators.getWorld().getSpawnLocation());
|
|
||||||
spectators.setAllowFlight(false);
|
|
||||||
for(Player online:plugin.getServer().getOnlinePlayers()){
|
|
||||||
online.showPlayer(spectators);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
plugin.Dead.clear();
|
|
||||||
plugin.Quit.clear();
|
|
||||||
plugin.Watching.clear();
|
|
||||||
plugin.Frozen.clear();
|
|
||||||
plugin.Ready.clear();
|
|
||||||
plugin.NeedConfirm.clear();
|
|
||||||
plugin.Out.clear();
|
|
||||||
plugin.Playing.clear();
|
|
||||||
plugin.inArena.clear();
|
|
||||||
Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "ha refill");
|
|
||||||
sender.sendMessage(ChatColor.GOLD + "Arena " + i + " Closed!");
|
|
||||||
}else{
|
|
||||||
sender.sendMessage(ChatColor.RED + "Arena " + i + " already closed, type /ha open to re-open them!");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}else if(args[0].equalsIgnoreCase("open")){
|
}else if(args[0].equalsIgnoreCase("open")){ // Jeppa: i / a fixed ;)
|
||||||
if(args.length>= 2){
|
if(args.length>= 2){
|
||||||
a = Integer.parseInt(args[1]);
|
a = Integer.parseInt(args[1]);
|
||||||
if(!plugin.open.get(a)){
|
if(!plugin.open.get(a)){
|
||||||
@ -1477,9 +1333,9 @@ public class HaCommands implements CommandExecutor {
|
|||||||
for(i = 1; i <= plugin.open.size(); i++){
|
for(i = 1; i <= plugin.open.size(); i++){
|
||||||
if(!plugin.open.get(i)){
|
if(!plugin.open.get(i)){
|
||||||
plugin.open.put(i, true);
|
plugin.open.put(i, true);
|
||||||
sender.sendMessage(ChatColor.GOLD + "Arena " + a + " Open!");
|
sender.sendMessage(ChatColor.GOLD + "Arena " + i + " Open!");
|
||||||
}else{
|
}else{
|
||||||
sender.sendMessage(ChatColor.RED + "Arena " + a + " already open, type /ha close to close them!");
|
sender.sendMessage(ChatColor.RED + "Arena " + i + " already open, type /ha close to close them!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1489,6 +1345,7 @@ public class HaCommands implements CommandExecutor {
|
|||||||
plugin.Reward.clear();
|
plugin.Reward.clear();
|
||||||
plugin.Cost.clear();
|
plugin.Cost.clear();
|
||||||
plugin.Fee.clear();
|
plugin.Fee.clear();
|
||||||
|
HandlerList.unregisterAll(plugin); //Jeppa: Close all running Listeners before reopening them!
|
||||||
plugin.onEnable();
|
plugin.onEnable();
|
||||||
sender.sendMessage(ChatColor.AQUA + "HungerArena Reloaded!");
|
sender.sendMessage(ChatColor.AQUA + "HungerArena Reloaded!");
|
||||||
}else if(args[0].equalsIgnoreCase("WarpAll")){
|
}else if(args[0].equalsIgnoreCase("WarpAll")){
|
||||||
|
@ -114,7 +114,7 @@ public class Main extends JavaPlugin{
|
|||||||
getCommand("Sponsor").setExecutor(SponsorCommands);
|
getCommand("Sponsor").setExecutor(SponsorCommands);
|
||||||
getCommand("Startpoint").setExecutor(SpawnsCommand);
|
getCommand("Startpoint").setExecutor(SpawnsCommand);
|
||||||
i = 1;
|
i = 1;
|
||||||
//TODO THIS CRAP
|
//TODO THIS CRAP /* Jeppa: Wasn't this already done ??? */
|
||||||
if(spawns.getConfigurationSection("Spawns")!= null){
|
if(spawns.getConfigurationSection("Spawns")!= null){
|
||||||
Map<String, Object> temp = spawns.getConfigurationSection("Spawns").getValues(false);
|
Map<String, Object> temp = spawns.getConfigurationSection("Spawns").getValues(false);
|
||||||
for(Entry<String, Object> entry: temp.entrySet()){
|
for(Entry<String, Object> entry: temp.entrySet()){
|
||||||
@ -315,6 +315,7 @@ public class Main extends JavaPlugin{
|
|||||||
double spawny = Double.parseDouble(Spawncoords[1]);
|
double spawny = Double.parseDouble(Spawncoords[1]);
|
||||||
double spawnz = Double.parseDouble(Spawncoords[2]);
|
double spawnz = Double.parseDouble(Spawncoords[2]);
|
||||||
Location Spawn = new Location(spawnw, spawnx, spawny, spawnz);
|
Location Spawn = new Location(spawnw, spawnx, spawny, spawnz);
|
||||||
|
final String a2 = String.valueOf(a); // Jeppa Test
|
||||||
if(Playing.get(a).size()== 1 && canjoin.get(a)== true){
|
if(Playing.get(a).size()== 1 && canjoin.get(a)== true){
|
||||||
//Announce winner
|
//Announce winner
|
||||||
for(i = 0; i < Playing.get(a).size(); i++){
|
for(i = 0; i < Playing.get(a).size(); i++){
|
||||||
@ -368,8 +369,7 @@ public class Main extends JavaPlugin{
|
|||||||
if(config.getString("Auto_Restart").equalsIgnoreCase("True")){
|
if(config.getString("Auto_Restart").equalsIgnoreCase("True")){
|
||||||
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(this, new Runnable(){
|
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(this, new Runnable(){
|
||||||
public void run(){
|
public void run(){
|
||||||
Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "ha restart");
|
Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "ha restart " + a2);
|
||||||
|
|
||||||
}
|
}
|
||||||
}, 220L);
|
}, 220L);
|
||||||
}
|
}
|
||||||
@ -379,7 +379,12 @@ public class Main extends JavaPlugin{
|
|||||||
String begin = config.getString("Start_Message");
|
String begin = config.getString("Start_Message");
|
||||||
begin = begin.replaceAll("(&([a-f0-9]))", "\u00A7$2");
|
begin = begin.replaceAll("(&([a-f0-9]))", "\u00A7$2");
|
||||||
final String msg = begin;
|
final String msg = begin;
|
||||||
i = 10;
|
/* Jeppa add : */
|
||||||
|
if(config.getInt("Countdown_Timer") != 0) {
|
||||||
|
i = config.getInt("Countdown_Timer") ;
|
||||||
|
} else {
|
||||||
|
i = 10;
|
||||||
|
}
|
||||||
if(config.getString("Countdown").equalsIgnoreCase("true")){
|
if(config.getString("Countdown").equalsIgnoreCase("true")){
|
||||||
start = getServer().getScheduler().scheduleSyncRepeatingTask(this, new Runnable(){
|
start = getServer().getScheduler().scheduleSyncRepeatingTask(this, new Runnable(){
|
||||||
public void run(){
|
public void run(){
|
||||||
|
Loading…
x
Reference in New Issue
Block a user