Merge remote-tracking branch 'origin/Hells_bells' into Hells_bells
Dieser Commit ist enthalten in:
Commit
5ca3217579
@ -19,12 +19,10 @@
|
|||||||
|
|
||||||
package de.steamwar.fightsystem.fight;
|
package de.steamwar.fightsystem.fight;
|
||||||
|
|
||||||
import com.sk89q.worldedit.EditSession;
|
|
||||||
import com.sk89q.worldedit.MaxChangedBlocksException;
|
|
||||||
import com.sk89q.worldedit.Vector;
|
import com.sk89q.worldedit.Vector;
|
||||||
|
import com.sk89q.worldedit.WorldEditException;
|
||||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||||
import de.steamwar.fightsystem.utils.Region;
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.DyeColor;
|
import org.bukkit.DyeColor;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@ -52,17 +50,25 @@ class FightTeam_12 {
|
|||||||
team.setOption(Team.Option.NAME_TAG_VISIBILITY, Team.OptionStatus.FOR_OWN_TEAM);
|
team.setOption(Team.Option.NAME_TAG_VISIBILITY, Team.OptionStatus.FOR_OWN_TEAM);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void replaceTeamColor(Clipboard clipboard, DyeColor c) throws WorldEditException {
|
||||||
|
FightTeam_8.replaceTeamColor(clipboard, c);
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
Vector minimum = clipboard.getRegion().getMinimumPoint();
|
||||||
static void replaceTeamColor(EditSession e, DyeColor c, Region r){
|
BaseBlock concrete = new BaseBlock(CONCRETE.getId(), c.getWoolData());
|
||||||
FightTeam_8.replaceTeamColor(e, c, r);
|
BaseBlock concretePowder = new BaseBlock(CONCRETE_POWDER.getId(), c.getWoolData());
|
||||||
CuboidRegion region = new CuboidRegion(new Vector(r.getMinX(), r.getMinY(), r.getMinZ()), new Vector(r.getMaxX(), r.getMaxY(), r.getMaxZ()));
|
|
||||||
try {
|
for(int x = 0; x < clipboard.getDimensions().getX(); x++){
|
||||||
e.replaceBlocks(region, CONCRETE_SET, new BaseBlock(CONCRETE.getId(), c.getWoolData()));
|
for(int y = 0; y < clipboard.getDimensions().getY(); y++){
|
||||||
e.replaceBlocks(region, CONCRETE_POWDER_SET, new BaseBlock(CONCRETE_POWDER.getId(), c.getWoolData()));
|
for(int z = 0; z < clipboard.getDimensions().getZ(); z++){
|
||||||
} catch (MaxChangedBlocksException ex) {
|
Vector pos = minimum.add(x, y, z);
|
||||||
//ignored
|
BaseBlock block = clipboard.getBlock(pos);
|
||||||
|
if(block.equals(CONCRETE)){
|
||||||
|
clipboard.setBlock(pos, concrete);
|
||||||
|
}else if(block.equals(CONCRETE_POWDER)){
|
||||||
|
clipboard.setBlock(pos, concretePowder);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
e.flushQueue();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,6 @@
|
|||||||
package de.steamwar.fightsystem.fight;
|
package de.steamwar.fightsystem.fight;
|
||||||
|
|
||||||
import com.sk89q.worldedit.EditSession;
|
import com.sk89q.worldedit.EditSession;
|
||||||
import com.sk89q.worldedit.MaxChangedBlocksException;
|
|
||||||
import com.sk89q.worldedit.WorldEdit;
|
import com.sk89q.worldedit.WorldEdit;
|
||||||
import com.sk89q.worldedit.WorldEditException;
|
import com.sk89q.worldedit.WorldEditException;
|
||||||
import com.sk89q.worldedit.bukkit.BukkitWorld;
|
import com.sk89q.worldedit.bukkit.BukkitWorld;
|
||||||
@ -50,43 +49,60 @@ import org.bukkit.scoreboard.Team;
|
|||||||
|
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
public class FightTeam_14 {
|
public class FightTeam_14 {
|
||||||
private FightTeam_14(){}
|
private FightTeam_14(){}
|
||||||
|
|
||||||
private static final Set<BaseBlock> WOOL_SET = Collections.singleton(Objects.requireNonNull(BlockTypes.PINK_WOOL).getDefaultState().toBaseBlock());
|
private static final BaseBlock WOOL = Objects.requireNonNull(BlockTypes.PINK_WOOL).getDefaultState().toBaseBlock();
|
||||||
private static final Set<BaseBlock> CLAY_SET = Collections.singleton(Objects.requireNonNull(BlockTypes.PINK_TERRACOTTA).getDefaultState().toBaseBlock());
|
private static final BaseBlock CLAY = Objects.requireNonNull(BlockTypes.PINK_TERRACOTTA).getDefaultState().toBaseBlock();
|
||||||
private static final Set<BaseBlock> GLASS_SET = Collections.singleton(Objects.requireNonNull(BlockTypes.PINK_STAINED_GLASS).getDefaultState().toBaseBlock());
|
private static final BaseBlock GLASS = Objects.requireNonNull(BlockTypes.PINK_STAINED_GLASS).getDefaultState().toBaseBlock();
|
||||||
private static final Set<BaseBlock> GLASS_PANE_SET = Collections.singleton(Objects.requireNonNull(BlockTypes.PINK_STAINED_GLASS_PANE).getDefaultState().toBaseBlock());
|
private static final BaseBlock GLASS_PANE = Objects.requireNonNull(BlockTypes.PINK_STAINED_GLASS_PANE).getDefaultState().toBaseBlock();
|
||||||
private static final Set<BaseBlock> CONCRETE_SET = Collections.singleton(Objects.requireNonNull(BlockTypes.PINK_CONCRETE).getDefaultState().toBaseBlock());
|
private static final BaseBlock CONCRETE = Objects.requireNonNull(BlockTypes.PINK_CONCRETE).getDefaultState().toBaseBlock();
|
||||||
private static final Set<BaseBlock> CONCRETE_POWDER_SET = Collections.singleton(Objects.requireNonNull(BlockTypes.PINK_CONCRETE_POWDER).getDefaultState().toBaseBlock());
|
private static final BaseBlock CONCRETE_POWDER = Objects.requireNonNull(BlockTypes.PINK_CONCRETE_POWDER).getDefaultState().toBaseBlock();
|
||||||
private static final Set<BaseBlock> CARPET_SET = Collections.singleton(Objects.requireNonNull(BlockTypes.PINK_CARPET).getDefaultState().toBaseBlock());
|
private static final BaseBlock CARPET = Objects.requireNonNull(BlockTypes.PINK_CARPET).getDefaultState().toBaseBlock();
|
||||||
|
|
||||||
static void setTeamColor(Team team, ChatColor color){
|
static void setTeamColor(Team team, ChatColor color){
|
||||||
team.setColor(color);
|
team.setColor(color);
|
||||||
team.setOption(Team.Option.NAME_TAG_VISIBILITY, Team.OptionStatus.FOR_OWN_TEAM);
|
team.setOption(Team.Option.NAME_TAG_VISIBILITY, Team.OptionStatus.FOR_OWN_TEAM);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void replaceTeamColor(EditSession e, DyeColor c, Region r){
|
static void replaceTeamColor(Clipboard clipboard, DyeColor c) throws WorldEditException {
|
||||||
CuboidRegion region = new CuboidRegion(BlockVector3.at(r.getMinX(), r.getMinY(), r.getMinZ()), BlockVector3.at(r.getMaxX(), r.getMaxY(), r.getMaxZ()));
|
BlockVector3 minimum = clipboard.getRegion().getMinimumPoint();
|
||||||
try {
|
BaseBlock wool = Objects.requireNonNull(BlockTypes.get(c.name().toLowerCase() + "_wool")).getDefaultState().toBaseBlock();
|
||||||
e.replaceBlocks(region, WOOL_SET, Objects.requireNonNull(BlockTypes.get(c.name().toLowerCase() + "_wool")).getDefaultState().toBaseBlock());
|
BaseBlock clay = Objects.requireNonNull(BlockTypes.get(c.name().toLowerCase() + "_terracotta")).getDefaultState().toBaseBlock();
|
||||||
e.replaceBlocks(region, CARPET_SET, Objects.requireNonNull(BlockTypes.get(c.name().toLowerCase() + "_carpet")).getDefaultState().toBaseBlock());
|
BaseBlock glass = Objects.requireNonNull(BlockTypes.get(c.name().toLowerCase() + "_stained_glass")).getDefaultState().toBaseBlock();
|
||||||
e.replaceBlocks(region, CLAY_SET, Objects.requireNonNull(BlockTypes.get(c.name().toLowerCase() + "_terracotta")).getDefaultState().toBaseBlock());
|
BaseBlock glassPane = Objects.requireNonNull(BlockTypes.get(c.name().toLowerCase() + "_stained_glass_pane")).getDefaultState().toBaseBlock();
|
||||||
e.replaceBlocks(region, GLASS_SET, Objects.requireNonNull(BlockTypes.get(c.name().toLowerCase() + "_stained_glass")).getDefaultState().toBaseBlock());
|
BaseBlock carpet = Objects.requireNonNull(BlockTypes.get(c.name().toLowerCase() + "_carpet")).getDefaultState().toBaseBlock();
|
||||||
e.replaceBlocks(region, GLASS_PANE_SET, Objects.requireNonNull(BlockTypes.get(c.name().toLowerCase() + "_stained_glass_pane")).getDefaultState().toBaseBlock());
|
BaseBlock concrete = Objects.requireNonNull(BlockTypes.get(c.name().toLowerCase() + "_concrete")).getDefaultState().toBaseBlock();
|
||||||
e.replaceBlocks(region, CONCRETE_SET, Objects.requireNonNull(BlockTypes.get(c.name().toLowerCase() + "_concrete")).getDefaultState().toBaseBlock());
|
BaseBlock concretePowder = Objects.requireNonNull(BlockTypes.get(c.name().toLowerCase() + "_concrete_powder")).getDefaultState().toBaseBlock();
|
||||||
e.replaceBlocks(region, CONCRETE_POWDER_SET, Objects.requireNonNull(BlockTypes.get(c.name().toLowerCase() + "_concrete_powder")).getDefaultState().toBaseBlock());
|
|
||||||
} catch (MaxChangedBlocksException ex) {
|
for(int x = 0; x < clipboard.getDimensions().getX(); x++){
|
||||||
//ignored
|
for(int y = 0; y < clipboard.getDimensions().getY(); y++){
|
||||||
|
for(int z = 0; z < clipboard.getDimensions().getZ(); z++){
|
||||||
|
BlockVector3 pos = minimum.add(x, y, z);
|
||||||
|
BaseBlock block = clipboard.getFullBlock(pos);
|
||||||
|
if(block.equals(WOOL)){
|
||||||
|
clipboard.setBlock(pos, wool);
|
||||||
|
}else if(block.equals(CLAY)){
|
||||||
|
clipboard.setBlock(pos, clay);
|
||||||
|
}else if(block.equals(GLASS)){
|
||||||
|
clipboard.setBlock(pos, glass);
|
||||||
|
}else if(block.equals(GLASS_PANE)){
|
||||||
|
clipboard.setBlock(pos, glassPane);
|
||||||
|
}else if(block.equals(CARPET)){
|
||||||
|
clipboard.setBlock(pos, carpet);
|
||||||
|
}else if(block.equals(CONCRETE)){
|
||||||
|
clipboard.setBlock(pos, concrete);
|
||||||
|
}else if(block.equals(CONCRETE_POWDER)){
|
||||||
|
clipboard.setBlock(pos, concretePowder);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
e.flushSession();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static EditSession pasteSchematic(Clipboard clipboard, Region region, boolean rotate) throws Schematic.WrongVersionException, IOException, NoClipboardException {
|
static void pasteSchematic(Clipboard clipboard, Region region, boolean rotate) throws NoClipboardException {
|
||||||
BlockVector3 paste = BlockVector3.at(region.centerX(), region.getMinY(), region.centerZ());
|
BlockVector3 paste = BlockVector3.at(region.centerX(), region.getMinY(), region.centerZ());
|
||||||
|
|
||||||
World w = new BukkitWorld(Bukkit.getWorlds().get(0));
|
World w = new BukkitWorld(Bukkit.getWorlds().get(0));
|
||||||
@ -116,7 +132,6 @@ public class FightTeam_14 {
|
|||||||
ch.setTransform(aT);
|
ch.setTransform(aT);
|
||||||
Operations.completeBlindly(ch.createPaste(e).to(v).build());
|
Operations.completeBlindly(ch.createPaste(e).to(v).build());
|
||||||
e.flushSession();
|
e.flushSession();
|
||||||
return e;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean checkPistonMoving(Block block){
|
public static boolean checkPistonMoving(Block block){
|
||||||
|
@ -19,7 +19,10 @@
|
|||||||
|
|
||||||
package de.steamwar.fightsystem.fight;
|
package de.steamwar.fightsystem.fight;
|
||||||
|
|
||||||
import com.sk89q.worldedit.*;
|
import com.sk89q.worldedit.EditSession;
|
||||||
|
import com.sk89q.worldedit.Vector;
|
||||||
|
import com.sk89q.worldedit.WorldEdit;
|
||||||
|
import com.sk89q.worldedit.WorldEditException;
|
||||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||||
import com.sk89q.worldedit.bukkit.BukkitWorld;
|
import com.sk89q.worldedit.bukkit.BukkitWorld;
|
||||||
import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard;
|
import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard;
|
||||||
@ -45,8 +48,6 @@ import org.bukkit.scoreboard.Team;
|
|||||||
|
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
public class FightTeam_8 {
|
public class FightTeam_8 {
|
||||||
private FightTeam_8(){}
|
private FightTeam_8(){}
|
||||||
@ -65,32 +66,40 @@ public class FightTeam_8 {
|
|||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
private static final BaseBlock CARPET = new BaseBlock(Material.CARPET.getId(), COLOR_TO_REPLACE);
|
private static final BaseBlock CARPET = new BaseBlock(Material.CARPET.getId(), COLOR_TO_REPLACE);
|
||||||
|
|
||||||
private static final Set<BaseBlock> WOOL_SET = Collections.singleton(WOOL);
|
|
||||||
private static final Set<BaseBlock> CLAY_SET = Collections.singleton(CLAY);
|
|
||||||
private static final Set<BaseBlock> GLASS_SET = Collections.singleton(GLASS);
|
|
||||||
private static final Set<BaseBlock> GLASS_PANE_SET = Collections.singleton(GLASS_PANE);
|
|
||||||
private static final Set<BaseBlock> CARPET_SET = Collections.singleton(CARPET);
|
|
||||||
|
|
||||||
static void setTeamColor(Team team, ChatColor color){
|
static void setTeamColor(Team team, ChatColor color){
|
||||||
team.setPrefix("§" + color.getChar());
|
team.setPrefix("§" + color.getChar());
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
static void replaceTeamColor(Clipboard clipboard, DyeColor c) throws WorldEditException {
|
||||||
static void replaceTeamColor(EditSession e, DyeColor c, Region r){
|
Vector minimum = clipboard.getRegion().getMinimumPoint();
|
||||||
CuboidRegion region = new CuboidRegion(new Vector(r.getMinX(), r.getMinY(), r.getMinZ()), new Vector(r.getMaxX(), r.getMaxY(), r.getMaxZ()));
|
BaseBlock wool = new BaseBlock(WOOL.getId(), c.getWoolData());
|
||||||
try {
|
BaseBlock clay = new BaseBlock(CLAY.getId(), c.getWoolData());
|
||||||
e.replaceBlocks(region, WOOL_SET, new BaseBlock(WOOL.getId(), c.getWoolData()));
|
BaseBlock glass = new BaseBlock(GLASS.getId(), c.getWoolData());
|
||||||
e.replaceBlocks(region, CLAY_SET, new BaseBlock(CLAY.getId(), c.getWoolData()));
|
BaseBlock glassPane = new BaseBlock(GLASS_PANE.getId(), c.getWoolData());
|
||||||
e.replaceBlocks(region, GLASS_SET, new BaseBlock(GLASS.getId(), c.getWoolData()));
|
BaseBlock carpet = new BaseBlock(CARPET.getId(), c.getWoolData());
|
||||||
e.replaceBlocks(region, GLASS_PANE_SET, new BaseBlock(GLASS_PANE.getId(), c.getWoolData()));
|
|
||||||
e.replaceBlocks(region, CARPET_SET, new BaseBlock(CARPET.getId(), c.getWoolData()));
|
for(int x = 0; x < clipboard.getDimensions().getX(); x++){
|
||||||
} catch (MaxChangedBlocksException ex) {
|
for(int y = 0; y < clipboard.getDimensions().getY(); y++){
|
||||||
// ignore, will never occur
|
for(int z = 0; z < clipboard.getDimensions().getZ(); z++){
|
||||||
|
Vector pos = minimum.add(x, y, z);
|
||||||
|
BaseBlock block = clipboard.getBlock(pos);
|
||||||
|
if(block.equals(WOOL)){
|
||||||
|
clipboard.setBlock(pos, wool);
|
||||||
|
}else if(block.equals(CLAY)){
|
||||||
|
clipboard.setBlock(pos, clay);
|
||||||
|
}else if(block.equals(GLASS)){
|
||||||
|
clipboard.setBlock(pos, glass);
|
||||||
|
}else if(block.equals(GLASS_PANE)){
|
||||||
|
clipboard.setBlock(pos, glassPane);
|
||||||
|
}else if(block.equals(CARPET)){
|
||||||
|
clipboard.setBlock(pos, carpet);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
e.flushQueue();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static EditSession pasteSchematic(Clipboard clipboard, Region paste, boolean rotate) throws Schematic.WrongVersionException, IOException, NoClipboardException {
|
static void pasteSchematic(Clipboard clipboard, Region paste, boolean rotate) throws NoClipboardException {
|
||||||
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(paste.centerX(), paste.getMinY(), paste.centerZ());
|
Vector v = new Vector(paste.centerX(), paste.getMinY(), paste.centerZ());
|
||||||
@ -118,7 +127,6 @@ public class FightTeam_8 {
|
|||||||
ch.setTransform(aT);
|
ch.setTransform(aT);
|
||||||
Operations.completeBlindly(ch.createPaste(e, w.getWorldData()).to(v).build());
|
Operations.completeBlindly(ch.createPaste(e, w.getWorldData()).to(v).build());
|
||||||
e.flushQueue();
|
e.flushQueue();
|
||||||
return e;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean checkPistonMoving(Block block){
|
public static boolean checkPistonMoving(Block block){
|
||||||
|
@ -77,6 +77,7 @@ public abstract class Countdown {
|
|||||||
time = totalTime;
|
time = totalTime;
|
||||||
task = Bukkit.getScheduler().runTaskTimer(FightSystem.getPlugin(), this::count, 20, 20);
|
task = Bukkit.getScheduler().runTaskTimer(FightSystem.getPlugin(), this::count, 20, 20);
|
||||||
currentCountdowns.add(this);
|
currentCountdowns.add(this);
|
||||||
|
show();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void disable() {
|
public void disable() {
|
||||||
@ -97,9 +98,10 @@ public abstract class Countdown {
|
|||||||
smallestTime = countdown.time;
|
smallestTime = countdown.time;
|
||||||
}
|
}
|
||||||
|
|
||||||
smallestTime -= 2;
|
smallestTime--;
|
||||||
for(Countdown countdown : currentCountdowns){
|
for(Countdown countdown : currentCountdowns){
|
||||||
countdown.time -= smallestTime;
|
countdown.time -= smallestTime;
|
||||||
|
countdown.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
Bukkit.broadcastMessage(FightSystem.PREFIX + "§aBeide Teams waren damit einverstanden, zum nächsten Event zu beschleunigen!");
|
Bukkit.broadcastMessage(FightSystem.PREFIX + "§aBeide Teams waren damit einverstanden, zum nächsten Event zu beschleunigen!");
|
||||||
@ -116,9 +118,12 @@ public abstract class Countdown {
|
|||||||
return time;
|
return time;
|
||||||
}
|
}
|
||||||
|
|
||||||
void count(){
|
private void count() {
|
||||||
time--;
|
time--;
|
||||||
|
show();
|
||||||
|
}
|
||||||
|
|
||||||
|
void show(){
|
||||||
switch (time) {
|
switch (time) {
|
||||||
case 900: case 600: case 300: case 180: case 120:
|
case 900: case 600: case 300: case 180: case 120:
|
||||||
broadcast("§rNoch §a" + time / 60 + " §rMinuten " + countdownCounting());
|
broadcast("§rNoch §a" + time / 60 + " §rMinuten " + countdownCounting());
|
||||||
|
@ -52,9 +52,7 @@ public class EnternCountdown extends Countdown {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
void count(){
|
void show(){
|
||||||
time--;
|
|
||||||
|
|
||||||
Player player = fightPlayer.getPlayer();
|
Player player = fightPlayer.getPlayer();
|
||||||
switch (time) {
|
switch (time) {
|
||||||
case 900: case 600: case 300: case 180: case 120:
|
case 900: case 600: case 300: case 180: case 120:
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
package de.steamwar.fightsystem.fight;
|
package de.steamwar.fightsystem.fight;
|
||||||
|
|
||||||
import com.sk89q.worldedit.EditSession;
|
import com.sk89q.worldedit.WorldEditException;
|
||||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||||
import de.steamwar.core.VersionedRunnable;
|
import de.steamwar.core.VersionedRunnable;
|
||||||
import de.steamwar.fightsystem.ArenaMode;
|
import de.steamwar.fightsystem.ArenaMode;
|
||||||
@ -33,7 +33,10 @@ import de.steamwar.fightsystem.utils.ColorConverter;
|
|||||||
import de.steamwar.fightsystem.utils.Region;
|
import de.steamwar.fightsystem.utils.Region;
|
||||||
import de.steamwar.sql.NoClipboardException;
|
import de.steamwar.sql.NoClipboardException;
|
||||||
import de.steamwar.sql.Schematic;
|
import de.steamwar.sql.Schematic;
|
||||||
import org.bukkit.*;
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.DyeColor;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.World;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.HandlerList;
|
import org.bukkit.event.HandlerList;
|
||||||
@ -120,23 +123,23 @@ public class FightSchematic extends StateDependent {
|
|||||||
try {
|
try {
|
||||||
VersionedRunnable.call(new VersionedRunnable(() -> {
|
VersionedRunnable.call(new VersionedRunnable(() -> {
|
||||||
try {
|
try {
|
||||||
EditSession e = FightTeam_8.pasteSchematic(clipboard, region, rotate);
|
FightTeam_8.replaceTeamColor(clipboard, c);
|
||||||
FightTeam_8.replaceTeamColor(e, c, region);
|
FightTeam_8.pasteSchematic(clipboard, region, rotate);
|
||||||
} catch (Schematic.WrongVersionException | IOException | NoClipboardException ex) {
|
} catch (NoClipboardException | WorldEditException ex) {
|
||||||
throw new SecurityException("Error pasting arena in schematic", ex);
|
throw new SecurityException("Error pasting arena in schematic", ex);
|
||||||
}
|
}
|
||||||
}, 8), new VersionedRunnable(() -> {
|
}, 8), new VersionedRunnable(() -> {
|
||||||
try {
|
try {
|
||||||
EditSession e = FightTeam_8.pasteSchematic(clipboard, region, rotate);
|
FightTeam_12.replaceTeamColor(clipboard, c);
|
||||||
FightTeam_12.replaceTeamColor(e, c, region);
|
FightTeam_8.pasteSchematic(clipboard, region, rotate);
|
||||||
} catch (Schematic.WrongVersionException | IOException | NoClipboardException ex) {
|
} catch (NoClipboardException | WorldEditException ex) {
|
||||||
throw new SecurityException("Error pasting arena in schematic", ex);
|
throw new SecurityException("Error pasting arena in schematic", ex);
|
||||||
}
|
}
|
||||||
}, 12), new VersionedRunnable(() -> {
|
}, 12), new VersionedRunnable(() -> {
|
||||||
try {
|
try {
|
||||||
EditSession e = FightTeam_14.pasteSchematic(clipboard, region, rotate);
|
FightTeam_14.replaceTeamColor(clipboard, c);
|
||||||
FightTeam_14.replaceTeamColor(e, c, region);
|
FightTeam_14.pasteSchematic(clipboard, region, rotate);
|
||||||
} catch (Schematic.WrongVersionException | IOException | NoClipboardException ex) {
|
} catch (NoClipboardException | WorldEditException ex) {
|
||||||
throw new SecurityException("Error pasting arena in schematic", ex);
|
throw new SecurityException("Error pasting arena in schematic", ex);
|
||||||
}
|
}
|
||||||
}, 14));
|
}, 14));
|
||||||
|
@ -69,14 +69,6 @@ public class FightScoreboard implements Listener, ScoreboardCallback {
|
|||||||
SWScoreboard.removeScoreboard(event.getPlayer());
|
SWScoreboard.removeScoreboard(event.getPlayer());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void teamScoreboard(FightTeam fightTeam){
|
|
||||||
setTitle(fightTeam.getColoredName());
|
|
||||||
fightTeam.getPlayers().forEach(fp -> {
|
|
||||||
if(fp.isLiving())
|
|
||||||
addScore(fightTeam.getPrefix() + fp.getPlayer().getName(), (int) Math.ceil(fp.getPlayer().getHealth()));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private void generalScoreboard(){
|
private void generalScoreboard(){
|
||||||
setTitle("§eKampf");
|
setTitle("§eKampf");
|
||||||
List<String> scoreList = new ArrayList<>();
|
List<String> scoreList = new ArrayList<>();
|
||||||
@ -105,16 +97,20 @@ public class FightScoreboard implements Listener, ScoreboardCallback {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void teamScoreboard(FightTeam fightTeam){
|
||||||
|
fightTeam.getPlayers().forEach(fp -> {
|
||||||
|
if(fp.isLiving())
|
||||||
|
addScore(fightTeam.getPrefix() + fp.getPlayer().getName(), (int) Math.ceil(fp.getPlayer().getHealth()));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
private void updateScoreboard() {
|
private void updateScoreboard() {
|
||||||
scores.clear();
|
scores.clear();
|
||||||
switch((index++ / 10) % 3){
|
if ((index++ / 5) % 2 == 0) {
|
||||||
case 0:
|
|
||||||
generalScoreboard();
|
generalScoreboard();
|
||||||
break;
|
} else {
|
||||||
case 1:
|
setTitle(Fight.getBlueTeam().getColoredName() + " " + Fight.getRedTeam().getColoredName());
|
||||||
teamScoreboard(Fight.getBlueTeam());
|
teamScoreboard(Fight.getBlueTeam());
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
teamScoreboard(Fight.getRedTeam());
|
teamScoreboard(Fight.getRedTeam());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,6 +29,7 @@ import org.bukkit.Material;
|
|||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.block.BlockBreakEvent;
|
import org.bukkit.event.block.BlockBreakEvent;
|
||||||
|
import org.bukkit.event.block.BlockDispenseEvent;
|
||||||
import org.bukkit.event.block.BlockPlaceEvent;
|
import org.bukkit.event.block.BlockPlaceEvent;
|
||||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||||
import org.bukkit.event.inventory.InventoryDragEvent;
|
import org.bukkit.event.inventory.InventoryDragEvent;
|
||||||
@ -123,4 +124,10 @@ public class InFightInventory implements Listener {
|
|||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onBlockDispense(BlockDispenseEvent e) {
|
||||||
|
if(e.getItem().getType() == Material.TNT)
|
||||||
|
e.setCancelled(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -39,9 +39,8 @@ public class PistonListener implements Listener {
|
|||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void handlePistonExtend(BlockPistonExtendEvent e){
|
public void handlePistonExtend(BlockPistonExtendEvent e){
|
||||||
BlockFace b = e.getDirection().getOppositeFace();
|
|
||||||
for(Block block : e.getBlocks()){
|
for(Block block : e.getBlocks()){
|
||||||
if(!Config.BlueExtendRegion.inRegion(block.getRelative(b)) && !Config.RedExtendRegion.inRegion(block.getRelative(b))){
|
if(!Config.BlueExtendRegion.inRegion(block) && !Config.RedExtendRegion.inRegion(block)){
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -50,9 +49,8 @@ public class PistonListener implements Listener {
|
|||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void handlePistonRetract(BlockPistonRetractEvent e){
|
public void handlePistonRetract(BlockPistonRetractEvent e){
|
||||||
BlockFace b = e.getDirection().getOppositeFace();
|
|
||||||
for(Block block : e.getBlocks()){
|
for(Block block : e.getBlocks()){
|
||||||
if(!Config.BlueExtendRegion.inRegion(block.getRelative(b)) && !Config.RedExtendRegion.inRegion(block.getRelative(b))) {
|
if(!Config.BlueExtendRegion.inRegion(block) && !Config.RedExtendRegion.inRegion(block)) {
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren