No known bugs
This commit is contained in:
parent
6b1a6b3c30
commit
b0d29cd907
@ -2,7 +2,7 @@
|
|||||||
<classpath>
|
<classpath>
|
||||||
<classpathentry kind="src" path="src"/>
|
<classpathentry kind="src" path="src"/>
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
|
||||||
<classpathentry kind="lib" path="C:/Users/Travja/Downloads/bukkit-1.3.1-R1.1-20120809.005103-3.jar"/>
|
|
||||||
<classpathentry kind="lib" path="C:/Users/Travja/Documents/Plugins/Vault.jar"/>
|
<classpathentry kind="lib" path="C:/Users/Travja/Documents/Plugins/Vault.jar"/>
|
||||||
|
<classpathentry kind="lib" path="C:/Users/Travja/Downloads/bukkit-1.3.2-R1.0.jar"/>
|
||||||
<classpathentry kind="output" path="bin"/>
|
<classpathentry kind="output" path="bin"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
3
Data.yml
Normal file
3
Data.yml
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
# Stores all blocks to reset!
|
||||||
|
Blocks_Destroyed: []
|
||||||
|
Blocks_Placed: []
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
bin/me/Travja/HungerArena/DeathListener$2.class
Normal file
BIN
bin/me/Travja/HungerArena/DeathListener$2.class
Normal file
Binary file not shown.
Binary file not shown.
BIN
bin/me/Travja/HungerArena/FreezeListener$1.class
Normal file
BIN
bin/me/Travja/HungerArena/FreezeListener$1.class
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
15
commandAndBlockManagement.yml
Normal file
15
commandAndBlockManagement.yml
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
# Make like this to whitelist/blacklist
|
||||||
|
# whitelist:
|
||||||
|
# - /broadcast
|
||||||
|
# - /pm
|
||||||
|
# Anything not in the whitelist will be counted as blacklist!
|
||||||
|
|
||||||
|
commands:
|
||||||
|
whitelist: []
|
||||||
|
##### Not implemented! #####
|
||||||
|
blocks:
|
||||||
|
whitelist: []
|
||||||
|
blacklist: []
|
||||||
|
sponsors:
|
||||||
|
blacklist: []
|
||||||
|
############################
|
37
config.yml
37
config.yml
@ -78,40 +78,3 @@ ChatClose_Radius: 10
|
|||||||
#############################
|
#############################
|
||||||
#############################
|
#############################
|
||||||
#############################
|
#############################
|
||||||
|
|
||||||
########################
|
|
||||||
####### Spawns #########
|
|
||||||
########################
|
|
||||||
Spawn_coords: 100,100,100,world
|
|
||||||
# If /ha setspawn has been run
|
|
||||||
Spawns_set: 'false'
|
|
||||||
Tribute_one_spawn: 100,100,100
|
|
||||||
Tribute_two_spawn: 100,100,100
|
|
||||||
Tribute_three_spawn: 100,100,100
|
|
||||||
Tribute_four_spawn: 100,100,100
|
|
||||||
Tribute_five_spawn: 100,100,100
|
|
||||||
Tribute_six_spawn: 100,100,100
|
|
||||||
Tribute_seven_spawn: 100,100,100
|
|
||||||
Tribute_eight_spawn: 100,100,100
|
|
||||||
Tribute_nine_spawn: 100,100,100
|
|
||||||
Tribute_ten_spawn: 100,100,100
|
|
||||||
Tribute_eleven_spawn: 100,100,100
|
|
||||||
Tribute_twelve_spawn: 100,100,100
|
|
||||||
Tribute_thirteen_spawn: 100,100,100
|
|
||||||
Tribute_fourteen_spawn: 100,100,100
|
|
||||||
Tribute_fifteen_spawn: 100,100,100
|
|
||||||
Tribute_sixteen_spawn: 100,100,100
|
|
||||||
Tribute_seventeen_spawn: 100,100,100
|
|
||||||
Tribute_eighteen_spawn: 100,100,100
|
|
||||||
Tribute_nineteen_spawn: 100,100,100
|
|
||||||
Tribute_twenty_spawn: 100,100,100
|
|
||||||
Tribute_twentyone_spawn: 100,100,100
|
|
||||||
Tribute_twentytwo_spawn: 100,100,100
|
|
||||||
Tribute_twentythree_spawn: 100,100,100
|
|
||||||
Tribute_twentyfour_spawn: 100,100,100
|
|
||||||
########################
|
|
||||||
########################
|
|
||||||
########################
|
|
||||||
|
|
||||||
# Leave this. :)
|
|
||||||
Blocks_Destroyed:
|
|
49
spawns.yml
49
spawns.yml
@ -2,27 +2,28 @@
|
|||||||
Spawn_coords: 100,100,100,world
|
Spawn_coords: 100,100,100,world
|
||||||
# If /ha setspawn has been run
|
# If /ha setspawn has been run
|
||||||
Spawns_set: 'false'
|
Spawns_set: 'false'
|
||||||
Tribute_one_spawn: 100,100,100
|
Spawns:
|
||||||
Tribute_two_spawn: 100,100,100
|
- 100,100,100,world,false
|
||||||
Tribute_three_spawn: 100,100,100
|
- 100,100,100,world,false
|
||||||
Tribute_four_spawn: 100,100,100
|
- 100,100,100,world,false
|
||||||
Tribute_five_spawn: 100,100,100
|
- 100,100,100,world,false
|
||||||
Tribute_six_spawn: 100,100,100
|
- 100,100,100,world,false
|
||||||
Tribute_seven_spawn: 100,100,100
|
- 100,100,100,world,false
|
||||||
Tribute_eight_spawn: 100,100,100
|
- 100,100,100,world,false
|
||||||
Tribute_nine_spawn: 100,100,100
|
- 100,100,100,world,false
|
||||||
Tribute_ten_spawn: 100,100,100
|
- 100,100,100,world,false
|
||||||
Tribute_eleven_spawn: 100,100,100
|
- 100,100,100,world,false
|
||||||
Tribute_twelve_spawn: 100,100,100
|
- 100,100,100,world,false
|
||||||
Tribute_thirteen_spawn: 100,100,100
|
- 100,100,100,world,false
|
||||||
Tribute_fourteen_spawn: 100,100,100
|
- 100,100,100,world,false
|
||||||
Tribute_fifteen_spawn: 100,100,100
|
- 100,100,100,world,false
|
||||||
Tribute_sixteen_spawn: 100,100,100
|
- 100,100,100,world,false
|
||||||
Tribute_seventeen_spawn: 100,100,100
|
- 100,100,100,world,false
|
||||||
Tribute_eighteen_spawn: 100,100,100
|
- 100,100,100,world,false
|
||||||
Tribute_nineteen_spawn: 100,100,100
|
- 100,100,100,world,false
|
||||||
Tribute_twenty_spawn: 100,100,100
|
- 100,100,100,world,false
|
||||||
Tribute_twentyone_spawn: 100,100,100
|
- 100,100,100,world,false
|
||||||
Tribute_twentytwo_spawn: 100,100,100
|
- 100,100,100,world,false
|
||||||
Tribute_twentythree_spawn: 100,100,100
|
- 100,100,100,world,false
|
||||||
Tribute_twentyfour_spawn: 100,100,100
|
- 100,100,100,world,false
|
||||||
|
- 100,100,100,world,false
|
@ -3,22 +3,18 @@ package me.Travja.HungerArena;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
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.BlockFace;
|
import org.bukkit.block.BlockFace;
|
||||||
|
import org.bukkit.entity.Entity;
|
||||||
|
import org.bukkit.entity.EntityType;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.block.BlockBreakEvent;
|
import org.bukkit.event.block.BlockBreakEvent;
|
||||||
import org.bukkit.event.block.BlockBurnEvent;
|
import org.bukkit.event.block.BlockBurnEvent;
|
||||||
import org.bukkit.event.block.BlockFadeEvent;
|
import org.bukkit.event.block.BlockFadeEvent;
|
||||||
import org.bukkit.event.block.BlockFormEvent;
|
|
||||||
import org.bukkit.event.block.BlockGrowEvent;
|
|
||||||
import org.bukkit.event.block.BlockPhysicsEvent;
|
|
||||||
import org.bukkit.event.block.BlockPistonExtendEvent;
|
|
||||||
import org.bukkit.event.block.BlockPlaceEvent;
|
import org.bukkit.event.block.BlockPlaceEvent;
|
||||||
import org.bukkit.event.block.LeavesDecayEvent;
|
|
||||||
import org.bukkit.event.entity.EntityExplodeEvent;
|
import org.bukkit.event.entity.EntityExplodeEvent;
|
||||||
import org.bukkit.event.player.PlayerBucketEmptyEvent;
|
import org.bukkit.event.player.PlayerBucketEmptyEvent;
|
||||||
import org.bukkit.event.player.PlayerBucketFillEvent;
|
import org.bukkit.event.player.PlayerBucketFillEvent;
|
||||||
@ -32,8 +28,13 @@ public class BlockStorage implements Listener {
|
|||||||
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();
|
||||||
|
if(plugin.Playing.contains(pname)){
|
||||||
|
if(plugin.config.getString("Protected_Arena").equalsIgnoreCase("True")){
|
||||||
|
event.setCancelled(true);
|
||||||
|
p.sendMessage(ChatColor.RED + "You can't break blocks when you're playing!");
|
||||||
|
}
|
||||||
if(plugin.canjoin){
|
if(plugin.canjoin){
|
||||||
if(plugin.Playing.contains(p.getName())){
|
|
||||||
if(plugin.config.getStringList("worlds").isEmpty() || (!plugin.config.getStringList("worlds").isEmpty() && plugin.config.getStringList("worlds").contains(p.getWorld().getName()))){
|
if(plugin.config.getStringList("worlds").isEmpty() || (!plugin.config.getStringList("worlds").isEmpty() && plugin.config.getStringList("worlds").contains(p.getWorld().getName()))){
|
||||||
String w = b.getWorld().getName();
|
String w = b.getWorld().getName();
|
||||||
int x = b.getX();
|
int x = b.getX();
|
||||||
@ -42,118 +43,110 @@ public class BlockStorage implements Listener {
|
|||||||
int d = b.getTypeId();
|
int d = b.getTypeId();
|
||||||
byte m = b.getData();
|
byte m = b.getData();
|
||||||
String coords = w + "," + x + "," + y + "," + z + "," + d + "," + m;
|
String coords = w + "," + x + "," + y + "," + z + "," + d + "," + m;
|
||||||
System.out.println("Leaf Break: " + coords);
|
List<String> blocks = plugin.data.getStringList("Blocks_Destroyed");
|
||||||
List<String> blocks = plugin.config.getStringList("Blocks_Destroyed");
|
if(!plugin.data.getStringList("Blocks_Placed").contains(w + "," + x + "," + y + "," + z)){
|
||||||
blocks.add(coords);
|
blocks.add(coords);
|
||||||
plugin.config.set("Blocks_Destroyed", blocks);
|
plugin.data.set("Blocks_Destroyed", blocks);
|
||||||
plugin.saveConfig();
|
plugin.saveData();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*@EventHandler
|
}
|
||||||
public void creeperExplosion(EntityExplodeEvent event){
|
@EventHandler
|
||||||
if(plugin.canjoin== true){
|
public void Explosion(EntityExplodeEvent event){
|
||||||
for(Block b:event.blockList()){
|
List<Block> blocksd = event.blockList();
|
||||||
String w = b.getWorld().getName();
|
Entity e = event.getEntity();
|
||||||
|
if(plugin.canjoin){
|
||||||
|
if(plugin.config.getStringList("worlds").isEmpty() || (!plugin.config.getStringList("worlds").isEmpty() && plugin.config.getStringList("worlds").contains(event.getEntity().getWorld().getName()))){
|
||||||
|
if(e.getType()== EntityType.PRIMED_TNT){
|
||||||
|
if(!plugin.data.getStringList("Blocks_Placed").contains(e.getLocation().getWorld() + "," + e.getLocation().getX() + "," + e.getLocation().getY() + "," + e.getLocation().getZ()) /*|| !plugin.data.getStringList("Blocks_Destroyed").contains(e.getLocation().getWorld() + "," + e.getLocation().getX() + "," + e.getLocation().getY() + "," + e.getLocation().getZ())*/){
|
||||||
|
List<String> blocks = plugin.data.getStringList("Blocks_Destroyed");
|
||||||
|
blocks.add(e.getLocation().getWorld().getName() + "," + e.getLocation().getX() + "," + e.getLocation().getY() + "," + e.getLocation().getZ() + ",46" + ",0");
|
||||||
|
plugin.data.set("Blocks_Destroyed", blocks);
|
||||||
|
plugin.saveData();
|
||||||
|
plugin.getServer().broadcastMessage("TNT blew up!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for(Block b:blocksd){
|
||||||
|
String w = event.getEntity().getWorld().getName();
|
||||||
int x = b.getX();
|
int x = b.getX();
|
||||||
int y = b.getY();
|
int y = b.getY();
|
||||||
int z = b.getZ();
|
int z = b.getZ();
|
||||||
int d = b.getTypeId();
|
int d = b.getTypeId();
|
||||||
String coords = w + "," + x + "," + y + "," + z + "," + d;
|
byte m = b.getData();
|
||||||
System.out.println("Explode: " + coords);
|
String coords = w + "," + x + "," + y + "," + z + "," + d + "," + m;
|
||||||
List<String> blocks = plugin.config.getStringList("Blocks_Destroyed");
|
List<String> blocks = plugin.data.getStringList("Blocks_Destroyed");
|
||||||
|
if(!plugin.data.getStringList("Blocks_Placed").contains(w + "," + x + "," + y + "," + z) || !plugin.data.getStringList("Blocks_Destroyed").contains(w + "," + x + "," + y + "," + z)){
|
||||||
blocks.add(coords);
|
blocks.add(coords);
|
||||||
plugin.config.set("Blocks_Destroyed", blocks);
|
plugin.data.set("Blocks_Destroyed", blocks);
|
||||||
plugin.saveConfig();
|
plugin.saveData();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void burningBlocks(BlockBurnEvent event){
|
public void burningBlocks(BlockBurnEvent event){
|
||||||
if(plugin.canjoin== true){
|
|
||||||
Block b = event.getBlock();
|
Block b = event.getBlock();
|
||||||
|
if(plugin.canjoin== true){
|
||||||
|
if(plugin.config.getStringList("worlds").isEmpty() || (!plugin.config.getStringList("worlds").isEmpty() && plugin.config.getStringList("worlds").contains(b.getWorld().getName()))){
|
||||||
String w = b.getWorld().getName();
|
String w = b.getWorld().getName();
|
||||||
int x = b.getX();
|
int x = b.getX();
|
||||||
int y = b.getY();
|
int y = b.getY();
|
||||||
int z = b.getZ();
|
int z = b.getZ();
|
||||||
int d = b.getTypeId();
|
int d = b.getTypeId();
|
||||||
String coords = w + "," + x + "," + y + "," + z + "," + d;
|
byte m = b.getData();
|
||||||
System.out.println("Burn: " + coords);
|
String coords = w + "," + x + "," + y + "," + z + "," + d + "," + m;
|
||||||
List<String> blocks = plugin.config.getStringList("Blocks_Destroyed");
|
List<String> blocks = plugin.data.getStringList("Blocks_Destroyed");
|
||||||
|
if(!plugin.data.getStringList("Blocks_Placed").contains(w + "," + x + "," + y + "," + z)){
|
||||||
blocks.add(coords);
|
blocks.add(coords);
|
||||||
plugin.config.set("Blocks_Destroyed", blocks);
|
plugin.data.set("Blocks_Destroyed", blocks);
|
||||||
plugin.saveConfig();
|
plugin.saveData();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@EventHandler
|
|
||||||
public void leafDecay(LeavesDecayEvent event){
|
|
||||||
if(plugin.canjoin== true){
|
|
||||||
Block b = event.getBlock();
|
|
||||||
String w = b.getWorld().getName();
|
|
||||||
int x = b.getX();
|
|
||||||
int y = b.getY();
|
|
||||||
int z = b.getZ();
|
|
||||||
int d = b.getTypeId();
|
|
||||||
String coords = w + "," + x + "," + y + "," + z + "," + d;
|
|
||||||
System.out.println("Decay: " + coords);
|
|
||||||
List<String> blocks = plugin.config.getStringList("Blocks_Destroyed");
|
|
||||||
blocks.add(coords);
|
|
||||||
plugin.config.set("Blocks_Destroyed", blocks);
|
|
||||||
plugin.saveConfig();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void blockPlace(BlockPlaceEvent event){
|
public void blockPlace(BlockPlaceEvent event){
|
||||||
if(plugin.canjoin== true){
|
|
||||||
Block b = event.getBlock();
|
Block b = event.getBlock();
|
||||||
|
Player p = event.getPlayer();
|
||||||
|
if(plugin.Playing.contains(p.getName())){
|
||||||
|
if(plugin.canjoin){
|
||||||
|
if(plugin.config.getStringList("worlds").isEmpty() || (!plugin.config.getStringList("worlds").isEmpty() && plugin.config.getStringList("worlds").contains(b.getWorld().getName()))){
|
||||||
|
//TODO
|
||||||
|
if((b.getType()== Material.SAND || b.getType()== Material.GRAVEL) && (b.getRelative(BlockFace.DOWN).getType()== Material.AIR || b.getRelative(BlockFace.DOWN).getType()== Material.WATER || b.getRelative(BlockFace.DOWN).getType()== Material.LAVA)){
|
||||||
|
int n = b.getY() -1;
|
||||||
|
while(b.getWorld().getBlockAt(b.getX(), n, b.getZ()).getType()== Material.AIR || b.getWorld().getBlockAt(b.getX(), n, b.getZ()).getType()== Material.WATER || b.getWorld().getBlockAt(b.getX(), n, b.getZ()).getType()== Material.LAVA){
|
||||||
|
n = n -1;
|
||||||
|
event.getPlayer().sendMessage(b.getWorld().getBlockAt(b.getX(), n, b.getZ()).getType().toString().toLowerCase());
|
||||||
|
if(b.getWorld().getBlockAt(b.getX(), n, b.getZ()).getType()!= Material.AIR || b.getWorld().getBlockAt(b.getX(), n, b.getZ()).getType()!= Material.WATER || b.getWorld().getBlockAt(b.getX(), n, b.getZ()).getType()!= Material.LAVA){
|
||||||
|
int l = n +1;
|
||||||
|
Block br = b.getWorld().getBlockAt(b.getX(), l, b.getZ());
|
||||||
|
String w = br.getWorld().getName();
|
||||||
|
int x = br.getX();
|
||||||
|
int y = br.getY();
|
||||||
|
int z = br.getZ();
|
||||||
|
String coords = w + "," + x + "," + y + "," + z;
|
||||||
|
p.sendMessage(ChatColor.GREEN + "Sand/Gravel will land at " + coords);
|
||||||
|
List<String> blocks = plugin.data.getStringList("Blocks_Placed");
|
||||||
|
blocks.add(coords);
|
||||||
|
plugin.data.set("Blocks_Placed", blocks);
|
||||||
|
plugin.saveData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
if(b.getType()!= Material.SAND || b.getType()!= Material.GRAVEL){
|
||||||
String w = b.getWorld().getName();
|
String w = b.getWorld().getName();
|
||||||
int x = b.getX();
|
int x = b.getX();
|
||||||
int y = b.getY();
|
int y = b.getY();
|
||||||
int z = b.getZ();
|
int z = b.getZ();
|
||||||
int d = b.getTypeId();
|
String coords = w + "," + x + "," + y + "," + z;
|
||||||
String coords = w + "," + x + "," + y + "," + z + "," + d;
|
List<String> blocks = plugin.data.getStringList("Blocks_Placed");
|
||||||
if(!(d== 51) && !(d==12) && !(d==13)){
|
|
||||||
System.out.println("Place: " + coords);
|
|
||||||
List<String> blocks = plugin.config.getStringList("Blocks_Placed");
|
|
||||||
blocks.add(coords);
|
blocks.add(coords);
|
||||||
plugin.config.set("Blocks_Placed", blocks);
|
plugin.data.set("Blocks_Placed", blocks);
|
||||||
plugin.saveConfig();
|
plugin.saveData();
|
||||||
}else if (d == 12 || d == 13) {
|
|
||||||
System.out.println("Sand/Gravel");
|
|
||||||
int newy = y;
|
|
||||||
int replaced = 0;
|
|
||||||
Location l = b.getLocation();
|
|
||||||
while(l.getBlock().getRelative(BlockFace.DOWN).getType()== Material.AIR){
|
|
||||||
newy = newy-1;
|
|
||||||
replaced = 0;
|
|
||||||
System.out.println(newy);
|
|
||||||
}
|
}
|
||||||
while(l.getBlock().getRelative(BlockFace.DOWN).getType()== Material.WATER){
|
|
||||||
newy = newy-1;
|
|
||||||
replaced = 8;
|
|
||||||
}
|
|
||||||
while(l.getBlock().getRelative(BlockFace.DOWN).getType()== Material.LAVA){
|
|
||||||
newy = newy-1;
|
|
||||||
replaced = 10;
|
|
||||||
}
|
|
||||||
if(l.getBlock().getRelative(BlockFace.DOWN).getType()!= Material.AIR || l.getBlock().getRelative(BlockFace.DOWN).getType()!= Material.WATER || l.getBlock().getRelative(BlockFace.DOWN).getType()!= Material.LAVA){
|
|
||||||
event.getPlayer().sendMessage(ChatColor.GREEN + "Block will land at " + x + ", " + newy + ", " + z + " and replaced " + replaced);
|
|
||||||
}
|
|
||||||
Location location = b.getLocation();
|
|
||||||
if (location.getBlock().getRelative(BlockFace.DOWN).getType() == Material.AIR) {
|
|
||||||
int i = 0;
|
|
||||||
for (i = location.getBlockY(); i > -1; i --) {
|
|
||||||
location = new Location(location.getWorld(), location.getBlockX(), i, location.getBlockZ());
|
|
||||||
if (location.getBlock().getType() != Material.AIR && location.getBlock().getType() != Material.WATER && location.getBlock().getType() != Material.LAVA) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
event.getPlayer().sendMessage("Block will land at: " + location);
|
|
||||||
System.out.println("Sand/Gravel Place: " + coords);
|
|
||||||
List<String> blocks = plugin.config.getStringList("Blocks_Destroyed");
|
|
||||||
blocks.add(coords);
|
|
||||||
plugin.config.set("Blocks_Destroyed", blocks);
|
|
||||||
plugin.saveConfig();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -161,77 +154,68 @@ public class BlockStorage implements Listener {
|
|||||||
}
|
}
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void bucketEmpty(PlayerBucketEmptyEvent event){
|
public void bucketEmpty(PlayerBucketEmptyEvent event){
|
||||||
if(plugin.canjoin== true){
|
if(plugin.canjoin){
|
||||||
Block clicked = event.getBlockClicked();
|
if(plugin.Playing.contains(event.getPlayer().getName())){
|
||||||
BlockFace face = event.getBlockFace();
|
if(plugin.config.getStringList("worlds").isEmpty() || (!plugin.config.getStringList("worlds").isEmpty() && plugin.config.getStringList("worlds").contains(event.getPlayer().getWorld().getName()))){
|
||||||
Block b = clicked.getRelative(face);
|
Block b = event.getBlockClicked().getRelative(event.getBlockFace());
|
||||||
String w = b.getWorld().getName();
|
String w = b.getWorld().getName();
|
||||||
int x = b.getX();
|
int x = b.getX();
|
||||||
int y = b.getY();
|
int y = b.getY();
|
||||||
int z = b.getZ();
|
int z = b.getZ();
|
||||||
int d = b.getTypeId();
|
String coords = w + "," + x + "," + y + "," + z;
|
||||||
String coords = w + "," + x + "," + y + "," + z + "," + d;
|
List<String> blocks = plugin.data.getStringList("Blocks_Placed");
|
||||||
System.out.println("Bucket Empty: " + coords);
|
|
||||||
List<String> blocks = plugin.config.getStringList("Blocks_Placed");
|
|
||||||
blocks.add(coords);
|
blocks.add(coords);
|
||||||
plugin.config.set("Blocks_Destroyed", blocks);
|
plugin.data.set("Blocks_Placed", blocks);
|
||||||
plugin.saveConfig();
|
plugin.saveData();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void bucketFill(PlayerBucketFillEvent event){
|
public void bucketFill(PlayerBucketFillEvent event){
|
||||||
if(plugin.canjoin== true){
|
if(plugin.canjoin){
|
||||||
Block b = event.getBlockClicked();
|
if(plugin.Playing.contains(event.getPlayer().getName())){
|
||||||
|
if(plugin.config.getStringList("worlds").isEmpty() || (!plugin.config.getStringList("worlds").isEmpty() && plugin.config.getStringList("worlds").contains(event.getPlayer().getWorld().getName()))){
|
||||||
|
Block b = event.getBlockClicked().getRelative(event.getBlockFace());
|
||||||
String w = b.getWorld().getName();
|
String w = b.getWorld().getName();
|
||||||
int x = b.getX();
|
int x = b.getX();
|
||||||
int y = b.getY();
|
int y = b.getY();
|
||||||
int z = b.getZ();
|
int z = b.getZ();
|
||||||
int d = b.getTypeId();
|
int d = b.getTypeId();
|
||||||
String coords = w + "," + x + "," + y + "," + z + "," + d;
|
byte m = b.getData();
|
||||||
System.out.println("Bucket Fill: " + coords);
|
String coords = w + "," + x + "," + y + "," + z + "," + d + "," + m;
|
||||||
List<String> blocks = plugin.config.getStringList("Blocks_Destroyed");
|
List<String> blocks = plugin.data.getStringList("Blocks_Destroyed");
|
||||||
|
if(!plugin.data.getStringList("Blocks_Placed").contains(w + "," + x + "," + y + "," + z)){
|
||||||
blocks.add(coords);
|
blocks.add(coords);
|
||||||
plugin.config.set("Blocks_Destroyed", blocks);
|
plugin.data.set("Blocks_Destroyed", blocks);
|
||||||
plugin.saveConfig();
|
plugin.saveData();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@EventHandler
|
|
||||||
public void blockBreak(BlockBreakEvent event){
|
|
||||||
if(plugin.canjoin== true){
|
|
||||||
Block b = event.getBlock();
|
|
||||||
String w = b.getWorld().getName();
|
|
||||||
int x = b.getX();
|
|
||||||
int y = b.getY();
|
|
||||||
int z = b.getZ();
|
|
||||||
int d = b.getTypeId();
|
|
||||||
String coords = w + "," + x + "," + y + "," + z + "," + d;
|
|
||||||
System.out.println("Break: " + coords);
|
|
||||||
List<String> blocks = plugin.config.getStringList("Blocks_Destroyed");
|
|
||||||
blocks.add(coords);
|
|
||||||
plugin.config.set("Blocks_Destroyed", blocks);
|
|
||||||
plugin.saveConfig();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void blockMelt(BlockFadeEvent event){
|
public void blockMelt(BlockFadeEvent event){
|
||||||
if(plugin.canjoin== true){
|
if(plugin.canjoin){
|
||||||
|
if(plugin.config.getStringList("worlds").isEmpty() || (!plugin.config.getStringList("worlds").isEmpty() && plugin.config.getStringList("worlds").contains(event.getBlock().getWorld().getName()))){
|
||||||
Block b = event.getBlock();
|
Block b = event.getBlock();
|
||||||
String w = b.getWorld().getName();
|
String w = b.getWorld().getName();
|
||||||
int x = b.getX();
|
int x = b.getX();
|
||||||
int y = b.getY();
|
int y = b.getY();
|
||||||
int z = b.getZ();
|
int z = b.getZ();
|
||||||
int d = b.getTypeId();
|
int d = b.getTypeId();
|
||||||
String coords = w + "," + x + "," + y + "," + z + "," + d;
|
byte m = b.getData();
|
||||||
if(d != 51 && d != 2){
|
String coords = w + "," + x + "," + y + "," + z + "," + d + "," + m;
|
||||||
System.out.println("Fade: " + coords);
|
List<String> blocks = plugin.data.getStringList("Blocks_Destroyed");
|
||||||
List<String> blocks = plugin.config.getStringList("Blocks_Destroyed");
|
if(!plugin.data.getStringList("Blocks_Placed").contains(w + "," + x + "," + y + "," + z)){
|
||||||
blocks.add(coords);
|
blocks.add(coords);
|
||||||
plugin.config.set("Blocks_Destroyed", blocks);
|
plugin.data.set("Blocks_Destroyed", blocks);
|
||||||
plugin.saveConfig();
|
plugin.saveData();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@EventHandler
|
}
|
||||||
|
/*@EventHandler
|
||||||
public void blockGrow(BlockGrowEvent event){
|
public void blockGrow(BlockGrowEvent event){
|
||||||
if(plugin.canjoin== true){
|
if(plugin.canjoin== true){
|
||||||
Block b = event.getBlock();
|
Block b = event.getBlock();
|
||||||
@ -242,9 +226,9 @@ public class BlockStorage implements Listener {
|
|||||||
int d = b.getTypeId();
|
int d = b.getTypeId();
|
||||||
String coords = w + "," + x + "," + y + "," + z + "," + d;
|
String coords = w + "," + x + "," + y + "," + z + "," + d;
|
||||||
System.out.println("Grow: " + coords);
|
System.out.println("Grow: " + coords);
|
||||||
List<String> blocks = plugin.config.getStringList("Blocks_Placed");
|
List<String> blocks = plugin.data.getStringList("Blocks_Placed");
|
||||||
blocks.add(coords);
|
blocks.add(coords);
|
||||||
plugin.config.set("Blocks_Destroyed", blocks);
|
plugin.data.set("Blocks_Destroyed", blocks);
|
||||||
plugin.saveConfig();
|
plugin.saveConfig();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -259,9 +243,9 @@ public class BlockStorage implements Listener {
|
|||||||
int d = b.getTypeId();
|
int d = b.getTypeId();
|
||||||
String coords = w + "," + x + "," + y + "," + z + "," + d;
|
String coords = w + "," + x + "," + y + "," + z + "," + d;
|
||||||
System.out.println("Snowfall: " + coords);
|
System.out.println("Snowfall: " + coords);
|
||||||
List<String> blocks = plugin.config.getStringList("Blocks_Placed");
|
List<String> blocks = plugin.data.getStringList("Blocks_Placed");
|
||||||
blocks.add(coords);
|
blocks.add(coords);
|
||||||
plugin.config.set("Blocks_Destroyed", blocks);
|
plugin.data.set("Blocks_Destroyed", blocks);
|
||||||
plugin.saveConfig();
|
plugin.saveConfig();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -276,9 +260,9 @@ public class BlockStorage implements Listener {
|
|||||||
int d = b.getTypeId();
|
int d = b.getTypeId();
|
||||||
String coords = w + "," + x + "," + y + "," + z + "," + d;
|
String coords = w + "," + x + "," + y + "," + z + "," + d;
|
||||||
System.out.println("Piston: " + coords);
|
System.out.println("Piston: " + coords);
|
||||||
List<String> blocks = plugin.config.getStringList("Blocks_Destroyed");
|
List<String> blocks = plugin.data.getStringList("Blocks_Destroyed");
|
||||||
blocks.add(coords);
|
blocks.add(coords);
|
||||||
plugin.config.set("Blocks_Destroyed", blocks);
|
plugin.data.set("Blocks_Destroyed", blocks);
|
||||||
plugin.saveConfig();
|
plugin.saveConfig();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -297,9 +281,9 @@ public class BlockStorage implements Listener {
|
|||||||
int d = b.getTypeId();
|
int d = b.getTypeId();
|
||||||
String coords = w + "," + x + "," + y + "," + z + "," + d;
|
String coords = w + "," + x + "," + y + "," + z + "," + d;
|
||||||
System.out.println("Lava Change: " + coords);
|
System.out.println("Lava Change: " + coords);
|
||||||
List<String> blocks = plugin.config.getStringList("Blocks_Placed");
|
List<String> blocks = plugin.data.getStringList("Blocks_Placed");
|
||||||
blocks.add(coords);
|
blocks.add(coords);
|
||||||
plugin.config.set("Blocks_Destroyed", blocks);
|
plugin.data.set("Blocks_Destroyed", blocks);
|
||||||
plugin.saveConfig();
|
plugin.saveConfig();
|
||||||
}else if(changed == Material.WATER){
|
}else if(changed == Material.WATER){
|
||||||
Block b = event.getBlock();
|
Block b = event.getBlock();
|
||||||
@ -310,9 +294,9 @@ public class BlockStorage implements Listener {
|
|||||||
int d = b.getTypeId();
|
int d = b.getTypeId();
|
||||||
String coords = w + "," + x + "," + y + "," + z + "," + d;
|
String coords = w + "," + x + "," + y + "," + z + "," + d;
|
||||||
System.out.println("Water Change: " + coords);
|
System.out.println("Water Change: " + coords);
|
||||||
List<String> blocks = plugin.config.getStringList("Blocks_Placed");
|
List<String> blocks = plugin.data.getStringList("Blocks_Placed");
|
||||||
blocks.add(coords);
|
blocks.add(coords);
|
||||||
plugin.config.set("Blocks_Destroyed", blocks);
|
plugin.data.set("Blocks_Destroyed", blocks);
|
||||||
plugin.saveConfig();
|
plugin.saveConfig();
|
||||||
}
|
}
|
||||||
}else if (block.getType() == Material.SAND || block.getType() == Material.GRAVEL) {
|
}else if (block.getType() == Material.SAND || block.getType() == Material.GRAVEL) {
|
||||||
@ -325,9 +309,9 @@ public class BlockStorage implements Listener {
|
|||||||
int d = b.getTypeId();
|
int d = b.getTypeId();
|
||||||
String coords = w + "," + x + "," + y + "," + z + "," + d;
|
String coords = w + "," + x + "," + y + "," + z + "," + d;
|
||||||
System.out.println("Sand/Gravel Fall: " + coords);
|
System.out.println("Sand/Gravel Fall: " + coords);
|
||||||
List<String> blocks = plugin.config.getStringList("Blocks_Placed");
|
List<String> blocks = plugin.data.getStringList("Blocks_Placed");
|
||||||
blocks.add(coords);
|
blocks.add(coords);
|
||||||
plugin.config.set("Blocks_Destroyed", blocks);
|
plugin.data.set("Blocks_Destroyed", blocks);
|
||||||
plugin.saveConfig();
|
plugin.saveConfig();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@ package me.Travja.HungerArena;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.GameMode;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
@ -39,70 +40,23 @@ public class Chests implements Listener {
|
|||||||
plugin.getConfig().addDefault("Storage." + blockx + "," + blocky + "," + blockz + ".Location.Z",blockz);
|
plugin.getConfig().addDefault("Storage." + blockx + "," + blocky + "," + blockz + ".Location.Z",blockz);
|
||||||
plugin.getConfig().addDefault("Storage." + blockx + "," + blocky + "," + blockz + ".Location.W", blockw);
|
plugin.getConfig().addDefault("Storage." + blockx + "," + blocky + "," + blockz + ".Location.W", blockw);
|
||||||
plugin.getConfig().addDefault("Storage." + blockx + "," + blocky + "," + blockz + ".ItemsInStorage", itemsinchest);
|
plugin.getConfig().addDefault("Storage." + blockx + "," + blocky + "," + blockz + ".ItemsInStorage", itemsinchest);
|
||||||
}else{
|
|
||||||
plugin.getConfig().set("Storage." + blockx + "," + blocky+ "," + blockz + ".Location.X",blockx);
|
|
||||||
plugin.getConfig().set("Storage." + blockx + "," + blocky + "," + blockz + ".Location.Y", blocky);
|
|
||||||
plugin.getConfig().set("Storage." + blockx + "," + blocky + "," + blockz + ".Location.Z", blockz);
|
|
||||||
plugin.getConfig().set("Storage." + blockx + "," + blocky + "," + blockz + ".Location.W", blockw);
|
|
||||||
plugin.getConfig().set("Storage." + blockx + "," + blocky + "," + blockz + ".ItemsInStorage", itemsinchest);
|
|
||||||
}
|
}
|
||||||
List<String> list2 = plugin.getConfig().getStringList("StorageXYZ");
|
List<String> list2 = plugin.getConfig().getStringList("StorageXYZ");
|
||||||
|
if(!list2.contains(blockx + "," + blocky + "," + blockz)){
|
||||||
list2.add(blockx + "," + blocky + "," + blockz);
|
list2.add(blockx + "," + blocky + "," + blockz);
|
||||||
plugin.getConfig().set("StorageXYZ", list2);
|
plugin.getConfig().set("StorageXYZ", list2);
|
||||||
plugin.getConfig().options().copyDefaults(true);
|
plugin.getConfig().options().copyDefaults(true);
|
||||||
plugin.saveConfig();
|
plugin.saveConfig();
|
||||||
p.sendMessage(ChatColor.GREEN + "Chest Stored!");
|
p.sendMessage(ChatColor.GREEN + "Chest Stored!");
|
||||||
|
}else{
|
||||||
|
p.sendMessage(ChatColor.GREEN + "Chest already stored!");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}else if(p.getItemInHand().getType()== Material.BLAZE_ROD && !p.hasPermission("HungerArena.Chest.Store") && block.getState() instanceof Chest){
|
}else if(p.getItemInHand().getType()== Material.BLAZE_ROD && !p.hasPermission("HungerArena.Chest.Store") && block.getState() instanceof Chest){
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
p.sendMessage(ChatColor.RED + "You can't store chests!!");
|
p.sendMessage(ChatColor.RED + "You can't store chests!!");
|
||||||
}
|
}else if(p.hasPermission("HungerArena.Chest.Break")){
|
||||||
}
|
|
||||||
@EventHandler
|
|
||||||
public void ChestSaves(PlayerInteractEvent event){
|
|
||||||
Block block = event.getClickedBlock();
|
|
||||||
Player p = event.getPlayer();
|
|
||||||
if(p.getItemInHand().getType()== Material.BLAZE_ROD && event.getAction() == Action.LEFT_CLICK_BLOCK){
|
|
||||||
if(!plugin.restricted || (plugin.restricted && plugin.worlds.contains(p.getWorld().getName()))){
|
|
||||||
if(block.getState() instanceof Chest){
|
|
||||||
if(p.hasPermission("HungerArena.Chest.Store")){
|
|
||||||
ItemStack[] itemsinchest = ((Chest) block.getState()).getInventory().getContents();
|
|
||||||
int blockx = block.getX();
|
|
||||||
int blocky = block.getY();
|
|
||||||
int blockz = block.getZ();
|
|
||||||
String blockw = block.getWorld().getName().toString();
|
|
||||||
if(!plugin.getConfig().contains("Storage." + blockx + "," + blocky + "," + blockz + ".Location.X")){
|
|
||||||
plugin.getConfig().addDefault("Storage." + blockx + "," + blocky + "," + blockz + ".Location.X", blockx);
|
|
||||||
plugin.getConfig().addDefault("Storage." + blockx + "," + blocky + "," + blockz + ".Location.Y", blocky);
|
|
||||||
plugin.getConfig().addDefault("Storage." + blockx + "," + blocky + "," + blockz + ".Location.Z",blockz);
|
|
||||||
plugin.getConfig().addDefault("Storage." + blockx + "," + blocky + "," + blockz + ".Location.W", blockw);
|
|
||||||
plugin.getConfig().addDefault("Storage." + blockx + "," + blocky + "," + blockz + ".ItemsInStorage", itemsinchest);
|
|
||||||
}else{
|
|
||||||
plugin.getConfig().set("Storage." + blockx + "," + blocky+ "," + blockz + ".Location.X",blockx);
|
|
||||||
plugin.getConfig().set("Storage." + blockx + "," + blocky + "," + blockz + ".Location.Y", blocky);
|
|
||||||
plugin.getConfig().set("Storage." + blockx + "," + blocky + "," + blockz + ".Location.Z", blockz);
|
|
||||||
plugin.getConfig().set("Storage." + blockx + "," + blocky + "," + blockz + ".Location.W", blockw);
|
|
||||||
plugin.getConfig().set("Storage." + blockx + "," + blocky + "," + blockz + ".ItemsInStorage", itemsinchest);
|
|
||||||
}
|
|
||||||
List<String> list2 = plugin.getConfig().getStringList("StorageXYZ");
|
|
||||||
list2.add(blockx + "," + blocky + "," + blockz);
|
|
||||||
plugin.getConfig().set("StorageXYZ", list2);
|
|
||||||
plugin.getConfig().options().copyDefaults(true);
|
|
||||||
plugin.saveConfig();
|
|
||||||
p.sendMessage(ChatColor.GREEN + "Chest Stored!");
|
|
||||||
}else{
|
|
||||||
p.sendMessage(ChatColor.RED + "You don't have permission to store chests!");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@EventHandler
|
|
||||||
public void onBlockBreak(BlockBreakEvent event) {
|
|
||||||
Player p = event.getPlayer();
|
|
||||||
Block block = event.getBlock();
|
|
||||||
Location blocklocation = event.getBlock().getLocation();
|
Location blocklocation = event.getBlock().getLocation();
|
||||||
if (block.getState() instanceof Chest && !plugin.Playing.contains(p.getDisplayName())) {
|
|
||||||
int blockx = blocklocation.getBlockX();
|
int blockx = blocklocation.getBlockX();
|
||||||
int blocky = blocklocation.getBlockY();
|
int blocky = blocklocation.getBlockY();
|
||||||
int blockz = blocklocation.getBlockZ();
|
int blockz = blocklocation.getBlockZ();
|
||||||
@ -110,6 +64,7 @@ public class Chests implements Listener {
|
|||||||
if(p.hasPermission("HungerArena.Chest.Break")){
|
if(p.hasPermission("HungerArena.Chest.Break")){
|
||||||
List<String> list2 = plugin.getConfig().getStringList("StorageXYZ");
|
List<String> list2 = plugin.getConfig().getStringList("StorageXYZ");
|
||||||
list2.remove(blockx + "," + blocky + "," + blockz);
|
list2.remove(blockx + "," + blocky + "," + blockz);
|
||||||
|
plugin.getConfig().set("Storage." + blockx + "," + blocky+ "," + blockz, null);
|
||||||
plugin.getConfig().set("StorageXYZ", list2);
|
plugin.getConfig().set("StorageXYZ", list2);
|
||||||
plugin.getConfig().options().copyDefaults(true);
|
plugin.getConfig().options().copyDefaults(true);
|
||||||
plugin.saveConfig();
|
plugin.saveConfig();
|
||||||
@ -121,4 +76,71 @@ public class Chests implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@EventHandler
|
||||||
|
public void ChestSaves(PlayerInteractEvent event){
|
||||||
|
Block block = event.getClickedBlock();
|
||||||
|
Player p = event.getPlayer();
|
||||||
|
if(event.getAction()== Action.LEFT_CLICK_BLOCK || event.getAction()== Action.RIGHT_CLICK_BLOCK){
|
||||||
|
if(p.getItemInHand().getType()== Material.BLAZE_ROD && event.getAction() == Action.LEFT_CLICK_BLOCK){
|
||||||
|
if(!plugin.restricted || (plugin.restricted && plugin.worlds.contains(p.getWorld().getName()))){
|
||||||
|
if(p.getGameMode().equals(GameMode.SURVIVAL)){
|
||||||
|
if(block.getState() instanceof Chest){
|
||||||
|
if(p.hasPermission("HungerArena.Chest.Store")){
|
||||||
|
ItemStack[] itemsinchest = ((Chest) block.getState()).getInventory().getContents();
|
||||||
|
List<String> list2 = plugin.getConfig().getStringList("StorageXYZ");
|
||||||
|
int blockx = block.getX();
|
||||||
|
int blocky = block.getY();
|
||||||
|
int blockz = block.getZ();
|
||||||
|
String blockw = block.getWorld().getName().toString();
|
||||||
|
if(!plugin.getConfig().contains("Storage." + blockx + "," + blocky + "," + blockz + ".Location.X")){
|
||||||
|
plugin.getConfig().addDefault("Storage." + blockx + "," + blocky + "," + blockz + ".Location.X", blockx);
|
||||||
|
plugin.getConfig().addDefault("Storage." + blockx + "," + blocky + "," + blockz + ".Location.Y", blocky);
|
||||||
|
plugin.getConfig().addDefault("Storage." + blockx + "," + blocky + "," + blockz + ".Location.Z",blockz);
|
||||||
|
plugin.getConfig().addDefault("Storage." + blockx + "," + blocky + "," + blockz + ".Location.W", blockw);
|
||||||
|
plugin.getConfig().addDefault("Storage." + blockx + "," + blocky + "," + blockz + ".ItemsInStorage", itemsinchest);
|
||||||
|
}
|
||||||
|
if(!list2.contains(blockx + "," + blocky + "," + blockz)){
|
||||||
|
list2.add(blockx + "," + blocky + "," + blockz);
|
||||||
|
plugin.getConfig().set("StorageXYZ", list2);
|
||||||
|
plugin.getConfig().options().copyDefaults(true);
|
||||||
|
plugin.saveConfig();
|
||||||
|
p.sendMessage(ChatColor.GREEN + "Chest Stored!");
|
||||||
|
}else{
|
||||||
|
p.sendMessage(ChatColor.GREEN + "Chest already stored!");
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
p.sendMessage(ChatColor.RED + "You don't have permission to store chests!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(plugin.Playing.contains(p.getName()) && plugin.canjoin){
|
||||||
|
if(!plugin.restricted || (plugin.restricted && plugin.worlds.contains(p.getWorld().getName()))){
|
||||||
|
if(block.getState() instanceof Chest){
|
||||||
|
ItemStack[] itemsinchest = ((Chest) block.getState()).getInventory().getContents();
|
||||||
|
int blockx = block.getX();
|
||||||
|
int blocky = block.getY();
|
||||||
|
int blockz = block.getZ();
|
||||||
|
String blockw = block.getWorld().getName().toString();
|
||||||
|
if(!plugin.getConfig().contains("Storage." + blockx + "," + blocky + "," + blockz + ".Location.X")){
|
||||||
|
plugin.getConfig().addDefault("Storage." + blockx + "," + blocky + "," + blockz + ".Location.X", blockx);
|
||||||
|
plugin.getConfig().addDefault("Storage." + blockx + "," + blocky + "," + blockz + ".Location.Y", blocky);
|
||||||
|
plugin.getConfig().addDefault("Storage." + blockx + "," + blocky + "," + blockz + ".Location.Z",blockz);
|
||||||
|
plugin.getConfig().addDefault("Storage." + blockx + "," + blocky + "," + blockz + ".Location.W", blockw);
|
||||||
|
plugin.getConfig().addDefault("Storage." + blockx + "," + blocky + "," + blockz + ".ItemsInStorage", itemsinchest);
|
||||||
|
}
|
||||||
|
List<String> list2 = plugin.getConfig().getStringList("StorageXYZ");
|
||||||
|
if(!list2.contains(blockx + "," + blocky + "," + blockz)){
|
||||||
|
list2.add(blockx + "," + blocky + "," + blockz);
|
||||||
|
plugin.getConfig().set("StorageXYZ", list2);
|
||||||
|
plugin.getConfig().options().copyDefaults(true);
|
||||||
|
plugin.saveConfig();
|
||||||
|
p.sendMessage(ChatColor.GREEN + "Thank you for finding this undiscovered chest, it has been stored!!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,13 +17,40 @@ public class CommandBlock implements Listener {
|
|||||||
String cmd = event.getMessage();
|
String cmd = event.getMessage();
|
||||||
Player p = event.getPlayer();
|
Player p = event.getPlayer();
|
||||||
String pname = p.getName();
|
String pname = p.getName();
|
||||||
if(!cmd.contains("/ha") && plugin.Playing.contains(pname) && plugin.canjoin== true){
|
if(plugin.Playing.contains(pname)){
|
||||||
if(!cmd.contains("/login")){
|
|
||||||
if(!p.hasPermission("HungerArena.UseCommands")){
|
if(!p.hasPermission("HungerArena.UseCommands")){
|
||||||
|
for(String whitelist: plugin.management.getStringList("commands.whitelist")){
|
||||||
|
if(!cmd.toLowerCase().contains(whitelist.toLowerCase()) && !cmd.toLowerCase().contains("/ha")){
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
p.sendMessage(ChatColor.RED + "You are only allowed to use /ha commands!");
|
p.sendMessage(ChatColor.RED + "You are only allowed to perform the following commands:");
|
||||||
|
p.sendMessage(ChatColor.AQUA + whitelist);
|
||||||
|
p.sendMessage(ChatColor.AQUA + "/ha");
|
||||||
|
p.sendMessage(ChatColor.AQUA + "/ha close");
|
||||||
|
p.sendMessage(ChatColor.AQUA + "/ha help");
|
||||||
|
p.sendMessage(ChatColor.AQUA + "/ha join");
|
||||||
|
p.sendMessage(ChatColor.AQUA + "/ha kick [Player]");
|
||||||
|
p.sendMessage(ChatColor.AQUA + "/ha leave");
|
||||||
|
p.sendMessage(ChatColor.AQUA + "/ha list");
|
||||||
|
p.sendMessage(ChatColor.AQUA + "/ha open");
|
||||||
|
p.sendMessage(ChatColor.AQUA + "/ha ready");
|
||||||
|
p.sendMessage(ChatColor.AQUA + "/ha refill");
|
||||||
|
p.sendMessage(ChatColor.AQUA + "/ha reload");
|
||||||
|
p.sendMessage(ChatColor.AQUA + "/ha restart");
|
||||||
|
p.sendMessage(ChatColor.AQUA + "/ha rlist");
|
||||||
|
p.sendMessage(ChatColor.AQUA + "/ha setspawn");
|
||||||
|
p.sendMessage(ChatColor.AQUA + "/ha start");
|
||||||
|
p.sendMessage(ChatColor.AQUA + "/ha watch");
|
||||||
|
p.sendMessage(ChatColor.AQUA + "/ha warpall");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}else if(!cmd.toLowerCase().contains("/ha")){
|
||||||
|
if(cmd.toLowerCase().contains("/spawn")){
|
||||||
|
event.setCancelled(true);
|
||||||
|
p.sendMessage("You have perms for all commands except this one!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else if(cmd.toLowerCase().equals("/back") && plugin.Dead.contains(pname) && plugin.canjoin== true){
|
||||||
|
plugin.Tele.add(p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,8 @@ import org.bukkit.event.EventHandler;
|
|||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||||
import org.bukkit.event.player.PlayerRespawnEvent;
|
import org.bukkit.event.player.PlayerRespawnEvent;
|
||||||
|
import org.bukkit.potion.PotionEffect;
|
||||||
|
import org.bukkit.potion.PotionEffectType;
|
||||||
|
|
||||||
public class DeathListener implements Listener{
|
public class DeathListener implements Listener{
|
||||||
public Main plugin;
|
public Main plugin;
|
||||||
@ -17,7 +19,7 @@ public class DeathListener implements Listener{
|
|||||||
int i = 0;
|
int i = 0;
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerRespawn(PlayerRespawnEvent event){
|
public void onPlayerRespawn(PlayerRespawnEvent event){
|
||||||
Player p = event.getPlayer();
|
final Player p = event.getPlayer();
|
||||||
String pname = p.getName();
|
String pname = p.getName();
|
||||||
if(plugin.Dead.contains(pname)){
|
if(plugin.Dead.contains(pname)){
|
||||||
String[] Spawncoords = plugin.spawns.getString("Spawn_coords").split(",");
|
String[] Spawncoords = plugin.spawns.getString("Spawn_coords").split(",");
|
||||||
@ -25,8 +27,12 @@ public class DeathListener implements Listener{
|
|||||||
double spawnx = Double.parseDouble(Spawncoords[0]);
|
double spawnx = Double.parseDouble(Spawncoords[0]);
|
||||||
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);
|
final Location Spawn = new Location(spawnw, spawnx, spawny, spawnz);
|
||||||
event.setRespawnLocation(Spawn);
|
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable(){
|
||||||
|
public void run(){
|
||||||
|
p.teleport(Spawn);
|
||||||
|
}
|
||||||
|
}, 10L);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@EventHandler
|
@EventHandler
|
||||||
@ -42,7 +48,6 @@ public class DeathListener implements Listener{
|
|||||||
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);
|
||||||
|
|
||||||
if(plugin.Frozen.contains(pname) && plugin.Playing.contains(pname)){
|
if(plugin.Frozen.contains(pname) && plugin.Playing.contains(pname)){
|
||||||
if(plugin.config.getString("Cannon_Death").equalsIgnoreCase("True")){
|
if(plugin.config.getString("Cannon_Death").equalsIgnoreCase("True")){
|
||||||
double y = p.getLocation().getY();
|
double y = p.getLocation().getY();
|
||||||
@ -66,19 +71,23 @@ public class DeathListener implements Listener{
|
|||||||
String winnername2 = winner.getName();
|
String winnername2 = winner.getName();
|
||||||
plugin.getServer().broadcastMessage(ChatColor.GREEN + winnername2 + " is the victor of this Hunger Games!");
|
plugin.getServer().broadcastMessage(ChatColor.GREEN + winnername2 + " is the victor of this Hunger Games!");
|
||||||
winner.getInventory().clear();
|
winner.getInventory().clear();
|
||||||
winner.teleport(Spawn);
|
|
||||||
winner.getInventory().setBoots(null);
|
winner.getInventory().setBoots(null);
|
||||||
winner.getInventory().setChestplate(null);
|
winner.getInventory().setChestplate(null);
|
||||||
winner.getInventory().setHelmet(null);
|
winner.getInventory().setHelmet(null);
|
||||||
winner.getInventory().setLeggings(null);
|
winner.getInventory().setLeggings(null);
|
||||||
|
for(PotionEffect pe: winner.getActivePotionEffects()){
|
||||||
|
PotionEffectType potion = pe.getType();
|
||||||
|
winner.removePotionEffect(potion);
|
||||||
|
}
|
||||||
|
winner.teleport(Spawn);
|
||||||
winner.getInventory().addItem(plugin.Reward);
|
winner.getInventory().addItem(plugin.Reward);
|
||||||
plugin.Playing.clear();
|
plugin.Playing.clear();
|
||||||
}
|
}
|
||||||
//Show spectators
|
//Show spectators
|
||||||
for(String sname: plugin.Watching){
|
for(String s1: plugin.Watching){
|
||||||
Player spectator = plugin.getServer().getPlayerExact(sname);
|
Player spectator = plugin.getServer().getPlayerExact(s1);
|
||||||
spectator.setAllowFlight(false);
|
spectator.setAllowFlight(false);
|
||||||
spectator.teleport(spectator.getWorld().getSpawnLocation());
|
spectator.teleport(Spawn);
|
||||||
for(Player online:plugin.getServer().getOnlinePlayers()){
|
for(Player online:plugin.getServer().getOnlinePlayers()){
|
||||||
online.showPlayer(spectator);
|
online.showPlayer(spectator);
|
||||||
}
|
}
|
||||||
@ -118,18 +127,20 @@ public class DeathListener implements Listener{
|
|||||||
String winnername2 = winner.getName();
|
String winnername2 = winner.getName();
|
||||||
plugin.getServer().broadcastMessage(ChatColor.GREEN + winnername2 + " is the victor of this Hunger Games!");
|
plugin.getServer().broadcastMessage(ChatColor.GREEN + winnername2 + " is the victor of this Hunger Games!");
|
||||||
winner.getInventory().clear();
|
winner.getInventory().clear();
|
||||||
winner.teleport(Spawn);
|
|
||||||
winner.getInventory().setBoots(null);
|
winner.getInventory().setBoots(null);
|
||||||
winner.getInventory().setChestplate(null);
|
winner.getInventory().setChestplate(null);
|
||||||
winner.getInventory().setHelmet(null);
|
winner.getInventory().setHelmet(null);
|
||||||
winner.getInventory().setLeggings(null);
|
winner.getInventory().setLeggings(null);
|
||||||
|
for(PotionEffect pe: winner.getActivePotionEffects()){
|
||||||
|
PotionEffectType potion = pe.getType();
|
||||||
|
winner.removePotionEffect(potion);
|
||||||
|
}
|
||||||
|
winner.teleport(Spawn);
|
||||||
winner.getInventory().addItem(plugin.Reward);
|
winner.getInventory().addItem(plugin.Reward);
|
||||||
}
|
}
|
||||||
plugin.Playing.clear();
|
plugin.Playing.clear();
|
||||||
//Show spectators
|
//Show spectators
|
||||||
if(!plugin.Watching.isEmpty()){
|
for(String s1: plugin.Watching){
|
||||||
for(i = 0; i < plugin.Watching.size(); i++){
|
|
||||||
String s1 = plugin.Watching.get(i++);
|
|
||||||
Player spectator = plugin.getServer().getPlayerExact(s1);
|
Player spectator = plugin.getServer().getPlayerExact(s1);
|
||||||
spectator.setAllowFlight(false);
|
spectator.setAllowFlight(false);
|
||||||
spectator.teleport(Spawn);
|
spectator.teleport(Spawn);
|
||||||
@ -137,7 +148,6 @@ public class DeathListener implements Listener{
|
|||||||
online.showPlayer(spectator);
|
online.showPlayer(spectator);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if(plugin.config.getString("Auto_Restart").equalsIgnoreCase("True")){
|
if(plugin.config.getString("Auto_Restart").equalsIgnoreCase("True")){
|
||||||
Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "ha restart");
|
Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "ha restart");
|
||||||
}
|
}
|
||||||
@ -158,18 +168,20 @@ public class DeathListener implements Listener{
|
|||||||
String winnername2 = winner.getName();
|
String winnername2 = winner.getName();
|
||||||
plugin.getServer().broadcastMessage(ChatColor.GREEN + winnername2 + " is the victor of this Hunger Games!");
|
plugin.getServer().broadcastMessage(ChatColor.GREEN + winnername2 + " is the victor of this Hunger Games!");
|
||||||
winner.getInventory().clear();
|
winner.getInventory().clear();
|
||||||
winner.teleport(Spawn);
|
|
||||||
winner.getInventory().setBoots(null);
|
winner.getInventory().setBoots(null);
|
||||||
winner.getInventory().setChestplate(null);
|
winner.getInventory().setChestplate(null);
|
||||||
winner.getInventory().setHelmet(null);
|
winner.getInventory().setHelmet(null);
|
||||||
winner.getInventory().setLeggings(null);
|
winner.getInventory().setLeggings(null);
|
||||||
|
for(PotionEffect pe: winner.getActivePotionEffects()){
|
||||||
|
PotionEffectType potion = pe.getType();
|
||||||
|
winner.removePotionEffect(potion);
|
||||||
|
}
|
||||||
|
winner.teleport(Spawn);
|
||||||
winner.getInventory().addItem(plugin.Reward);
|
winner.getInventory().addItem(plugin.Reward);
|
||||||
}
|
}
|
||||||
plugin.Playing.clear();
|
plugin.Playing.clear();
|
||||||
//Show spectators
|
//Show spectators
|
||||||
if(plugin.Watching.size() != 0){
|
for(String s1: plugin.Watching){
|
||||||
for(i = 0; i < plugin.Watching.size(); i++){
|
|
||||||
String s1 = plugin.Watching.get(i++);
|
|
||||||
Player spectator = plugin.getServer().getPlayerExact(s1);
|
Player spectator = plugin.getServer().getPlayerExact(s1);
|
||||||
spectator.setAllowFlight(false);
|
spectator.setAllowFlight(false);
|
||||||
spectator.teleport(Spawn);
|
spectator.teleport(Spawn);
|
||||||
@ -177,7 +189,6 @@ public class DeathListener implements Listener{
|
|||||||
online.showPlayer(spectator);
|
online.showPlayer(spectator);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if(plugin.config.getString("Auto_Restart").equalsIgnoreCase("True")){
|
if(plugin.config.getString("Auto_Restart").equalsIgnoreCase("True")){
|
||||||
Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "ha restart");
|
Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "ha restart");
|
||||||
}
|
}
|
||||||
@ -195,11 +206,15 @@ public class DeathListener implements Listener{
|
|||||||
String winnername2 = winner.getName();
|
String winnername2 = winner.getName();
|
||||||
plugin.getServer().broadcastMessage(ChatColor.GREEN + winnername2 + " is the victor of this Hunger Games!");
|
plugin.getServer().broadcastMessage(ChatColor.GREEN + winnername2 + " is the victor of this Hunger Games!");
|
||||||
winner.getInventory().clear();
|
winner.getInventory().clear();
|
||||||
winner.teleport(Spawn);
|
|
||||||
winner.getInventory().setBoots(null);
|
winner.getInventory().setBoots(null);
|
||||||
winner.getInventory().setChestplate(null);
|
winner.getInventory().setChestplate(null);
|
||||||
winner.getInventory().setHelmet(null);
|
winner.getInventory().setHelmet(null);
|
||||||
winner.getInventory().setLeggings(null);
|
winner.getInventory().setLeggings(null);
|
||||||
|
for(PotionEffect pe: winner.getActivePotionEffects()){
|
||||||
|
PotionEffectType potion = pe.getType();
|
||||||
|
winner.removePotionEffect(potion);
|
||||||
|
}
|
||||||
|
winner.teleport(Spawn);
|
||||||
winner.getInventory().addItem(plugin.Reward);
|
winner.getInventory().addItem(plugin.Reward);
|
||||||
}
|
}
|
||||||
// Create the event here
|
// Create the event here
|
||||||
@ -208,9 +223,7 @@ public class DeathListener implements Listener{
|
|||||||
//Bukkit.getServer().getPluginManager().callEvent(winevent);
|
//Bukkit.getServer().getPluginManager().callEvent(winevent);
|
||||||
plugin.Playing.clear();
|
plugin.Playing.clear();
|
||||||
//Show spectators
|
//Show spectators
|
||||||
if(!plugin.Watching.isEmpty()){
|
for(String s1: plugin.Watching){
|
||||||
for(i = 0; i < plugin.Watching.size(); i++){
|
|
||||||
String s1 = plugin.Watching.get(i++);
|
|
||||||
Player spectator = plugin.getServer().getPlayerExact(s1);
|
Player spectator = plugin.getServer().getPlayerExact(s1);
|
||||||
spectator.setAllowFlight(false);
|
spectator.setAllowFlight(false);
|
||||||
spectator.teleport(Spawn);
|
spectator.teleport(Spawn);
|
||||||
@ -218,7 +231,6 @@ public class DeathListener implements Listener{
|
|||||||
online.showPlayer(spectator);
|
online.showPlayer(spectator);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if(plugin.config.getString("Auto_Restart").equalsIgnoreCase("True")){
|
if(plugin.config.getString("Auto_Restart").equalsIgnoreCase("True")){
|
||||||
Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "ha restart");
|
Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "ha restart");
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package me.Travja.HungerArena;
|
package me.Travja.HungerArena;
|
||||||
|
|
||||||
import org.bukkit.Location;
|
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
@ -12,13 +11,39 @@ public class FreezeListener implements Listener {
|
|||||||
public FreezeListener(Main m) {
|
public FreezeListener(Main m) {
|
||||||
this.plugin = m;
|
this.plugin = m;
|
||||||
}
|
}
|
||||||
|
int i = 0;
|
||||||
|
private boolean timeUp;
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerMove(PlayerMoveEvent event){
|
public void onPlayerMove(PlayerMoveEvent event){
|
||||||
Player p = event.getPlayer();
|
Player p = event.getPlayer();
|
||||||
String pname = p.getName();
|
String pname = p.getName();
|
||||||
if(plugin.Frozen.contains(pname) && plugin.config.getString("Frozen_Teleport").equalsIgnoreCase("True")){
|
if(plugin.Frozen.contains(pname) && plugin.config.getString("Frozen_Teleport").equalsIgnoreCase("True")){
|
||||||
if(plugin.config.getString("Explode_on_Move").equalsIgnoreCase("true")){
|
if(plugin.config.getString("Explode_on_Move").equalsIgnoreCase("true")){
|
||||||
if(plugin.Playing.size()>=1){
|
for(String players:plugin.Playing){
|
||||||
|
final Player playing = plugin.getServer().getPlayerExact(players);
|
||||||
|
i = plugin.Playing.indexOf(players);
|
||||||
|
if(!timeUp){
|
||||||
|
if(!playing.getLocation().getBlock().getLocation().equals(plugin.location.get(i))){
|
||||||
|
playing.teleport(plugin.location.get(i));
|
||||||
|
plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable(){
|
||||||
|
public void run(){
|
||||||
|
if(!timeUp){
|
||||||
|
timeUp = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},30L);
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
if(!playing.getLocation().getBlock().getLocation().equals(plugin.location.get(i))){
|
||||||
|
if(!plugin.Dead.contains(playing.getName())){
|
||||||
|
World world = playing.getLocation().getWorld();
|
||||||
|
world.createExplosion(playing.getLocation(), 0.0F, false);
|
||||||
|
playing.setHealth(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*if(plugin.Playing.size()>=1){
|
||||||
String one = plugin.Playing.get(0);
|
String one = plugin.Playing.get(0);
|
||||||
if(pname==one){
|
if(pname==one){
|
||||||
Player tone = plugin.getServer().getPlayerExact(one);
|
Player tone = plugin.getServer().getPlayerExact(one);
|
||||||
@ -473,9 +498,16 @@ public class FreezeListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
}else{
|
}else{
|
||||||
if(plugin.Playing.size()>=1){
|
for(String players:plugin.Playing){
|
||||||
|
Player playing = plugin.getServer().getPlayerExact(players);
|
||||||
|
i = plugin.Playing.indexOf(players);
|
||||||
|
if(!playing.getLocation().getBlock().getLocation().equals(plugin.location.get(i))){
|
||||||
|
playing.teleport(plugin.location.get(i));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*if(plugin.Playing.size()>=1){
|
||||||
String one = plugin.Playing.get(0);
|
String one = plugin.Playing.get(0);
|
||||||
if(pname==one){
|
if(pname==one){
|
||||||
Player tone = plugin.getServer().getPlayerExact(one);
|
Player tone = plugin.getServer().getPlayerExact(one);
|
||||||
@ -834,7 +866,7 @@ public class FreezeListener implements Listener {
|
|||||||
ttwentyfour.teleport(twentyfourspwn);
|
ttwentyfour.teleport(twentyfourspwn);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -117,9 +117,7 @@ public class JoinAndQuitListener implements Listener {
|
|||||||
Bukkit.getServer().getPluginManager().callEvent(evt);
|
Bukkit.getServer().getPluginManager().callEvent(evt);
|
||||||
}
|
}
|
||||||
//Make spectators visible
|
//Make spectators visible
|
||||||
if(!plugin.Watching.isEmpty()){
|
for(String s: plugin.Watching){
|
||||||
for(i = 0; i < plugin.Playing.size(); i++){
|
|
||||||
String s = plugin.Watching.get(i++);
|
|
||||||
Player spectator = plugin.getServer().getPlayerExact(s);
|
Player spectator = plugin.getServer().getPlayerExact(s);
|
||||||
spectator.setAllowFlight(false);
|
spectator.setAllowFlight(false);
|
||||||
spectator.teleport(Spawn);
|
spectator.teleport(Spawn);
|
||||||
@ -127,7 +125,6 @@ public class JoinAndQuitListener implements Listener {
|
|||||||
online.showPlayer(spectator);
|
online.showPlayer(spectator);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if(plugin.config.getString("Auto_Restart").equalsIgnoreCase("True")){
|
if(plugin.config.getString("Auto_Restart").equalsIgnoreCase("True")){
|
||||||
Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "ha restart");
|
Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "ha restart");
|
||||||
}
|
}
|
||||||
|
@ -8,11 +8,16 @@ import java.util.HashSet;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import net.milkbowl.vault.economy.Economy;
|
import net.milkbowl.vault.economy.Economy;
|
||||||
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.World;
|
||||||
import org.bukkit.command.CommandExecutor;
|
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.Player;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.plugin.RegisteredServiceProvider;
|
import org.bukkit.plugin.RegisteredServiceProvider;
|
||||||
@ -27,6 +32,8 @@ public class Main extends JavaPlugin{
|
|||||||
public ArrayList<String> Out = new ArrayList<String>();
|
public ArrayList<String> Out = new ArrayList<String>();
|
||||||
public ArrayList<String> Watching = new ArrayList<String>();
|
public ArrayList<String> Watching = new ArrayList<String>();
|
||||||
public ArrayList<String> NeedConfirm = new ArrayList<String>();
|
public ArrayList<String> NeedConfirm = new ArrayList<String>();
|
||||||
|
public ArrayList<Location> location = new ArrayList<Location>();
|
||||||
|
public ArrayList<Player> Tele = new ArrayList<Player>();
|
||||||
public HashSet<String> Frozen = new HashSet<String>();
|
public HashSet<String> Frozen = new HashSet<String>();
|
||||||
public List<String> worlds;
|
public List<String> worlds;
|
||||||
public Listener DeathListener = new DeathListener(this);
|
public Listener DeathListener = new DeathListener(this);
|
||||||
@ -36,7 +43,6 @@ public class Main extends JavaPlugin{
|
|||||||
public Listener ChatListener = new ChatListener(this);
|
public Listener ChatListener = new ChatListener(this);
|
||||||
public Listener Chests = new Chests(this);
|
public Listener Chests = new Chests(this);
|
||||||
public Listener PvP = new PvP(this);
|
public Listener PvP = new PvP(this);
|
||||||
public Listener Blocks = new Blocks(this);
|
|
||||||
public Listener CommandBlock = new CommandBlock(this);
|
public Listener CommandBlock = new CommandBlock(this);
|
||||||
public Listener Damage = new DmgListener(this);
|
public Listener Damage = new DmgListener(this);
|
||||||
public Listener Teleport = new TeleportListener(this);
|
public Listener Teleport = new TeleportListener(this);
|
||||||
@ -53,6 +59,10 @@ public class Main extends JavaPlugin{
|
|||||||
public FileConfiguration config;
|
public FileConfiguration config;
|
||||||
public FileConfiguration spawns = null;
|
public FileConfiguration spawns = null;
|
||||||
public File spawnsFile = null;
|
public File spawnsFile = null;
|
||||||
|
public FileConfiguration data = null;
|
||||||
|
public File dataFile = null;
|
||||||
|
public File managementFile = null;
|
||||||
|
public FileConfiguration management = null;
|
||||||
public ItemStack Reward;
|
public ItemStack Reward;
|
||||||
public ItemStack Cost;
|
public ItemStack Cost;
|
||||||
public boolean vault = false;
|
public boolean vault = false;
|
||||||
@ -61,9 +71,15 @@ public class Main extends JavaPlugin{
|
|||||||
config = this.getConfig();
|
config = this.getConfig();
|
||||||
config.options().copyDefaults(true);
|
config.options().copyDefaults(true);
|
||||||
this.saveDefaultConfig();
|
this.saveDefaultConfig();
|
||||||
this.getSpawns();
|
spawns = this.getSpawns();
|
||||||
spawns.options().copyDefaults(true);
|
spawns.options().copyDefaults(true);
|
||||||
this.saveSpawns();
|
this.saveSpawns();
|
||||||
|
data = this.getData();
|
||||||
|
data.options().copyDefaults(true);
|
||||||
|
this.saveData();
|
||||||
|
management = this.getManagement();
|
||||||
|
management.options().copyDefaults(true);
|
||||||
|
this.saveManagement();
|
||||||
log.info("[HungerArena] enabled v" + getDescription().getVersion());
|
log.info("[HungerArena] enabled v" + getDescription().getVersion());
|
||||||
getServer().getPluginManager().registerEvents(DeathListener, this);
|
getServer().getPluginManager().registerEvents(DeathListener, this);
|
||||||
getServer().getPluginManager().registerEvents(SpectatorListener, this);
|
getServer().getPluginManager().registerEvents(SpectatorListener, this);
|
||||||
@ -72,7 +88,6 @@ public class Main extends JavaPlugin{
|
|||||||
getServer().getPluginManager().registerEvents(ChatListener, this);
|
getServer().getPluginManager().registerEvents(ChatListener, this);
|
||||||
getServer().getPluginManager().registerEvents(Chests, this);
|
getServer().getPluginManager().registerEvents(Chests, this);
|
||||||
getServer().getPluginManager().registerEvents(PvP, this);
|
getServer().getPluginManager().registerEvents(PvP, this);
|
||||||
getServer().getPluginManager().registerEvents(Blocks, this);
|
|
||||||
getServer().getPluginManager().registerEvents(CommandBlock, this);
|
getServer().getPluginManager().registerEvents(CommandBlock, this);
|
||||||
getServer().getPluginManager().registerEvents(Signs, this);
|
getServer().getPluginManager().registerEvents(Signs, this);
|
||||||
getServer().getPluginManager().registerEvents(BlockStorage, this);
|
getServer().getPluginManager().registerEvents(BlockStorage, this);
|
||||||
@ -81,6 +96,19 @@ public class Main extends JavaPlugin{
|
|||||||
getCommand("Ha").setExecutor(HaCommands);
|
getCommand("Ha").setExecutor(HaCommands);
|
||||||
getCommand("Sponsor").setExecutor(SponsorCommands);
|
getCommand("Sponsor").setExecutor(SponsorCommands);
|
||||||
getCommand("Startpoint").setExecutor(SpawnsCommand);
|
getCommand("Startpoint").setExecutor(SpawnsCommand);
|
||||||
|
for(String spawnlocations:spawns.getStringList("Spawns")){
|
||||||
|
String[] coords = spawnlocations.split(",");
|
||||||
|
if(coords[4].equalsIgnoreCase("true")){
|
||||||
|
double x = Double.parseDouble(coords[0]);
|
||||||
|
double y = Double.parseDouble(coords[1]);
|
||||||
|
double z = Double.parseDouble(coords[2]);
|
||||||
|
String world = coords[3];
|
||||||
|
World w = getServer().getWorld(world);
|
||||||
|
Location loc = new Location(w, x, y, z);
|
||||||
|
location.add(loc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
System.out.println("[HungerArena] Loaded " + location.size() + " tribute spawns!");
|
||||||
if (setupEconomy()) {
|
if (setupEconomy()) {
|
||||||
log.info(ChatColor.AQUA + "[HungerArena] Found Vault! Hooking in for economy!");
|
log.info(ChatColor.AQUA + "[HungerArena] Found Vault! Hooking in for economy!");
|
||||||
}
|
}
|
||||||
@ -156,4 +184,62 @@ public class Main extends JavaPlugin{
|
|||||||
this.getLogger().log(Level.SEVERE, "Could not save config to " + spawnsFile, ex);
|
this.getLogger().log(Level.SEVERE, "Could not save config to " + spawnsFile, ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public void reloadData() {
|
||||||
|
if (dataFile == null) {
|
||||||
|
dataFile = new File(getDataFolder(), "Data.yml");
|
||||||
|
}
|
||||||
|
data = YamlConfiguration.loadConfiguration(dataFile);
|
||||||
|
|
||||||
|
// Look for defaults in the jar
|
||||||
|
InputStream defConfigStream = this.getResource("Data.yml");
|
||||||
|
if (defConfigStream != null) {
|
||||||
|
YamlConfiguration defConfig = YamlConfiguration.loadConfiguration(defConfigStream);
|
||||||
|
data.setDefaults(defConfig);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public FileConfiguration getData() {
|
||||||
|
if (data == null) {
|
||||||
|
this.reloadData();
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
public void saveData() {
|
||||||
|
if (data == null || dataFile == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
getData().save(dataFile);
|
||||||
|
} catch (IOException ex) {
|
||||||
|
this.getLogger().log(Level.SEVERE, "Could not save config to " + dataFile, ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public void reloadManagement() {
|
||||||
|
if (managementFile == null) {
|
||||||
|
managementFile = new File(getDataFolder(), "commandAndBlockManagement.yml");
|
||||||
|
}
|
||||||
|
management = YamlConfiguration.loadConfiguration(managementFile);
|
||||||
|
|
||||||
|
// Look for defaults in the jar
|
||||||
|
InputStream defConfigStream = this.getResource("commandAndBlockManagement.yml");
|
||||||
|
if (defConfigStream != null) {
|
||||||
|
YamlConfiguration defConfig = YamlConfiguration.loadConfiguration(defConfigStream);
|
||||||
|
management.setDefaults(defConfig);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public FileConfiguration getManagement() {
|
||||||
|
if (management == null) {
|
||||||
|
this.reloadManagement();
|
||||||
|
}
|
||||||
|
return management;
|
||||||
|
}
|
||||||
|
public void saveManagement() {
|
||||||
|
if (management == null || managementFile == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
getManagement().save(managementFile);
|
||||||
|
} catch (IOException ex) {
|
||||||
|
this.getLogger().log(Level.SEVERE, "Could not save config to " + managementFile, ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,10 @@ package me.Travja.HungerArena;
|
|||||||
|
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.entity.Projectile;
|
||||||
|
import org.bukkit.entity.Skeleton;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.EventPriority;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||||
|
|
||||||
@ -11,14 +14,48 @@ public class PvP implements Listener {
|
|||||||
public PvP(Main m) {
|
public PvP(Main m) {
|
||||||
this.plugin = m;
|
this.plugin = m;
|
||||||
}
|
}
|
||||||
@EventHandler
|
@EventHandler(priority= EventPriority.MONITOR)
|
||||||
public void PlayerPvP(EntityDamageByEntityEvent event){
|
public void PlayerPvP(EntityDamageByEntityEvent event){
|
||||||
Entity p = event.getEntity();
|
Entity p = event.getEntity();
|
||||||
if(p instanceof Player){
|
Entity d = event.getDamager();
|
||||||
|
if(p instanceof Player && d instanceof Player){
|
||||||
String pname = ((Player) p).getName();
|
String pname = ((Player) p).getName();
|
||||||
if(plugin.Playing.contains(pname) && plugin.canjoin== false){
|
String dname = ((Player) d).getName();
|
||||||
|
if(plugin.Playing.contains(pname) && plugin.Playing.contains(dname)){
|
||||||
|
if(plugin.canjoin){
|
||||||
|
if(event.isCancelled()){
|
||||||
|
event.setCancelled(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else if(plugin.Playing.contains(pname)){
|
||||||
|
if(!plugin.canjoin){
|
||||||
|
if(!event.isCancelled()){
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}else if(!plugin.Playing.contains(pname) && plugin.Playing.contains(dname)){
|
||||||
|
if(!event.isCancelled()){
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else if(p instanceof Player && d instanceof Projectile){
|
||||||
|
Projectile projectile = (Projectile) d;
|
||||||
|
String pname = ((Player) p).getName();
|
||||||
|
if(projectile.getShooter() instanceof Player){
|
||||||
|
if(plugin.Playing.contains(pname)){
|
||||||
|
Player shooter = (Player) projectile.getShooter();
|
||||||
|
if(plugin.Playing.contains(shooter.getName())){
|
||||||
|
event.setCancelled(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else if(projectile.getShooter() instanceof Entity){
|
||||||
|
Entity e = projectile.getShooter();
|
||||||
|
if(e instanceof Skeleton){
|
||||||
|
if(plugin.Playing.contains(pname)){
|
||||||
|
event.setCancelled(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package me.Travja.HungerArena;
|
package me.Travja.HungerArena;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
@ -12,19 +14,42 @@ public class SpawnsCommand implements CommandExecutor {
|
|||||||
public SpawnsCommand(Main m) {
|
public SpawnsCommand(Main m) {
|
||||||
this.plugin = m;
|
this.plugin = m;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) {
|
public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) {
|
||||||
Player p = (Player) sender;
|
Player p = (Player) sender;
|
||||||
if(cmd.getName().equalsIgnoreCase("StartPoint")){
|
if(cmd.getName().equalsIgnoreCase("StartPoint")){
|
||||||
if(p.hasPermission("HungerArena.StartPoint")){
|
if(p.hasPermission("HungerArena.StartPoint")){
|
||||||
if(!plugin.restricted || (plugin.restricted && plugin.worlds.contains(p.getWorld().getName()))){
|
if(!plugin.restricted || (plugin.restricted && plugin.worlds.contains(p.getWorld().getName()))){
|
||||||
|
try{
|
||||||
|
int i = Integer.parseInt(args[0]);
|
||||||
|
if(i >= 1 && i <= 24){
|
||||||
if(plugin.restricted && !plugin.worlds.contains(p.getWorld().getName())){
|
if(plugin.restricted && !plugin.worlds.contains(p.getWorld().getName())){
|
||||||
p.sendMessage(ChatColor.GOLD + "We ran the command, however, this isn't a world you defined in the config...");
|
p.sendMessage(ChatColor.GOLD + "We ran the command, however, this isn't a world you defined in the config...");
|
||||||
p.sendMessage(ChatColor.GOLD + "If this is the right world, please disregard this message.");
|
p.sendMessage(ChatColor.GOLD + "If this is the right world, please disregard this message.");
|
||||||
}
|
}
|
||||||
Location ploc = p.getLocation().getBlock().getLocation();
|
Location ploc = p.getLocation().getBlock().getLocation();
|
||||||
if(args[0].equalsIgnoreCase("1")){
|
List<String> locations = plugin.spawns.getStringList("Spawns");
|
||||||
|
double x = ploc.getX();
|
||||||
|
double y = ploc.getY();
|
||||||
|
double z = ploc.getZ();
|
||||||
|
String w = ploc.getWorld().getName();
|
||||||
|
String coords = x + "," + y + "," + z + "," + w + ",true";
|
||||||
|
locations.set(i-1, coords);
|
||||||
|
plugin.spawns.set("Spawns", locations);
|
||||||
|
plugin.saveSpawns();
|
||||||
|
plugin.location.add(new Location(ploc.getWorld(), x, y, z));
|
||||||
|
p.sendMessage(ChatColor.AQUA + "You have set the spawn location of Tribute " + i);
|
||||||
|
}else{
|
||||||
|
p.sendMessage(ChatColor.RED + "You can't go past 24 or below 1!");
|
||||||
|
}
|
||||||
|
}catch(Exception e){
|
||||||
|
p.sendMessage(ChatColor.RED + "Argument not an integer!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
p.sendMessage(ChatColor.RED + "You don't have permission!");
|
||||||
|
}
|
||||||
|
/*if(args[0].equalsIgnoreCase("1")){
|
||||||
double x = ploc.getX();
|
double x = ploc.getX();
|
||||||
double y = ploc.getY();
|
double y = ploc.getY();
|
||||||
double z = ploc.getZ();
|
double z = ploc.getZ();
|
||||||
@ -239,11 +264,7 @@ public class SpawnsCommand implements CommandExecutor {
|
|||||||
plugin.spawns.set("Tribute_twentyfour_spawn", x + "," + y + "," + z + "," + w);
|
plugin.spawns.set("Tribute_twentyfour_spawn", x + "," + y + "," + z + "," + w);
|
||||||
plugin.saveSpawns();
|
plugin.saveSpawns();
|
||||||
p.sendMessage(ChatColor.AQUA + "You have set the spawn location of Tribute twentyfour!");
|
p.sendMessage(ChatColor.AQUA + "You have set the spawn location of Tribute twentyfour!");
|
||||||
}
|
}*/
|
||||||
}
|
|
||||||
}else{
|
|
||||||
p.sendMessage(ChatColor.RED + "You don't have permission!");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -36,11 +36,10 @@ public class SponsorCommands implements CommandExecutor {
|
|||||||
}
|
}
|
||||||
if(args.length== 3){
|
if(args.length== 3){
|
||||||
Player target = Bukkit.getServer().getPlayer(args[0]);
|
Player target = Bukkit.getServer().getPlayer(args[0]);
|
||||||
if(args[1].equalsIgnoreCase("57") || args[1].equalsIgnoreCase("7")){
|
try{
|
||||||
p.sendMessage(ChatColor.RED + "You can't sponsor that item!");
|
|
||||||
}else{
|
|
||||||
int ID = Integer.parseInt(args[1]);
|
int ID = Integer.parseInt(args[1]);
|
||||||
int Amount = Integer.parseInt(args[2]);
|
int Amount = Integer.parseInt(args[2]);
|
||||||
|
if((!plugin.management.getStringList("sponsors.blacklist").isEmpty() && !plugin.management.getStringList("sponsors.blacklist").contains(ID)) || plugin.management.getStringList("sponsors.blacklist").isEmpty()){
|
||||||
ItemStack sponsoritem = new ItemStack(ID, Amount);
|
ItemStack sponsoritem = new ItemStack(ID, Amount);
|
||||||
if(p.getInventory().contains(plugin.config.getInt("Sponsor_Cost.ID"), plugin.config.getInt("Sponsor_Cost.Amount")*Amount)){
|
if(p.getInventory().contains(plugin.config.getInt("Sponsor_Cost.ID"), plugin.config.getInt("Sponsor_Cost.Amount")*Amount)){
|
||||||
if(!plugin.Playing.contains(target.getName())){
|
if(!plugin.Playing.contains(target.getName())){
|
||||||
@ -58,6 +57,15 @@ public class SponsorCommands implements CommandExecutor {
|
|||||||
}else{
|
}else{
|
||||||
p.sendMessage(ChatColor.RED + "You don't have the necessary items to sponsor!");
|
p.sendMessage(ChatColor.RED + "You don't have the necessary items to sponsor!");
|
||||||
}
|
}
|
||||||
|
}else{
|
||||||
|
p.sendMessage(ChatColor.RED + "You can't sponsor that item!");
|
||||||
|
p.sendMessage(ChatColor.GREEN + "Other items you can't sponsor are:");
|
||||||
|
for(String blacklist: plugin.management.getStringList("sponsors.blacklist")){
|
||||||
|
p.sendMessage(ChatColor.AQUA + blacklist);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}catch(Exception e){
|
||||||
|
p.sendMessage(ChatColor.RED + "Something went wrong there... Make sure that you do like this /sponsor [name] [number] [number]");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
@ -79,11 +87,10 @@ public class SponsorCommands implements CommandExecutor {
|
|||||||
}
|
}
|
||||||
if(args.length== 3){
|
if(args.length== 3){
|
||||||
Player target = Bukkit.getPlayer(args[0]);
|
Player target = Bukkit.getPlayer(args[0]);
|
||||||
if(args[1].equalsIgnoreCase("57") || args[1].equalsIgnoreCase("7")){
|
|
||||||
sender.sendMessage(ChatColor.RED + "You can't sponsor that item!");
|
|
||||||
}else{
|
|
||||||
int ID = Integer.parseInt(args[1]);
|
int ID = Integer.parseInt(args[1]);
|
||||||
int Amount = Integer.parseInt(args[2]);
|
int Amount = Integer.parseInt(args[2]);
|
||||||
|
try{
|
||||||
|
if((!plugin.management.getStringList("sponsors.blacklist").isEmpty() && !plugin.management.getStringList("sponsors.blacklist").contains(ID)) || plugin.management.getStringList("sponsors.blacklist").isEmpty()){
|
||||||
ItemStack sponsoritem = new ItemStack(ID, Amount);
|
ItemStack sponsoritem = new ItemStack(ID, Amount);
|
||||||
if(!plugin.Playing.contains(target.getName())){
|
if(!plugin.Playing.contains(target.getName())){
|
||||||
sender.sendMessage(ChatColor.RED + "That person isn't playing!");
|
sender.sendMessage(ChatColor.RED + "That person isn't playing!");
|
||||||
@ -93,6 +100,15 @@ public class SponsorCommands implements CommandExecutor {
|
|||||||
target.getInventory().addItem(sponsoritem);
|
target.getInventory().addItem(sponsoritem);
|
||||||
sender.sendMessage("You have sponsored " + target.getName() + "!");
|
sender.sendMessage("You have sponsored " + target.getName() + "!");
|
||||||
}
|
}
|
||||||
|
}else{
|
||||||
|
sender.sendMessage(ChatColor.RED + "You can't sponsor that item!");
|
||||||
|
sender.sendMessage(ChatColor.GREEN + "Other items you can't sponsor are:");
|
||||||
|
for(String blacklist: plugin.management.getStringList("sponsors.blacklist")){
|
||||||
|
sender.sendMessage(ChatColor.AQUA + blacklist);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}catch(Exception e){
|
||||||
|
sender.sendMessage(ChatColor.RED + "Something went wrong there... Make sure that you do like this /sponsor [name] [number] [number]");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,22 +1,29 @@
|
|||||||
package me.Travja.HungerArena;
|
package me.Travja.HungerArena;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.player.PlayerTeleportEvent;
|
import org.bukkit.event.player.PlayerTeleportEvent;
|
||||||
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author YoshiGenius
|
|
||||||
*/
|
|
||||||
public class TeleportListener implements Listener {
|
public class TeleportListener implements Listener {
|
||||||
|
|
||||||
public Main plugin;
|
public Main plugin;
|
||||||
public TeleportListener(Main m) {
|
public TeleportListener(Main m) {
|
||||||
this.plugin = m;
|
this.plugin = m;
|
||||||
}
|
}
|
||||||
|
@EventHandler
|
||||||
|
public void onTP(PlayerTeleportEvent event){
|
||||||
|
Player p = event.getPlayer();
|
||||||
|
List<String> worlds = plugin.config.getStringList("worlds");
|
||||||
|
if(worlds.contains(event.getTo().getWorld().getName()) && plugin.Tele.contains(p)){
|
||||||
|
event.setCancelled(true);
|
||||||
|
p.sendMessage(ChatColor.RED + "You are a dead tribute... How are you supposed to get back into the arena....");
|
||||||
|
plugin.Tele.remove(p);
|
||||||
|
}
|
||||||
|
}
|
||||||
/*@EventHandler Unwanted right now...
|
/*@EventHandler Unwanted right now...
|
||||||
public void onTP(PlayerTeleportEvent evt) {
|
public void onTP(PlayerTeleportEvent evt) {
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user