13
0

Multiple bugfixes

Dieser Commit ist enthalten in:
Lixfel 2020-11-02 12:02:50 +01:00
Ursprung 3f65da5775
Commit 18dc4754cf
7 geänderte Dateien mit 27 neuen und 8 gelöschten Zeilen

Datei anzeigen

@ -90,6 +90,8 @@ public class Config {
public static final int BorderMaxY; public static final int BorderMaxY;
public static final int BorderMaxZ; public static final int BorderMaxZ;
public static final int AdditionalSpectatorArea;
static{ static{
World world = Bukkit.getWorlds().get(0); World world = Bukkit.getWorlds().get(0);
File worldConfigFile = new File(world.getWorldFolder(), "config.yml"); File worldConfigFile = new File(world.getWorldFolder(), "config.yml");
@ -180,6 +182,8 @@ public class Config {
BorderMaxY = spectateconfig.getInt("Border.MaxY"); BorderMaxY = spectateconfig.getInt("Border.MaxY");
BorderMaxZ = spectateconfig.getInt("Border.MaxZ"); BorderMaxZ = spectateconfig.getInt("Border.MaxZ");
AdditionalSpectatorArea = spectateconfig.getInt("AdditionalSpectatorArea");
boolean teamRedRotate; boolean teamRedRotate;
boolean teamBlueRotate; boolean teamBlueRotate;
if(TeamBluetoReddistanceX > 0){ if(TeamBluetoReddistanceX > 0){

Datei anzeigen

@ -53,8 +53,8 @@ public class PlayerSetup {
} }
private static boolean locInArena(Location loc){ private static boolean locInArena(Location loc){
return Config.ArenaMinX <= loc.getX() && Config.ArenaMaxX >= loc.getX() && return Config.ArenaMinX - Config.AdditionalSpectatorArea <= loc.getX() && Config.ArenaMaxX + Config.AdditionalSpectatorArea >= loc.getX() &&
Config.ArenaMinZ <= loc.getZ() && Config.ArenaMaxZ >= loc.getZ(); Config.ArenaMinZ - Config.AdditionalSpectatorArea <= loc.getZ() && Config.ArenaMaxZ + Config.AdditionalSpectatorArea >= loc.getZ();
} }
private static void playerJoinsLobby(Player player){ private static void playerJoinsLobby(Player player){

Datei anzeigen

@ -25,6 +25,7 @@ import de.steamwar.spectatesystem.listener.PlayerListener;
import de.steamwar.spectatesystem.listener.CancelListener; import de.steamwar.spectatesystem.listener.CancelListener;
import de.steamwar.spectatesystem.listener.JoinListener; import de.steamwar.spectatesystem.listener.JoinListener;
import de.steamwar.spectatesystem.listener.PlayerSeatListener; import de.steamwar.spectatesystem.listener.PlayerSeatListener;
import de.steamwar.spectatesystem.util.WorldLoader;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
@ -52,6 +53,7 @@ public class SpectateSystem extends JavaPlugin {
} }
Bukkit.getPluginCommand("replay").setExecutor(new ReplayCommand()); Bukkit.getPluginCommand("replay").setExecutor(new ReplayCommand());
WorldLoader.configureForceLoad();
} }
@Override @Override

Datei anzeigen

@ -36,7 +36,7 @@ public class ReplayCommand implements CommandExecutor {
} }
try { try {
new FightfileConnection(new File(args[0])); new FightfileConnection(new File(args[0] + ".recording"));
} catch (IOException e) { } catch (IOException e) {
Bukkit.getLogger().log(Level.WARNING, "Could not start reading file", e); Bukkit.getLogger().log(Level.WARNING, "Could not start reading file", e);
sender.sendMessage("§eSteam§8War» §cReplay konnte nicht gestartet werden."); sender.sendMessage("§eSteam§8War» §cReplay konnte nicht gestartet werden.");

Datei anzeigen

@ -68,11 +68,13 @@ public abstract class REntity {
} }
public static void removeAll(){ public static void removeAll(){
int entity_counter = 0;
while(!entities.isEmpty()){ while(!entities.isEmpty()){
entity_counter++;
REntity entity = entities.values().iterator().next(); REntity entity = entities.values().iterator().next();
System.out.println("Has to remove manually entity " + entity.internalId);
entity.remove(); entity.remove();
} }
System.out.println("Has to remove manually " + entity_counter + " entities!");
} }
public void move(double x, double y, double z, float yaw, float pitch, byte headYaw){ public void move(double x, double y, double z, float yaw, float pitch, byte headYaw){

Datei anzeigen

@ -38,10 +38,13 @@ public class BlockTextCreator {
private static BlockArrayClipboard[] createText(String text){ private static BlockArrayClipboard[] createText(String text){
List<BlockArrayClipboard> result = new ArrayList<>(); List<BlockArrayClipboard> result = new ArrayList<>();
for(char c : text.toUpperCase().toCharArray()){ for(char c : text.toUpperCase().toCharArray()){
try {
try{ try{
result.add((BlockArrayClipboard) new SpongeSchematicReader(new NBTInputStream(new GZIPInputStream(new FileInputStream(new File(SpectateSystem.get().getDataFolder(), "text/" + c + ".schem"))))).read()); result.add((BlockArrayClipboard) new SpongeSchematicReader(new NBTInputStream(new GZIPInputStream(new FileInputStream(new File(SpectateSystem.get().getDataFolder(), "text/" + c + ".schem"))))).read());
} catch (FileNotFoundException e) { } catch (FileNotFoundException e) {
Bukkit.getLogger().log(Level.WARNING, "Could not display character " + c + " due to missing file!"); Bukkit.getLogger().log(Level.WARNING, "Could not display character " + c + " due to missing file!");
result.add((BlockArrayClipboard) new SpongeSchematicReader(new NBTInputStream(new GZIPInputStream(new FileInputStream(new File(SpectateSystem.get().getDataFolder(), "text/?.schem"))))).read());
}
}catch (IOException e) { }catch (IOException e) {
throw new SecurityException("Could not load text", e); throw new SecurityException("Could not load text", e);
} }

Datei anzeigen

@ -36,6 +36,14 @@ public class WorldLoader {
private static final World world = Bukkit.getWorlds().get(0); private static final World world = Bukkit.getWorlds().get(0);
public static void configureForceLoad(){
for(int cX = Config.ArenaMinX / 16; cX <= Config.ArenaMaxX / 16; cX++){
for(int cZ = Config.ArenaMinZ / 16; cZ <= Config.ArenaMaxZ / 16; cZ++){
world.setChunkForceLoaded(cX, cZ, true);
}
}
}
public static void reloadWorld(){ public static void reloadWorld(){
Bukkit.getScheduler().runTask(SpectateSystem.get(), () -> { Bukkit.getScheduler().runTask(SpectateSystem.get(), () -> {
REntity.removeAll(); REntity.removeAll();