Merge branch 'master' into RegionFix
# Conflicts: # BauSystem_Main/src/de/steamwar/bausystem/world/Region.java
Dieser Commit ist enthalten in:
Commit
7ef027c921
@ -49,7 +49,7 @@ class TPSLimit_12 {
|
|||||||
|
|
||||||
static void sendTickPackets() {
|
static void sendTickPackets() {
|
||||||
Bukkit.getOnlinePlayers().forEach(player -> {
|
Bukkit.getOnlinePlayers().forEach(player -> {
|
||||||
PlayerConnection connection = ((CraftPlayer)player).getHandle().playerConnection;
|
PlayerConnection connection = ((CraftPlayer) player).getHandle().playerConnection;
|
||||||
for (Packet<?> p : packets) {
|
for (Packet<?> p : packets) {
|
||||||
connection.sendPacket(p);
|
connection.sendPacket(p);
|
||||||
}
|
}
|
||||||
|
@ -44,9 +44,9 @@ class TraceEntity_12 extends EntityFallingBlock implements AbstractTraceEntity {
|
|||||||
this.setCustomNameVisible(true);
|
this.setCustomNameVisible(true);
|
||||||
this.setCustomName("Bumm");
|
this.setCustomName("Bumm");
|
||||||
this.exploded = true;
|
this.exploded = true;
|
||||||
if(references++ > 0)
|
if (references++ > 0)
|
||||||
sendDestroy(player);
|
sendDestroy(player);
|
||||||
}else if(references++ > 0)
|
} else if (references++ > 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
PacketPlayOutSpawnEntity packetPlayOutSpawnEntity = new PacketPlayOutSpawnEntity(this, 0, 0);
|
PacketPlayOutSpawnEntity packetPlayOutSpawnEntity = new PacketPlayOutSpawnEntity(this, 0, 0);
|
||||||
@ -60,7 +60,7 @@ class TraceEntity_12 extends EntityFallingBlock implements AbstractTraceEntity {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hide(Player player, boolean force) {
|
public boolean hide(Player player, boolean force) {
|
||||||
if(!force && --references > 0)
|
if (!force && --references > 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
sendDestroy(player);
|
sendDestroy(player);
|
||||||
@ -68,7 +68,7 @@ class TraceEntity_12 extends EntityFallingBlock implements AbstractTraceEntity {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sendDestroy(Player player){
|
private void sendDestroy(Player player) {
|
||||||
PacketPlayOutEntityDestroy packetPlayOutEntityDestroy = new PacketPlayOutEntityDestroy(getId());
|
PacketPlayOutEntityDestroy packetPlayOutEntityDestroy = new PacketPlayOutEntityDestroy(getId());
|
||||||
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packetPlayOutEntityDestroy);
|
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packetPlayOutEntityDestroy);
|
||||||
}
|
}
|
||||||
|
@ -33,11 +33,12 @@ import java.util.stream.Collectors;
|
|||||||
|
|
||||||
|
|
||||||
class AutoLoader_12 {
|
class AutoLoader_12 {
|
||||||
private AutoLoader_12(){}
|
private AutoLoader_12() {
|
||||||
|
}
|
||||||
|
|
||||||
static boolean tntPlaceActionPerform(Location location){
|
static boolean tntPlaceActionPerform(Location location) {
|
||||||
Material m = location.getBlock().getType();
|
Material m = location.getBlock().getType();
|
||||||
if(m != Material.AIR && m != Material.STATIONARY_WATER && m != Material.WATER)
|
if (m != Material.AIR && m != Material.STATIONARY_WATER && m != Material.WATER)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
location.getBlock().setType(Material.TNT);
|
location.getBlock().setType(Material.TNT);
|
||||||
@ -45,34 +46,34 @@ class AutoLoader_12 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
static boolean setRedstone(Location location, boolean active){
|
static boolean setRedstone(Location location, boolean active) {
|
||||||
Block block = location.getBlock();
|
Block block = location.getBlock();
|
||||||
Material material = block.getType();
|
Material material = block.getType();
|
||||||
if(material == Material.LEVER || material == Material.STONE_BUTTON || material == Material.WOOD_BUTTON){
|
if (material == Material.LEVER || material == Material.STONE_BUTTON || material == Material.WOOD_BUTTON) {
|
||||||
if(active)
|
if (active)
|
||||||
block.setData((byte)(block.getData() | 8));
|
block.setData((byte) (block.getData() | 8));
|
||||||
else
|
else
|
||||||
block.setData((byte)(block.getData() & -9));
|
block.setData((byte) (block.getData() & -9));
|
||||||
}else if(material == Material.STONE_PLATE || material == Material.WOOD_PLATE) {
|
} else if (material == Material.STONE_PLATE || material == Material.WOOD_PLATE) {
|
||||||
if (active)
|
if (active)
|
||||||
block.setData((byte) 1);
|
block.setData((byte) 1);
|
||||||
else
|
else
|
||||||
block.setData((byte) 0);
|
block.setData((byte) 0);
|
||||||
}else if(material == Material.TRIPWIRE) {
|
} else if (material == Material.TRIPWIRE) {
|
||||||
if(active) {
|
if (active) {
|
||||||
ArmorStand armorStand = (ArmorStand) Bukkit.getWorlds().get(0).spawnEntity(location, EntityType.ARMOR_STAND);
|
ArmorStand armorStand = (ArmorStand) Bukkit.getWorlds().get(0).spawnEntity(location, EntityType.ARMOR_STAND);
|
||||||
armorStand.setVisible(false);
|
armorStand.setVisible(false);
|
||||||
armorStand.setBasePlate(false);
|
armorStand.setBasePlate(false);
|
||||||
armorStand.addScoreboardTag("detonator-" + location.getBlockX() + location.getBlockY() + location.getBlockZ());
|
armorStand.addScoreboardTag("detonator-" + location.getBlockX() + location.getBlockY() + location.getBlockZ());
|
||||||
}else {
|
} else {
|
||||||
List<Entity> entityList = Bukkit.getWorlds().get(0).getEntitiesByClasses(ArmorStand.class).stream().filter(entity ->
|
List<Entity> entityList = Bukkit.getWorlds().get(0).getEntitiesByClasses(ArmorStand.class).stream().filter(entity ->
|
||||||
entity.getScoreboardTags().contains("detonator-" + location.getBlockX() + location.getBlockY() + location.getBlockZ()))
|
entity.getScoreboardTags().contains("detonator-" + location.getBlockX() + location.getBlockY() + location.getBlockZ()))
|
||||||
.limit(1)
|
.limit(1)
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
if(entityList.isEmpty()) return false;
|
if (entityList.isEmpty()) return false;
|
||||||
entityList.get(0).remove();
|
entityList.get(0).remove();
|
||||||
}
|
}
|
||||||
}else{
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
block.getState().update(true);
|
block.getState().update(true);
|
||||||
@ -80,24 +81,24 @@ class AutoLoader_12 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
static Detoloader onPlayerInteractLoader(PlayerInteractEvent event){
|
static Detoloader onPlayerInteractLoader(PlayerInteractEvent event) {
|
||||||
Block block = event.getClickedBlock();
|
Block block = event.getClickedBlock();
|
||||||
Material material = block.getType();
|
Material material = block.getType();
|
||||||
if(material == Material.LEVER){
|
if (material == Material.LEVER) {
|
||||||
if((block.getData() & 8) == 8) {
|
if ((block.getData() & 8) == 8) {
|
||||||
return new Detoloader("Hebel", 0).setActive(false);
|
return new Detoloader("Hebel", 0).setActive(false);
|
||||||
}else{
|
} else {
|
||||||
return new Detoloader("Hebel", 0).setActive(true);
|
return new Detoloader("Hebel", 0).setActive(true);
|
||||||
}
|
}
|
||||||
}else if(material == Material.STONE_BUTTON){
|
} else if (material == Material.STONE_BUTTON) {
|
||||||
return new Detoloader("Knopf", Detoloader.STONE_BUTTON);
|
return new Detoloader("Knopf", Detoloader.STONE_BUTTON);
|
||||||
}else if(material == Material.WOOD_BUTTON){
|
} else if (material == Material.WOOD_BUTTON) {
|
||||||
return new Detoloader("Knopf", Detoloader.WOODEN_BUTTON);
|
return new Detoloader("Knopf", Detoloader.WOODEN_BUTTON);
|
||||||
}else if (material == Material.NOTE_BLOCK) {
|
} else if (material == Material.NOTE_BLOCK) {
|
||||||
return new Detoloader("Noteblock", Detoloader.NOTE_BLOCK);
|
return new Detoloader("Noteblock", Detoloader.NOTE_BLOCK);
|
||||||
}else if(material == Material.STONE_PLATE || material == Material.WOOD_PLATE){
|
} else if (material == Material.STONE_PLATE || material == Material.WOOD_PLATE) {
|
||||||
return new Detoloader("Druckplatte", Detoloader.PRESSURE_PLATE);
|
return new Detoloader("Druckplatte", Detoloader.PRESSURE_PLATE);
|
||||||
}else if (material == Material.TRIPWIRE) {
|
} else if (material == Material.TRIPWIRE) {
|
||||||
return new Detoloader("Tripwire", Detoloader.TRIPWIRE);
|
return new Detoloader("Tripwire", Detoloader.TRIPWIRE);
|
||||||
}
|
}
|
||||||
return new Detoloader("§eUnbekannter Block betätigt (nicht aufgenommen)", -1).setAddBack(false);
|
return new Detoloader("§eUnbekannter Block betätigt (nicht aufgenommen)", -1).setAddBack(false);
|
||||||
|
@ -28,7 +28,8 @@ import org.bukkit.craftbukkit.v1_12_R1.entity.CraftPlayer;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
class RegionListener_12 {
|
class RegionListener_12 {
|
||||||
private RegionListener_12(){}
|
private RegionListener_12() {
|
||||||
|
}
|
||||||
|
|
||||||
static boolean isWorldEditCommand(String command) {
|
static boolean isWorldEditCommand(String command) {
|
||||||
if (command.startsWith("/")) {
|
if (command.startsWith("/")) {
|
||||||
|
@ -37,9 +37,10 @@ import java.io.IOException;
|
|||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
class Region_12 {
|
class Region_12 {
|
||||||
private Region_12(){}
|
private Region_12() {
|
||||||
|
}
|
||||||
|
|
||||||
static void paste(File file, int x, int y, int z, boolean rotate){
|
static void paste(File file, int x, int y, int z, boolean rotate) {
|
||||||
World w = new BukkitWorld(Bukkit.getWorlds().get(0));
|
World w = new BukkitWorld(Bukkit.getWorlds().get(0));
|
||||||
Clipboard clipboard;
|
Clipboard clipboard;
|
||||||
try {
|
try {
|
||||||
@ -51,18 +52,18 @@ class Region_12 {
|
|||||||
paste(clipboard, x, y, z, rotate);
|
paste(clipboard, x, y, z, rotate);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void paste(Clipboard clipboard, int x, int y, int z, boolean rotate){
|
static void paste(Clipboard clipboard, int x, int y, int z, boolean rotate) {
|
||||||
World w = new BukkitWorld(Bukkit.getWorlds().get(0));
|
World w = new BukkitWorld(Bukkit.getWorlds().get(0));
|
||||||
|
|
||||||
Vector dimensions = clipboard.getDimensions();
|
Vector dimensions = clipboard.getDimensions();
|
||||||
Vector v = new Vector(x, y, z);
|
Vector v = new Vector(x, y, z);
|
||||||
Vector offset = clipboard.getRegion().getMinimumPoint().subtract(clipboard.getOrigin());
|
Vector offset = clipboard.getRegion().getMinimumPoint().subtract(clipboard.getOrigin());
|
||||||
AffineTransform aT = new AffineTransform();
|
AffineTransform aT = new AffineTransform();
|
||||||
if(rotate){
|
if (rotate) {
|
||||||
aT = aT.rotateY(180);
|
aT = aT.rotateY(180);
|
||||||
v = v.add(dimensions.getX()/2 + dimensions.getX()%2, 0, dimensions.getZ()/2 + dimensions.getZ()%2).subtract(offset.multiply(-1, 1, -1)).subtract(1, 0, 1);
|
v = v.add(dimensions.getX() / 2 + dimensions.getX() % 2, 0, dimensions.getZ() / 2 + dimensions.getZ() % 2).subtract(offset.multiply(-1, 1, -1)).subtract(1, 0, 1);
|
||||||
}else{
|
} else {
|
||||||
v = v.subtract(dimensions.getX()/2 - dimensions.getX()%2, 0, dimensions.getZ()/2 - dimensions.getZ()%2).subtract(offset);
|
v = v.subtract(dimensions.getX() / 2 - dimensions.getX() % 2, 0, dimensions.getZ() / 2 - dimensions.getZ() % 2).subtract(offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
EditSession e = WorldEdit.getInstance().getEditSessionFactory().getEditSession(w, -1);
|
EditSession e = WorldEdit.getInstance().getEditSessionFactory().getEditSession(w, -1);
|
||||||
|
@ -23,9 +23,10 @@ import org.bukkit.Material;
|
|||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
class ScriptListener_12 {
|
class ScriptListener_12 {
|
||||||
private ScriptListener_12(){}
|
private ScriptListener_12() {
|
||||||
|
}
|
||||||
|
|
||||||
static boolean isNoBook(ItemStack item){
|
static boolean isNoBook(ItemStack item) {
|
||||||
return item.getType() != Material.BOOK_AND_QUILL && item.getType() != Material.WRITTEN_BOOK;
|
return item.getType() != Material.BOOK_AND_QUILL && item.getType() != Material.WRITTEN_BOOK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,8 @@ import org.bukkit.entity.Player;
|
|||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
class CommandDebugStick_15 {
|
class CommandDebugStick_15 {
|
||||||
private CommandDebugStick_15(){}
|
private CommandDebugStick_15() {
|
||||||
|
}
|
||||||
|
|
||||||
static void giveStick(Player player){
|
static void giveStick(Player player){
|
||||||
SWUtils.giveItemToPlayer(player, new ItemStack(Material.DEBUG_STICK));
|
SWUtils.giveItemToPlayer(player, new ItemStack(Material.DEBUG_STICK));
|
||||||
|
@ -50,7 +50,7 @@ class TPSLimit_15 {
|
|||||||
|
|
||||||
static void sendTickPackets() {
|
static void sendTickPackets() {
|
||||||
Bukkit.getOnlinePlayers().forEach(player -> {
|
Bukkit.getOnlinePlayers().forEach(player -> {
|
||||||
PlayerConnection connection = ((CraftPlayer)player).getHandle().playerConnection;
|
PlayerConnection connection = ((CraftPlayer) player).getHandle().playerConnection;
|
||||||
for (Packet<?> p : packets) {
|
for (Packet<?> p : packets) {
|
||||||
connection.sendPacket(p);
|
connection.sendPacket(p);
|
||||||
}
|
}
|
||||||
|
@ -34,11 +34,11 @@ public class TNTTracer_15 {
|
|||||||
|
|
||||||
public static boolean inWater(World world, Vector tntPosition) {
|
public static boolean inWater(World world, Vector tntPosition) {
|
||||||
Block block = world.getBlockAt(tntPosition.getBlockX(), tntPosition.getBlockY(), tntPosition.getBlockZ());
|
Block block = world.getBlockAt(tntPosition.getBlockX(), tntPosition.getBlockY(), tntPosition.getBlockZ());
|
||||||
if(block.getType() == Material.WATER)
|
if (block.getType() == Material.WATER)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
BlockData data = block.getBlockData();
|
BlockData data = block.getBlockData();
|
||||||
if(!(data instanceof Waterlogged))
|
if (!(data instanceof Waterlogged))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return ((Waterlogged) data).isWaterlogged();
|
return ((Waterlogged) data).isWaterlogged();
|
||||||
|
@ -50,9 +50,9 @@ class TraceEntity_15 extends EntityFallingBlock implements AbstractTraceEntity {
|
|||||||
this.setCustomNameVisible(true);
|
this.setCustomNameVisible(true);
|
||||||
this.setCustomName(new ChatComponentText("Bumm"));
|
this.setCustomName(new ChatComponentText("Bumm"));
|
||||||
this.exploded = true;
|
this.exploded = true;
|
||||||
if(references++ > 0)
|
if (references++ > 0)
|
||||||
sendDestroy(player);
|
sendDestroy(player);
|
||||||
}else if(references++ > 0)
|
} else if (references++ > 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
PacketPlayOutSpawnEntity packetPlayOutSpawnEntity = new PacketPlayOutSpawnEntity(getId(), getUniqueID(), position.getX(), position.getY(), position.getZ(), 0, 0, EntityTypes.FALLING_BLOCK, tnt ? Block.getCombinedId(Blocks.TNT.getBlockData()) : Block.getCombinedId(Blocks.WHITE_STAINED_GLASS.getBlockData()), ZERO);
|
PacketPlayOutSpawnEntity packetPlayOutSpawnEntity = new PacketPlayOutSpawnEntity(getId(), getUniqueID(), position.getX(), position.getY(), position.getZ(), 0, 0, EntityTypes.FALLING_BLOCK, tnt ? Block.getCombinedId(Blocks.TNT.getBlockData()) : Block.getCombinedId(Blocks.WHITE_STAINED_GLASS.getBlockData()), ZERO);
|
||||||
@ -65,7 +65,7 @@ class TraceEntity_15 extends EntityFallingBlock implements AbstractTraceEntity {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hide(Player player, boolean force) {
|
public boolean hide(Player player, boolean force) {
|
||||||
if(!force && --references > 0)
|
if (!force && --references > 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
sendDestroy(player);
|
sendDestroy(player);
|
||||||
@ -73,7 +73,7 @@ class TraceEntity_15 extends EntityFallingBlock implements AbstractTraceEntity {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sendDestroy(Player player){
|
private void sendDestroy(Player player) {
|
||||||
PacketPlayOutEntityDestroy packetPlayOutEntityDestroy = new PacketPlayOutEntityDestroy(getId());
|
PacketPlayOutEntityDestroy packetPlayOutEntityDestroy = new PacketPlayOutEntityDestroy(getId());
|
||||||
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packetPlayOutEntityDestroy);
|
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packetPlayOutEntityDestroy);
|
||||||
}
|
}
|
||||||
|
@ -54,7 +54,7 @@ class AutoLoader_15 {
|
|||||||
powerable.setPowered(active);
|
powerable.setPowered(active);
|
||||||
block.setBlockData(powerable);
|
block.setBlockData(powerable);
|
||||||
|
|
||||||
if(data instanceof Openable) {
|
if (data instanceof Openable) {
|
||||||
Openable openable = (Openable) data;
|
Openable openable = (Openable) data;
|
||||||
openable.setOpen(active);
|
openable.setOpen(active);
|
||||||
block.setBlockData(openable);
|
block.setBlockData(openable);
|
||||||
@ -63,7 +63,7 @@ class AutoLoader_15 {
|
|||||||
if (data instanceof Switch) {
|
if (data instanceof Switch) {
|
||||||
Switch swtch = (Switch) data;
|
Switch swtch = (Switch) data;
|
||||||
Block relative;
|
Block relative;
|
||||||
switch(swtch.getFace()){
|
switch (swtch.getFace()) {
|
||||||
case FLOOR:
|
case FLOOR:
|
||||||
relative = block.getRelative(BlockFace.DOWN);
|
relative = block.getRelative(BlockFace.DOWN);
|
||||||
break;
|
break;
|
||||||
@ -75,7 +75,7 @@ class AutoLoader_15 {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
updateBlock(relative);
|
updateBlock(relative);
|
||||||
} else if(block.getType() == Material.TRIPWIRE) {
|
} else if (block.getType() == Material.TRIPWIRE) {
|
||||||
updateBlock(block);
|
updateBlock(block);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@ -101,13 +101,13 @@ class AutoLoader_15 {
|
|||||||
return new Detoloader("Hebel", 0).setActive(!powerable.isPowered());
|
return new Detoloader("Hebel", 0).setActive(!powerable.isPowered());
|
||||||
} else if (material == Material.STONE_BUTTON) {
|
} else if (material == Material.STONE_BUTTON) {
|
||||||
return new Detoloader("Knopf", Detoloader.STONE_BUTTON);
|
return new Detoloader("Knopf", Detoloader.STONE_BUTTON);
|
||||||
} else if (material.name().contains("PRESSURE_PLATE")){
|
} else if (material.name().contains("PRESSURE_PLATE")) {
|
||||||
return new Detoloader("Druckplatte", Detoloader.PRESSURE_PLATE);
|
return new Detoloader("Druckplatte", Detoloader.PRESSURE_PLATE);
|
||||||
} else if (material.name().contains("BUTTON")) {
|
} else if (material.name().contains("BUTTON")) {
|
||||||
return new Detoloader("Knopf", Detoloader.WOODEN_BUTTON);
|
return new Detoloader("Knopf", Detoloader.WOODEN_BUTTON);
|
||||||
}else if (material == Material.NOTE_BLOCK) {
|
} else if (material == Material.NOTE_BLOCK) {
|
||||||
return new Detoloader("Noteblock", Detoloader.NOTE_BLOCK);
|
return new Detoloader("Noteblock", Detoloader.NOTE_BLOCK);
|
||||||
}else if (material.name().equals("TRIPWIRE")) {
|
} else if (material.name().equals("TRIPWIRE")) {
|
||||||
return new Detoloader("Tripwire", Detoloader.TRIPWIRE);
|
return new Detoloader("Tripwire", Detoloader.TRIPWIRE);
|
||||||
} else {
|
} else {
|
||||||
return new Detoloader("§eUnbekannter Block betätigt (aufgenommen)", 0).setAddBack(false);
|
return new Detoloader("§eUnbekannter Block betätigt (aufgenommen)", 0).setAddBack(false);
|
||||||
@ -115,7 +115,7 @@ class AutoLoader_15 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static boolean getLever(Block block) {
|
static boolean getLever(Block block) {
|
||||||
if(!(block.getBlockData() instanceof Powerable))
|
if (!(block.getBlockData() instanceof Powerable))
|
||||||
return false;
|
return false;
|
||||||
return ((Powerable) block.getBlockData()).isPowered();
|
return ((Powerable) block.getBlockData()).isPowered();
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,8 @@ import java.lang.reflect.InvocationTargetException;
|
|||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
class RegionListener_15 {
|
class RegionListener_15 {
|
||||||
private RegionListener_15(){}
|
private RegionListener_15() {
|
||||||
|
}
|
||||||
|
|
||||||
static boolean isWorldEditCommand(String command) {
|
static boolean isWorldEditCommand(String command) {
|
||||||
if (command.startsWith("/")) {
|
if (command.startsWith("/")) {
|
||||||
|
@ -44,9 +44,10 @@ import java.io.IOException;
|
|||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
class Region_15 {
|
class Region_15 {
|
||||||
private Region_15(){}
|
private Region_15() {
|
||||||
|
}
|
||||||
|
|
||||||
static void paste(File file, int x, int y, int z, boolean rotate){
|
static void paste(File file, int x, int y, int z, boolean rotate) {
|
||||||
Clipboard clipboard;
|
Clipboard clipboard;
|
||||||
try {
|
try {
|
||||||
clipboard = Objects.requireNonNull(ClipboardFormats.findByFile(file)).getReader(new FileInputStream(file)).read();
|
clipboard = Objects.requireNonNull(ClipboardFormats.findByFile(file)).getReader(new FileInputStream(file)).read();
|
||||||
@ -57,16 +58,16 @@ class Region_15 {
|
|||||||
paste(clipboard, x, y, z, rotate);
|
paste(clipboard, x, y, z, rotate);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void paste(Clipboard clipboard, int x, int y, int z, boolean rotate){
|
static void paste(Clipboard clipboard, int x, int y, int z, boolean rotate) {
|
||||||
BlockVector3 dimensions = clipboard.getDimensions();
|
BlockVector3 dimensions = clipboard.getDimensions();
|
||||||
BlockVector3 v = BlockVector3.at(x, y, z);
|
BlockVector3 v = BlockVector3.at(x, y, z);
|
||||||
BlockVector3 offset = clipboard.getRegion().getMinimumPoint().subtract(clipboard.getOrigin());
|
BlockVector3 offset = clipboard.getRegion().getMinimumPoint().subtract(clipboard.getOrigin());
|
||||||
AffineTransform aT = new AffineTransform();
|
AffineTransform aT = new AffineTransform();
|
||||||
if(rotate){
|
if (rotate) {
|
||||||
aT = aT.rotateY(180);
|
aT = aT.rotateY(180);
|
||||||
v = v.add(dimensions.getX()/2 + dimensions.getX()%2, 0, dimensions.getZ()/2 + dimensions.getZ()%2).subtract(offset.multiply(-1, 1, -1)).subtract(1, 0, 1);
|
v = v.add(dimensions.getX() / 2 + dimensions.getX() % 2, 0, dimensions.getZ() / 2 + dimensions.getZ() % 2).subtract(offset.multiply(-1, 1, -1)).subtract(1, 0, 1);
|
||||||
}else{
|
} else {
|
||||||
v = v.subtract(dimensions.getX()/2 - dimensions.getX()%2, 0, dimensions.getZ()/2 - dimensions.getZ()%2).subtract(offset);
|
v = v.subtract(dimensions.getX() / 2 - dimensions.getX() % 2, 0, dimensions.getZ() / 2 - dimensions.getZ() % 2).subtract(offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
EditSession e = WorldEdit.getInstance().getEditSessionFactory().getEditSession(new BukkitWorld(Bukkit.getWorlds().get(0)), -1);
|
EditSession e = WorldEdit.getInstance().getEditSessionFactory().getEditSession(new BukkitWorld(Bukkit.getWorlds().get(0)), -1);
|
||||||
@ -76,7 +77,7 @@ class Region_15 {
|
|||||||
e.flushSession();
|
e.flushSession();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void fastpaste(File file, int x, int y, int z, boolean rotate){
|
static void fastpaste(File file, int x, int y, int z, boolean rotate) {
|
||||||
Clipboard clipboard;
|
Clipboard clipboard;
|
||||||
try {
|
try {
|
||||||
clipboard = Objects.requireNonNull(ClipboardFormats.findByFile(file)).getReader(new FileInputStream(file)).read();
|
clipboard = Objects.requireNonNull(ClipboardFormats.findByFile(file)).getReader(new FileInputStream(file)).read();
|
||||||
@ -87,26 +88,26 @@ class Region_15 {
|
|||||||
BlockVector3 dimensions = clipboard.getDimensions();
|
BlockVector3 dimensions = clipboard.getDimensions();
|
||||||
BlockVector3 v = BlockVector3.at(x, y, z);
|
BlockVector3 v = BlockVector3.at(x, y, z);
|
||||||
BlockVector3 offset = clipboard.getRegion().getMinimumPoint().subtract(clipboard.getOrigin());
|
BlockVector3 offset = clipboard.getRegion().getMinimumPoint().subtract(clipboard.getOrigin());
|
||||||
if(rotate){
|
if (rotate) {
|
||||||
v = v.add(dimensions.getX()/2 + dimensions.getX()%2, 0, dimensions.getZ()/2 + dimensions.getZ()%2).subtract(offset.multiply(-1, 1, -1)).subtract(1, 0, 1);
|
v = v.add(dimensions.getX() / 2 + dimensions.getX() % 2, 0, dimensions.getZ() / 2 + dimensions.getZ() % 2).subtract(offset.multiply(-1, 1, -1)).subtract(1, 0, 1);
|
||||||
}else{
|
} else {
|
||||||
v = v.subtract(dimensions.getX()/2 - dimensions.getX()%2, 0, dimensions.getZ()/2 - dimensions.getZ()%2).subtract(offset);
|
v = v.subtract(dimensions.getX() / 2 - dimensions.getX() % 2, 0, dimensions.getZ() / 2 - dimensions.getZ() % 2).subtract(offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
WorldServer world = ((CraftWorld)Bukkit.getWorlds().get(0)).getHandle();
|
WorldServer world = ((CraftWorld) Bukkit.getWorlds().get(0)).getHandle();
|
||||||
v = v.add(offset);
|
v = v.add(offset);
|
||||||
|
|
||||||
for(int X = v.getBlockX(); X < v.getBlockX() + dimensions.getBlockX(); X++){
|
for (int X = v.getBlockX(); X < v.getBlockX() + dimensions.getBlockX(); X++) {
|
||||||
for(int Y = v.getBlockY(); Y < v.getBlockY() + dimensions.getBlockY(); Y++){
|
for (int Y = v.getBlockY(); Y < v.getBlockY() + dimensions.getBlockY(); Y++) {
|
||||||
for(int Z = v.getBlockZ(); Z < v.getBlockZ() + dimensions.getBlockZ(); Z++){
|
for (int Z = v.getBlockZ(); Z < v.getBlockZ() + dimensions.getBlockZ(); Z++) {
|
||||||
BlockPosition blockPos = new BlockPosition(X, Y, Z);
|
BlockPosition blockPos = new BlockPosition(X, Y, Z);
|
||||||
BaseBlock fullBlock = clipboard.getFullBlock(BlockVector3.at(X, Y, Z).subtract(v).add(clipboard.getRegion().getMinimumPoint()));
|
BaseBlock fullBlock = clipboard.getFullBlock(BlockVector3.at(X, Y, Z).subtract(v).add(clipboard.getRegion().getMinimumPoint()));
|
||||||
BlockData replaceTo = BukkitAdapter.adapt(fullBlock);
|
BlockData replaceTo = BukkitAdapter.adapt(fullBlock);
|
||||||
world.removeTileEntity(blockPos);
|
world.removeTileEntity(blockPos);
|
||||||
if(replaceTo == null)
|
if (replaceTo == null)
|
||||||
world.setTypeAndData(blockPos, ((CraftBlockData)Material.AIR.createBlockData()).getState(), 1042);
|
world.setTypeAndData(blockPos, ((CraftBlockData) Material.AIR.createBlockData()).getState(), 1042);
|
||||||
else
|
else
|
||||||
world.setTypeAndData(new BlockPosition(X, Y, Z), ((CraftBlockData)replaceTo).getState(), 1042);
|
world.setTypeAndData(new BlockPosition(X, Y, Z), ((CraftBlockData) replaceTo).getState(), 1042);
|
||||||
|
|
||||||
world.getChunkProvider().flagDirty(blockPos);
|
world.getChunkProvider().flagDirty(blockPos);
|
||||||
}
|
}
|
||||||
|
@ -23,9 +23,10 @@ import org.bukkit.Material;
|
|||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
class ScriptListener_15 {
|
class ScriptListener_15 {
|
||||||
private ScriptListener_15(){}
|
private ScriptListener_15() {
|
||||||
|
}
|
||||||
|
|
||||||
static boolean isNoBook(ItemStack item){
|
static boolean isNoBook(ItemStack item) {
|
||||||
return item.getType() != Material.WRITABLE_BOOK && item.getType() != Material.WRITTEN_BOOK;
|
return item.getType() != Material.WRITABLE_BOOK && item.getType() != Material.WRITTEN_BOOK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,7 @@ import org.bukkit.entity.Player;
|
|||||||
|
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
|
|
||||||
abstract class IAutoLoader {
|
abstract class AbstractAutoLoader {
|
||||||
|
|
||||||
abstract Player getPlayer();
|
abstract Player getPlayer();
|
||||||
abstract boolean setRedstone(Location location, boolean active);
|
abstract boolean setRedstone(Location location, boolean active);
|
||||||
@ -44,9 +44,9 @@ abstract class IAutoLoader {
|
|||||||
abstract static class LoaderAction {
|
abstract static class LoaderAction {
|
||||||
|
|
||||||
final Location location;
|
final Location location;
|
||||||
final IAutoLoader loader;
|
final AbstractAutoLoader loader;
|
||||||
|
|
||||||
LoaderAction(IAutoLoader loader, Location location){
|
LoaderAction(AbstractAutoLoader loader, Location location){
|
||||||
this.location = location;
|
this.location = location;
|
||||||
this.loader = loader;
|
this.loader = loader;
|
||||||
loader.getActions().add(this);
|
loader.getActions().add(this);
|
||||||
@ -63,7 +63,7 @@ abstract class IAutoLoader {
|
|||||||
final int length;
|
final int length;
|
||||||
int status;
|
int status;
|
||||||
|
|
||||||
RedstoneActivation(IAutoLoader loader, Location location, int ticks, boolean active){
|
RedstoneActivation(AbstractAutoLoader loader, Location location, int ticks, boolean active){
|
||||||
super(loader, location);
|
super(loader, location);
|
||||||
this.length = ticks;
|
this.length = ticks;
|
||||||
this.active = active;
|
this.active = active;
|
||||||
@ -93,7 +93,7 @@ abstract class IAutoLoader {
|
|||||||
final int length;
|
final int length;
|
||||||
int status;
|
int status;
|
||||||
|
|
||||||
TemporaryActivation(IAutoLoader loader, Location location, int ticks){
|
TemporaryActivation(AbstractAutoLoader loader, Location location, int ticks){
|
||||||
super(loader, location);
|
super(loader, location);
|
||||||
this.length = ticks;
|
this.length = ticks;
|
||||||
status = 0;
|
status = 0;
|
@ -32,7 +32,7 @@ public class CommandBau implements CommandExecutor {
|
|||||||
|
|
||||||
private void onToggleBD(Player p, String arg) {
|
private void onToggleBD(Player p, String arg) {
|
||||||
SteamwarUser id = SteamwarUser.get(arg);
|
SteamwarUser id = SteamwarUser.get(arg);
|
||||||
if(negativeToggleCheck(p, id)){
|
if (negativeToggleCheck(p, id)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -42,7 +42,7 @@ public class CommandBau implements CommandExecutor {
|
|||||||
|
|
||||||
private void onToggleWE(Player p, String arg) {
|
private void onToggleWE(Player p, String arg) {
|
||||||
SteamwarUser id = SteamwarUser.get(arg);
|
SteamwarUser id = SteamwarUser.get(arg);
|
||||||
if(negativeToggleCheck(p, id)){
|
if (negativeToggleCheck(p, id)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -52,7 +52,7 @@ public class CommandBau implements CommandExecutor {
|
|||||||
|
|
||||||
private void onToggleWorld(Player p, String arg) {
|
private void onToggleWorld(Player p, String arg) {
|
||||||
SteamwarUser id = SteamwarUser.get(arg);
|
SteamwarUser id = SteamwarUser.get(arg);
|
||||||
if(negativeToggleCheck(p, id)){
|
if (negativeToggleCheck(p, id)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -60,7 +60,7 @@ public class CommandBau implements CommandExecutor {
|
|||||||
Welt.toggleWorld(p, target);
|
Welt.toggleWorld(p, target);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean negativeToggleCheck(Player p, SteamwarUser id){
|
private boolean negativeToggleCheck(Player p, SteamwarUser id) {
|
||||||
if (id == null) {
|
if (id == null) {
|
||||||
p.sendMessage(BauSystem.PREFIX + "§cUnbekannter Spieler");
|
p.sendMessage(BauSystem.PREFIX + "§cUnbekannter Spieler");
|
||||||
return true;
|
return true;
|
||||||
@ -76,19 +76,19 @@ public class CommandBau implements CommandExecutor {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||||
if(!(sender instanceof Player))
|
if (!(sender instanceof Player))
|
||||||
return false;
|
return false;
|
||||||
Player player = (Player) sender;
|
Player player = (Player) sender;
|
||||||
if(!BauSystem.getOwner().equals(player.getUniqueId())){
|
if (!BauSystem.getOwner().equals(player.getUniqueId())) {
|
||||||
player.sendMessage(BauSystem.PREFIX + "§cDies ist nicht deine Welt!");
|
player.sendMessage(BauSystem.PREFIX + "§cDies ist nicht deine Welt!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(args[0].equalsIgnoreCase("togglebuild")){
|
if (args[0].equalsIgnoreCase("togglebuild")) {
|
||||||
onToggleBD(player, args[1]);
|
onToggleBD(player, args[1]);
|
||||||
}else if(args[0].equalsIgnoreCase("togglewe")){
|
} else if (args[0].equalsIgnoreCase("togglewe")) {
|
||||||
onToggleWE(player, args[1]);
|
onToggleWE(player, args[1]);
|
||||||
}else if(args[0].equalsIgnoreCase("toggleworld")){
|
} else if (args[0].equalsIgnoreCase("toggleworld")) {
|
||||||
onToggleWorld(player, args[1]);
|
onToggleWorld(player, args[1]);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -36,32 +36,34 @@ public class CommandClear extends BukkitCommand {
|
|||||||
description = "Leere dein Inventar oder das eines anderen Spielers.";
|
description = "Leere dein Inventar oder das eines anderen Spielers.";
|
||||||
usageMessage = "/clear [Spieler]";
|
usageMessage = "/clear [Spieler]";
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean execute(CommandSender sender, String currentAlias, String[] args) {
|
public boolean execute(CommandSender sender, String currentAlias, String[] args) {
|
||||||
if (!(sender instanceof Player))
|
if (!(sender instanceof Player))
|
||||||
return false;
|
return false;
|
||||||
Player player = (Player) sender;
|
Player player = (Player) sender;
|
||||||
if (args.length == 0){
|
if (args.length == 0) {
|
||||||
clear(player);
|
clear(player);
|
||||||
player.sendMessage(BauSystem.PREFIX + "Dein Inventar wurde geleert.");
|
player.sendMessage(BauSystem.PREFIX + "Dein Inventar wurde geleert.");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
// check if admin
|
// check if admin
|
||||||
if(Welt.noPermission(player, Permission.world)){
|
if (Welt.noPermission(player, Permission.world)) {
|
||||||
player.sendMessage(BauSystem.PREFIX + "$cDu darfst hier keine fremden Inventare leeren.");
|
player.sendMessage(BauSystem.PREFIX + "$cDu darfst hier keine fremden Inventare leeren.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Player target = Bukkit.getPlayerExact(args[0]);
|
Player target = Bukkit.getPlayerExact(args[0]);
|
||||||
if(!(target instanceof Player)){
|
if (!(target instanceof Player)) {
|
||||||
player.sendMessage(BauSystem.PREFIX + "§cDas ist kein Spieler.");
|
player.sendMessage(BauSystem.PREFIX + "§cDas ist kein Spieler.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
clear(target);
|
clear(target);
|
||||||
target.sendMessage(BauSystem.PREFIX + "Dein Inventar wurde von" + player.getDisplayName() +" §7geleert.");
|
target.sendMessage(BauSystem.PREFIX + "Dein Inventar wurde von" + player.getDisplayName() + " §7geleert.");
|
||||||
player.sendMessage(BauSystem.PREFIX + "Das Inventar von " + target.getDisplayName() +" §7wurde geleert.");
|
player.sendMessage(BauSystem.PREFIX + "Das Inventar von " + target.getDisplayName() + " §7wurde geleert.");
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
}
|
}
|
||||||
private void clear(Player player){
|
|
||||||
|
private void clear(Player player) {
|
||||||
player.getInventory().clear();
|
player.getInventory().clear();
|
||||||
player.getInventory().setHelmet(new ItemStack(Material.AIR));
|
player.getInventory().setHelmet(new ItemStack(Material.AIR));
|
||||||
player.getInventory().setChestplate(new ItemStack(Material.AIR));
|
player.getInventory().setChestplate(new ItemStack(Material.AIR));
|
||||||
|
@ -33,11 +33,11 @@ public class CommandDebugStick implements CommandExecutor {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||||
if(!(sender instanceof Player))
|
if (!(sender instanceof Player))
|
||||||
return false;
|
return false;
|
||||||
Player player = (Player) sender;
|
Player player = (Player) sender;
|
||||||
|
|
||||||
if (Welt.noPermission(player, Permission.build)){
|
if (Welt.noPermission(player, Permission.build)) {
|
||||||
player.sendMessage(BauSystem.PREFIX + "§cKein Debugstick für dich hier.");
|
player.sendMessage(BauSystem.PREFIX + "§cKein Debugstick für dich hier.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,7 @@ public class CommandDetonator implements CommandExecutor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean permissionCheck(Player player) {
|
private boolean permissionCheck(Player player) {
|
||||||
if(Welt.noPermission(player, Permission.world)){
|
if (Welt.noPermission(player, Permission.world)) {
|
||||||
player.sendMessage(BauSystem.PREFIX + "§cDu darfst hier nicht den Detonator nutzen");
|
player.sendMessage(BauSystem.PREFIX + "§cDu darfst hier nicht den Detonator nutzen");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -48,11 +48,11 @@ public class CommandDetonator implements CommandExecutor {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command command, String s, String[] args) {
|
public boolean onCommand(CommandSender sender, Command command, String s, String[] args) {
|
||||||
if(!(sender instanceof Player))
|
if (!(sender instanceof Player))
|
||||||
return false;
|
return false;
|
||||||
Player player = (Player) sender;
|
Player player = (Player) sender;
|
||||||
|
|
||||||
if(args.length == 0){
|
if (args.length == 0) {
|
||||||
help(player);
|
help(player);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -30,12 +30,14 @@ public class CommandFire extends RegionToggleCommand {
|
|||||||
String getNoPermMessage() {
|
String getNoPermMessage() {
|
||||||
return "§cDu darfst hier nicht Feuerschaden (de-)aktivieren";
|
return "§cDu darfst hier nicht Feuerschaden (de-)aktivieren";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
String getEnableMessage(){
|
String getEnableMessage() {
|
||||||
return "§cFeuerschaden deaktiviert";
|
return "§cFeuerschaden deaktiviert";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
String getDisableMessage(){
|
String getDisableMessage() {
|
||||||
return "§aFeuerschaden aktiviert";
|
return "§aFeuerschaden aktiviert";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -51,7 +53,7 @@ public class CommandFire extends RegionToggleCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onFireSpread(BlockSpreadEvent e){
|
public void onFireSpread(BlockSpreadEvent e) {
|
||||||
if (Region.getRegion(e.getBlock().getLocation()).isFire()) e.setCancelled(true);
|
if (Region.getRegion(e.getBlock().getLocation()).isFire()) e.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -100,12 +100,12 @@ public class CommandFreeze extends RegionToggleCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onRedstoneEvent(BlockRedstoneEvent e){
|
public void onRedstoneEvent(BlockRedstoneEvent e) {
|
||||||
if (Region.getRegion(e.getBlock().getLocation()).isFreeze()) e.setNewCurrent(e.getOldCurrent());
|
if (Region.getRegion(e.getBlock().getLocation()).isFreeze()) e.setNewCurrent(e.getOldCurrent());
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onBlockDispense(BlockDispenseEvent e){
|
public void onBlockDispense(BlockDispenseEvent e) {
|
||||||
if (Region.getRegion(e.getBlock().getLocation()).isFreeze()) e.setCancelled(true);
|
if (Region.getRegion(e.getBlock().getLocation()).isFreeze()) e.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,16 +48,16 @@ public class CommandGamemode extends BukkitCommand {
|
|||||||
public boolean execute(CommandSender sender, String currentAlias, String[] args) {
|
public boolean execute(CommandSender sender, String currentAlias, String[] args) {
|
||||||
if (!(sender instanceof Player)) {
|
if (!(sender instanceof Player)) {
|
||||||
return false;
|
return false;
|
||||||
}else if (args.length == 0) {
|
} else if (args.length == 0) {
|
||||||
sender.sendMessage(BauSystem.PREFIX + this.usageMessage);
|
sender.sendMessage(BauSystem.PREFIX + this.usageMessage);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Player p = (Player) sender;
|
Player p = (Player) sender;
|
||||||
|
|
||||||
if(!p.getUniqueId().equals(BauSystem.getOwner())){
|
if (!p.getUniqueId().equals(BauSystem.getOwner())) {
|
||||||
BauweltMember member = BauweltMember.getBauMember(BauSystem.getOwner(), p.getUniqueId());
|
BauweltMember member = BauweltMember.getBauMember(BauSystem.getOwner(), p.getUniqueId());
|
||||||
if(member == null || !member.isBuild()){
|
if (member == null || !member.isBuild()) {
|
||||||
p.sendMessage(BauSystem.PREFIX + "§cDu darfst hier deinen Spielmodus nicht ändern");
|
p.sendMessage(BauSystem.PREFIX + "§cDu darfst hier deinen Spielmodus nicht ändern");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -65,7 +65,7 @@ public class CommandGamemode extends BukkitCommand {
|
|||||||
|
|
||||||
GameMode mode = createMode(args[0]);
|
GameMode mode = createMode(args[0]);
|
||||||
|
|
||||||
if(mode == null){
|
if (mode == null) {
|
||||||
p.sendMessage(BauSystem.PREFIX + "§cUnbekannter Spielmodus");
|
p.sendMessage(BauSystem.PREFIX + "§cUnbekannter Spielmodus");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -75,7 +75,7 @@ public class CommandGamemode extends BukkitCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
private GameMode createMode(String modeArg){
|
private GameMode createMode(String modeArg) {
|
||||||
try {
|
try {
|
||||||
return GameMode.getByValue(Integer.parseInt(modeArg));
|
return GameMode.getByValue(Integer.parseInt(modeArg));
|
||||||
} catch (NumberFormatException ignored) {
|
} catch (NumberFormatException ignored) {
|
||||||
|
@ -31,7 +31,7 @@ public class CommandGills implements CommandExecutor {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||||
if(!(sender instanceof Player))
|
if (!(sender instanceof Player))
|
||||||
return false;
|
return false;
|
||||||
Player player = (Player) sender;
|
Player player = (Player) sender;
|
||||||
toggleGills(player);
|
toggleGills(player);
|
||||||
@ -39,7 +39,7 @@ public class CommandGills implements CommandExecutor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void toggleGills(Player player) {
|
public static void toggleGills(Player player) {
|
||||||
if(player.hasPotionEffect(PotionEffectType.WATER_BREATHING)) {
|
if (player.hasPotionEffect(PotionEffectType.WATER_BREATHING)) {
|
||||||
player.sendMessage(BauSystem.PREFIX + "Wassersicht deaktiviert");
|
player.sendMessage(BauSystem.PREFIX + "Wassersicht deaktiviert");
|
||||||
player.removePotionEffect(PotionEffectType.WATER_BREATHING);
|
player.removePotionEffect(PotionEffectType.WATER_BREATHING);
|
||||||
return;
|
return;
|
||||||
|
@ -27,7 +27,8 @@ import java.lang.reflect.Field;
|
|||||||
|
|
||||||
public class CommandInjector {
|
public class CommandInjector {
|
||||||
|
|
||||||
private CommandInjector(){}
|
private CommandInjector() {
|
||||||
|
}
|
||||||
|
|
||||||
private static final String PACKAGE_NAME = Bukkit.getServer().getClass().getPackage().getName();
|
private static final String PACKAGE_NAME = Bukkit.getServer().getClass().getPackage().getName();
|
||||||
private static final String VERSION = PACKAGE_NAME.substring(PACKAGE_NAME.lastIndexOf('.') + 1);
|
private static final String VERSION = PACKAGE_NAME.substring(PACKAGE_NAME.lastIndexOf('.') + 1);
|
||||||
|
@ -30,7 +30,7 @@ import org.bukkit.entity.Player;
|
|||||||
|
|
||||||
public class CommandLoader implements CommandExecutor {
|
public class CommandLoader implements CommandExecutor {
|
||||||
|
|
||||||
private void help(Player player){
|
private void help(Player player) {
|
||||||
player.sendMessage("§8/§eloader setup §8- §7Startet die Aufnahme der Aktionen");
|
player.sendMessage("§8/§eloader setup §8- §7Startet die Aufnahme der Aktionen");
|
||||||
player.sendMessage("§8/§7loader undo §8- §7Entfernt die zuletzt aufgenommene Aktion");
|
player.sendMessage("§8/§7loader undo §8- §7Entfernt die zuletzt aufgenommene Aktion");
|
||||||
player.sendMessage("§8/§eloader start §8- §7Spielt die zuvor aufgenommenen Aktionen ab");
|
player.sendMessage("§8/§eloader start §8- §7Spielt die zuvor aufgenommenen Aktionen ab");
|
||||||
@ -42,21 +42,21 @@ public class CommandLoader implements CommandExecutor {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||||
if(!(sender instanceof Player))
|
if (!(sender instanceof Player))
|
||||||
return false;
|
return false;
|
||||||
Player player = (Player) sender;
|
Player player = (Player) sender;
|
||||||
|
|
||||||
if(Welt.noPermission(player, Permission.build)){
|
if (Welt.noPermission(player, Permission.build)) {
|
||||||
player.sendMessage(BauSystem.PREFIX + "§cDu darfst hier nicht den AutoLader verwenden");
|
player.sendMessage(BauSystem.PREFIX + "§cDu darfst hier nicht den AutoLader verwenden");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(args.length == 0){
|
if (args.length == 0) {
|
||||||
help(player);
|
help(player);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch(args[0].toLowerCase()){
|
switch (args[0].toLowerCase()) {
|
||||||
case "setup":
|
case "setup":
|
||||||
setup(player);
|
setup(player);
|
||||||
break;
|
break;
|
||||||
@ -81,16 +81,16 @@ public class CommandLoader implements CommandExecutor {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setup(Player player){
|
private void setup(Player player) {
|
||||||
AutoLoader.getLoader(player).setup();
|
AutoLoader.getLoader(player).setup();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void undo(Player player){
|
private void undo(Player player) {
|
||||||
AutoLoader loader = loader(player);
|
AutoLoader loader = loader(player);
|
||||||
if(loader == null)
|
if (loader == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(!loader.isSetup()){
|
if (!loader.isSetup()) {
|
||||||
player.sendMessage("§cDer AutoLader wird in den Setup-Zustand versetzt");
|
player.sendMessage("§cDer AutoLader wird in den Setup-Zustand versetzt");
|
||||||
setup(player);
|
setup(player);
|
||||||
}
|
}
|
||||||
@ -98,58 +98,58 @@ public class CommandLoader implements CommandExecutor {
|
|||||||
loader.undo();
|
loader.undo();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void start(Player player){
|
private void start(Player player) {
|
||||||
AutoLoader loader = loader(player);
|
AutoLoader loader = loader(player);
|
||||||
if(loader == null)
|
if (loader == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
loader.start();
|
loader.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void stop(Player player){
|
private void stop(Player player) {
|
||||||
if(!AutoLoader.hasLoader(player)){
|
if (!AutoLoader.hasLoader(player)) {
|
||||||
player.sendMessage(BauSystem.PREFIX + "§cDu hast keinen aktiven AutoLader");
|
player.sendMessage(BauSystem.PREFIX + "§cDu hast keinen aktiven AutoLader");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
AutoLoader.getLoader(player).stop();
|
AutoLoader.getLoader(player).stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void wait(Player player, String[] args){
|
private void wait(Player player, String[] args) {
|
||||||
if(args.length != 2){
|
if (args.length != 2) {
|
||||||
help(player);
|
help(player);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
AutoLoader loader = loader(player);
|
AutoLoader loader = loader(player);
|
||||||
if(loader == null)
|
if (loader == null)
|
||||||
loader = AutoLoader.getLoader(player);
|
loader = AutoLoader.getLoader(player);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
loader.wait(Integer.parseInt(args[1]));
|
loader.wait(Integer.parseInt(args[1]));
|
||||||
}catch (NumberFormatException e){
|
} catch (NumberFormatException e) {
|
||||||
player.sendMessage(BauSystem.PREFIX + "§cBitte gib eine Ganzzahl an");
|
player.sendMessage(BauSystem.PREFIX + "§cBitte gib eine Ganzzahl an");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void speed(Player player, String[] args){
|
private void speed(Player player, String[] args) {
|
||||||
if(args.length != 2){
|
if (args.length != 2) {
|
||||||
help(player);
|
help(player);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
AutoLoader loader = loader(player);
|
AutoLoader loader = loader(player);
|
||||||
if(loader == null)
|
if (loader == null)
|
||||||
loader = AutoLoader.getLoader(player);
|
loader = AutoLoader.getLoader(player);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
loader.blockWait(Integer.parseInt(args[1]));
|
loader.blockWait(Integer.parseInt(args[1]));
|
||||||
}catch (NumberFormatException e){
|
} catch (NumberFormatException e) {
|
||||||
player.sendMessage(BauSystem.PREFIX + "§cBitte gib eine Ganzzahl an");
|
player.sendMessage(BauSystem.PREFIX + "§cBitte gib eine Ganzzahl an");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private AutoLoader loader(Player player){
|
private AutoLoader loader(Player player) {
|
||||||
if(AutoLoader.hasLoader(player))
|
if (AutoLoader.hasLoader(player))
|
||||||
return AutoLoader.getLoader(player);
|
return AutoLoader.getLoader(player);
|
||||||
player.sendMessage(BauSystem.PREFIX + "§cDu hast keinen aktiven AutoLader");
|
player.sendMessage(BauSystem.PREFIX + "§cDu hast keinen aktiven AutoLader");
|
||||||
player.sendMessage(BauSystem.PREFIX + "§7Es wird ein neuer AutoLader gestartet");
|
player.sendMessage(BauSystem.PREFIX + "§7Es wird ein neuer AutoLader gestartet");
|
||||||
|
@ -32,31 +32,31 @@ import org.bukkit.entity.Player;
|
|||||||
public class CommandLockschem implements CommandExecutor {
|
public class CommandLockschem implements CommandExecutor {
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||||
if(!(sender instanceof Player))
|
if (!(sender instanceof Player))
|
||||||
return false;
|
return false;
|
||||||
Player player = (Player) sender;
|
Player player = (Player) sender;
|
||||||
|
|
||||||
SteamwarUser steamwarUser = SteamwarUser.get(player.getUniqueId());
|
SteamwarUser steamwarUser = SteamwarUser.get(player.getUniqueId());
|
||||||
UserGroup userGroup = steamwarUser.getUserGroup();
|
UserGroup userGroup = steamwarUser.getUserGroup();
|
||||||
|
|
||||||
if(userGroup != UserGroup.Admin &&
|
if (userGroup != UserGroup.Admin &&
|
||||||
userGroup != UserGroup.Developer &&
|
userGroup != UserGroup.Developer &&
|
||||||
userGroup != UserGroup.Moderator &&
|
userGroup != UserGroup.Moderator &&
|
||||||
userGroup != UserGroup.Supporter)
|
userGroup != UserGroup.Supporter)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if(args.length != 2) {
|
if (args.length != 2) {
|
||||||
sendHelp(player);
|
sendHelp(player);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
SteamwarUser schemOwner = SteamwarUser.get(args[0]);
|
SteamwarUser schemOwner = SteamwarUser.get(args[0]);
|
||||||
if(schemOwner == null) {
|
if (schemOwner == null) {
|
||||||
player.sendMessage(BauSystem.PREFIX + "Dieser Spieler existiert nicht!");
|
player.sendMessage(BauSystem.PREFIX + "Dieser Spieler existiert nicht!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Schematic schematic = Schematic.getSchemFromDB(args[1], schemOwner.getUUID());
|
Schematic schematic = Schematic.getSchemFromDB(args[1], schemOwner.getUUID());
|
||||||
if(schematic == null) {
|
if (schematic == null) {
|
||||||
player.sendMessage(BauSystem.PREFIX + "Dieser Spieler besitzt keine Schematic mit diesem Namen!");
|
player.sendMessage(BauSystem.PREFIX + "Dieser Spieler besitzt keine Schematic mit diesem Namen!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,7 @@ public class CommandNV implements CommandExecutor {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||||
if(!(sender instanceof Player))
|
if (!(sender instanceof Player))
|
||||||
return false;
|
return false;
|
||||||
Player player = (Player) sender;
|
Player player = (Player) sender;
|
||||||
toggleNightvision(player);
|
toggleNightvision(player);
|
||||||
@ -39,7 +39,7 @@ public class CommandNV implements CommandExecutor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void toggleNightvision(Player player) {
|
public static void toggleNightvision(Player player) {
|
||||||
if(player.hasPotionEffect(PotionEffectType.NIGHT_VISION)) {
|
if (player.hasPotionEffect(PotionEffectType.NIGHT_VISION)) {
|
||||||
player.sendMessage(BauSystem.PREFIX + "Nachtsicht deaktiviert");
|
player.sendMessage(BauSystem.PREFIX + "Nachtsicht deaktiviert");
|
||||||
player.removePotionEffect(PotionEffectType.NIGHT_VISION);
|
player.removePotionEffect(PotionEffectType.NIGHT_VISION);
|
||||||
return;
|
return;
|
||||||
|
@ -36,11 +36,11 @@ public class CommandProtect implements CommandExecutor {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||||
if(!(sender instanceof Player))
|
if (!(sender instanceof Player))
|
||||||
return false;
|
return false;
|
||||||
Player player = (Player) sender;
|
Player player = (Player) sender;
|
||||||
|
|
||||||
if(Welt.noPermission(player, Permission.worldedit)){
|
if (Welt.noPermission(player, Permission.worldedit)) {
|
||||||
player.sendMessage(BauSystem.PREFIX + "§cDu darfst hier nicht den Boden schützen");
|
player.sendMessage(BauSystem.PREFIX + "§cDu darfst hier nicht den Boden schützen");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -52,16 +52,16 @@ public class CommandProtect implements CommandExecutor {
|
|||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
Schematic schem = null;
|
Schematic schem = null;
|
||||||
if(args.length > 0){
|
if (args.length > 0) {
|
||||||
schem = Schematic.getSchemFromDB(args[0], player.getUniqueId());
|
schem = Schematic.getSchemFromDB(args[0], player.getUniqueId());
|
||||||
if(schem == null){
|
if (schem == null) {
|
||||||
player.sendMessage(BauSystem.PREFIX + "§cSchematic nicht gefunden");
|
player.sendMessage(BauSystem.PREFIX + "§cSchematic nicht gefunden");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
region.protect(schem);
|
region.protect(schem);
|
||||||
player.sendMessage(BauSystem.PREFIX + "§7Boden geschützt");
|
player.sendMessage(BauSystem.PREFIX + "§7Boden geschützt");
|
||||||
}catch(Exception e){
|
} catch (Exception e) {
|
||||||
player.sendMessage(BauSystem.PREFIX + "§cFehler beim Schützen der Region");
|
player.sendMessage(BauSystem.PREFIX + "§cFehler beim Schützen der Region");
|
||||||
Bukkit.getLogger().log(Level.WARNING, "Failed protect", e);
|
Bukkit.getLogger().log(Level.WARNING, "Failed protect", e);
|
||||||
}
|
}
|
||||||
|
@ -36,11 +36,11 @@ public class CommandReset implements CommandExecutor {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||||
if(!(sender instanceof Player))
|
if (!(sender instanceof Player))
|
||||||
return false;
|
return false;
|
||||||
Player player = (Player) sender;
|
Player player = (Player) sender;
|
||||||
|
|
||||||
if(Welt.noPermission(player, Permission.world)){
|
if (Welt.noPermission(player, Permission.world)) {
|
||||||
player.sendMessage(BauSystem.PREFIX + "§cDu darfst hier nicht die Region zurücksetzen");
|
player.sendMessage(BauSystem.PREFIX + "§cDu darfst hier nicht die Region zurücksetzen");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -51,18 +51,18 @@ public class CommandReset implements CommandExecutor {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
if(args.length > 0){
|
if (args.length > 0) {
|
||||||
Schematic schem = Schematic.getSchemFromDB(args[0], player.getUniqueId());
|
Schematic schem = Schematic.getSchemFromDB(args[0], player.getUniqueId());
|
||||||
if(schem == null){
|
if (schem == null) {
|
||||||
player.sendMessage(BauSystem.PREFIX + "§cSchematic nicht gefunden");
|
player.sendMessage(BauSystem.PREFIX + "§cSchematic nicht gefunden");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
region.reset(schem);
|
region.reset(schem);
|
||||||
}else{
|
} else {
|
||||||
region.fastreset();
|
region.fastreset();
|
||||||
}
|
}
|
||||||
player.sendMessage(BauSystem.PREFIX + "§7Region zurückgesetzt");
|
player.sendMessage(BauSystem.PREFIX + "§7Region zurückgesetzt");
|
||||||
}catch(Exception e){
|
} catch (Exception e) {
|
||||||
player.sendMessage(BauSystem.PREFIX + "§cFehler beim Zurücksetzen der Region");
|
player.sendMessage(BauSystem.PREFIX + "§cFehler beim Zurücksetzen der Region");
|
||||||
Bukkit.getLogger().log(Level.WARNING, "Failed reset", e);
|
Bukkit.getLogger().log(Level.WARNING, "Failed reset", e);
|
||||||
}
|
}
|
||||||
|
@ -33,17 +33,17 @@ public class CommandSkull implements CommandExecutor {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender commandSender, Command command, String s, String[] args) {
|
public boolean onCommand(CommandSender commandSender, Command command, String s, String[] args) {
|
||||||
if(!(commandSender instanceof Player))
|
if (!(commandSender instanceof Player))
|
||||||
return false;
|
return false;
|
||||||
Player p = (Player) commandSender;
|
Player p = (Player) commandSender;
|
||||||
|
|
||||||
if(args.length != 1){
|
if (args.length != 1) {
|
||||||
p.sendMessage(BauSystem.PREFIX + "§8/§eskull §8[§eSpieler§8]");
|
p.sendMessage(BauSystem.PREFIX + "§8/§eskull §8[§eSpieler§8]");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
ItemStack is = SWItem.getPlayerSkull(args[0]).getItemStack();
|
ItemStack is = SWItem.getPlayerSkull(args[0]).getItemStack();
|
||||||
SkullMeta sm = (SkullMeta)is.getItemMeta();
|
SkullMeta sm = (SkullMeta) is.getItemMeta();
|
||||||
assert sm != null;
|
assert sm != null;
|
||||||
sm.setDisplayName("§e" + args[0] + "§8s Kopf");
|
sm.setDisplayName("§e" + args[0] + "§8s Kopf");
|
||||||
is.setItemMeta(sm);
|
is.setItemMeta(sm);
|
||||||
|
@ -29,19 +29,19 @@ public class CommandSpeed implements CommandExecutor {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||||
if(!(sender instanceof Player))
|
if (!(sender instanceof Player))
|
||||||
return false;
|
return false;
|
||||||
Player player = (Player) sender;
|
Player player = (Player) sender;
|
||||||
|
|
||||||
if (args.length == 0){
|
if (args.length == 0) {
|
||||||
player.sendMessage(BauSystem.PREFIX + "/speed [Geschwindigkeit]");
|
player.sendMessage(BauSystem.PREFIX + "/speed [Geschwindigkeit]");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
float speed;
|
float speed;
|
||||||
try{
|
try {
|
||||||
speed = Float.parseFloat(args[0]);
|
speed = Float.parseFloat(args[0]);
|
||||||
}catch(NumberFormatException e){
|
} catch (NumberFormatException e) {
|
||||||
player.sendMessage(BauSystem.PREFIX + "§cBitte gib eine Zahl zwischen 0 und 10 an");
|
player.sendMessage(BauSystem.PREFIX + "§cBitte gib eine Zahl zwischen 0 und 10 an");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -102,7 +102,7 @@ public class CommandTPSLimiter implements CommandExecutor {
|
|||||||
|
|
||||||
private void tpsLimiter() {
|
private void tpsLimiter() {
|
||||||
delay = 20 / currentTPSLimit;
|
delay = 20 / currentTPSLimit;
|
||||||
loops = (int)Math.ceil(delay);
|
loops = (int) Math.ceil(delay);
|
||||||
sleepDelay = (long) (50 * delay) / loops;
|
sleepDelay = (long) (50 * delay) / loops;
|
||||||
|
|
||||||
TPSUtils.setTPS(currentTPSLimit);
|
TPSUtils.setTPS(currentTPSLimit);
|
||||||
@ -141,7 +141,7 @@ public class CommandTPSLimiter implements CommandExecutor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static double getCurrentTPSLimit() {
|
public static double getCurrentTPSLimit() {
|
||||||
return (double)Math.round(currentTPSLimit * 10.0D) / 10.0D;
|
return (double) Math.round(currentTPSLimit * 10.0D) / 10.0D;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,8 @@ public class CommandTPSLimiterTabComplete implements TabCompleter {
|
|||||||
private List<String> arguments = new ArrayList<>(Arrays.asList("default", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20"));
|
private List<String> arguments = new ArrayList<>(Arrays.asList("default", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20"));
|
||||||
|
|
||||||
public CommandTPSLimiterTabComplete() {
|
public CommandTPSLimiterTabComplete() {
|
||||||
if (TPSUtils.isWarpAllowed()) arguments.addAll(Arrays.asList("21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31", "32", "33", "34", "35", "36", "37", "38", "39", "40"));
|
if (TPSUtils.isWarpAllowed())
|
||||||
|
arguments.addAll(Arrays.asList("21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31", "32", "33", "34", "35", "36", "37", "38", "39", "40"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -54,14 +54,14 @@ public class CommandTeleport extends BukkitCommand {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(p.getUniqueId().equals(target.getUniqueId())){
|
if (p.getUniqueId().equals(target.getUniqueId())) {
|
||||||
p.sendMessage(BauSystem.PREFIX + "§cSei eins mit dir selbst!");
|
p.sendMessage(BauSystem.PREFIX + "§cSei eins mit dir selbst!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!BauSystem.getOwner().equals(p.getUniqueId())){
|
if (!BauSystem.getOwner().equals(p.getUniqueId())) {
|
||||||
BauweltMember member = BauweltMember.getBauMember(BauSystem.getOwner(), p.getUniqueId());
|
BauweltMember member = BauweltMember.getBauMember(BauSystem.getOwner(), p.getUniqueId());
|
||||||
if(member == null || !member.isBuild()){
|
if (member == null || !member.isBuild()) {
|
||||||
p.sendMessage(BauSystem.PREFIX + "§cDu darfst dich auf dieser Welt nicht teleportieren!");
|
p.sendMessage(BauSystem.PREFIX + "§cDu darfst dich auf dieser Welt nicht teleportieren!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -36,11 +36,11 @@ public class CommandTestblock implements CommandExecutor {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||||
if(!(sender instanceof Player))
|
if (!(sender instanceof Player))
|
||||||
return false;
|
return false;
|
||||||
Player player = (Player) sender;
|
Player player = (Player) sender;
|
||||||
|
|
||||||
if(Welt.noPermission(player, Permission.worldedit)){
|
if (Welt.noPermission(player, Permission.worldedit)) {
|
||||||
player.sendMessage(BauSystem.PREFIX + "§cDu darfst hier nicht den Testblock zurücksetzen");
|
player.sendMessage(BauSystem.PREFIX + "§cDu darfst hier nicht den Testblock zurücksetzen");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -52,16 +52,16 @@ public class CommandTestblock implements CommandExecutor {
|
|||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
Schematic schem = null;
|
Schematic schem = null;
|
||||||
if(args.length > 0){
|
if (args.length > 0) {
|
||||||
schem = Schematic.getSchemFromDB(args[0], player.getUniqueId());
|
schem = Schematic.getSchemFromDB(args[0], player.getUniqueId());
|
||||||
if(schem == null){
|
if (schem == null) {
|
||||||
player.sendMessage(BauSystem.PREFIX + "§cSchematic nicht gefunden");
|
player.sendMessage(BauSystem.PREFIX + "§cSchematic nicht gefunden");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
region.resetTestblock(schem);
|
region.resetTestblock(schem);
|
||||||
player.sendMessage(BauSystem.PREFIX + "§7Testblock zurückgesetzt");
|
player.sendMessage(BauSystem.PREFIX + "§7Testblock zurückgesetzt");
|
||||||
}catch(Exception e){
|
} catch (Exception e) {
|
||||||
player.sendMessage(BauSystem.PREFIX + "§cFehler beim Zurücksetzen des Testblocks");
|
player.sendMessage(BauSystem.PREFIX + "§cFehler beim Zurücksetzen des Testblocks");
|
||||||
Bukkit.getLogger().log(Level.WARNING, "Failed testblock", e);
|
Bukkit.getLogger().log(Level.WARNING, "Failed testblock", e);
|
||||||
}
|
}
|
||||||
|
@ -44,15 +44,15 @@ public class CommandTime extends BukkitCommand {
|
|||||||
}
|
}
|
||||||
Player player = (Player) sender;
|
Player player = (Player) sender;
|
||||||
|
|
||||||
if (Welt.noPermission(player, Permission.world)){
|
if (Welt.noPermission(player, Permission.world)) {
|
||||||
player.sendMessage(BauSystem.PREFIX + "§cDu darfst hier nicht die Zeit ändern");
|
player.sendMessage(BauSystem.PREFIX + "§cDu darfst hier nicht die Zeit ändern");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
int time;
|
int time;
|
||||||
try{
|
try {
|
||||||
time = Integer.valueOf(args[0]);
|
time = Integer.valueOf(args[0]);
|
||||||
}catch(NumberFormatException e){
|
} catch (NumberFormatException e) {
|
||||||
player.sendMessage(BauSystem.PREFIX + "§cBitte gib eine Zahl zwischen 0 und 24000 an");
|
player.sendMessage(BauSystem.PREFIX + "§cBitte gib eine Zahl zwischen 0 und 24000 an");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -49,7 +49,7 @@ public class CommandTrace implements CommandExecutor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean permissionCheck(Player player) {
|
private boolean permissionCheck(Player player) {
|
||||||
if(Welt.noPermission(player, Permission.world)){
|
if (Welt.noPermission(player, Permission.world)) {
|
||||||
player.sendMessage(BauSystem.PREFIX + "§cDu darfst hier nicht den TNT-Tracer nutzen");
|
player.sendMessage(BauSystem.PREFIX + "§cDu darfst hier nicht den TNT-Tracer nutzen");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -58,10 +58,10 @@ public class CommandTrace implements CommandExecutor {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||||
if(!(sender instanceof Player)) return false;
|
if (!(sender instanceof Player)) return false;
|
||||||
Player player = (Player) sender;
|
Player player = (Player) sender;
|
||||||
|
|
||||||
if(args.length == 0){
|
if (args.length == 0) {
|
||||||
help(player);
|
help(player);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -46,7 +46,7 @@ public class CommandTraceTabCompleter implements TabCompleter {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> onTabComplete(CommandSender sender, Command command, String label, String[] args) {
|
public List<String> onTabComplete(CommandSender sender, Command command, String label, String[] args) {
|
||||||
if(!(sender instanceof Player)) return new ArrayList<>();
|
if (!(sender instanceof Player)) return new ArrayList<>();
|
||||||
return tracerTabComplete((Player) sender, args);
|
return tracerTabComplete((Player) sender, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,11 +42,11 @@ public abstract class RegionToggleCommand implements CommandExecutor, Listener {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||||
if(!(sender instanceof Player))
|
if (!(sender instanceof Player))
|
||||||
return false;
|
return false;
|
||||||
Player player = (Player) sender;
|
Player player = (Player) sender;
|
||||||
|
|
||||||
if (Welt.noPermission(player, Permission.world)){
|
if (Welt.noPermission(player, Permission.world)) {
|
||||||
player.sendMessage(BauSystem.PREFIX + getNoPermMessage());
|
player.sendMessage(BauSystem.PREFIX + getNoPermMessage());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -69,7 +69,9 @@ public abstract class RegionToggleCommand implements CommandExecutor, Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
abstract String getNoPermMessage();
|
abstract String getNoPermMessage();
|
||||||
|
|
||||||
abstract String getEnableMessage();
|
abstract String getEnableMessage();
|
||||||
|
|
||||||
abstract String getDisableMessage();
|
abstract String getDisableMessage();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -56,16 +56,19 @@ public class GuiTraceShow {
|
|||||||
swInventory.addCloseCallback(clickType -> ShowModeParameterMap.remove(player));
|
swInventory.addCloseCallback(clickType -> ShowModeParameterMap.remove(player));
|
||||||
setActiveShow(player, swInventory);
|
setActiveShow(player, swInventory);
|
||||||
|
|
||||||
SWItem water = new SWItem(Material.TNT, "§eWasser §7Positionen", Arrays.asList("§7Zeigt alles TNT, welches", "§7im Wasser explodiert ist."), false, clickType -> {});
|
SWItem water = new SWItem(Material.TNT, "§eWasser §7Positionen", Arrays.asList("§7Zeigt alles TNT, welches", "§7im Wasser explodiert ist."), false, clickType -> {
|
||||||
|
});
|
||||||
swInventory.setItem(5, water);
|
swInventory.setItem(5, water);
|
||||||
swInventory.setCallback(5, clickType -> toggleHideTNTinWaterExploded(player, swInventory, water));
|
swInventory.setCallback(5, clickType -> toggleHideTNTinWaterExploded(player, swInventory, water));
|
||||||
|
|
||||||
SWItem interpolateY = new SWItem(Material.QUARTZ_STAIRS, "§eInterpolation §7Y-Achse", Arrays.asList("§7Zeigt die Interpolation", "§7auf der Y-Achse."), false, clickType -> {});
|
SWItem interpolateY = new SWItem(Material.QUARTZ_STAIRS, "§eInterpolation §7Y-Achse", Arrays.asList("§7Zeigt die Interpolation", "§7auf der Y-Achse."), false, clickType -> {
|
||||||
|
});
|
||||||
swInventory.setItem(6, interpolateY);
|
swInventory.setItem(6, interpolateY);
|
||||||
swInventory.setCallback(6, clickType -> toggleInterpolateYPosition(player, swInventory, interpolateY));
|
swInventory.setCallback(6, clickType -> toggleInterpolateYPosition(player, swInventory, interpolateY));
|
||||||
|
|
||||||
Material xzMaterial = VersionedCallable.call(new VersionedCallable<>(TNTTracer_12::getTraceXZMaterial, 8), new VersionedCallable<>(TNTTracer_15::getTraceXZMaterial, 14));
|
Material xzMaterial = VersionedCallable.call(new VersionedCallable<>(TNTTracer_12::getTraceXZMaterial, 8), new VersionedCallable<>(TNTTracer_15::getTraceXZMaterial, 14));
|
||||||
SWItem interpolateXZ = new SWItem(xzMaterial, (byte) 7, "§eInterpolation §7XZ-Achse", Arrays.asList("§7Zeigt die Interpolation", "§7auf der XZ-Achse."), false, clickType -> {});
|
SWItem interpolateXZ = new SWItem(xzMaterial, (byte) 7, "§eInterpolation §7XZ-Achse", Arrays.asList("§7Zeigt die Interpolation", "§7auf der XZ-Achse."), false, clickType -> {
|
||||||
|
});
|
||||||
swInventory.setItem(7, interpolateXZ);
|
swInventory.setItem(7, interpolateXZ);
|
||||||
swInventory.setCallback(7, clickType -> toggleInterpolateXZPosition(player, swInventory, interpolateXZ));
|
swInventory.setCallback(7, clickType -> toggleInterpolateXZPosition(player, swInventory, interpolateXZ));
|
||||||
// Water Bucket (-water)
|
// Water Bucket (-water)
|
||||||
|
@ -42,9 +42,9 @@ public class RoundedTNTPosition {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public RoundedTNTPosition(double x, double y, double z) {
|
public RoundedTNTPosition(double x, double y, double z) {
|
||||||
this.x = (int)(x * factor);
|
this.x = (int) (x * factor);
|
||||||
this.y = (int)(y * factor);
|
this.y = (int) (y * factor);
|
||||||
this.z = (int)(z * factor);
|
this.z = (int) (z * factor);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -49,7 +49,7 @@ public class TNTPosition {
|
|||||||
return exploded;
|
return exploded;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Record.TNTRecord getRecord(){
|
public Record.TNTRecord getRecord() {
|
||||||
return record;
|
return record;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,7 +87,7 @@ public class RecordStateMachine {
|
|||||||
return recorder.getStartTime();
|
return recorder.getStartTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void postClear(){
|
public static void postClear() {
|
||||||
if (recorder == null) return;
|
if (recorder == null) return;
|
||||||
recorder.postClear();
|
recorder.postClear();
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@ package de.steamwar.bausystem.tracer.record;
|
|||||||
|
|
||||||
public enum RecordStatus {
|
public enum RecordStatus {
|
||||||
|
|
||||||
RECORD("§aan", true,"§cTNT-Tracer muss gestoppt werden"),
|
RECORD("§aan", true, "§cTNT-Tracer muss gestoppt werden"),
|
||||||
RECORD_AUTO("§aan", true, "§cTNT-Tracer darf nicht aufnehmen"),
|
RECORD_AUTO("§aan", true, "§cTNT-Tracer darf nicht aufnehmen"),
|
||||||
IDLE("§caus", false, "§cAuto-Tracer gestoppt"),
|
IDLE("§caus", false, "§cAuto-Tracer gestoppt"),
|
||||||
IDLE_AUTO("§eauto", false, "§aAuto-Tracer gestartet");
|
IDLE_AUTO("§eauto", false, "§aAuto-Tracer gestartet");
|
||||||
|
@ -34,13 +34,13 @@ public class TraceAutoHandler implements Listener {
|
|||||||
private BukkitTask task;
|
private BukkitTask task;
|
||||||
private int lastExplosion = 0; // Time since the last explosion in ticks
|
private int lastExplosion = 0; // Time since the last explosion in ticks
|
||||||
|
|
||||||
public void enable(){
|
public void enable() {
|
||||||
Bukkit.getPluginManager().registerEvents(this, BauSystem.getPlugin());
|
Bukkit.getPluginManager().registerEvents(this, BauSystem.getPlugin());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void disable(){
|
public void disable() {
|
||||||
HandlerList.unregisterAll(this);
|
HandlerList.unregisterAll(this);
|
||||||
if(task != null){
|
if (task != null) {
|
||||||
task.cancel();
|
task.cancel();
|
||||||
task = null;
|
task = null;
|
||||||
}
|
}
|
||||||
@ -52,13 +52,13 @@ public class TraceAutoHandler implements Listener {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
lastExplosion = 0;
|
lastExplosion = 0;
|
||||||
if(task == null){
|
if (task == null) {
|
||||||
RecordStateMachine.autoRecord();
|
RecordStateMachine.autoRecord();
|
||||||
task = Bukkit.getScheduler().runTaskTimer(BauSystem.getPlugin(), this::run, 1, 1);
|
task = Bukkit.getScheduler().runTaskTimer(BauSystem.getPlugin(), this::run, 1, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void run(){
|
private void run() {
|
||||||
lastExplosion++;
|
lastExplosion++;
|
||||||
|
|
||||||
if (lastExplosion > 80) {
|
if (lastExplosion > 80) {
|
||||||
|
@ -55,7 +55,7 @@ public class Record {
|
|||||||
return record;
|
return record;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void clear(){
|
public void clear() {
|
||||||
tnt.clear();
|
tnt.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -87,7 +87,7 @@ public class Record {
|
|||||||
add(tntPrimed, true);
|
add(tntPrimed, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<TNTPosition> getPositions(){
|
public List<TNTPosition> getPositions() {
|
||||||
return positions;
|
return positions;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,5 +23,6 @@ import de.steamwar.bausystem.tracer.TNTPosition;
|
|||||||
|
|
||||||
public interface ShowMode {
|
public interface ShowMode {
|
||||||
void show(TNTPosition position);
|
void show(TNTPosition position);
|
||||||
|
|
||||||
void hide();
|
void hide();
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,6 @@ package de.steamwar.bausystem.tracer.show;
|
|||||||
|
|
||||||
import de.steamwar.bausystem.BauSystem;
|
import de.steamwar.bausystem.BauSystem;
|
||||||
import de.steamwar.bausystem.tracer.TNTPosition;
|
import de.steamwar.bausystem.tracer.TNTPosition;
|
||||||
import de.steamwar.bausystem.tracer.show.mode.*;
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
@ -13,7 +12,8 @@ import java.util.HashMap;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public class TraceShowManager implements Listener {
|
public class TraceShowManager implements Listener {
|
||||||
private TraceShowManager() {}
|
private TraceShowManager() {
|
||||||
|
}
|
||||||
|
|
||||||
private static final Map<Player, ShowMode> showModes = new HashMap<>();
|
private static final Map<Player, ShowMode> showModes = new HashMap<>();
|
||||||
|
|
||||||
|
@ -32,13 +32,13 @@ public class AFKStopper implements Listener {
|
|||||||
|
|
||||||
private int minutesAfk;
|
private int minutesAfk;
|
||||||
|
|
||||||
public AFKStopper(){
|
public AFKStopper() {
|
||||||
minutesAfk = 0;
|
minutesAfk = 0;
|
||||||
Bukkit.getPluginManager().registerEvents(this, BauSystem.getPlugin());
|
Bukkit.getPluginManager().registerEvents(this, BauSystem.getPlugin());
|
||||||
Bukkit.getScheduler().runTaskTimer(BauSystem.getPlugin(), () -> {
|
Bukkit.getScheduler().runTaskTimer(BauSystem.getPlugin(), () -> {
|
||||||
switch(minutesAfk){
|
switch (minutesAfk) {
|
||||||
case 5:
|
case 5:
|
||||||
for(Player p : Bukkit.getOnlinePlayers())
|
for (Player p : Bukkit.getOnlinePlayers())
|
||||||
p.kickPlayer("§cAuf diesem Server ist seit 5 Minuten nichts passiert.");
|
p.kickPlayer("§cAuf diesem Server ist seit 5 Minuten nichts passiert.");
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
@ -50,7 +50,7 @@ public class AFKStopper implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerMove(PlayerMoveEvent event){
|
public void onPlayerMove(PlayerMoveEvent event) {
|
||||||
minutesAfk = 0;
|
minutesAfk = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,7 @@ import java.util.LinkedList;
|
|||||||
import java.util.ListIterator;
|
import java.util.ListIterator;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public class AutoLoader extends IAutoLoader implements Listener {
|
public class AutoLoader extends AbstractAutoLoader implements Listener {
|
||||||
|
|
||||||
private static final Map<Player, AutoLoader> players = new HashMap<>();
|
private static final Map<Player, AutoLoader> players = new HashMap<>();
|
||||||
|
|
||||||
@ -184,11 +184,11 @@ public class AutoLoader extends IAutoLoader implements Listener {
|
|||||||
if (lastLocation != null && lastLocation.distance(event.getClickedBlock().getLocation()) <= 1) return;
|
if (lastLocation != null && lastLocation.distance(event.getClickedBlock().getLocation()) <= 1) return;
|
||||||
|
|
||||||
if (detoloader.useActive) {
|
if (detoloader.useActive) {
|
||||||
new IAutoLoader.RedstoneActivation(this, event.getClickedBlock().getLocation()
|
new AbstractAutoLoader.RedstoneActivation(this, event.getClickedBlock().getLocation()
|
||||||
, detoloader.getActivation() == 0 ? getLastActivation() : detoloader.getActivation()
|
, detoloader.getActivation() == 0 ? getLastActivation() : detoloader.getActivation()
|
||||||
, detoloader.isActive());
|
, detoloader.isActive());
|
||||||
} else {
|
} else {
|
||||||
new IAutoLoader.TemporaryActivation(this, event.getClickedBlock().getLocation()
|
new AbstractAutoLoader.TemporaryActivation(this, event.getClickedBlock().getLocation()
|
||||||
, detoloader.getActivation());
|
, detoloader.getActivation());
|
||||||
}
|
}
|
||||||
print(detoloader.addBack ? "§e" + detoloader.getBlock() + " betätigt" :
|
print(detoloader.addBack ? "§e" + detoloader.getBlock() + " betätigt" :
|
||||||
@ -251,9 +251,9 @@ public class AutoLoader extends IAutoLoader implements Listener {
|
|||||||
return lastActivation;
|
return lastActivation;
|
||||||
}
|
}
|
||||||
|
|
||||||
class TNTPlaceAction extends IAutoLoader.LoaderAction {
|
class TNTPlaceAction extends AbstractAutoLoader.LoaderAction {
|
||||||
|
|
||||||
TNTPlaceAction(IAutoLoader loader, Location location){
|
TNTPlaceAction(AbstractAutoLoader loader, Location location){
|
||||||
super(loader, location);
|
super(loader, location);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,7 +77,7 @@ public class BauScoreboard implements Listener {
|
|||||||
|
|
||||||
int i = strings.size();
|
int i = strings.size();
|
||||||
HashMap<String, Integer> result = new HashMap<>();
|
HashMap<String, Integer> result = new HashMap<>();
|
||||||
for(String s : strings)
|
for (String s : strings)
|
||||||
result.put(s, i--);
|
result.put(s, i--);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -33,10 +33,10 @@ public class ClipboardListener implements Listener {
|
|||||||
private static final String CLIPBOARD_SCHEMNAME = "//copy";
|
private static final String CLIPBOARD_SCHEMNAME = "//copy";
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onLogin(PlayerJoinEvent e){
|
public void onLogin(PlayerJoinEvent e) {
|
||||||
try {
|
try {
|
||||||
Schematic schematic = Schematic.getSchemFromDB(CLIPBOARD_SCHEMNAME, e.getPlayer().getUniqueId());
|
Schematic schematic = Schematic.getSchemFromDB(CLIPBOARD_SCHEMNAME, e.getPlayer().getUniqueId());
|
||||||
if(schematic != null){
|
if (schematic != null) {
|
||||||
schematic.loadToPlayer(e.getPlayer());
|
schematic.loadToPlayer(e.getPlayer());
|
||||||
}
|
}
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
@ -45,20 +45,20 @@ public class ClipboardListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onLogout(PlayerQuitEvent e){
|
public void onLogout(PlayerQuitEvent e) {
|
||||||
UUID playerUUID = e.getPlayer().getUniqueId();
|
UUID playerUUID = e.getPlayer().getUniqueId();
|
||||||
Schematic schematic = Schematic.getSchemFromDB(CLIPBOARD_SCHEMNAME, playerUUID);
|
Schematic schematic = Schematic.getSchemFromDB(CLIPBOARD_SCHEMNAME, playerUUID);
|
||||||
boolean newSchem = false;
|
boolean newSchem = false;
|
||||||
if(schematic == null){
|
if (schematic == null) {
|
||||||
Schematic.createSchem(CLIPBOARD_SCHEMNAME, playerUUID, "", SchematicType.Normal);
|
Schematic.createSchem(CLIPBOARD_SCHEMNAME, playerUUID, "", SchematicType.Normal);
|
||||||
schematic = Schematic.getSchemFromDB(CLIPBOARD_SCHEMNAME, playerUUID);
|
schematic = Schematic.getSchemFromDB(CLIPBOARD_SCHEMNAME, playerUUID);
|
||||||
newSchem = true;
|
newSchem = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
try{
|
try {
|
||||||
schematic.saveFromPlayer(e.getPlayer());
|
schematic.saveFromPlayer(e.getPlayer());
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
if(newSchem)
|
if (newSchem)
|
||||||
schematic.remove();
|
schematic.remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -68,7 +68,7 @@ public class Detonator implements Listener {
|
|||||||
List<int[]> locs = new ArrayList<>();
|
List<int[]> locs = new ArrayList<>();
|
||||||
for (int i = 0; i < 128; i++) {
|
for (int i = 0; i < 128; i++) {
|
||||||
NamespacedKey key = new NamespacedKey(BauSystem.getPlugin(), DETO_PREFIX + i);
|
NamespacedKey key = new NamespacedKey(BauSystem.getPlugin(), DETO_PREFIX + i);
|
||||||
if(container.has(key, PersistentDataType.INTEGER_ARRAY))
|
if (container.has(key, PersistentDataType.INTEGER_ARRAY))
|
||||||
locs.add(container.get(key, PersistentDataType.INTEGER_ARRAY));
|
locs.add(container.get(key, PersistentDataType.INTEGER_ARRAY));
|
||||||
}
|
}
|
||||||
return new Detonator(player, locs.toArray(new int[0][0]));
|
return new Detonator(player, locs.toArray(new int[0][0]));
|
||||||
@ -84,7 +84,7 @@ public class Detonator implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static ItemStack toggleLocation(ItemStack item, Player player, Detoloader detoloader, Location location) {
|
public static ItemStack toggleLocation(ItemStack item, Player player, Detoloader detoloader, Location location) {
|
||||||
if(VersionedCallable.call(new VersionedCallable<>(() -> PLAYER_LOCS.computeIfAbsent(player, player1 -> new HashSet<>()).stream().anyMatch(activation -> activation.location.equals(location)), 12),
|
if (VersionedCallable.call(new VersionedCallable<>(() -> PLAYER_LOCS.computeIfAbsent(player, player1 -> new HashSet<>()).stream().anyMatch(activation -> activation.location.equals(location)), 12),
|
||||||
new VersionedCallable<>(() -> hasLocation(item, location), 15))) {
|
new VersionedCallable<>(() -> hasLocation(item, location), 15))) {
|
||||||
DetonatorListener.print(player, detoloader.addBack ? "§e" + detoloader.getBlock() + " entfernt" :
|
DetonatorListener.print(player, detoloader.addBack ? "§e" + detoloader.getBlock() + " entfernt" :
|
||||||
detoloader.getBlock(), Detonator.getDetonator(player, player.getInventory().getItemInMainHand()).getLocs().size() - 1);
|
detoloader.getBlock(), Detonator.getDetonator(player, player.getInventory().getItemInMainHand()).getLocs().size() - 1);
|
||||||
@ -92,10 +92,10 @@ public class Detonator implements Listener {
|
|||||||
PLAYER_LOCS.computeIfAbsent(player, player1 -> new HashSet<>()).removeIf(activation -> activation.location.equals(location));
|
PLAYER_LOCS.computeIfAbsent(player, player1 -> new HashSet<>()).removeIf(activation -> activation.location.equals(location));
|
||||||
return item;
|
return item;
|
||||||
}, 12), new VersionedCallable<>(() -> removeLocation(item, location), 15));
|
}, 12), new VersionedCallable<>(() -> removeLocation(item, location), 15));
|
||||||
}else {
|
} else {
|
||||||
DetonatorListener.print(player, detoloader.addBack ? "§e" + detoloader.getBlock() + " hinzugefügt" :
|
DetonatorListener.print(player, detoloader.addBack ? "§e" + detoloader.getBlock() + " hinzugefügt" :
|
||||||
detoloader.getBlock(), Math.min(Detonator.getDetonator(player, player.getInventory().getItemInMainHand()).getLocs().size() + 1, 128));
|
detoloader.getBlock(), Math.min(Detonator.getDetonator(player, player.getInventory().getItemInMainHand()).getLocs().size() + 1, 128));
|
||||||
if(detoloader.getActivation() == 0)
|
if (detoloader.getActivation() == 0)
|
||||||
return VersionedCallable.call(new VersionedCallable<>(() -> {
|
return VersionedCallable.call(new VersionedCallable<>(() -> {
|
||||||
PLAYER_LOCS.computeIfAbsent(player, player1 -> new HashSet<>()).add(new Detoloader.DetonatorActivation(location));
|
PLAYER_LOCS.computeIfAbsent(player, player1 -> new HashSet<>()).add(new Detoloader.DetonatorActivation(location));
|
||||||
return item;
|
return item;
|
||||||
@ -151,7 +151,7 @@ public class Detonator implements Listener {
|
|||||||
|
|
||||||
public static ItemStack pushLocToDetonator(ItemStack item, Detoloader.DetonatorActivation detoloader) {
|
public static ItemStack pushLocToDetonator(ItemStack item, Detoloader.DetonatorActivation detoloader) {
|
||||||
int slot = getFreeSlot(item);
|
int slot = getFreeSlot(item);
|
||||||
if(slot == -1)
|
if (slot == -1)
|
||||||
throw new SecurityException("Der Detonator ist auf 128 Positionen Limitiert");
|
throw new SecurityException("Der Detonator ist auf 128 Positionen Limitiert");
|
||||||
ItemMeta meta = item.getItemMeta();
|
ItemMeta meta = item.getItemMeta();
|
||||||
Location block = detoloader.location;
|
Location block = detoloader.location;
|
||||||
@ -181,9 +181,9 @@ public class Detonator implements Listener {
|
|||||||
PersistentDataContainer container = meta.getPersistentDataContainer();
|
PersistentDataContainer container = meta.getPersistentDataContainer();
|
||||||
for (int i = 0; i < 128; i++) {
|
for (int i = 0; i < 128; i++) {
|
||||||
NamespacedKey key = new NamespacedKey(BauSystem.getPlugin(), DETO_PREFIX + i);
|
NamespacedKey key = new NamespacedKey(BauSystem.getPlugin(), DETO_PREFIX + i);
|
||||||
if(container.has(key, PersistentDataType.INTEGER_ARRAY)) {
|
if (container.has(key, PersistentDataType.INTEGER_ARRAY)) {
|
||||||
int[] locs = container.get(key, PersistentDataType.INTEGER_ARRAY);
|
int[] locs = container.get(key, PersistentDataType.INTEGER_ARRAY);
|
||||||
if(locs[0] == location.getBlockX() && locs[1] == location.getBlockY() && locs[2] == location.getBlockZ())
|
if (locs[0] == location.getBlockX() && locs[1] == location.getBlockY() && locs[2] == location.getBlockZ())
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@ public class DetonatorListener implements Listener {
|
|||||||
if (VersionedCallable.call(new VersionedCallable<>(() -> event.getItem().isSimilar(Detonator.WAND), 12),
|
if (VersionedCallable.call(new VersionedCallable<>(() -> event.getItem().isSimilar(Detonator.WAND), 12),
|
||||||
new VersionedCallable<>(() -> event.getItem().getItemMeta().getPersistentDataContainer().has(new NamespacedKey(BauSystem.getPlugin(), "deto"), PersistentDataType.BYTE), 15))) {
|
new VersionedCallable<>(() -> event.getItem().getItemMeta().getPersistentDataContainer().has(new NamespacedKey(BauSystem.getPlugin(), "deto"), PersistentDataType.BYTE), 15))) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
if(Welt.noPermission(player, Permission.world)){
|
if (Welt.noPermission(player, Permission.world)) {
|
||||||
player.sendMessage(BauSystem.PREFIX + "§cDu darfst hier nicht den Detonator nutzen");
|
player.sendMessage(BauSystem.PREFIX + "§cDu darfst hier nicht den Detonator nutzen");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -37,7 +37,7 @@ public class DetonatorListener implements Listener {
|
|||||||
if (detoloader == null) {
|
if (detoloader == null) {
|
||||||
return;
|
return;
|
||||||
} else if (detoloader.activation == -1) {
|
} else if (detoloader.activation == -1) {
|
||||||
print(player, detoloader.getBlock(), detoloader.addBack?Detonator.getDetonator(player, player.getInventory().getItemInMainHand()).getLocs().size():0);
|
print(player, detoloader.getBlock(), detoloader.addBack ? Detonator.getDetonator(player, player.getInventory().getItemInMainHand()).getLocs().size() : 0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -50,7 +50,7 @@ public class DetonatorListener implements Listener {
|
|||||||
player.getInventory().setItemInMainHand(Detonator.setLocation(player, item, new Detoloader.DetonatorActivation(detoloader.activation, event.getClickedBlock().getLocation())));
|
player.getInventory().setItemInMainHand(Detonator.setLocation(player, item, new Detoloader.DetonatorActivation(detoloader.activation, event.getClickedBlock().getLocation())));
|
||||||
}
|
}
|
||||||
print(player, detoloader.addBack ? "§e" + detoloader.getBlock() + " gesetzt" :
|
print(player, detoloader.addBack ? "§e" + detoloader.getBlock() + " gesetzt" :
|
||||||
detoloader.getBlock(), detoloader.addBack?Detonator.getDetonator(player, player.getInventory().getItemInMainHand()).getLocs().size():0);
|
detoloader.getBlock(), detoloader.addBack ? Detonator.getDetonator(player, player.getInventory().getItemInMainHand()).getLocs().size() : 0);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case RIGHT_CLICK_AIR:
|
case RIGHT_CLICK_AIR:
|
||||||
@ -58,7 +58,7 @@ public class DetonatorListener implements Listener {
|
|||||||
Detonator.execute(player);
|
Detonator.execute(player);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}catch (RuntimeException e) {
|
} catch (RuntimeException e) {
|
||||||
player.sendMessage(BauSystem.PREFIX + "§c" + e.getMessage());
|
player.sendMessage(BauSystem.PREFIX + "§c" + e.getMessage());
|
||||||
player.getInventory().setItemInMainHand(item);
|
player.getInventory().setItemInMainHand(item);
|
||||||
}
|
}
|
||||||
@ -68,7 +68,7 @@ public class DetonatorListener implements Listener {
|
|||||||
public static void print(Player player, String message, int size) {
|
public static void print(Player player, String message, int size) {
|
||||||
if (size == 0) {
|
if (size == 0) {
|
||||||
player.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(message));
|
player.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(message));
|
||||||
}else {
|
} else {
|
||||||
player.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(message + " §8" + size));
|
player.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(message + " §8" + size));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,10 +23,10 @@ public class PredefinedBook {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static List<PredefinedBook> getBooks() {
|
public static List<PredefinedBook> getBooks() {
|
||||||
if(bookCache != null)
|
if (bookCache != null)
|
||||||
return bookCache;
|
return bookCache;
|
||||||
List<PredefinedBook> books = new ArrayList<>();
|
List<PredefinedBook> books = new ArrayList<>();
|
||||||
for (String book:configuration.getKeys(false)) {
|
for (String book : configuration.getKeys(false)) {
|
||||||
ConfigurationSection section = Objects.requireNonNull(configuration.getConfigurationSection(book));
|
ConfigurationSection section = Objects.requireNonNull(configuration.getConfigurationSection(book));
|
||||||
books.add(new PredefinedBook(section));
|
books.add(new PredefinedBook(section));
|
||||||
}
|
}
|
||||||
@ -52,7 +52,7 @@ public class PredefinedBook {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ItemStack toItemStack() {
|
public ItemStack toItemStack() {
|
||||||
if(finishedBook != null)
|
if (finishedBook != null)
|
||||||
return finishedBook;
|
return finishedBook;
|
||||||
ItemStack book = new ItemStack(getBookMat());
|
ItemStack book = new ItemStack(getBookMat());
|
||||||
BookMeta meta = (BookMeta) book.getItemMeta();
|
BookMeta meta = (BookMeta) book.getItemMeta();
|
||||||
@ -94,22 +94,22 @@ public class PredefinedBook {
|
|||||||
int currentLine = 0;
|
int currentLine = 0;
|
||||||
int currentpage = 0;
|
int currentpage = 0;
|
||||||
boolean first = true;
|
boolean first = true;
|
||||||
for (String line:lines) {
|
for (String line : lines) {
|
||||||
int linesPlus = (int) Math.ceil((double) line.length() / charsPerLine);
|
int linesPlus = (int) Math.ceil((double) line.length() / charsPerLine);
|
||||||
currentLine += linesPlus;
|
currentLine += linesPlus;
|
||||||
if(currentLine >= 14 || line.equals("!")) {
|
if (currentLine >= 14 || line.equals("!")) {
|
||||||
currentLine = linesPlus;
|
currentLine = linesPlus;
|
||||||
currentpage++;
|
currentpage++;
|
||||||
if(currentpage > 50)
|
if (currentpage > 50)
|
||||||
throw new IllegalStateException("Book " + name + " has more pages than 50");
|
throw new IllegalStateException("Book " + name + " has more pages than 50");
|
||||||
pages.add(currentpage, new StringBuilder());
|
pages.add(currentpage, new StringBuilder());
|
||||||
first = true;
|
first = true;
|
||||||
if(line.equals("!"))
|
if (line.equals("!"))
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if(!first) {
|
if (!first) {
|
||||||
pages.get(currentpage).append("\n");
|
pages.get(currentpage).append("\n");
|
||||||
}else {
|
} else {
|
||||||
first = false;
|
first = false;
|
||||||
}
|
}
|
||||||
pages.get(currentpage).append(line);
|
pages.get(currentpage).append(line);
|
||||||
|
@ -53,7 +53,7 @@ public class RegionListener implements Listener {
|
|||||||
|
|
||||||
Player p = e.getPlayer();
|
Player p = e.getPlayer();
|
||||||
|
|
||||||
if (Welt.noPermission(p, Permission.worldedit)){
|
if (Welt.noPermission(p, Permission.worldedit)) {
|
||||||
p.sendMessage(BauSystem.PREFIX + "§cDu darfst hier kein WorldEdit benutzen");
|
p.sendMessage(BauSystem.PREFIX + "§cDu darfst hier kein WorldEdit benutzen");
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
}
|
}
|
||||||
@ -63,7 +63,7 @@ public class RegionListener implements Listener {
|
|||||||
public void onBlockBreak(BlockBreakEvent e) {
|
public void onBlockBreak(BlockBreakEvent e) {
|
||||||
Player p = e.getPlayer();
|
Player p = e.getPlayer();
|
||||||
|
|
||||||
if (Welt.noPermission(p, Permission.build)){
|
if (Welt.noPermission(p, Permission.build)) {
|
||||||
p.sendMessage(BauSystem.PREFIX + "§cDu darfst hier keine Blöcke abbauen");
|
p.sendMessage(BauSystem.PREFIX + "§cDu darfst hier keine Blöcke abbauen");
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
}
|
}
|
||||||
@ -74,12 +74,12 @@ public class RegionListener implements Listener {
|
|||||||
if (Core.getVersion() == 12) return;
|
if (Core.getVersion() == 12) return;
|
||||||
|
|
||||||
Player p = e.getPlayer();
|
Player p = e.getPlayer();
|
||||||
try{
|
try {
|
||||||
if (Welt.noPermission(p, Permission.build)){
|
if (Welt.noPermission(p, Permission.build)) {
|
||||||
p.sendMessage(BauSystem.PREFIX + "§cDu darfst hier keine Blöcke platzieren");
|
p.sendMessage(BauSystem.PREFIX + "§cDu darfst hier keine Blöcke platzieren");
|
||||||
e.setBuildable(false);
|
e.setBuildable(false);
|
||||||
}
|
}
|
||||||
}catch(NullPointerException ex){
|
} catch (NullPointerException ex) {
|
||||||
//ignored, caused by worldedit brushes
|
//ignored, caused by worldedit brushes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -89,12 +89,12 @@ public class RegionListener implements Listener {
|
|||||||
if (Core.getVersion() == 15) return;
|
if (Core.getVersion() == 15) return;
|
||||||
|
|
||||||
Player p = e.getPlayer();
|
Player p = e.getPlayer();
|
||||||
try{
|
try {
|
||||||
if (Welt.noPermission(p, Permission.build)){
|
if (Welt.noPermission(p, Permission.build)) {
|
||||||
p.sendMessage(BauSystem.PREFIX + "§cDu darfst hier keine Blöcke platzieren");
|
p.sendMessage(BauSystem.PREFIX + "§cDu darfst hier keine Blöcke platzieren");
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
}
|
}
|
||||||
}catch(NullPointerException ex){
|
} catch (NullPointerException ex) {
|
||||||
//ignored, caused by worldedit brushes
|
//ignored, caused by worldedit brushes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -102,8 +102,8 @@ public class RegionListener implements Listener {
|
|||||||
private static final String[] shortcutCommands = {"//1", "//2", "//90", "//-90", "//180", "//p", "//c", "//flopy", "//floppy", "//flopyp", "//floppyp", "//u", "//r"};
|
private static final String[] shortcutCommands = {"//1", "//2", "//90", "//-90", "//180", "//p", "//c", "//flopy", "//floppy", "//flopyp", "//floppyp", "//u", "//r"};
|
||||||
|
|
||||||
private boolean isWorldEditCommand(String command) {
|
private boolean isWorldEditCommand(String command) {
|
||||||
for(String shortcut : shortcutCommands)
|
for (String shortcut : shortcutCommands)
|
||||||
if(command.startsWith(shortcut))
|
if (command.startsWith(shortcut))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return VersionedCallable.call(new VersionedCallable<>(() -> RegionListener_12.isWorldEditCommand(command), 8),
|
return VersionedCallable.call(new VersionedCallable<>(() -> RegionListener_12.isWorldEditCommand(command), 8),
|
||||||
@ -112,9 +112,9 @@ public class RegionListener implements Listener {
|
|||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onSignChange(SignChangeEvent event) {
|
public void onSignChange(SignChangeEvent event) {
|
||||||
for(int i = 0; i <= 3; ++i) {
|
for (int i = 0; i <= 3; ++i) {
|
||||||
String line = event.getLine(i);
|
String line = event.getLine(i);
|
||||||
if(line == null)
|
if (line == null)
|
||||||
continue;
|
continue;
|
||||||
line = ChatColor.translateAlternateColorCodes('&', line);
|
line = ChatColor.translateAlternateColorCodes('&', line);
|
||||||
event.setLine(i, line);
|
event.setLine(i, line);
|
||||||
@ -123,7 +123,7 @@ public class RegionListener implements Listener {
|
|||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void editSign(PlayerInteractEvent event) {
|
public void editSign(PlayerInteractEvent event) {
|
||||||
if(event.getAction() != Action.RIGHT_CLICK_BLOCK ||
|
if (event.getAction() != Action.RIGHT_CLICK_BLOCK ||
|
||||||
!event.getClickedBlock().getType().name().contains("SIGN") ||
|
!event.getClickedBlock().getType().name().contains("SIGN") ||
|
||||||
!event.getPlayer().isSneaking() ||
|
!event.getPlayer().isSneaking() ||
|
||||||
(event.getItem() != null && event.getItem().getType() != Material.AIR))
|
(event.getItem() != null && event.getItem().getType() != Material.AIR))
|
||||||
@ -143,7 +143,7 @@ public class RegionListener implements Listener {
|
|||||||
ProtocolLibrary.getProtocolManager().addPacketListener(new PacketAdapter(BauSystem.getPlugin(), PacketType.Play.Client.UPDATE_SIGN) {
|
ProtocolLibrary.getProtocolManager().addPacketListener(new PacketAdapter(BauSystem.getPlugin(), PacketType.Play.Client.UPDATE_SIGN) {
|
||||||
@Override
|
@Override
|
||||||
public void onPacketReceiving(PacketEvent event) {
|
public void onPacketReceiving(PacketEvent event) {
|
||||||
if(!event.getPlayer().equals(player))
|
if (!event.getPlayer().equals(player))
|
||||||
return;
|
return;
|
||||||
Bukkit.getScheduler().runTask(BauSystem.getPlugin(), () -> {
|
Bukkit.getScheduler().runTask(BauSystem.getPlugin(), () -> {
|
||||||
PacketContainer packetContainer = event.getPacket();
|
PacketContainer packetContainer = event.getPacket();
|
||||||
@ -151,7 +151,7 @@ public class RegionListener implements Listener {
|
|||||||
String[] lines = packetContainer.getStringArrays().read(0);
|
String[] lines = packetContainer.getStringArrays().read(0);
|
||||||
|
|
||||||
Block signLoc = position.toLocation(player.getWorld()).getBlock();
|
Block signLoc = position.toLocation(player.getWorld()).getBlock();
|
||||||
if(!signLoc.getType().name().contains("SIGN"))
|
if (!signLoc.getType().name().contains("SIGN"))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Sign sign = ((Sign) signLoc.getState());
|
Sign sign = ((Sign) signLoc.getState());
|
||||||
|
@ -50,7 +50,7 @@ public class ScriptListener implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.HIGH)
|
@EventHandler(priority = EventPriority.HIGH)
|
||||||
public void onLeftClick(PlayerInteractEvent event) {
|
public void onLeftClick(PlayerInteractEvent event) {
|
||||||
ItemStack item = event.getItem();
|
ItemStack item = event.getItem();
|
||||||
if(item == null || isNoBook(item) || item.getItemMeta() == null)
|
if (item == null || isNoBook(item) || item.getItemMeta() == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (CommandScript.BOOK.getItemMeta() != null && item.getItemMeta().hasDisplayName() && item.getItemMeta().getDisplayName().equals(CommandScript.BOOK.getItemMeta().getDisplayName())) {
|
if (CommandScript.BOOK.getItemMeta() != null && item.getItemMeta().hasDisplayName() && item.getItemMeta().getDisplayName().equals(CommandScript.BOOK.getItemMeta().getDisplayName())) {
|
||||||
@ -71,7 +71,7 @@ public class ScriptListener implements Listener {
|
|||||||
new ScriptExecutor((BookMeta) item.getItemMeta(), event.getPlayer());
|
new ScriptExecutor((BookMeta) item.getItemMeta(), event.getPlayer());
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isNoBook(ItemStack item){
|
private boolean isNoBook(ItemStack item) {
|
||||||
return VersionedCallable.call(new VersionedCallable<>(() -> ScriptListener_12.isNoBook(item), 8),
|
return VersionedCallable.call(new VersionedCallable<>(() -> ScriptListener_12.isNoBook(item), 8),
|
||||||
new VersionedCallable<>(() -> ScriptListener_15.isNoBook(item), 15));
|
new VersionedCallable<>(() -> ScriptListener_15.isNoBook(item), 15));
|
||||||
}
|
}
|
||||||
@ -88,7 +88,7 @@ public class ScriptListener implements Listener {
|
|||||||
public ScriptExecutor(BookMeta bookMeta, Player player) {
|
public ScriptExecutor(BookMeta bookMeta, Player player) {
|
||||||
this.player = player;
|
this.player = player;
|
||||||
|
|
||||||
for(String page : bookMeta.getPages()) {
|
for (String page : bookMeta.getPages()) {
|
||||||
for (String command : page.split("\n")) {
|
for (String command : page.split("\n")) {
|
||||||
if (command.startsWith("#") || command.trim().isEmpty()) continue;
|
if (command.startsWith("#") || command.trim().isEmpty()) continue;
|
||||||
if (command.startsWith(".")) {
|
if (command.startsWith(".")) {
|
||||||
|
@ -312,7 +312,7 @@ public class TNTSimulator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static double clamp(double d) {
|
private static double clamp(double d) {
|
||||||
return (int)(d * 10000) * 0.0001;
|
return (int) (d * 10000) * 0.0001;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void delete() {
|
public void delete() {
|
||||||
|
@ -58,7 +58,8 @@ public class TPSUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static double getTps(TPSWatcher.TPSType tpsType) {
|
public static double getTps(TPSWatcher.TPSType tpsType) {
|
||||||
if (TPSUtils.isWarping()) return TPSWatcher.getTPS(tpsType, Math.max(CommandTPSLimiter.getCurrentTPSLimit(), 20));
|
if (TPSUtils.isWarping())
|
||||||
|
return TPSWatcher.getTPS(tpsType, Math.max(CommandTPSLimiter.getCurrentTPSLimit(), 20));
|
||||||
return TPSWatcher.getTPS(tpsType);
|
return TPSWatcher.getTPS(tpsType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,17 +28,18 @@ import org.bukkit.entity.Player;
|
|||||||
|
|
||||||
public class Welt {
|
public class Welt {
|
||||||
|
|
||||||
private Welt(){}
|
private Welt() {
|
||||||
|
}
|
||||||
|
|
||||||
public static boolean noPermission(Player member, Permission perm){
|
public static boolean noPermission(Player member, Permission perm) {
|
||||||
if(member.getUniqueId().equals(BauSystem.getOwner()))
|
if (member.getUniqueId().equals(BauSystem.getOwner()))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
BauweltMember member1 = BauweltMember.getBauMember(BauSystem.getOwner(), member.getUniqueId());
|
BauweltMember member1 = BauweltMember.getBauMember(BauSystem.getOwner(), member.getUniqueId());
|
||||||
if(member1 == null)
|
if (member1 == null)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
switch(perm){
|
switch (perm) {
|
||||||
case build:
|
case build:
|
||||||
return !member1.isBuild();
|
return !member1.isBuild();
|
||||||
case worldedit:
|
case worldedit:
|
||||||
@ -52,12 +53,12 @@ public class Welt {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void sendMessages(Player p, boolean ableTo, BauweltMember target, String what){
|
private static void sendMessages(Player p, boolean ableTo, BauweltMember target, String what) {
|
||||||
Player z = Bukkit.getPlayer(SteamwarUser.get(target.getMemberID()).getUUID());
|
Player z = Bukkit.getPlayer(SteamwarUser.get(target.getMemberID()).getUUID());
|
||||||
if (z != null) {
|
if (z != null) {
|
||||||
if (ableTo) {
|
if (ableTo) {
|
||||||
z.sendMessage(BauSystem.PREFIX + "§aDu kannst nun auf der Welt von §6" + p.getName() + "§a " + what);
|
z.sendMessage(BauSystem.PREFIX + "§aDu kannst nun auf der Welt von §6" + p.getName() + "§a " + what);
|
||||||
}else {
|
} else {
|
||||||
z.sendMessage(BauSystem.PREFIX + "§cDu kannst nun nicht mehr auf der Welt von §6" + p.getName() + "§c " + what);
|
z.sendMessage(BauSystem.PREFIX + "§cDu kannst nun nicht mehr auf der Welt von §6" + p.getName() + "§c " + what);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -68,17 +69,17 @@ public class Welt {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void toggleBuild(Player p, BauweltMember target){
|
public static void toggleBuild(Player p, BauweltMember target) {
|
||||||
target.setBuild(!target.isBuild());
|
target.setBuild(!target.isBuild());
|
||||||
sendMessages(p, target.isBuild(), target, "bauen");
|
sendMessages(p, target.isBuild(), target, "bauen");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void toggleWE(Player p, BauweltMember target){
|
public static void toggleWE(Player p, BauweltMember target) {
|
||||||
target.setWorldEdit(!target.isWorldEdit());
|
target.setWorldEdit(!target.isWorldEdit());
|
||||||
sendMessages(p, target.isWorldEdit(), target, "WorldEdit verwenden");
|
sendMessages(p, target.isWorldEdit(), target, "WorldEdit verwenden");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void toggleWorld(Player p, BauweltMember target){
|
public static void toggleWorld(Player p, BauweltMember target) {
|
||||||
target.setWorld(!target.isWorld());
|
target.setWorld(!target.isWorld());
|
||||||
sendMessages(p, target.isWorld(), target, "Einstellungen vornehmen");
|
sendMessages(p, target.isWorld(), target, "Einstellungen vornehmen");
|
||||||
}
|
}
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren