浏览代码

Merge pull request #135 from RedstoneFuture/improvements/fawe-paster

Adding flag-arguments for Paste-Cmd; Updating Schematics
RedstoneFuture 9 月之前
父节点
当前提交
e102637f62
共有 32 个文件被更改,包括 323 次插入685 次删除
  1. 0 58
      1_13/pom.xml
  2. 0 51
      1_13/src/main/java/de/butzlabben/missilewars/missile/paste/r1_13/we/BlockFilterExtent.java
  3. 0 118
      1_13/src/main/java/de/butzlabben/missilewars/missile/paste/r1_13/we/R1_13Paster.java
  4. 二进制
      1_13_FAWE/lib/FastAsyncWorldEdit.jar
  5. 0 44
      1_13_FAWE/pom.xml
  6. 0 97
      1_13_FAWE/src/main/java/de/butzlabben/missilewars/missile/paste/r1_13/fawe/R1_13Paster.java
  7. 0 100
      1_16_FAWE/src/main/java/de/butzlabben/missilewars/missile/paste/r1_16/fawe/R1_16Paster.java
  8. 2 2
      FAWE_Paster/pom.xml
  9. 130 0
      FAWE_Paster/src/main/java/de/butzlabben/missilewars/missile/paste/v1_20/fawe/FAWE_Paster.java
  10. 7 19
      missilewars-plugin/pom.xml
  11. 2 2
      missilewars-plugin/src/main/java/de/butzlabben/missilewars/MissileWars.java
  12. 19 0
      missilewars-plugin/src/main/java/de/butzlabben/missilewars/commands/MWCommandCompletions.java
  13. 39 7
      missilewars-plugin/src/main/java/de/butzlabben/missilewars/commands/MWCommands.java
  14. 16 20
      missilewars-plugin/src/main/java/de/butzlabben/missilewars/configuration/Config.java
  15. 6 6
      missilewars-plugin/src/main/java/de/butzlabben/missilewars/configuration/arena/MissileConfiguration.java
  16. 1 1
      missilewars-plugin/src/main/java/de/butzlabben/missilewars/configuration/arena/ShieldConfiguration.java
  17. 17 5
      missilewars-plugin/src/main/java/de/butzlabben/missilewars/game/Game.java
  18. 2 0
      missilewars-plugin/src/main/java/de/butzlabben/missilewars/game/GameManager.java
  19. 27 13
      missilewars-plugin/src/main/java/de/butzlabben/missilewars/game/schematics/objects/Missile.java
  20. 1 1
      missilewars-plugin/src/main/java/de/butzlabben/missilewars/game/schematics/objects/Shield.java
  21. 10 12
      missilewars-plugin/src/main/java/de/butzlabben/missilewars/game/schematics/paste/FawePasteProvider.java
  22. 7 13
      missilewars-plugin/src/main/java/de/butzlabben/missilewars/game/schematics/paste/PasteProvider.java
  23. 4 3
      missilewars-plugin/src/main/java/de/butzlabben/missilewars/game/schematics/paste/Paster.java
  24. 0 49
      missilewars-plugin/src/main/java/de/butzlabben/missilewars/game/schematics/paste/R1_13FawePasteProvider.java
  25. 0 49
      missilewars-plugin/src/main/java/de/butzlabben/missilewars/game/schematics/paste/R1_13WEPasteProvider.java
  26. 0 4
      missilewars-plugin/src/main/java/de/butzlabben/missilewars/menus/hotbar/GameJoinMenu.java
  27. 26 0
      missilewars-plugin/src/main/java/de/butzlabben/missilewars/util/MaterialUtil.java
  28. 0 2
      missilewars-plugin/src/main/java/de/butzlabben/missilewars/util/serialization/Serializer.java
  29. 2 2
      missilewars-plugin/src/main/resources-filtered/plugin.yml
  30. 二进制
      missilewars-plugin/src/main/resources/missiles.zip
  31. 二进制
      missilewars-plugin/src/main/resources/shields.zip
  32. 5 7
      pom.xml

+ 0 - 58
1_13/pom.xml

@@ -1,58 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  ~ This file is part of MissileWars (https://github.com/Butzlabben/missilewars).
-  ~ Copyright (c) 2018-2021 Daniel Nägele.
-  ~
-  ~ MissileWars is free software: you can redistribute it and/or modify
-  ~ it under the terms of the GNU General Public License as published by
-  ~ the Free Software Foundation, either version 3 of the License, or
-  ~ (at your option) any later version.
-  ~
-  ~ MissileWars 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 General Public License for more details.
-  ~
-  ~ You should have received a copy of the GNU General Public License
-  ~ along with MissileWars.  If not, see <https://www.gnu.org/licenses/>.
-  -->
-
-<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-         xmlns="http://maven.apache.org/POM/4.0.0"
-         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-    <parent>
-        <artifactId>missilewars</artifactId>
-        <groupId>de.butzlabben</groupId>
-        <version>1.0</version>
-    </parent>
-
-    <modelVersion>4.0.0</modelVersion>
-
-    <artifactId>1_13</artifactId>
-
-    <dependencies>
-        <!-- WorldEdit (Bukkit) API -->
-        <dependency>
-            <groupId>com.sk89q.worldedit</groupId>
-            <artifactId>worldedit-bukkit</artifactId>
-            <version>7.0.0-SNAPSHOT</version>
-            <scope>provided</scope>
-
-            <exclusions>
-                <exclusion>
-                    <groupId>org.bstats</groupId>
-                    <artifactId>bstats-bukkit</artifactId>
-                </exclusion>
-            </exclusions>
-        </dependency>
-
-        <!-- WorldEdit (Core) API -->
-        <dependency>
-            <groupId>com.sk89q.worldedit</groupId>
-            <artifactId>worldedit-core</artifactId>
-            <version>7.0.0-SNAPSHOT</version>
-            <scope>provided</scope>
-        </dependency>
-    </dependencies>
-
-</project>

+ 0 - 51
1_13/src/main/java/de/butzlabben/missilewars/missile/paste/r1_13/we/BlockFilterExtent.java

@@ -1,51 +0,0 @@
-/*
- * This file is part of MissileWars (https://github.com/Butzlabben/missilewars).
- * Copyright (c) 2018-2021 Daniel Nägele.
- *
- * MissileWars is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * MissileWars 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with MissileWars.  If not, see <https://www.gnu.org/licenses/>.
- */
-
-package de.butzlabben.missilewars.missile.paste.r1_13.we;
-
-import com.sk89q.worldedit.extent.AbstractDelegateExtent;
-import com.sk89q.worldedit.extent.Extent;
-import com.sk89q.worldedit.math.BlockVector3;
-import com.sk89q.worldedit.world.block.BaseBlock;
-import com.sk89q.worldedit.world.block.BlockTypes;
-import org.bukkit.Material;
-
-public class BlockFilterExtent extends AbstractDelegateExtent {
-
-    private Material material;
-
-    protected BlockFilterExtent(Extent extent) {
-        super(extent);
-    }
-
-    public BlockFilterExtent(Extent extent, Material material) {
-        this(extent);
-        this.material = material;
-    }
-
-    @Override
-    public BaseBlock getFullBlock(BlockVector3 position) {
-        BaseBlock block = super.getFullBlock(position);
-        if (block.getBlockType().toString().contains("stained_glass_pane")) {
-            block = BlockTypes.get(material.toString().toLowerCase() + "_pane").getDefaultState().toBaseBlock();
-        } else if (block.getBlockType().toString().contains("stained_glass")) {
-            block = BlockTypes.get(material.toString().toLowerCase()).getDefaultState().toBaseBlock();
-        }
-        return block;
-    }
-}

+ 0 - 118
1_13/src/main/java/de/butzlabben/missilewars/missile/paste/r1_13/we/R1_13Paster.java

@@ -1,118 +0,0 @@
-/*
- * This file is part of MissileWars (https://github.com/Butzlabben/missilewars).
- * Copyright (c) 2018-2021 Daniel Nägele.
- *
- * MissileWars is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * MissileWars 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with MissileWars.  If not, see <https://www.gnu.org/licenses/>.
- */
-
-package de.butzlabben.missilewars.missile.paste.r1_13.we;
-
-import com.sk89q.worldedit.EditSession;
-import com.sk89q.worldedit.WorldEdit;
-import com.sk89q.worldedit.bukkit.BukkitWorld;
-import com.sk89q.worldedit.extent.clipboard.Clipboard;
-import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormat;
-import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormats;
-import com.sk89q.worldedit.extent.clipboard.io.ClipboardReader;
-import com.sk89q.worldedit.extent.transform.BlockTransformExtent;
-import com.sk89q.worldedit.function.mask.ExistingBlockMask;
-import com.sk89q.worldedit.function.operation.ForwardExtentCopy;
-import com.sk89q.worldedit.function.operation.Operation;
-import com.sk89q.worldedit.function.operation.Operations;
-import com.sk89q.worldedit.math.BlockVector3;
-import com.sk89q.worldedit.math.transform.AffineTransform;
-import com.sk89q.worldedit.regions.CuboidRegion;
-import com.sk89q.worldedit.session.ClipboardHolder;
-import com.sk89q.worldedit.world.World;
-import java.io.File;
-import java.io.FileInputStream;
-import java.util.HashSet;
-import java.util.Set;
-import org.bukkit.Material;
-import org.bukkit.block.Block;
-import org.bukkit.plugin.java.JavaPlugin;
-import org.bukkit.scheduler.BukkitRunnable;
-import org.bukkit.util.Vector;
-
-/**
- * @author Butzlabben
- * @since 23.09.2018
- */
-public class R1_13Paster {
-
-    public void pasteMissile(File schematic, org.bukkit.util.Vector pos, int rotation, org.bukkit.World world,
-                             Material glassBlockReplace, int radius, Material replaceType, JavaPlugin plugin, int replaceTicks) {
-        try {
-            World weWorld = new BukkitWorld(world);
-            ClipboardFormat format = ClipboardFormats.findByFile(schematic);
-
-            try (ClipboardReader reader = format.getReader(new FileInputStream(schematic));
-                 EditSession editSession = WorldEdit.getInstance().getEditSessionFactory().getEditSession(weWorld, -1)) {
-                ClipboardHolder clipboardHolder = new ClipboardHolder(reader.read());
-                Clipboard clipboard = clipboardHolder.getClipboard();
-                AffineTransform transform = new AffineTransform();
-                transform = transform.rotateY(rotation);
-
-                BlockTransformExtent extent = new BlockTransformExtent(clipboard, transform);
-                ForwardExtentCopy copy = new ForwardExtentCopy(new BlockFilterExtent(extent, glassBlockReplace), clipboard.getRegion(), clipboard.getOrigin(), editSession, BlockVector3.at(pos.getX(), pos.getY(), pos.getZ()));
-                copy.setTransform(transform);
-                copy.setSourceMask(new ExistingBlockMask(clipboard));
-
-                Operations.complete(copy);
-            }
-
-            // Replace given blocks
-            Set<Block> replace = new HashSet<>();
-            BlockVector3 min = BlockVector3.at(pos.getX() - radius, pos.getY() - radius, pos.getZ() - radius);
-            BlockVector3 max = BlockVector3.at(pos.getX() + radius, pos.getY() + radius, pos.getZ() + radius);
-            for (BlockVector3 v : new CuboidRegion(min, max)) {
-                Block b = world.getBlockAt(v.getBlockX(), v.getBlockY(), v.getBlockZ());
-                if (b.getType() == replaceType) {
-                    replace.add(b);
-                }
-            }
-            new BukkitRunnable() {
-                @Override
-                public void run() {
-                    replace.forEach(b -> b.setType(Material.AIR));
-                }
-            }.runTaskLater(plugin, replaceTicks);
-
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-    }
-
-    public void pasteSchematic(File schematic, Vector pos, org.bukkit.World world) {
-        try {
-            World weWorld = new BukkitWorld(world);
-
-            ClipboardFormat format = ClipboardFormats.findByFile(schematic);
-            try (ClipboardReader reader = format.getReader(new FileInputStream(schematic));
-                 EditSession editSession = WorldEdit.getInstance().getEditSessionFactory().getEditSession(weWorld, -1)) {
-                ClipboardHolder clipboard = new ClipboardHolder(reader.read());
-
-                Operation operation = clipboard
-                        .createPaste(editSession)
-                        .to(BlockVector3.at(pos.getX(), pos.getY(), pos.getZ()))
-                        .ignoreAirBlocks(true)
-                        .build();
-                Operations.complete(operation);
-
-            }
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-    }
-}

二进制
1_13_FAWE/lib/FastAsyncWorldEdit.jar


+ 0 - 44
1_13_FAWE/pom.xml

@@ -1,44 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  ~ This file is part of MissileWars (https://github.com/Butzlabben/missilewars).
-  ~ Copyright (c) 2018-2021 Daniel Nägele.
-  ~
-  ~ MissileWars is free software: you can redistribute it and/or modify
-  ~ it under the terms of the GNU General Public License as published by
-  ~ the Free Software Foundation, either version 3 of the License, or
-  ~ (at your option) any later version.
-  ~
-  ~ MissileWars 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 General Public License for more details.
-  ~
-  ~ You should have received a copy of the GNU General Public License
-  ~ along with MissileWars.  If not, see <https://www.gnu.org/licenses/>.
-  -->
-
-<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-         xmlns="http://maven.apache.org/POM/4.0.0"
-         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-    <parent>
-        <artifactId>missilewars</artifactId>
-        <groupId>de.butzlabben</groupId>
-        <version>1.0</version>
-    </parent>
-
-    <modelVersion>4.0.0</modelVersion>
-
-    <artifactId>1_13_FAWE</artifactId>
-
-    <dependencies>
-        <!-- FAWE API -->
-        <dependency>
-            <groupId>com.sk98q.worldedit</groupId>
-            <artifactId>FastAsnycWorldEdit</artifactId>
-            <version>1.0</version>
-            <scope>system</scope>
-            <systemPath>${pom.basedir}/lib/FastAsyncWorldEdit.jar</systemPath>
-        </dependency>
-    </dependencies>
-
-</project>

+ 0 - 97
1_13_FAWE/src/main/java/de/butzlabben/missilewars/missile/paste/r1_13/fawe/R1_13Paster.java

@@ -1,97 +0,0 @@
-/*
- * This file is part of MissileWars (https://github.com/Butzlabben/missilewars).
- * Copyright (c) 2018-2021 Daniel Nägele.
- *
- * MissileWars is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * MissileWars 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with MissileWars.  If not, see <https://www.gnu.org/licenses/>.
- */
-
-package de.butzlabben.missilewars.missile.paste.r1_13.fawe;
-
-import com.sk89q.worldedit.EditSession;
-import com.sk89q.worldedit.Vector;
-import com.sk89q.worldedit.WorldEdit;
-import com.sk89q.worldedit.bukkit.BukkitWorld;
-import com.sk89q.worldedit.extent.clipboard.Clipboard;
-import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormat;
-import com.sk89q.worldedit.function.mask.ExistingBlockMask;
-import com.sk89q.worldedit.function.operation.ForwardExtentCopy;
-import com.sk89q.worldedit.function.operation.Operations;
-import com.sk89q.worldedit.math.transform.AffineTransform;
-import com.sk89q.worldedit.regions.CuboidRegion;
-import com.sk89q.worldedit.world.World;
-import java.io.File;
-import java.util.HashSet;
-import java.util.Set;
-import org.bukkit.Material;
-import org.bukkit.block.Block;
-import org.bukkit.plugin.java.JavaPlugin;
-import org.bukkit.scheduler.BukkitRunnable;
-
-public class R1_13Paster {
-
-    public void pasteMissile(File schematic, org.bukkit.util.Vector pos, int rotation, org.bukkit.World world,
-                             Material glassBlockReplace, int radius, Material replaceType, JavaPlugin plugin, int replaceTicks) {
-        try {
-            World weWorld = new BukkitWorld(world);
-
-            EditSession editSession = WorldEdit.getInstance().getEditSessionFactory().getEditSession(weWorld, -1);
-            Clipboard clipboard = ClipboardFormat.findByFile(schematic).load(schematic).getClipboard();
-
-            AffineTransform transform = new AffineTransform();
-            transform = transform.rotateY(rotation);
-
-            Vector origin = new Vector(clipboard.getOrigin().getX(), clipboard.getOrigin().getY(), clipboard.getOrigin().getZ());
-//            BlockTransformExtent extent = new BlockTransformExtent(clipboard, transform, ((BukkitWorld) weWorld).getWorldData().getBlockRegistry());
-            ForwardExtentCopy copy = new ForwardExtentCopy(clipboard, clipboard.getRegion(), origin, editSession, new Vector(pos.getX(), pos.getY(), pos.getZ()));
-            copy.setTransform(transform);
-            copy.setSourceMask(new ExistingBlockMask(clipboard));
-
-            Operations.complete(copy);
-
-
-            // Replace given blocks
-            Set<Block> replace = new HashSet<>();
-            Vector min = new Vector(pos.getX() - radius, pos.getY() - radius, pos.getZ() - radius);
-            Vector max = new Vector(pos.getX() + radius, pos.getY() + radius, pos.getZ() + radius);
-            for (Vector v : new CuboidRegion(min, max)) {
-                Block b = world.getBlockAt(v.getBlockX(), v.getBlockY(), v.getBlockZ());
-                if (b.getType() == replaceType) {
-                    replace.add(b);
-                }
-            }
-            new BukkitRunnable() {
-                @Override
-                public void run() {
-                    replace.forEach(b -> b.setType(Material.AIR));
-                }
-            }.runTaskLater(plugin, replaceTicks);
-
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-    }
-
-    public void pasteSchematic(File schematic, org.bukkit.util.Vector pos, org.bukkit.World world) {
-        try {
-            World weWorld = new BukkitWorld(world);
-
-            EditSession editSession = ClipboardFormat.findByFile(schematic).load(schematic)
-                    .paste(weWorld, new Vector(pos.getX(), pos.getY(), pos.getZ()), false, false, null);
-            editSession.flushQueue();
-
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-    }
-}

+ 0 - 100
1_16_FAWE/src/main/java/de/butzlabben/missilewars/missile/paste/r1_16/fawe/R1_16Paster.java

@@ -1,100 +0,0 @@
-/*
- * This file is part of MissileWars (https://github.com/Butzlabben/missilewars).
- * Copyright (c) 2018-2021 Daniel Nägele.
- *
- * MissileWars is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * MissileWars 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with MissileWars.  If not, see <https://www.gnu.org/licenses/>.
- */
-
-package de.butzlabben.missilewars.missile.paste.r1_16.fawe;
-
-import com.sk89q.worldedit.WorldEdit;
-import com.sk89q.worldedit.bukkit.BukkitAdapter;
-import com.sk89q.worldedit.bukkit.BukkitWorld;
-import com.sk89q.worldedit.extent.clipboard.Clipboard;
-import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormats;
-import com.sk89q.worldedit.function.operation.Operation;
-import com.sk89q.worldedit.function.operation.Operations;
-import com.sk89q.worldedit.math.BlockVector3;
-import com.sk89q.worldedit.math.transform.AffineTransform;
-import com.sk89q.worldedit.regions.CuboidRegion;
-import com.sk89q.worldedit.session.ClipboardHolder;
-import com.sk89q.worldedit.world.World;
-import org.bukkit.Material;
-import org.bukkit.plugin.java.JavaPlugin;
-import org.bukkit.scheduler.BukkitRunnable;
-import org.bukkit.util.Vector;
-
-import java.io.File;
-import java.util.Set;
-import java.util.logging.Level;
-
-/**
- * @author Daniel Nägele
- */
-public class R1_16Paster {
-
-    public void pasteMissile(File schematic, Vector pos, int rotation, org.bukkit.World world,
-                             Material glassBlockReplace, int radius, Material replaceType, JavaPlugin plugin, int replaceTicks) {
-        World weWorld = new BukkitWorld(world);
-
-        try (Clipboard clipboard = ClipboardFormats.findByFile(schematic).load(schematic);
-             var session = WorldEdit.getInstance().newEditSession(weWorld)) {
-            ClipboardHolder clipboardHolder = new ClipboardHolder(clipboard);
-            clipboardHolder.setTransform(new AffineTransform().rotateY(rotation));
-            BlockVector3 vec = fromBukkitVector(pos);
-            Operation pasteBuilder = clipboardHolder
-                    .createPaste(session)
-                    .to(vec)
-                    .ignoreAirBlocks(true)
-                    .build();
-
-            Operations.completeBlindly(pasteBuilder);
-
-            new BukkitRunnable() {
-                @Override
-                public void run() {
-                    var rad = BlockVector3.at(radius, radius, radius);
-                    try (var session = WorldEdit.getInstance().newEditSession(weWorld)) {
-                        session.replaceBlocks(new CuboidRegion(vec.subtract(rad), vec.add(rad)),
-                                Set.of(BukkitAdapter.adapt(replaceType.createBlockData()).toBaseBlock()),
-                                BukkitAdapter.adapt(Material.AIR.createBlockData()));
-                    }
-
-                }
-            }.runTaskLater(plugin, replaceTicks);
-        } catch (Exception e) {
-            plugin.getLogger().log(Level.SEVERE, "Could not paste schematic", e);
-        }
-    }
-
-    public void pasteSchematic(File schematic, Vector pos, org.bukkit.World world) {
-        World weWorld = new BukkitWorld(world);
-
-        try (var clipboard = ClipboardFormats.findByFile(schematic).load(schematic);
-             var session = WorldEdit.getInstance().newEditSession(weWorld)) {
-            Operation paste = new ClipboardHolder(clipboard)
-                    .createPaste(session)
-                    .to(fromBukkitVector(pos))
-                    .ignoreAirBlocks(true)
-                    .build();
-            Operations.completeBlindly(paste);
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-    }
-
-    private BlockVector3 fromBukkitVector(org.bukkit.util.Vector pos) {
-        return BlockVector3.at(pos.getX(), pos.getY(), pos.getZ());
-    }
-}

+ 2 - 2
1_16_FAWE/pom.xml → FAWE_Paster/pom.xml

@@ -28,14 +28,14 @@
 
     <modelVersion>4.0.0</modelVersion>
 
-    <artifactId>1_16_FAWE</artifactId>
+    <artifactId>FAWE_Paster</artifactId>
 
     <dependencies>
         <!-- FAWE API -->
         <dependency>
             <groupId>com.fastasyncworldedit</groupId>
             <artifactId>FastAsyncWorldEdit-Core</artifactId>
-            <version>2.0.0-SNAPSHOT</version>
+            <version>2.11.0</version>
             <scope>provided</scope>
         </dependency>
 

+ 130 - 0
FAWE_Paster/src/main/java/de/butzlabben/missilewars/missile/paste/v1_20/fawe/FAWE_Paster.java

@@ -0,0 +1,130 @@
+/*
+ * This file is part of MissileWars (https://github.com/Butzlabben/missilewars).
+ * Copyright (c) 2018-2021 Daniel Nägele.
+ *
+ * MissileWars is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * MissileWars 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with MissileWars.  If not, see <https://www.gnu.org/licenses/>.
+ */
+
+package de.butzlabben.missilewars.missile.paste.v1_20.fawe;
+
+import com.sk89q.worldedit.WorldEdit;
+import com.sk89q.worldedit.bukkit.BukkitWorld;
+import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormat;
+import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormats;
+import com.sk89q.worldedit.extent.clipboard.io.ClipboardReader;
+import com.sk89q.worldedit.function.operation.Operation;
+import com.sk89q.worldedit.function.operation.Operations;
+import com.sk89q.worldedit.math.BlockVector3;
+import com.sk89q.worldedit.math.transform.AffineTransform;
+import com.sk89q.worldedit.session.ClipboardHolder;
+import com.sk89q.worldedit.world.World;
+import org.bukkit.Material;
+import org.bukkit.block.Block;
+import org.bukkit.plugin.java.JavaPlugin;
+import org.bukkit.scheduler.BukkitRunnable;
+import org.bukkit.util.Vector;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.util.logging.Level;
+
+/**
+ * @author Daniel Nägele
+ */
+public class FAWE_Paster {
+
+    public void pasteMissile(File schematic, Vector locationVec, int rotation, org.bukkit.World world, boolean blockUpdate, 
+                             Material replaceMaterial, int replaceTicks, int replaceRadius, JavaPlugin plugin) {
+        
+        pasteSchematic(schematic, locationVec, rotation, world, plugin);
+        
+        if (!blockUpdate) return;
+        
+        new BukkitRunnable() {
+            @Override
+            public void run() {
+                removeTempBlock(locationVec, world, replaceMaterial, replaceRadius);
+            }
+        }.runTaskLater(plugin, replaceTicks);
+    }
+
+    /**
+     * This method executes the paste command via FAWE.
+     * 
+     * @param schematic (File) the target WorldEdit schematic file (all Schematic formats usable, '.schem' recommended)
+     * @param locationVec (Vector) the abstract block location
+     * @param world (World) the target world for the WorldEdit action
+     * @param rotation (int) the target schematic rotation
+     * @param plugin (JavaPlugin) the basis plugin
+     */
+    public void pasteSchematic(File schematic, Vector locationVec, int rotation, org.bukkit.World world, JavaPlugin plugin) {
+        World weWorld = new BukkitWorld(world);
+        BlockVector3 blockVec = getBlockVector(locationVec);
+        ClipboardFormat clipboardFormat = ClipboardFormats.findByFile(schematic);
+        
+        try (ClipboardReader clipboardReader = clipboardFormat.getReader(new FileInputStream(schematic));
+             var session = WorldEdit.getInstance().newEditSession(weWorld)) {
+            
+            ClipboardHolder clipboardHolder = new ClipboardHolder(clipboardReader.read());
+            clipboardHolder.setTransform(new AffineTransform().rotateY(rotation));
+            
+            Operation pasteBuilder = clipboardHolder
+                    .createPaste(session)
+                    .to(blockVec)
+                    .ignoreAirBlocks(true)
+                    .build();
+            Operations.completeBlindly(pasteBuilder);
+            
+        } catch (Exception e) {
+            plugin.getLogger().log(Level.SEVERE, "Could not paste schematic '" + schematic.getName() 
+                    + "' with FAWE (" + WorldEdit.getVersion() + ")", e);
+        }
+    }
+    
+    /**
+     * This method removes the temporary "Starter-Block", so that the 
+     * (asynchronously on FAWE) pasted schematic structure gets a 
+     * block-update. This remove process happens synchronously for this.
+     * 
+     * @param locationVec (Vector) the abstract block location
+     * @param world (World) the target world for the WorldEdit action
+     * @param replaceMaterial (Material) the target material for the replacement
+     * @param replaceRadius (int) the configured "Replace radius" 
+     *                      The value is used as the block-limit for the “Starter-Block” check and represents 
+     *                      a half of the cuboid-edge length with the Schematic-Origin as starting point.
+     */
+    public void removeTempBlock(Vector locationVec, org.bukkit.World world, Material replaceMaterial, int replaceRadius) {
+        int startX = locationVec.getBlockX() - replaceRadius;
+        int endX = locationVec.getBlockX() + replaceRadius;
+        int startY = locationVec.getBlockY() - replaceRadius;
+        int endY = locationVec.getBlockY() + replaceRadius;
+        int startZ = locationVec.getBlockZ() - replaceRadius;
+        int endZ = locationVec.getBlockZ() + replaceRadius;
+    
+        for (int x = startX; x <= endX; x++) {
+            for (int y = startY; y <= endY; y++) {
+                for (int z = startZ; z <= endZ; z++) {
+                    Block block = world.getBlockAt(x, y, z);
+                    if (block.getType() == replaceMaterial) {
+                        block.setType(Material.AIR);
+                    }
+                }
+            }
+        }
+    }
+    
+    public static BlockVector3 getBlockVector(org.bukkit.util.Vector locationVec) {
+        return BlockVector3.at(locationVec.getX(), locationVec.getY(), locationVec.getZ());
+    }
+}

+ 7 - 19
missilewars-plugin/pom.xml

@@ -26,7 +26,7 @@
         <version>1.0</version>
     </parent>
 
-    <version>4.7.1</version>
+    <version>4.8.0</version>
 
     <modelVersion>4.0.0</modelVersion>
 
@@ -50,19 +50,7 @@
     <dependencies>
         <dependency>
             <groupId>de.butzlabben</groupId>
-            <artifactId>1_13</artifactId>
-            <version>1.0</version>
-            <scope>compile</scope>
-        </dependency>
-        <dependency>
-            <groupId>de.butzlabben</groupId>
-            <artifactId>1_13_FAWE</artifactId>
-            <version>1.0</version>
-            <scope>compile</scope>
-        </dependency>
-        <dependency>
-            <groupId>de.butzlabben</groupId>
-            <artifactId>1_16_FAWE</artifactId>
+            <artifactId>FAWE_Paster</artifactId>
             <version>1.0</version>
             <scope>compile</scope>
         </dependency>
@@ -72,7 +60,7 @@
         <dependency>
             <groupId>commons-io</groupId>
             <artifactId>commons-io</artifactId>
-            <version>2.11.0</version>
+            <version>2.16.1</version>
         </dependency>
 
         <!-- https://github.com/aikar/commands -->
@@ -86,7 +74,7 @@
         <dependency>
             <groupId>com.fasterxml.jackson.core</groupId>
             <artifactId>jackson-databind</artifactId>
-            <version>2.15.2</version>
+            <version>2.16.2</version>
             <scope>compile</scope>
         </dependency>
 
@@ -94,14 +82,14 @@
         <dependency>
             <groupId>com.fasterxml.jackson.dataformat</groupId>
             <artifactId>jackson-dataformat-yaml</artifactId>
-            <version>2.15.2</version>
+            <version>2.16.2</version>
             <scope>compile</scope>
         </dependency>
 
         <dependency>
             <groupId>org.bstats</groupId>
             <artifactId>bstats-bukkit</artifactId>
-            <version>2.2.1</version>
+            <version>3.0.2</version>
             <scope>compile</scope>
         </dependency>
 
@@ -139,7 +127,7 @@
         <dependency>
             <groupId>com.github.stefvanschie.inventoryframework</groupId>
             <artifactId>IF</artifactId>
-            <version>0.10.13</version>
+            <version>0.10.15</version>
         </dependency>
     </dependencies>
 

+ 2 - 2
missilewars-plugin/src/main/java/de/butzlabben/missilewars/MissileWars.java

@@ -213,9 +213,9 @@ public class MissileWars extends JavaPlugin {
 
         Logger.BOOT.log("This server is running MissileWars v" + version + " by Butzlabben");
 
-        if (VersionUtil.getVersion() < 13) {
+        if (VersionUtil.getVersion() < 20) {
             Logger.WARN.log("====================================================");
-            Logger.WARN.log("It seems that you are using version older than 1.13");
+            Logger.WARN.log("It seems that you are using version older than 1.20");
             Logger.WARN.log("There is no guarantee for this to work");
             Logger.WARN.log("Proceed with extreme caution");
             Logger.WARN.log("====================================================");

+ 19 - 0
missilewars-plugin/src/main/java/de/butzlabben/missilewars/commands/MWCommandCompletions.java

@@ -22,6 +22,7 @@ import co.aikar.commands.BukkitCommandCompletionContext;
 import co.aikar.commands.CommandCompletions;
 import co.aikar.commands.PaperCommandManager;
 import com.google.common.collect.ImmutableList;
+import de.butzlabben.missilewars.configuration.Config;
 import de.butzlabben.missilewars.game.Game;
 import de.butzlabben.missilewars.game.GameManager;
 import org.bukkit.command.CommandSender;
@@ -36,6 +37,7 @@ public class MWCommandCompletions {
 
         registerGamesResult();
         registerMissilesResult();
+        registerMissileFlagsResult();
         registerArenasResult();
         registerTeamsResult();
         registerGamePlayerResult();
@@ -58,6 +60,23 @@ public class MWCommandCompletions {
             return game.getArena().getMissileConfiguration().getSchematicNames();
         });
     }
+    
+    private void registerMissileFlagsResult() {
+        commandCompletions.registerCompletion("missile-flags", c -> {
+            CommandSender sender = c.getSender();
+
+            if (!(sender instanceof Player)) return null;
+            Player player = (Player) sender;
+
+            Game game = GameManager.getInstance().getGame(player.getLocation());
+            if (game == null) return null;
+            
+            return ImmutableList.of("-tempblock:" + Config.isTempBlockEnabled(), 
+                    "-tempblock_material:" + Config.getTempBlockMaterial(), 
+                    "-tempblock_delay:" + Config.getUpdateDelay(), 
+                    "-tempblock_radius:" + Config.getUpdateRadius());
+        });
+    }
 
     private void registerArenasResult() {
         commandCompletions.registerCompletion("arenas", c -> {

+ 39 - 7
missilewars-plugin/src/main/java/de/butzlabben/missilewars/commands/MWCommands.java

@@ -29,10 +29,11 @@ import de.butzlabben.missilewars.game.enums.GameResult;
 import de.butzlabben.missilewars.game.enums.GameState;
 import de.butzlabben.missilewars.game.enums.TeamType;
 import de.butzlabben.missilewars.game.enums.VoteState;
-import de.butzlabben.missilewars.game.schematics.SchematicFacing;
 import de.butzlabben.missilewars.game.schematics.objects.Missile;
 import de.butzlabben.missilewars.game.timer.LobbyTimer;
 import de.butzlabben.missilewars.player.MWPlayer;
+import de.butzlabben.missilewars.util.MaterialUtil;
+import org.bukkit.Material;
 import org.bukkit.command.CommandSender;
 import org.bukkit.entity.Player;
 
@@ -56,7 +57,7 @@ public class MWCommands extends BaseCommand {
 
         sendHelpMessage(sender, "mw.listgames", "/mw listgames", "List the active games.");
         sendHelpMessage(sender, "mw.move", "/mw move <player> <1|2|spec>", "Change the team of a specific player.");
-        sendHelpMessage(sender, "mw.paste", "/mw paste <missile>", "Pastes a missile.");
+        sendHelpMessage(sender, "mw.paste", "/mw paste <missile> [flags, e.g. '-tempblock:true']", "Pastes a missile.");
         sendHelpMessage(sender, "mw.start", "/mw start [lobby]", "Starts the game.");
         sendHelpMessage(sender, "mw.stop", "/mw stop [lobby]", "Stops the game.");
         sendHelpMessage(sender, "mw.appendrestart", "/mw appendrestart [lobby]", "Appends a restart after the next game ends.");
@@ -212,7 +213,7 @@ public class MWCommands extends BaseCommand {
     }
 
     @Subcommand("paste")
-    @CommandCompletion("@missiles @nothing")
+    @CommandCompletion("@missiles @missile-flags @missile-flags @missile-flags @missile-flags @nothing")
     @CommandPermission("mw.paste")
     public void pasteCommand(CommandSender sender, String[] args) {
 
@@ -224,7 +225,7 @@ public class MWCommands extends BaseCommand {
             return;
         }
 
-        if (args.length > 1) {
+        if (args.length > 5) {
             player.sendMessage(Messages.getMessage(true, Messages.MessageEnum.COMMAND_TO_MANY_ARGUMENTS));
             return;
         }
@@ -241,9 +242,40 @@ public class MWCommands extends BaseCommand {
                     .replace("%input%", args[0]));
             return;
         }
-
-        SchematicFacing schematicFacing = SchematicFacing.getFacingPlayer(player, game.getArena().getMissileConfiguration());
-        missile.paste(game, player, schematicFacing);
+        
+        boolean hasTempBlock = Config.isTempBlockEnabled();
+        Material tempBlockMaterial = Config.getTempBlockMaterial();
+        int tempBlockDelay = Config.getUpdateDelay();
+        int tempBlockRadius = Config.getUpdateRadius();
+        
+        for (int i = 1; i < args.length; i++) {
+            if (args[i].toLowerCase().startsWith("-tempblock:")) {
+                hasTempBlock = Boolean.parseBoolean(args[i].split(":", 2)[1]);
+                continue;
+            }
+            if (args[i].toLowerCase().startsWith("-tempblock_material:")) {
+                tempBlockMaterial = MaterialUtil.getMaterial(args[i].split(":", 2)[1]);
+                continue;
+            }
+            if (args[i].toLowerCase().startsWith("-tempblock_delay:")) {
+                tempBlockDelay = Integer.parseInt(args[i].split(":", 2)[1]);
+                continue;
+            }
+            if (args[i].toLowerCase().startsWith("-tempblock_radius:")) {
+                tempBlockRadius = Integer.parseInt(args[i].split(":", 2)[1]);
+                continue;
+            }
+        }
+        
+        missile.paste(game, player, hasTempBlock, tempBlockMaterial, tempBlockDelay, tempBlockRadius);
+        
+        sender.sendMessage(Messages.getPrefix() + "Missile §7" + missile.getDisplayName() + " §fis placed.");
+        sender.sendMessage("§8 - §f" + "Temp-Block (for block-updater) enabled: §7" + hasTempBlock);
+        sender.sendMessage("§8 - §f" + "Temp-Block material: §7" + tempBlockMaterial);
+        sender.sendMessage("§8 - §f" + "Temp-Block delay: §7" + tempBlockDelay + " server ticks");
+        sender.sendMessage("§8 - §f" + "Temp-Block radius: §7" + tempBlockRadius + " blocks");
+        sender.sendMessage(" ");
+        
     }
 
     @Subcommand("start")

+ 16 - 20
missilewars-plugin/src/main/java/de/butzlabben/missilewars/configuration/Config.java

@@ -22,6 +22,7 @@ import de.butzlabben.missilewars.Logger;
 import de.butzlabben.missilewars.MissileWars;
 import de.butzlabben.missilewars.game.GameManager;
 import de.butzlabben.missilewars.menus.MenuItem;
+import de.butzlabben.missilewars.util.MaterialUtil;
 import de.butzlabben.missilewars.util.SetupUtil;
 import lombok.Getter;
 import org.bukkit.*;
@@ -31,8 +32,7 @@ import org.bukkit.configuration.file.YamlConfiguration;
 import java.io.File;
 import java.util.*;
 
-import static org.bukkit.Material.JUKEBOX;
-import static org.bukkit.Material.valueOf;
+import static org.bukkit.Material.*;
 
 /**
  * @author Butzlabben
@@ -89,9 +89,10 @@ public class Config {
         cfg.addDefault("missiles.folder", "plugins/MissileWars/missiles");
         cfg.addDefault("shields.folder", "plugins/MissileWars/shields");
 
-        cfg.addDefault("replace.material", JUKEBOX.name());
-        cfg.addDefault("replace.after_ticks", 2);
-        cfg.addDefault("replace.radius", 15);
+        cfg.addDefault("temp_block.enable", true);
+        cfg.addDefault("temp_block.material", NOTE_BLOCK.name());
+        cfg.addDefault("temp_block.remove_after_ticks", 0);
+        cfg.addDefault("temp_block.radius", 8);
         
         cfg.addDefault("game_result.firework", true);
 
@@ -308,25 +309,20 @@ public class Config {
         return cfg.getString("shields.folder");
     }
     
-    /**
-     * This method gets the minecraft material type of the block to start missiles.
-     */
-    public static Material getStartReplace() {
-        String name = cfg.getString("replace.material").toUpperCase();
-        try {
-            return valueOf(name);
-        } catch (Exception e) {
-            Logger.WARN.log("Could not use " + name + " as start material!");
-        }
-        return null;
+    public static boolean isTempBlockEnabled() {
+        return cfg.getBoolean("temp_block.enable");
+    }
+    
+    public static Material getTempBlockMaterial() {
+        return MaterialUtil.getMaterial(cfg.getString("temp_block.material"));
     }
 
-    public static int getReplaceTicks() {
-        return cfg.getInt("replace.after_ticks");
+    public static int getUpdateDelay() {
+        return cfg.getInt("temp_block.remove_after_ticks");
     }
 
-    public static int getReplaceRadius() {
-        return cfg.getInt("replace.radius");
+    public static int getUpdateRadius() {
+        return cfg.getInt("temp_block.radius");
     }
     
     public static boolean isGameResultFirework() {

+ 6 - 6
missilewars-plugin/src/main/java/de/butzlabben/missilewars/configuration/arena/MissileConfiguration.java

@@ -46,12 +46,12 @@ public class MissileConfiguration extends SchematicConfiguration {
     private boolean westFacing = true;
 
     private List<Missile> schematics = new ArrayList<>() {{
-        add(new Missile("Tomahawk.schematic", "&aTomahawk", 3, EntityType.CREEPER, 2, 2));
-        add(new Missile("Cruiser.schematic", "&eCruiser", 2, EntityType.BLAZE, 2, 2));
-        add(new Missile("Sword.schematic", "&7Sword", 2, EntityType.SKELETON, 2, 2));
-        add(new Missile("Juggernaut.schematic", "&4Juggernaut", 1, EntityType.MUSHROOM_COW, 2, 2));
-        add(new Missile("Piranha.schematic", "&3Piranha", 3, EntityType.HORSE, 2, 2));
-        add(new Missile("Tunnelbore.schematic", "&0Tunnelbore", 1, EntityType.ENDERMAN, 2, 2));
+        add(new Missile("Tomahawk.schem", "&a%schematic_name_compact%", 3, EntityType.CREEPER, 0, 2));
+        add(new Missile("Cruiser.schem", "&e%schematic_name_compact%", 2, EntityType.BLAZE, 0, 2));
+        add(new Missile("Sword.schem", "&7%schematic_name_compact%", 2, EntityType.SKELETON, 0, 2));
+        add(new Missile("Juggernaut.schem", "&4%schematic_name_compact%", 2, EntityType.MUSHROOM_COW, 0, 2));
+        add(new Missile("Piranha.schem", "&3%schematic_name_compact%", 3, EntityType.HORSE, 0, 2));
+        add(new Missile("Tunnelbore.schem", "&0%schematic_name_compact%", 1, EntityType.ENDERMAN, 0, 2));
     }};
 
 

+ 1 - 1
missilewars-plugin/src/main/java/de/butzlabben/missilewars/configuration/arena/ShieldConfiguration.java

@@ -41,7 +41,7 @@ public class ShieldConfiguration extends SchematicConfiguration {
     @SerializedName("fly_time") private int flyTime = 20;
 
     private List<Shield> schematics = new ArrayList<>() {{
-        add(new Shield("shield.schematic", "&cShield", 1));
+        add(new Shield("shield.schem", "&c%schematic_name_compact%", 1));
     }};
 
 

+ 17 - 5
missilewars-plugin/src/main/java/de/butzlabben/missilewars/game/Game.java

@@ -29,7 +29,6 @@ import de.butzlabben.missilewars.event.GameStopEvent;
 import de.butzlabben.missilewars.game.enums.GameResult;
 import de.butzlabben.missilewars.game.enums.GameState;
 import de.butzlabben.missilewars.game.enums.MapChooseProcedure;
-import de.butzlabben.missilewars.game.enums.TeamType;
 import de.butzlabben.missilewars.game.equipment.EquipmentManager;
 import de.butzlabben.missilewars.game.misc.MotdManager;
 import de.butzlabben.missilewars.game.misc.ScoreboardManager;
@@ -53,6 +52,7 @@ import de.butzlabben.missilewars.util.geometry.GameArea;
 import de.butzlabben.missilewars.util.geometry.Geometry;
 import de.butzlabben.missilewars.util.serialization.Serializer;
 import lombok.Getter;
+import lombok.Setter;
 import lombok.ToString;
 import org.bukkit.*;
 import org.bukkit.entity.Fireball;
@@ -76,6 +76,7 @@ import java.util.function.Consumer;
 @ToString(of = {"gameWorld", "players", "lobby", "arena", "state"})
 public class Game {
 
+    @Setter private GameState state = GameState.LOBBY;
     private static final Map<String, Integer> cycles = new HashMap<>();
     private static int fights = 0;
     private final Map<UUID, MWPlayer> players = new HashMap<>();
@@ -83,7 +84,6 @@ public class Game {
     private final Lobby lobby;
     private final Map<UUID, BukkitTask> playerTasks = new HashMap<>();
     private final List<Location> portalBlocks = new ArrayList<>();
-    private GameState state = GameState.LOBBY;
     private TeamManager teamManager;
     private boolean ready = false;
     private boolean restart = false;
@@ -315,9 +315,21 @@ public class Game {
     }
     
     public void resetGame() {
-        // Teleporting players; the event listener will handle the teleport event
-        applyForAllPlayers(this::teleportToAfterGameSpawn);
+        
+        Logger.DEBUG.log("Stopping");
 
+        for (BukkitTask bt : playerTasks.values()) {
+            bt.cancel();
+        }
+
+        Logger.DEBUG.log("Stopping for players");
+        for (Player player : gameWorld.getWorld().getPlayers()) {
+
+            Logger.DEBUG.log("Stopping for: " + player.getName());
+            teleportToAfterGameSpawn(player);
+
+        }
+        
         // Deactivation of all event handlers
         HandlerList.unregisterAll(listener);
         taskManager.stopTimer();
@@ -466,7 +478,7 @@ public class Game {
         
         itemStack.setAmount(itemStack.getAmount() - 1);
         player.setItemInHand(itemStack);
-        missile.paste(this, player, SchematicFacing.getFacingPlayer(player, this.arena.getMissileConfiguration()));
+        missile.paste(this, player);
     }
 
     /**

+ 2 - 0
missilewars-plugin/src/main/java/de/butzlabben/missilewars/game/GameManager.java

@@ -23,6 +23,7 @@ import de.butzlabben.missilewars.MissileWars;
 import de.butzlabben.missilewars.configuration.Config;
 import de.butzlabben.missilewars.configuration.lobby.Lobby;
 import de.butzlabben.missilewars.configuration.Messages;
+import de.butzlabben.missilewars.game.enums.GameState;
 import de.butzlabben.missilewars.util.geometry.GameArea;
 import de.butzlabben.missilewars.util.serialization.Serializer;
 import lombok.Getter;
@@ -53,6 +54,7 @@ public class GameManager {
         List<Game> gamesListCache = new ArrayList<>(games.values());
         
         for (Game game : gamesListCache) {
+            game.setState(GameState.END);
             restartGame(game.getLobby(), false);
         }
     }

+ 27 - 13
missilewars-plugin/src/main/java/de/butzlabben/missilewars/game/schematics/objects/Missile.java

@@ -56,37 +56,52 @@ public class Missile extends SchematicObject {
         return new File(Config.getMissilesFolder());
     }
     
-    public void paste(Game game, Player p, SchematicFacing mf) {
-        if (mf == null)
-            return;
+    public void paste(Game game, Player player) {
+        
+        boolean hasTempBlock = Config.isTempBlockEnabled();
+        Material tempBlockMaterial = Config.getTempBlockMaterial();
+        int tempBlockDelay = Config.getUpdateDelay();
+        int tempBlockRadius = Config.getUpdateRadius();
+        
+        paste(game, player, hasTempBlock, tempBlockMaterial, tempBlockDelay, tempBlockRadius);
+    }
+
+    public void paste(Game game, Player player, boolean hasTempBlock, Material tempBlockMaterial, int tempBlockDelay, 
+                      int tempBlockRadius) {
+        
+        SchematicFacing schematicFacing = SchematicFacing.getFacingPlayer(player, game.getArena().getMissileConfiguration());
+        if (schematicFacing == null) return;
+        
         try {
-            Location loc = p.getLocation();
+            
+            Location loc = player.getLocation();
             Vector pastePos = new Vector(loc.getX(), loc.getY(), loc.getZ());
             
             pastePos = pastePos.add(new Vector(0, -down, 0));
 
             int rotation = 0;
-            if (mf == SchematicFacing.NORTH) {
+            if (schematicFacing == SchematicFacing.NORTH) {
                 pastePos = pastePos.add(new Vector(0, 0, -dist));
-            } else if (mf == SchematicFacing.SOUTH) {
+            } else if (schematicFacing == SchematicFacing.SOUTH) {
                 pastePos = pastePos.add(new Vector(0, 0, dist));
                 rotation = 180;
-            } else if (mf == SchematicFacing.EAST) {
+            } else if (schematicFacing == SchematicFacing.EAST) {
                 pastePos = pastePos.add(new Vector(dist, 0, 0));
                 rotation = 270;
-            } else if (mf == SchematicFacing.WEST) {
+            } else if (schematicFacing == SchematicFacing.WEST) {
                 pastePos = pastePos.add(new Vector(-dist, 0, 0));
                 rotation = 90;
             }
-
-            PasteProvider.getPaster().pasteMissile(getSchematic(), pastePos, rotation, loc.getWorld(),
-                    game.getPlayer(p).getTeam());
+            
+            PasteProvider.getPaster().pasteMissile(getSchematic(), pastePos, rotation, loc.getWorld(), hasTempBlock, 
+                    tempBlockMaterial, tempBlockDelay, tempBlockRadius);
+            
         } catch (Exception e) {
             Logger.ERROR.log("Could not load " + getDisplayName());
             e.printStackTrace();
         }
     }
-    
+
     /**
      * This method provides the missile spawn item based on the
      * mob spawn item specification in the arena configuration.
@@ -116,5 +131,4 @@ public class Missile extends SchematicObject {
         String name = material.name();
         return name.contains("SPAWN_EGG") || name.equals("MONSTER_EGG");
     }
-    
 }

+ 1 - 1
missilewars-plugin/src/main/java/de/butzlabben/missilewars/game/schematics/objects/Shield.java

@@ -29,7 +29,7 @@ public class Shield extends SchematicObject {
             Location loc = ball.getLocation();
             Vector pastePos = new Vector(loc.getX(), loc.getY(), loc.getZ());
             
-            PasteProvider.getPaster().pasteSchematic(getSchematic(), pastePos, loc.getWorld());
+            PasteProvider.getPaster().pasteSchematic(getSchematic(), pastePos, 0, loc.getWorld());
         } catch (Exception e) {
             Logger.ERROR.log("Could not load " + getDisplayName());
             e.printStackTrace();

+ 10 - 12
missilewars-plugin/src/main/java/de/butzlabben/missilewars/game/schematics/paste/R1_16FawePasteProvider.java → missilewars-plugin/src/main/java/de/butzlabben/missilewars/game/schematics/paste/FawePasteProvider.java

@@ -19,11 +19,8 @@
 package de.butzlabben.missilewars.game.schematics.paste;
 
 import de.butzlabben.missilewars.MissileWars;
-import de.butzlabben.missilewars.configuration.Config;
-import de.butzlabben.missilewars.game.Team;
-import de.butzlabben.missilewars.missile.paste.r1_16.fawe.R1_16Paster;
-import de.butzlabben.missilewars.util.version.ColorConverter;
-import org.bukkit.World;
+import de.butzlabben.missilewars.missile.paste.v1_20.fawe.FAWE_Paster;
+import org.bukkit.Material;
 import org.bukkit.util.Vector;
 
 import java.io.File;
@@ -32,18 +29,19 @@ import java.io.File;
  * @author Butzlabben
  * @since 23.09.2018
  */
-public class R1_16FawePasteProvider implements Paster {
+public class FawePasteProvider implements Paster {
 
-    R1_16Paster paster = new R1_16Paster();
+    FAWE_Paster paster = new FAWE_Paster();
 
     @Override
-    public void pasteMissile(File schematic, Vector position, int rotation, World world, Team team) {
-        paster.pasteMissile(schematic, position, rotation, world, ColorConverter.getGlassFromColorCode(team.getColorCode()),
-                Config.getReplaceRadius(), Config.getStartReplace(), MissileWars.getInstance(), Config.getReplaceTicks());
+    public void pasteMissile(File schematic, Vector locationVec, int rotation, org.bukkit.World world, boolean blockUpdate, 
+                             Material replaceMaterial, int replaceTicks, int replaceRadius) {
+        paster.pasteMissile(schematic, locationVec, rotation, world, blockUpdate, replaceMaterial, replaceTicks, 
+                replaceRadius, MissileWars.getInstance());
     }
 
     @Override
-    public void pasteSchematic(File schematic, Vector position, World world) {
-        paster.pasteSchematic(schematic, position, world);
+    public void pasteSchematic(File schematic, Vector locationVec, int rotation, org.bukkit.World world) {
+        paster.pasteSchematic(schematic, locationVec, rotation, world, MissileWars.getInstance());
     }
 }

+ 7 - 13
missilewars-plugin/src/main/java/de/butzlabben/missilewars/game/schematics/paste/PasteProvider.java

@@ -21,7 +21,7 @@ package de.butzlabben.missilewars.game.schematics.paste;
 
 import de.butzlabben.missilewars.Logger;
 import de.butzlabben.missilewars.MissileWars;
-import de.butzlabben.missilewars.util.version.VersionUtil;
+import lombok.Getter;
 
 /**
  * @author Butzlabben
@@ -29,27 +29,21 @@ import de.butzlabben.missilewars.util.version.VersionUtil;
  */
 public class PasteProvider {
 
+    @Getter
     private static final Paster paster;
 
     static {
         if (MissileWars.getInstance().foundFAWE()) {
-            if (VersionUtil.getVersion() < 16) {
-                paster = new R1_13FawePasteProvider();
-                Logger.DEBUG.log("Chose 1.13 FAWE paster");
-            } else {
-                paster = new R1_16FawePasteProvider();
-                Logger.DEBUG.log("Chose 1.16 FAWE paster");
-            }
+            paster = new FawePasteProvider();
+            Logger.DEBUG.log("Chose FAWE paster.");
         } else {
-            paster = new R1_13WEPasteProvider();
-            Logger.DEBUG.log("Chose 1.13 WE paster");
+            // FAWE Paster works also for (normal) WorldEdit
+            paster = new FawePasteProvider();
+            Logger.DEBUG.log("Chose FAWE paster.");
         }
     }
 
     private PasteProvider() {
     }
 
-    public static Paster getPaster() {
-        return paster;
-    }
 }

+ 4 - 3
missilewars-plugin/src/main/java/de/butzlabben/missilewars/game/schematics/paste/Paster.java

@@ -18,7 +18,7 @@
 
 package de.butzlabben.missilewars.game.schematics.paste;
 
-import de.butzlabben.missilewars.game.Team;
+import org.bukkit.Material;
 import org.bukkit.util.Vector;
 
 import java.io.File;
@@ -29,7 +29,8 @@ import java.io.File;
  */
 public interface Paster {
 
-    void pasteSchematic(File schematic, Vector position, org.bukkit.World world);
+    void pasteMissile(File schematic, Vector locationVec, int rotation, org.bukkit.World world, boolean blockUpdate, 
+                      Material replaceMaterial, int replaceTicks, int replaceRadius);
 
-    void pasteMissile(File schematic, Vector position, int rotation, org.bukkit.World world, Team team);
+    void pasteSchematic(File schematic, Vector locationVec, int rotation, org.bukkit.World world);
 }

+ 0 - 49
missilewars-plugin/src/main/java/de/butzlabben/missilewars/game/schematics/paste/R1_13FawePasteProvider.java

@@ -1,49 +0,0 @@
-/*
- * This file is part of MissileWars (https://github.com/Butzlabben/missilewars).
- * Copyright (c) 2018-2021 Daniel Nägele.
- *
- * MissileWars is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * MissileWars 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with MissileWars.  If not, see <https://www.gnu.org/licenses/>.
- */
-
-package de.butzlabben.missilewars.game.schematics.paste;
-
-import de.butzlabben.missilewars.MissileWars;
-import de.butzlabben.missilewars.configuration.Config;
-import de.butzlabben.missilewars.game.Team;
-import de.butzlabben.missilewars.missile.paste.r1_13.fawe.R1_13Paster;
-import de.butzlabben.missilewars.util.version.ColorConverter;
-import org.bukkit.World;
-import org.bukkit.util.Vector;
-
-import java.io.File;
-
-/**
- * @author Butzlabben
- * @since 23.09.2018
- */
-public class R1_13FawePasteProvider implements Paster {
-
-    R1_13Paster paster = new R1_13Paster();
-
-    @Override
-    public void pasteMissile(File schematic, Vector position, int rotation, World world, Team team) {
-        paster.pasteMissile(schematic, position, rotation, world, ColorConverter.getGlassFromColorCode(team.getColorCode()),
-                Config.getReplaceRadius(), Config.getStartReplace(), MissileWars.getInstance(), Config.getReplaceTicks());
-    }
-
-    @Override
-    public void pasteSchematic(File schematic, Vector position, World world) {
-        paster.pasteSchematic(schematic, position, world);
-    }
-}

+ 0 - 49
missilewars-plugin/src/main/java/de/butzlabben/missilewars/game/schematics/paste/R1_13WEPasteProvider.java

@@ -1,49 +0,0 @@
-/*
- * This file is part of MissileWars (https://github.com/Butzlabben/missilewars).
- * Copyright (c) 2018-2021 Daniel Nägele.
- *
- * MissileWars is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * MissileWars 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with MissileWars.  If not, see <https://www.gnu.org/licenses/>.
- */
-
-package de.butzlabben.missilewars.game.schematics.paste;
-
-import de.butzlabben.missilewars.MissileWars;
-import de.butzlabben.missilewars.configuration.Config;
-import de.butzlabben.missilewars.game.Team;
-import de.butzlabben.missilewars.missile.paste.r1_13.we.R1_13Paster;
-import de.butzlabben.missilewars.util.version.ColorConverter;
-import org.bukkit.World;
-import org.bukkit.util.Vector;
-
-import java.io.File;
-
-/**
- * @author Butzlabben
- * @since 23.09.2018
- */
-public class R1_13WEPasteProvider implements Paster {
-
-    R1_13Paster paster = new R1_13Paster();
-
-    @Override
-    public void pasteMissile(File schematic, Vector position, int rotation, World world, Team team) {
-        paster.pasteMissile(schematic, position, rotation, world, ColorConverter.getGlassFromColorCode(team.getColorCode()),
-                Config.getReplaceRadius(), Config.getStartReplace(), MissileWars.getInstance(), Config.getReplaceTicks());
-    }
-
-    @Override
-    public void pasteSchematic(File schematic, Vector position, World world) {
-        paster.pasteSchematic(schematic, position, world);
-    }
-}

+ 0 - 4
missilewars-plugin/src/main/java/de/butzlabben/missilewars/menus/hotbar/GameJoinMenu.java

@@ -1,15 +1,11 @@
 package de.butzlabben.missilewars.menus.hotbar;
 
 import de.butzlabben.missilewars.Logger;
-import de.butzlabben.missilewars.configuration.Config;
 import de.butzlabben.missilewars.game.Game;
-import de.butzlabben.missilewars.menus.ItemRequirement;
 import de.butzlabben.missilewars.menus.MenuItem;
 import de.butzlabben.missilewars.player.MWPlayer;
 import lombok.Getter;
 import lombok.Setter;
-import org.apache.commons.lang3.tuple.Pair;
-import scala.Int;
 
 import java.util.*;
 

+ 26 - 0
missilewars-plugin/src/main/java/de/butzlabben/missilewars/util/MaterialUtil.java

@@ -0,0 +1,26 @@
+package de.butzlabben.missilewars.util;
+
+import de.butzlabben.missilewars.Logger;
+
+import javax.annotation.Nullable;
+
+import static org.bukkit.Material.valueOf;
+
+public class MaterialUtil {
+    
+    public static org.bukkit.Material getMaterial(@Nullable String input) {
+        if (input == null) {
+            Logger.WARN.log("Material not defined!");
+            return null;
+        }
+        
+        String name = input.toUpperCase();
+        try {
+            return valueOf(name);
+        } catch (Exception e) {
+            Logger.WARN.log("Could not use '" + name + "' as bukkit material!");
+        }
+        return null;
+    }
+    
+}

+ 0 - 2
missilewars-plugin/src/main/java/de/butzlabben/missilewars/util/serialization/Serializer.java

@@ -31,7 +31,6 @@ import java.io.IOException;
 import java.lang.reflect.Field;
 import java.nio.file.Files;
 import java.nio.file.Paths;
-import org.apache.commons.lang.Validate;
 import org.bukkit.Location;
 import org.bukkit.World;
 
@@ -131,7 +130,6 @@ public class Serializer {
     }
 
     private static String replaceColorStrings(char replace, char replacement, String textToTranslate) {
-        Validate.notNull(textToTranslate, "Cannot translate null text");
         char[] b = textToTranslate.toCharArray();
 
         for (int i = 0; i < b.length - 1; ++i) {

+ 2 - 2
missilewars-plugin/src/main/resources-filtered/plugin.yml

@@ -1,8 +1,8 @@
 name: MissileWars
-author: Butzlabben
+authors: [Butzlabben, RedstoneFuture]
 version: ${project.version}
 main: de.butzlabben.missilewars.MissileWars
-api-version: 1.13
+api-version: 1.20
 depend: [ WorldEdit ]
 softdepend: [ Vault, FastAsyncWorldEdit, PlaceholderAPI ]
 

二进制
missilewars-plugin/src/main/resources/missiles.zip


二进制
missilewars-plugin/src/main/resources/shields.zip


+ 5 - 7
pom.xml

@@ -33,9 +33,7 @@
     <version>1.0</version>
 
     <modules>
-        <module>1_13</module>
-        <module>1_13_FAWE</module>
-        <module>1_16_FAWE</module>
+        <module>FAWE_Paster</module>
         <module>missilewars-plugin</module>
     </modules>
 
@@ -67,7 +65,7 @@
         <dependency>
             <groupId>org.spigotmc</groupId>
             <artifactId>spigot-api</artifactId>
-            <version>1.18.1-R0.1-SNAPSHOT</version>
+            <version>1.20.4-R0.1-SNAPSHOT</version>
             <scope>provided</scope>
         </dependency>
 
@@ -75,7 +73,7 @@
         <dependency>
             <groupId>com.sk89q.worldedit</groupId>
             <artifactId>worldedit-bukkit</artifactId>
-            <version>7.2.0-SNAPSHOT</version>
+            <version>7.3.0</version>
             <scope>provided</scope>
 
             <exclusions>
@@ -89,7 +87,7 @@
         <dependency>
             <groupId>com.sk89q.worldedit</groupId>
             <artifactId>worldedit-core</artifactId>
-            <version>7.2.0-SNAPSHOT</version>
+            <version>7.3.0</version>
             <scope>provided</scope>
         </dependency>
 
@@ -97,7 +95,7 @@
         <dependency>
             <groupId>org.projectlombok</groupId>
             <artifactId>lombok</artifactId>
-            <version>1.18.24</version>
+            <version>1.18.34</version>
             <scope>provided</scope>
         </dependency>
     </dependencies>