The big refactoring #238
47
FightSystem_10/src/de/steamwar/fightsystem/fight/FightWorld_10.java
Normale Datei
47
FightSystem_10/src/de/steamwar/fightsystem/fight/FightWorld_10.java
Normale Datei
@ -0,0 +1,47 @@
|
|||||||
|
/*
|
||||||
|
This file is a part of the SteamWar software.
|
||||||
|
|
||||||
|
Copyright (C) 2020 SteamWar.de-Serverteam
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Affero General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Affero General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Affero General Public License
|
||||||
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package de.steamwar.fightsystem.fight;
|
||||||
|
|
||||||
|
import de.steamwar.core.events.ChunkListener;
|
||||||
|
import net.minecraft.server.v1_10_R1.Chunk;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.World;
|
||||||
|
import org.bukkit.craftbukkit.v1_10_R1.CraftWorld;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
class FightWorld_10 {
|
||||||
|
private FightWorld_10(){}
|
||||||
|
|
||||||
|
static void resetChunk(World world, World backup, int x, int z){
|
||||||
|
net.minecraft.server.v1_10_R1.World w = ((CraftWorld) world).getHandle();
|
||||||
|
Chunk chunk = w.getChunkAt(x, z);
|
||||||
|
Chunk backupChunk = ((CraftWorld) backup).getHandle().getChunkAt(x, z);
|
||||||
|
|
||||||
|
System.arraycopy(backupChunk.getSections(), 0, chunk.getSections(), 0, chunk.getSections().length);
|
||||||
|
System.arraycopy(backupChunk.heightMap, 0, chunk.heightMap, 0, chunk.heightMap.length);
|
||||||
|
w.tileEntityListTick.removeAll(chunk.tileEntities.values());
|
||||||
|
w.tileEntityList.removeAll(chunk.tileEntities.values());
|
||||||
|
chunk.tileEntities.clear();
|
||||||
|
chunk.tileEntities.putAll(backupChunk.tileEntities);
|
||||||
|
for(Player p : Bukkit.getOnlinePlayers()){
|
||||||
|
ChunkListener.sendChunk(p, x, z);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
28
FightSystem_12/src/de/steamwar/fightsystem/fight/FightWorld_12.java
Normale Datei
28
FightSystem_12/src/de/steamwar/fightsystem/fight/FightWorld_12.java
Normale Datei
@ -0,0 +1,28 @@
|
|||||||
|
package de.steamwar.fightsystem.fight;
|
||||||
|
|
||||||
|
import de.steamwar.core.events.ChunkListener;
|
||||||
|
import net.minecraft.server.v1_12_R1.Chunk;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.World;
|
||||||
|
import org.bukkit.craftbukkit.v1_12_R1.CraftWorld;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
class FightWorld_12 {
|
||||||
|
private FightWorld_12(){}
|
||||||
|
|
||||||
|
static void resetChunk(World world, World backup, int x, int z){
|
||||||
|
net.minecraft.server.v1_12_R1.World w = ((CraftWorld) world).getHandle();
|
||||||
|
Chunk chunk = w.getChunkAt(x, z);
|
||||||
|
Chunk backupChunk = ((CraftWorld) backup).getHandle().getChunkAt(x, z);
|
||||||
|
|
||||||
|
System.arraycopy(backupChunk.getSections(), 0, chunk.getSections(), 0, chunk.getSections().length);
|
||||||
|
System.arraycopy(backupChunk.heightMap, 0, chunk.heightMap, 0, chunk.heightMap.length);
|
||||||
|
w.tileEntityListTick.removeAll(chunk.tileEntities.values());
|
||||||
|
w.tileEntityList.removeAll(chunk.tileEntities.values());
|
||||||
|
chunk.tileEntities.clear();
|
||||||
|
chunk.tileEntities.putAll(backupChunk.tileEntities);
|
||||||
|
for(Player p : Bukkit.getOnlinePlayers()){
|
||||||
|
ChunkListener.sendChunk(p, x, z);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
48
FightSystem_14/src/de/steamwar/fightsystem/fight/FightWorld_14.java
Normale Datei
48
FightSystem_14/src/de/steamwar/fightsystem/fight/FightWorld_14.java
Normale Datei
@ -0,0 +1,48 @@
|
|||||||
|
/*
|
||||||
|
This file is a part of the SteamWar software.
|
||||||
|
|
||||||
|
Copyright (C) 2020 SteamWar.de-Serverteam
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Affero General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Affero General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Affero General Public License
|
||||||
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package de.steamwar.fightsystem.fight;
|
||||||
|
|
||||||
|
import de.steamwar.core.events.ChunkListener;
|
||||||
|
import net.minecraft.server.v1_14_R1.Chunk;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.World;
|
||||||
|
import org.bukkit.craftbukkit.v1_14_R1.CraftWorld;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
class FightWorld_14 {
|
||||||
|
private FightWorld_14(){}
|
||||||
|
|
||||||
|
static void resetChunk(World world, World backup, int x, int z){
|
||||||
|
net.minecraft.server.v1_14_R1.World w = ((CraftWorld) world).getHandle();
|
||||||
|
Chunk chunk = w.getChunkAt(x, z);
|
||||||
|
Chunk backupChunk = ((CraftWorld) backup).getHandle().getChunkAt(x, z);
|
||||||
|
|
||||||
|
System.arraycopy(backupChunk.getSections(), 0, chunk.getSections(), 0, chunk.getSections().length);
|
||||||
|
w.tileEntityListTick.removeAll(chunk.tileEntities.values());
|
||||||
|
w.tileEntityList.removeAll(chunk.tileEntities.values());
|
||||||
|
chunk.tileEntities.clear();
|
||||||
|
chunk.tileEntities.putAll(backupChunk.tileEntities);
|
||||||
|
chunk.heightMap.clear();
|
||||||
|
chunk.heightMap.putAll(backupChunk.heightMap);
|
||||||
|
for(Player p : Bukkit.getOnlinePlayers()){
|
||||||
|
ChunkListener.sendChunk(p, x, z);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
48
FightSystem_15/src/de/steamwar/fightsystem/fight/FightWorld_15.java
Normale Datei
48
FightSystem_15/src/de/steamwar/fightsystem/fight/FightWorld_15.java
Normale Datei
@ -0,0 +1,48 @@
|
|||||||
|
/*
|
||||||
|
This file is a part of the SteamWar software.
|
||||||
|
|
||||||
|
Copyright (C) 2020 SteamWar.de-Serverteam
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Affero General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Affero General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Affero General Public License
|
||||||
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package de.steamwar.fightsystem.fight;
|
||||||
|
|
||||||
|
import de.steamwar.core.events.ChunkListener;
|
||||||
|
import net.minecraft.server.v1_15_R1.Chunk;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.World;
|
||||||
|
import org.bukkit.craftbukkit.v1_15_R1.CraftWorld;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
class FightWorld_15 {
|
||||||
|
private FightWorld_15(){}
|
||||||
|
|
||||||
|
static void resetChunk(World world, World backup, int x, int z){
|
||||||
|
net.minecraft.server.v1_15_R1.World w = ((CraftWorld) world).getHandle();
|
||||||
|
Chunk chunk = w.getChunkAt(x, z);
|
||||||
|
Chunk backupChunk = ((CraftWorld) backup).getHandle().getChunkAt(x, z);
|
||||||
|
|
||||||
|
System.arraycopy(backupChunk.getSections(), 0, chunk.getSections(), 0, chunk.getSections().length);
|
||||||
|
w.tileEntityListTick.removeAll(chunk.tileEntities.values());
|
||||||
|
w.tileEntityList.removeAll(chunk.tileEntities.values());
|
||||||
|
chunk.tileEntities.clear();
|
||||||
|
chunk.tileEntities.putAll(backupChunk.tileEntities);
|
||||||
|
chunk.heightMap.clear();
|
||||||
|
chunk.heightMap.putAll(backupChunk.heightMap);
|
||||||
|
for(Player p : Bukkit.getOnlinePlayers()){
|
||||||
|
ChunkListener.sendChunk(p, x, z);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
47
FightSystem_8/src/de/steamwar/fightsystem/fight/FightWorld_8.java
Normale Datei
47
FightSystem_8/src/de/steamwar/fightsystem/fight/FightWorld_8.java
Normale Datei
@ -0,0 +1,47 @@
|
|||||||
|
/*
|
||||||
|
This file is a part of the SteamWar software.
|
||||||
|
|
||||||
|
Copyright (C) 2020 SteamWar.de-Serverteam
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Affero General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Affero General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Affero General Public License
|
||||||
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package de.steamwar.fightsystem.fight;
|
||||||
|
|
||||||
|
import de.steamwar.core.events.ChunkListener;
|
||||||
|
import net.minecraft.server.v1_8_R3.Chunk;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.World;
|
||||||
|
import org.bukkit.craftbukkit.v1_8_R3.CraftWorld;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
class FightWorld_8 {
|
||||||
|
private FightWorld_8(){}
|
||||||
|
|
||||||
|
static void resetChunk(World world, World backup, int x, int z){
|
||||||
|
net.minecraft.server.v1_8_R3.World w = ((CraftWorld) world).getHandle();
|
||||||
|
Chunk chunk = w.getChunkAt(x, z);
|
||||||
|
Chunk backupChunk = ((CraftWorld) backup).getHandle().getChunkAt(x, z);
|
||||||
|
|
||||||
|
System.arraycopy(backupChunk.getSections(), 0, chunk.getSections(), 0, chunk.getSections().length);
|
||||||
|
System.arraycopy(backupChunk.heightMap, 0, chunk.heightMap, 0, chunk.heightMap.length);
|
||||||
|
w.h.removeAll(chunk.tileEntities.values());
|
||||||
|
w.tileEntityList.removeAll(chunk.tileEntities.values());
|
||||||
|
chunk.tileEntities.clear();
|
||||||
|
chunk.tileEntities.putAll(backupChunk.tileEntities);
|
||||||
|
for(Player p : Bukkit.getOnlinePlayers()){
|
||||||
|
ChunkListener.sendChunk(p, x, z);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
47
FightSystem_9/src/de/steamwar/fightsystem/fight/FightWorld_9.java
Normale Datei
47
FightSystem_9/src/de/steamwar/fightsystem/fight/FightWorld_9.java
Normale Datei
@ -0,0 +1,47 @@
|
|||||||
|
/*
|
||||||
|
This file is a part of the SteamWar software.
|
||||||
|
|
||||||
|
Copyright (C) 2020 SteamWar.de-Serverteam
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Affero General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Affero General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Affero General Public License
|
||||||
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package de.steamwar.fightsystem.fight;
|
||||||
|
|
||||||
|
import de.steamwar.core.events.ChunkListener;
|
||||||
|
import net.minecraft.server.v1_9_R2.Chunk;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.World;
|
||||||
|
import org.bukkit.craftbukkit.v1_9_R2.CraftWorld;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
class FightWorld_9 {
|
||||||
|
private FightWorld_9(){}
|
||||||
|
|
||||||
|
static void resetChunk(World world, World backup, int x, int z){
|
||||||
|
net.minecraft.server.v1_9_R2.World w = ((CraftWorld) world).getHandle();
|
||||||
|
Chunk chunk = w.getChunkAt(x, z);
|
||||||
|
Chunk backupChunk = ((CraftWorld) backup).getHandle().getChunkAt(x, z);
|
||||||
|
|
||||||
|
System.arraycopy(backupChunk.getSections(), 0, chunk.getSections(), 0, chunk.getSections().length);
|
||||||
|
System.arraycopy(backupChunk.heightMap, 0, chunk.heightMap, 0, chunk.heightMap.length);
|
||||||
|
w.tileEntityListTick.removeAll(chunk.tileEntities.values());
|
||||||
|
w.tileEntityList.removeAll(chunk.tileEntities.values());
|
||||||
|
chunk.tileEntities.clear();
|
||||||
|
chunk.tileEntities.putAll(backupChunk.tileEntities);
|
||||||
|
for(Player p : Bukkit.getOnlinePlayers()){
|
||||||
|
ChunkListener.sendChunk(p, x, z);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -92,7 +92,7 @@ public class Commands {
|
|||||||
if(fightTeam == null || checkGetLeader(p) == null)
|
if(fightTeam == null || checkGetLeader(p) == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
fightTeam.skip();
|
fightTeam.setReady(!fightTeam.isReady());
|
||||||
}
|
}
|
||||||
|
|
||||||
static void toggleSkip(Player p){
|
static void toggleSkip(Player p){
|
||||||
@ -100,7 +100,7 @@ public class Commands {
|
|||||||
if(fightTeam == null || checkGetLeader(p) == null)
|
if(fightTeam == null || checkGetLeader(p) == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
fightTeam.setReady(!fightTeam.isReady());
|
fightTeam.skip();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void acceptInvitation(Player p){
|
static void acceptInvitation(Player p){
|
||||||
|
@ -1,16 +1,32 @@
|
|||||||
|
/*
|
||||||
|
This file is a part of the SteamWar software.
|
||||||
|
|
||||||
|
Copyright (C) 2020 SteamWar.de-Serverteam
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Affero General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Affero General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Affero General Public License
|
||||||
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
package de.steamwar.fightsystem.fight;
|
package de.steamwar.fightsystem.fight;
|
||||||
|
|
||||||
import de.steamwar.core.events.ChunkListener;
|
import de.steamwar.core.VersionedRunnable;
|
||||||
import de.steamwar.fightsystem.ArenaMode;
|
import de.steamwar.fightsystem.ArenaMode;
|
||||||
import de.steamwar.fightsystem.Config;
|
import de.steamwar.fightsystem.Config;
|
||||||
import de.steamwar.fightsystem.states.FightState;
|
import de.steamwar.fightsystem.states.FightState;
|
||||||
import de.steamwar.fightsystem.states.StateDependent;
|
import de.steamwar.fightsystem.states.StateDependent;
|
||||||
import net.minecraft.server.v1_15_R1.Chunk;
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.WorldCreator;
|
import org.bukkit.WorldCreator;
|
||||||
import org.bukkit.craftbukkit.v1_15_R1.CraftWorld;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
public class FightWorld extends StateDependent {
|
public class FightWorld extends StateDependent {
|
||||||
|
|
||||||
@ -35,16 +51,12 @@ public class FightWorld extends StateDependent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void resetChunk(World backup, int x, int z){
|
private void resetChunk(World backup, int x, int z){
|
||||||
Chunk chunk = ((CraftWorld) world).getHandle().getChunkAt(x, z);
|
VersionedRunnable.call(
|
||||||
Chunk backupChunk = ((CraftWorld) backup).getHandle().getChunkAt(x, z);
|
new VersionedRunnable(() -> FightWorld_8.resetChunk(world, backup, x, z), 8),
|
||||||
|
new VersionedRunnable(() -> FightWorld_9.resetChunk(world, backup, x, z), 9),
|
||||||
System.arraycopy(backupChunk.getSections(), 0, chunk.getSections(), 0, chunk.getSections().length);
|
new VersionedRunnable(() -> FightWorld_10.resetChunk(world, backup, x, z), 10),
|
||||||
chunk.tileEntities.clear();
|
new VersionedRunnable(() -> FightWorld_12.resetChunk(world, backup, x, z), 12),
|
||||||
chunk.tileEntities.putAll(backupChunk.tileEntities);
|
new VersionedRunnable(() -> FightWorld_14.resetChunk(world, backup, x, z), 14),
|
||||||
chunk.heightMap.clear();
|
new VersionedRunnable(() -> FightWorld_15.resetChunk(world, backup, x, z), 15));
|
||||||
chunk.heightMap.putAll(backupChunk.heightMap);
|
|
||||||
for(Player p : Bukkit.getOnlinePlayers()){
|
|
||||||
ChunkListener.sendChunk(p, x, z);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren