Migrate package from de.softwarerat to com.softwarerat and rebuild
This commit is contained in:
Vendored
+4
@@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"java.configuration.updateBuildConfiguration": "automatic",
|
||||||
|
"java.compile.nullAnalysis.mode": "automatic"
|
||||||
|
}
|
||||||
@@ -0,0 +1,83 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<groupId>com.softwarerat</groupId>
|
||||||
|
<artifactId>mlgrush</artifactId>
|
||||||
|
<name>mlgrush</name>
|
||||||
|
<version>1.0.24-SNAPSHOT</version>
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<version>3.13.0</version>
|
||||||
|
<configuration>
|
||||||
|
<source>${java.version}</source>
|
||||||
|
<target>${java.version}</target>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-shade-plugin</artifactId>
|
||||||
|
<version>3.5.3</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<phase>package</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>shade</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<transformers>
|
||||||
|
<transformer>
|
||||||
|
<mainClass>com.softwarerat.MLGRush.MLGRush</mainClass>
|
||||||
|
</transformer>
|
||||||
|
<transformer>
|
||||||
|
<resource>META-INF/spring.handlers</resource>
|
||||||
|
</transformer>
|
||||||
|
<transformer>
|
||||||
|
<resource>META-INF/spring.schemas</resource>
|
||||||
|
</transformer>
|
||||||
|
</transformers>
|
||||||
|
<filters>
|
||||||
|
<filter>
|
||||||
|
<artifact>*:*</artifact>
|
||||||
|
<excludes>
|
||||||
|
<exclude>META-INF/*.SF</exclude>
|
||||||
|
<exclude>META-INF/*.DSA</exclude>
|
||||||
|
<exclude>META-INF/*.RSA</exclude>
|
||||||
|
</excludes>
|
||||||
|
</filter>
|
||||||
|
</filters>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
<repositories>
|
||||||
|
<repository>
|
||||||
|
<id>papermc-repo</id>
|
||||||
|
<url>https://repo.papermc.io/repository/maven-public/</url>
|
||||||
|
</repository>
|
||||||
|
<repository>
|
||||||
|
<id>sonatype</id>
|
||||||
|
<url>https://oss.sonatype.org/content/groups/public/</url>
|
||||||
|
</repository>
|
||||||
|
</repositories>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.papermc.paper</groupId>
|
||||||
|
<artifactId>paper-api</artifactId>
|
||||||
|
<version>1.21.1-R0.1-SNAPSHOT</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.projectlombok</groupId>
|
||||||
|
<artifactId>lombok</artifactId>
|
||||||
|
<version>1.18.42</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
<properties>
|
||||||
|
<java.version>21</java.version>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
</properties>
|
||||||
|
</project>
|
||||||
@@ -1,37 +1,23 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
|
|
||||||
<groupId>de.softwarerat</groupId>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<groupId>com.softwarerat</groupId>
|
||||||
<artifactId>mlgrush</artifactId>
|
<artifactId>mlgrush</artifactId>
|
||||||
<version>1.0.24-SNAPSHOT</version>
|
<version>1.0.24-SNAPSHOT</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>mlgrush</name>
|
<name>mlgrush</name>
|
||||||
|
|
||||||
|
|
||||||
<distributionManagement>
|
|
||||||
<repository>
|
|
||||||
<id>gitlab-maven</id>
|
|
||||||
<url>https://gitlab.softwarerat.com/api/v4/projects/25/packages/maven</url>
|
|
||||||
</repository>
|
|
||||||
<snapshotRepository>
|
|
||||||
<id>gitlab-maven</id>
|
|
||||||
<url>https://gitlab.softwarerat.com/api/v4/projects/25/packages/maven</url>
|
|
||||||
</snapshotRepository>
|
|
||||||
</distributionManagement>
|
|
||||||
|
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<java.version>18</java.version>
|
<java.version>21</java.version>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
<defaultGoal>clean package</defaultGoal>
|
|
||||||
<plugins>
|
<plugins>
|
||||||
|
<!-- Compiler -->
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
@@ -41,6 +27,8 @@
|
|||||||
<target>${java.version}</target>
|
<target>${java.version}</target>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
||||||
|
<!-- Shade plugin -->
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-shade-plugin</artifactId>
|
<artifactId>maven-shade-plugin</artifactId>
|
||||||
@@ -51,29 +39,43 @@
|
|||||||
<goals>
|
<goals>
|
||||||
<goal>shade</goal>
|
<goal>shade</goal>
|
||||||
</goals>
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<!-- Merge MANIFEST files safely -->
|
||||||
|
<transformers>
|
||||||
|
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
|
||||||
|
<mainClass>com.softwarerat.MLGRush.MLGRush</mainClass>
|
||||||
|
</transformer>
|
||||||
|
<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
|
||||||
|
<resource>META-INF/spring.handlers</resource>
|
||||||
|
</transformer>
|
||||||
|
<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
|
||||||
|
<resource>META-INF/spring.schemas</resource>
|
||||||
|
</transformer>
|
||||||
|
</transformers>
|
||||||
|
|
||||||
|
<!-- Exclude duplicate signature files -->
|
||||||
|
<filters>
|
||||||
|
<filter>
|
||||||
|
<artifact>*:*</artifact>
|
||||||
|
<excludes>
|
||||||
|
<exclude>META-INF/*.SF</exclude>
|
||||||
|
<exclude>META-INF/*.DSA</exclude>
|
||||||
|
<exclude>META-INF/*.RSA</exclude>
|
||||||
|
</excludes>
|
||||||
|
</filter>
|
||||||
|
</filters>
|
||||||
|
</configuration>
|
||||||
</execution>
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
</plugin>
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
<resources>
|
|
||||||
<resource>
|
|
||||||
<directory>src/main/resources</directory>
|
|
||||||
<filtering>true</filtering>
|
|
||||||
</resource>
|
|
||||||
</resources>
|
|
||||||
</build>
|
</build>
|
||||||
|
|
||||||
<repositories>
|
<repositories>
|
||||||
|
|
||||||
<repository>
|
<repository>
|
||||||
<id>papermc-repo</id>
|
<id>papermc-repo</id>
|
||||||
<url>https://repo.papermc.io/repository/maven-public/</url>
|
<url>https://repo.papermc.io/repository/maven-public/</url>
|
||||||
</repository>
|
</repository>
|
||||||
<repository>
|
|
||||||
<id>gitlab-maven</id>
|
|
||||||
<url>https://Gitlab.Softwarerat.com/api/v4/projects/16/packages/maven</url>
|
|
||||||
</repository>
|
|
||||||
|
|
||||||
<repository>
|
<repository>
|
||||||
<id>sonatype</id>
|
<id>sonatype</id>
|
||||||
<url>https://oss.sonatype.org/content/groups/public/</url>
|
<url>https://oss.sonatype.org/content/groups/public/</url>
|
||||||
@@ -90,7 +92,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.projectlombok</groupId>
|
<groupId>org.projectlombok</groupId>
|
||||||
<artifactId>lombok</artifactId>
|
<artifactId>lombok</artifactId>
|
||||||
<version>1.18.28</version>
|
<version>1.18.42</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
@@ -99,4 +101,5 @@
|
|||||||
<version>1.6.4-SNAPSHOT</version>
|
<version>1.6.4-SNAPSHOT</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
@@ -0,0 +1,106 @@
|
|||||||
|
package com.softwarerat.MLGRush.MLGRush.GameState;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.GameMode;
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.World;
|
||||||
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
|
import org.bukkit.enchantments.Enchantment;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import com.softwarerat.API.builder.SpigotInventory;
|
||||||
|
import com.softwarerat.API.builder.SpigotItem;
|
||||||
|
import com.softwarerat.API.gameState.IGameState;
|
||||||
|
import com.softwarerat.MLGRush.MLGRush.MLGRush;
|
||||||
|
import com.softwarerat.MLGRush.MLGRush.data.Scores;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
public class IngameState implements IGameState {
|
||||||
|
|
||||||
|
private final Scores scores;
|
||||||
|
private final MLGRush plugin;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
private Player player1;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
private Player player2;
|
||||||
|
|
||||||
|
public IngameState(MLGRush plugin, Scores scores) {
|
||||||
|
this.plugin = plugin;
|
||||||
|
this.scores = scores;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void Start() {
|
||||||
|
|
||||||
|
Location redSpawn = getLocation("spawn.red");
|
||||||
|
Location blueSpawn = getLocation("spawn.blue");
|
||||||
|
|
||||||
|
scores.getScoreBlue().set(0);
|
||||||
|
scores.getScoreRed().set(0);
|
||||||
|
|
||||||
|
int index = 0;
|
||||||
|
|
||||||
|
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||||
|
|
||||||
|
preparePlayer(player);
|
||||||
|
|
||||||
|
if (index == 0) {
|
||||||
|
player1 = player;
|
||||||
|
player.teleport(redSpawn);
|
||||||
|
player.setRespawnLocation(redSpawn);
|
||||||
|
} else if (index == 1) {
|
||||||
|
player2 = player;
|
||||||
|
player.teleport(blueSpawn);
|
||||||
|
player.setRespawnLocation(blueSpawn);
|
||||||
|
}
|
||||||
|
|
||||||
|
index++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void Stop() {
|
||||||
|
Bukkit.shutdown();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void preparePlayer(Player player) {
|
||||||
|
|
||||||
|
SpigotInventory inventory = new SpigotInventory(player, plugin);
|
||||||
|
inventory.clear();
|
||||||
|
|
||||||
|
inventory.addItem(new SpigotItem(Material.SANDSTONE, 64).build());
|
||||||
|
inventory.addItem(new SpigotItem(Material.STICK, 1)
|
||||||
|
.addUnsafeEnchantment(Enchantment.KNOCKBACK, 1)
|
||||||
|
.build());
|
||||||
|
inventory.addItem(new SpigotItem(Material.WOODEN_PICKAXE, 1)
|
||||||
|
.addEnchant(Enchantment.EFFICIENCY, 5)
|
||||||
|
.setUnbreakable(true)
|
||||||
|
.build());
|
||||||
|
|
||||||
|
player.setGameMode(GameMode.SURVIVAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Location getLocation(String path) {
|
||||||
|
|
||||||
|
FileConfiguration config = plugin.getConfig();
|
||||||
|
|
||||||
|
String worldName = config.getString(path + ".world");
|
||||||
|
double x = config.getDouble(path + ".x");
|
||||||
|
double y = config.getDouble(path + ".y");
|
||||||
|
double z = config.getDouble(path + ".z");
|
||||||
|
float yaw = (float) config.getDouble(path + ".yaw");
|
||||||
|
float pitch = (float) config.getDouble(path + ".pitch");
|
||||||
|
|
||||||
|
World world = Bukkit.getWorld(worldName);
|
||||||
|
|
||||||
|
if (world == null) {
|
||||||
|
throw new IllegalArgumentException("World '" + worldName + "' not found in config!");
|
||||||
|
}
|
||||||
|
|
||||||
|
return new Location(world, x, y, z, yaw, pitch);
|
||||||
|
}
|
||||||
|
}
|
||||||
+3
-3
@@ -1,4 +1,4 @@
|
|||||||
package de.softwarerat.MLGRush.GameState;
|
package com.softwarerat.MLGRush.MLGRush.GameState;
|
||||||
|
|
||||||
import com.softwarerat.API.gameState.IGameState;
|
import com.softwarerat.API.gameState.IGameState;
|
||||||
import com.softwarerat.API.world.WorldAPI;
|
import com.softwarerat.API.world.WorldAPI;
|
||||||
@@ -14,12 +14,12 @@ public class LobbyState implements IGameState {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void Start() {
|
public void Start() {
|
||||||
|
worldAPI.loadWorld("ingame");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void Stop() {
|
public void Stop() {
|
||||||
worldAPI.loadWorld("ingame");
|
|
||||||
ingameState.Start();
|
ingameState.Start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+3
-2
@@ -1,9 +1,10 @@
|
|||||||
package de.softwarerat.MLGRush;
|
package com.softwarerat.MLGRush.MLGRush;
|
||||||
|
|
||||||
import com.softwarerat.API.prefix.PrefixAPI;
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import com.softwarerat.API.prefix.PrefixAPI;
|
||||||
|
|
||||||
public class IPrefix {
|
public class IPrefix {
|
||||||
PrefixAPI prefixAPI;
|
PrefixAPI prefixAPI;
|
||||||
|
|
||||||
+39
-22
@@ -1,16 +1,5 @@
|
|||||||
package de.softwarerat.MLGRush;
|
package com.softwarerat.MLGRush.MLGRush;
|
||||||
|
|
||||||
import com.softwarerat.API.data.GameData;
|
|
||||||
import com.softwarerat.API.prefix.PrefixAPI;
|
|
||||||
import com.softwarerat.API.world.WorldAPI;
|
|
||||||
import com.softwarerat.GameAPI;
|
|
||||||
import de.softwarerat.MLGRush.GameState.IngameState;
|
|
||||||
import de.softwarerat.MLGRush.GameState.LobbyState;
|
|
||||||
import de.softwarerat.MLGRush.data.Scores;
|
|
||||||
import de.softwarerat.MLGRush.listener.BlockBreakListener;
|
|
||||||
import de.softwarerat.MLGRush.listener.JoinListener;
|
|
||||||
import de.softwarerat.MLGRush.listener.OutOfAreaListener;
|
|
||||||
import lombok.Getter;
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
@@ -18,6 +7,18 @@ import org.bukkit.World;
|
|||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
import org.bukkit.scoreboard.Scoreboard;
|
import org.bukkit.scoreboard.Scoreboard;
|
||||||
|
|
||||||
|
import com.softwarerat.API.data.GameData;
|
||||||
|
import com.softwarerat.API.prefix.PrefixAPI;
|
||||||
|
import com.softwarerat.API.world.WorldAPI;
|
||||||
|
import com.softwarerat.GameAPI;
|
||||||
|
import com.softwarerat.MLGRush.MLGRush.GameState.IngameState;
|
||||||
|
import com.softwarerat.MLGRush.MLGRush.GameState.LobbyState;
|
||||||
|
import com.softwarerat.MLGRush.MLGRush.data.Scores;
|
||||||
|
import com.softwarerat.MLGRush.MLGRush.listener.BlockBreakListener;
|
||||||
|
import com.softwarerat.MLGRush.MLGRush.listener.JoinListener;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
public final class MLGRush extends JavaPlugin {
|
public final class MLGRush extends JavaPlugin {
|
||||||
GameAPI gameAPI;
|
GameAPI gameAPI;
|
||||||
GameData gameData;
|
GameData gameData;
|
||||||
@@ -29,8 +30,29 @@ public final class MLGRush extends JavaPlugin {
|
|||||||
IngameState ingameState;
|
IngameState ingameState;
|
||||||
@Override
|
@Override
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
|
saveDefaultConfig();
|
||||||
|
setupAPIs();
|
||||||
|
setupGame();
|
||||||
|
setupListener();
|
||||||
|
|
||||||
// Plugin startup logic
|
// Plugin startup logic
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDisable() {
|
||||||
|
// Plugin shutdown logic
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void setupListener() {
|
||||||
|
Bukkit.getPluginManager().registerEvents(new JoinListener(lobbyState,iPrefix),this);
|
||||||
|
Bukkit.getPluginManager().registerEvents(new BlockBreakListener(this,scores, ingameState),this);
|
||||||
|
// Bukkit.getPluginManager().registerEvents(new OutOfAreaListener(ingameState, this),this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setupAPIs() {
|
||||||
gameAPI = new GameAPI();
|
gameAPI = new GameAPI();
|
||||||
gameAPI.enableAPI(this);
|
gameAPI.enableAPI(this);
|
||||||
gameAPI.setJavaPlugin(this);
|
gameAPI.setJavaPlugin(this);
|
||||||
@@ -42,6 +64,9 @@ public final class MLGRush extends JavaPlugin {
|
|||||||
scoreboard = Bukkit.getScoreboardManager().getMainScoreboard();
|
scoreboard = Bukkit.getScoreboardManager().getMainScoreboard();
|
||||||
gameData.setScoreboard(scoreboard);
|
gameData.setScoreboard(scoreboard);
|
||||||
prefixAPI = new PrefixAPI(scoreboard);
|
prefixAPI = new PrefixAPI(scoreboard);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setupGame() {
|
||||||
|
|
||||||
if (Bukkit.getScoreboardManager().getMainScoreboard().getTeam("1Admin") == null){
|
if (Bukkit.getScoreboardManager().getMainScoreboard().getTeam("1Admin") == null){
|
||||||
prefixAPI.createPrefix("Admin", 01, ChatColor.RED + "Admin " + ChatColor.GRAY + "| ");
|
prefixAPI.createPrefix("Admin", 01, ChatColor.RED + "Admin " + ChatColor.GRAY + "| ");
|
||||||
@@ -69,16 +94,8 @@ public final class MLGRush extends JavaPlugin {
|
|||||||
// Plugin startup logic
|
// Plugin startup logic
|
||||||
iPrefix = new IPrefix(prefixAPI);
|
iPrefix = new IPrefix(prefixAPI);
|
||||||
scores = new Scores();
|
scores = new Scores();
|
||||||
ingameState = new IngameState(scores);
|
ingameState = new IngameState(this,scores);
|
||||||
lobbyState = new LobbyState(ingameState,new WorldAPI());
|
lobbyState = new LobbyState(ingameState,new WorldAPI());
|
||||||
|
lobbyState.Start();
|
||||||
Bukkit.getPluginManager().registerEvents(new JoinListener(lobbyState,iPrefix),this);
|
|
||||||
Bukkit.getPluginManager().registerEvents(new BlockBreakListener(scores, ingameState),this);
|
|
||||||
Bukkit.getPluginManager().registerEvents(new OutOfAreaListener(ingameState),this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onDisable() {
|
|
||||||
// Plugin shutdown logic
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+3
-3
@@ -1,10 +1,10 @@
|
|||||||
package de.softwarerat.MLGRush.data;
|
package com.softwarerat.MLGRush.MLGRush.data;
|
||||||
|
|
||||||
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
|
||||||
|
|
||||||
@Setter
|
@Setter
|
||||||
@Getter
|
@Getter
|
||||||
public class Scores {
|
public class Scores {
|
||||||
@@ -0,0 +1,62 @@
|
|||||||
|
package com.softwarerat.MLGRush.MLGRush.data;
|
||||||
|
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
|
|
||||||
|
public class Yaml {
|
||||||
|
|
||||||
|
private final File file;
|
||||||
|
private FileConfiguration config;
|
||||||
|
|
||||||
|
public Yaml(String path, String fileName) {
|
||||||
|
this.file = new File(path, fileName); // FIX HERE
|
||||||
|
load();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public void load() {
|
||||||
|
this.config = YamlConfiguration.loadConfiguration(file);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void save() {
|
||||||
|
try {
|
||||||
|
config.save(file);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void reload() {
|
||||||
|
load();
|
||||||
|
}
|
||||||
|
|
||||||
|
public FileConfiguration getConfig() {
|
||||||
|
return config;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void set(String path, Object value) {
|
||||||
|
config.set(path, value);
|
||||||
|
save();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object get(String path) {
|
||||||
|
return config.get(path);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getString(String path) {
|
||||||
|
return config.getString(path);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getInt(String path) {
|
||||||
|
return config.getInt(path);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean getBoolean(String path) {
|
||||||
|
return config.getBoolean(path);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,118 @@
|
|||||||
|
package com.softwarerat.MLGRush.MLGRush.listener;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.World;
|
||||||
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
|
import org.bukkit.enchantments.Enchantment;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
|
import org.bukkit.event.block.BlockBreakEvent;
|
||||||
|
|
||||||
|
import com.softwarerat.API.builder.SpigotInventory;
|
||||||
|
import com.softwarerat.API.builder.SpigotItem;
|
||||||
|
import com.softwarerat.MLGRush.MLGRush.GameState.IngameState;
|
||||||
|
import com.softwarerat.MLGRush.MLGRush.MLGRush;
|
||||||
|
import com.softwarerat.MLGRush.MLGRush.data.Scores;
|
||||||
|
|
||||||
|
public class BlockBreakListener implements Listener {
|
||||||
|
|
||||||
|
private final Scores scores;
|
||||||
|
private final IngameState ingameState;
|
||||||
|
private final MLGRush plugin;
|
||||||
|
|
||||||
|
public BlockBreakListener(MLGRush plugin, Scores scores, IngameState ingameState) {
|
||||||
|
this.plugin = plugin;
|
||||||
|
this.scores = scores;
|
||||||
|
this.ingameState = ingameState;
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onBlockBreak(BlockBreakEvent event) {
|
||||||
|
|
||||||
|
Player player1 = ingameState.getPlayer1();
|
||||||
|
Player player2 = ingameState.getPlayer2();
|
||||||
|
|
||||||
|
if (player1 == null || player2 == null) return;
|
||||||
|
|
||||||
|
if (event.getBlock().getType() != Material.SANDSTONE) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
|
||||||
|
// BLUE BED -> RED SCORES
|
||||||
|
if (event.getBlock().getType() == Material.BLUE_BED) {
|
||||||
|
if (event.getPlayer().equals(player1)) {
|
||||||
|
scores.getScoreRed().incrementAndGet();
|
||||||
|
handleRoundWin("Rot +1", true, player1, player2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// RED BED -> BLUE SCORES
|
||||||
|
else if (event.getBlock().getType() == Material.RED_BED) {
|
||||||
|
if (event.getPlayer().equals(player2)) {
|
||||||
|
scores.getScoreBlue().incrementAndGet();
|
||||||
|
handleRoundWin("Blau +1", false, player1, player2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
checkWinCondition();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void handleRoundWin(String message, boolean redScored, Player player1, Player player2) {
|
||||||
|
|
||||||
|
resetInventory(player1);
|
||||||
|
resetInventory(player2);
|
||||||
|
|
||||||
|
Location redSpawn = getLocation("spawn.red");
|
||||||
|
Location blueSpawn = getLocation("spawn.blue");
|
||||||
|
|
||||||
|
player1.teleport(redSpawn);
|
||||||
|
player2.teleport(blueSpawn);
|
||||||
|
|
||||||
|
Bukkit.getOnlinePlayers().forEach(player -> player.sendMessage(message));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void resetInventory(Player player) {
|
||||||
|
SpigotInventory inv = new SpigotInventory(player, plugin);
|
||||||
|
inv.clear();
|
||||||
|
inv.addItem(new SpigotItem(Material.SANDSTONE, 64).build());
|
||||||
|
inv.addItem(new SpigotItem(Material.STICK, 1)
|
||||||
|
.addUnsafeEnchantment(Enchantment.KNOCKBACK, 1)
|
||||||
|
.build());
|
||||||
|
inv.addItem(new SpigotItem(Material.WOODEN_PICKAXE, 1)
|
||||||
|
.addEnchant(Enchantment.EFFICIENCY, 5)
|
||||||
|
.setUnbreakable(true)
|
||||||
|
.build());
|
||||||
|
}
|
||||||
|
|
||||||
|
private void checkWinCondition() {
|
||||||
|
if (scores.getScoreRed().get() >= 10) {
|
||||||
|
ingameState.Stop();
|
||||||
|
Bukkit.getOnlinePlayers().forEach(player ->
|
||||||
|
player.sendTitle("Rot hat gewonnen", "Server startet nun neu"));
|
||||||
|
} else if (scores.getScoreBlue().get() >= 10) {
|
||||||
|
ingameState.Stop();
|
||||||
|
Bukkit.getOnlinePlayers().forEach(player ->
|
||||||
|
player.sendTitle("Blau hat gewonnen", "Server startet nun neu"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private Location getLocation(String path) {
|
||||||
|
FileConfiguration config = plugin.getConfig();
|
||||||
|
|
||||||
|
String worldName = config.getString(path + ".world");
|
||||||
|
double x = config.getDouble(path + ".x");
|
||||||
|
double y = config.getDouble(path + ".y");
|
||||||
|
double z = config.getDouble(path + ".z");
|
||||||
|
float yaw = (float) config.getDouble(path + ".yaw");
|
||||||
|
float pitch = (float) config.getDouble(path + ".pitch");
|
||||||
|
World world = Bukkit.getWorld(worldName);
|
||||||
|
if (world == null) {
|
||||||
|
throw new IllegalArgumentException("World '" + worldName + "' not found in config!");
|
||||||
|
}
|
||||||
|
|
||||||
|
return new Location(world, x, y, z, yaw, pitch);
|
||||||
|
}
|
||||||
|
}
|
||||||
+9
-4
@@ -1,14 +1,19 @@
|
|||||||
package de.softwarerat.MLGRush.listener;
|
package com.softwarerat.MLGRush.MLGRush.listener;
|
||||||
|
|
||||||
|
|
||||||
import de.softwarerat.MLGRush.GameState.LobbyState;
|
|
||||||
import de.softwarerat.MLGRush.IPrefix;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.*;
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.GameMode;
|
||||||
|
import org.bukkit.Location;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.player.PlayerJoinEvent;
|
import org.bukkit.event.player.PlayerJoinEvent;
|
||||||
|
|
||||||
|
import com.softwarerat.MLGRush.MLGRush.GameState.LobbyState;
|
||||||
|
import com.softwarerat.MLGRush.MLGRush.IPrefix;
|
||||||
|
|
||||||
|
|
||||||
public class JoinListener implements Listener {
|
public class JoinListener implements Listener {
|
||||||
LobbyState lobbyState;
|
LobbyState lobbyState;
|
||||||
@@ -0,0 +1,73 @@
|
|||||||
|
package com.softwarerat.MLGRush.MLGRush.listener;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.World;
|
||||||
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
|
import org.bukkit.event.player.PlayerMoveEvent;
|
||||||
|
|
||||||
|
import com.softwarerat.MLGRush.MLGRush.GameState.IngameState;
|
||||||
|
import com.softwarerat.MLGRush.MLGRush.MLGRush;
|
||||||
|
|
||||||
|
public class OutOfAreaListener implements Listener {
|
||||||
|
IngameState ingameState;
|
||||||
|
Player player2;
|
||||||
|
Player player1;
|
||||||
|
Location location;
|
||||||
|
Location location2;
|
||||||
|
private final MLGRush plugin;
|
||||||
|
|
||||||
|
public OutOfAreaListener(IngameState ingameState, MLGRush plugin) {
|
||||||
|
this.ingameState = ingameState;
|
||||||
|
this.plugin = plugin;
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onPlayerMove(PlayerMoveEvent event) {
|
||||||
|
Player player = event.getPlayer();
|
||||||
|
Location redSpawn = getLocation("spawn.red");
|
||||||
|
Location blueSpawn = getLocation("spawn.blue");
|
||||||
|
|
||||||
|
player1 = ingameState.getPlayer1();
|
||||||
|
player2 = ingameState.getPlayer2();
|
||||||
|
|
||||||
|
if (player1 == null || player2 == null) return;
|
||||||
|
|
||||||
|
int fallLimitRed = redSpawn.getBlockY() - 5;
|
||||||
|
int fallLimitBlue = blueSpawn.getBlockY() - 5;
|
||||||
|
|
||||||
|
int playerY = player.getLocation().getBlockY();
|
||||||
|
|
||||||
|
if (player.getUniqueId().equals(player1.getUniqueId()) && playerY <= fallLimitRed) {
|
||||||
|
player.teleport(redSpawn);
|
||||||
|
} else if (player.getUniqueId().equals(player2.getUniqueId()) && playerY <= fallLimitBlue) {
|
||||||
|
player.teleport(blueSpawn);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private Location getLocation(String path) {
|
||||||
|
FileConfiguration config = plugin.getConfig();
|
||||||
|
|
||||||
|
String worldName = config.getString(path + ".world");
|
||||||
|
double x = config.getDouble(path + ".x");
|
||||||
|
double y = config.getDouble(path + ".y");
|
||||||
|
double z = config.getDouble(path + ".z");
|
||||||
|
float yaw = (float) config.getDouble(path + ".yaw");
|
||||||
|
float pitch = (float) config.getDouble(path + ".pitch");
|
||||||
|
|
||||||
|
World world = Bukkit.getWorld(worldName);
|
||||||
|
if (world == null) {
|
||||||
|
throw new IllegalArgumentException("World '" + worldName + "' not found in config!");
|
||||||
|
}
|
||||||
|
|
||||||
|
return new Location(world, x, y, z, yaw, pitch);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,67 +0,0 @@
|
|||||||
package de.softwarerat.MLGRush.GameState;
|
|
||||||
|
|
||||||
|
|
||||||
import com.softwarerat.API.builder.SpigotInventory;
|
|
||||||
import com.softwarerat.API.builder.SpigotItem;
|
|
||||||
import com.softwarerat.API.gameState.IGameState;
|
|
||||||
import de.softwarerat.MLGRush.MLGRush;
|
|
||||||
import de.softwarerat.MLGRush.data.Scores;
|
|
||||||
import lombok.Getter;
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.GameMode;
|
|
||||||
import org.bukkit.Location;
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.enchantments.Enchantment;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
import java.util.concurrent.atomic.AtomicReference;
|
|
||||||
|
|
||||||
public class IngameState implements IGameState {
|
|
||||||
|
|
||||||
public IngameState(Scores scores) {
|
|
||||||
this.scores = scores;
|
|
||||||
}
|
|
||||||
|
|
||||||
Scores scores;
|
|
||||||
Location location;
|
|
||||||
Location location2;
|
|
||||||
@Getter
|
|
||||||
Player player1;
|
|
||||||
@Getter
|
|
||||||
Player player2;
|
|
||||||
@Override
|
|
||||||
public void Start() {
|
|
||||||
location = new Location(Bukkit.getWorld("ingame"),19,53,0);
|
|
||||||
location2 = new Location(Bukkit.getWorld("ingame"),-19,53,0);
|
|
||||||
AtomicReference<Boolean> teleported = new AtomicReference<>(false);
|
|
||||||
Bukkit.getOnlinePlayers().forEach(player ->
|
|
||||||
{
|
|
||||||
SpigotInventory spigotInventory = new SpigotInventory(player, MLGRush.getPlugin(MLGRush.class));
|
|
||||||
spigotInventory.addItem(new SpigotItem(Material.SANDSTONE,64).build());
|
|
||||||
spigotInventory.addItem(new SpigotItem(Material.STICK,1).addUnsafeEnchantment(Enchantment.KNOCKBACK,1).build());
|
|
||||||
spigotInventory.addItem(new SpigotItem(Material.WOODEN_PICKAXE,1).addEnchant(Enchantment.EFFICIENCY,5).setUnbreakable(true).build());
|
|
||||||
player.setGameMode(GameMode.SURVIVAL);
|
|
||||||
scores.getScoreBlue().set(0);
|
|
||||||
scores.getScoreRed().set(0);
|
|
||||||
if (!teleported.get()){
|
|
||||||
teleported.set(true);
|
|
||||||
player1 = player;
|
|
||||||
player1.teleport(location);
|
|
||||||
player1.setRespawnLocation(location);
|
|
||||||
} else {
|
|
||||||
player2 = player;
|
|
||||||
player2.teleport(location2);
|
|
||||||
player2.setRespawnLocation(location2);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void Stop() {
|
|
||||||
Bukkit.getServer().shutdown();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,94 +0,0 @@
|
|||||||
package de.softwarerat.MLGRush.listener;
|
|
||||||
|
|
||||||
import com.softwarerat.API.builder.SpigotInventory;
|
|
||||||
import com.softwarerat.API.builder.SpigotItem;
|
|
||||||
import de.softwarerat.MLGRush.GameState.IngameState;
|
|
||||||
import de.softwarerat.MLGRush.MLGRush;
|
|
||||||
import de.softwarerat.MLGRush.data.Scores;
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.Location;
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.enchantments.Enchantment;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.event.EventHandler;
|
|
||||||
import org.bukkit.event.Listener;
|
|
||||||
import org.bukkit.event.block.BlockBreakEvent;
|
|
||||||
|
|
||||||
import java.util.concurrent.atomic.AtomicReference;
|
|
||||||
|
|
||||||
public class BlockBreakListener implements Listener {
|
|
||||||
Scores scores;
|
|
||||||
IngameState ingameState;
|
|
||||||
Player player1;
|
|
||||||
Player player2;
|
|
||||||
|
|
||||||
public BlockBreakListener(Scores scores, IngameState ingameState) {
|
|
||||||
this.scores = scores;
|
|
||||||
this.ingameState = ingameState;
|
|
||||||
|
|
||||||
}
|
|
||||||
Location location;
|
|
||||||
Location location2;
|
|
||||||
@EventHandler
|
|
||||||
public void onBlockBreak(BlockBreakEvent event) {
|
|
||||||
player2 = ingameState.getPlayer2();
|
|
||||||
player1 = ingameState.getPlayer1();
|
|
||||||
if (!(event.getBlock().getBlockData().getMaterial() == Material.SANDSTONE)) {
|
|
||||||
event.setCancelled(true);
|
|
||||||
if (event.getBlock().getBlockData().getMaterial() == Material.BLUE_BED) {
|
|
||||||
if (event.getPlayer().equals(player1)){
|
|
||||||
scores.getScoreRed().getAndIncrement();
|
|
||||||
location = new Location(Bukkit.getWorld("ingame"),19,53,0);
|
|
||||||
location2 = new Location(Bukkit.getWorld("ingame"),-19,53,0);
|
|
||||||
AtomicReference<Boolean> teleported = new AtomicReference<>(false);
|
|
||||||
SpigotInventory spigotInventory = new SpigotInventory(player1, MLGRush.getPlugin(MLGRush.class));
|
|
||||||
spigotInventory.clear();
|
|
||||||
spigotInventory.addItem(new SpigotItem(Material.SANDSTONE,64).build());
|
|
||||||
spigotInventory.addItem(new SpigotItem(Material.STICK,1).addUnsafeEnchantment(Enchantment.KNOCKBACK,1).build());
|
|
||||||
spigotInventory.addItem(new SpigotItem(Material.WOODEN_PICKAXE,1).addEnchant(Enchantment.EFFICIENCY,5).setUnbreakable(true).build());
|
|
||||||
SpigotInventory spigotInventory1 = new SpigotInventory(player2, MLGRush.getPlugin(MLGRush.class));
|
|
||||||
spigotInventory1.clear();
|
|
||||||
spigotInventory1.addItem(new SpigotItem(Material.SANDSTONE,64).build());
|
|
||||||
spigotInventory1.addItem(new SpigotItem(Material.STICK,1).addUnsafeEnchantment(Enchantment.KNOCKBACK,1).build());
|
|
||||||
spigotInventory1.addItem(new SpigotItem(Material.WOODEN_PICKAXE,1).addEnchant(Enchantment.EFFICIENCY,5).setUnbreakable(true).build());
|
|
||||||
player1.teleport(location);
|
|
||||||
player2.teleport(location2);
|
|
||||||
Bukkit.getOnlinePlayers().forEach(player -> player.sendMessage("Rot +1"));
|
|
||||||
}
|
|
||||||
|
|
||||||
} else if (event.getBlock().getBlockData().getMaterial() == Material.RED_BED) {
|
|
||||||
if (event.getPlayer().equals(player2)) {
|
|
||||||
SpigotInventory spigotInventory = new SpigotInventory(player1, MLGRush.getPlugin(MLGRush.class));
|
|
||||||
spigotInventory.clear();
|
|
||||||
spigotInventory.addItem(new SpigotItem(Material.SANDSTONE,64).build());
|
|
||||||
spigotInventory.addItem(new SpigotItem(Material.STICK,1).addUnsafeEnchantment(Enchantment.KNOCKBACK,1).build());
|
|
||||||
spigotInventory.addItem(new SpigotItem(Material.WOODEN_PICKAXE,1).addEnchant(Enchantment.EFFICIENCY,5).setUnbreakable(true).build());
|
|
||||||
SpigotInventory spigotInventory1 = new SpigotInventory(player2, MLGRush.getPlugin(MLGRush.class));
|
|
||||||
spigotInventory1.clear();
|
|
||||||
spigotInventory1.addItem(new SpigotItem(Material.SANDSTONE,64).build());
|
|
||||||
spigotInventory1.addItem(new SpigotItem(Material.STICK,1).addUnsafeEnchantment(Enchantment.KNOCKBACK,1).build());
|
|
||||||
spigotInventory1.addItem(new SpigotItem(Material.WOODEN_PICKAXE,1).addEnchant(Enchantment.EFFICIENCY,5).setUnbreakable(true).build());
|
|
||||||
location = new Location(Bukkit.getWorld("ingame"), 19, 53, 0);
|
|
||||||
location2 = new Location(Bukkit.getWorld("ingame"), -19, 53, 0);
|
|
||||||
scores.getScoreBlue().getAndIncrement();
|
|
||||||
player1.teleport(location);
|
|
||||||
player2.teleport(location2);
|
|
||||||
Bukkit.getOnlinePlayers().forEach(player -> player.sendMessage("Blau +1"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (scores.getScoreRed().get() == 10) {
|
|
||||||
ingameState.Stop();
|
|
||||||
Bukkit.getOnlinePlayers().forEach(player -> {
|
|
||||||
player.sendTitle("Rot hat gewonnen", "server startet nun neu");
|
|
||||||
});
|
|
||||||
} else if (scores.getScoreBlue().get() == 10) {
|
|
||||||
ingameState.Stop();
|
|
||||||
Bukkit.getOnlinePlayers().forEach(player -> {
|
|
||||||
player.sendTitle("Blau hat gewonnen", "server startet nun neu");
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,39 +0,0 @@
|
|||||||
package de.softwarerat.MLGRush.listener;
|
|
||||||
|
|
||||||
import de.softwarerat.MLGRush.GameState.IngameState;
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.Location;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.event.EventHandler;
|
|
||||||
import org.bukkit.event.Listener;
|
|
||||||
import org.bukkit.event.player.PlayerMoveEvent;
|
|
||||||
|
|
||||||
public class OutOfAreaListener implements Listener {
|
|
||||||
IngameState ingameState;
|
|
||||||
Player player2;
|
|
||||||
Player player1;
|
|
||||||
Location location;
|
|
||||||
Location location2;
|
|
||||||
|
|
||||||
public OutOfAreaListener(IngameState ingameState) {
|
|
||||||
this.ingameState = ingameState;
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void onPlayerMove(PlayerMoveEvent event) {
|
|
||||||
location = new Location(Bukkit.getWorld("ingame"),19,53,0);
|
|
||||||
location2 = new Location(Bukkit.getWorld("ingame"),-19,53,0);
|
|
||||||
player2 = ingameState.getPlayer2();
|
|
||||||
player1 = ingameState.getPlayer1();
|
|
||||||
if (event.getPlayer().getLocation().getBlockY() <= 39){
|
|
||||||
if (event.getPlayer().getName().equals(player1.getName())){
|
|
||||||
player1.teleport(location);
|
|
||||||
|
|
||||||
}else {
|
|
||||||
player2.teleport(location2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
spawn:
|
||||||
|
red:
|
||||||
|
world: ingame
|
||||||
|
x: 19
|
||||||
|
y: 53
|
||||||
|
z: 0
|
||||||
|
yaw: 0
|
||||||
|
pitch: 0
|
||||||
|
blue:
|
||||||
|
world: ingame
|
||||||
|
x: -19
|
||||||
|
y: 53
|
||||||
|
z: 0
|
||||||
|
yaw: 180
|
||||||
|
pitch: 0
|
||||||
|
bed:
|
||||||
|
red:
|
||||||
|
world: ingame
|
||||||
|
x: 19
|
||||||
|
y: 53
|
||||||
|
z: 0
|
||||||
|
yaw: 0
|
||||||
|
pitch: 0
|
||||||
|
blue:
|
||||||
|
world: ingame
|
||||||
|
x: -19
|
||||||
|
y: 53
|
||||||
|
z: 0
|
||||||
|
yaw: 180
|
||||||
|
pitch: 0
|
||||||
@@ -1,4 +1,6 @@
|
|||||||
name: MLGRush
|
name: MLGRush
|
||||||
version: '1.0-SNAPSHOT'
|
version: '1.0-SNAPSHOT'
|
||||||
main: de.softwarerat.MLGRush.MLGRush
|
main: com.softwarerat.MLGRush.MLGRush.MLGRush
|
||||||
|
author: Softwarerat
|
||||||
|
description: A MLGRush plugin for Minecraft 1.21.1
|
||||||
api-version: '1.21'
|
api-version: '1.21'
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,30 @@
|
|||||||
|
spawn:
|
||||||
|
red:
|
||||||
|
world: ingame
|
||||||
|
x: 19
|
||||||
|
y: 53
|
||||||
|
z: 0
|
||||||
|
yaw: 0
|
||||||
|
pitch: 0
|
||||||
|
blue:
|
||||||
|
world: ingame
|
||||||
|
x: -19
|
||||||
|
y: 53
|
||||||
|
z: 0
|
||||||
|
yaw: 180
|
||||||
|
pitch: 0
|
||||||
|
bed:
|
||||||
|
red:
|
||||||
|
world: ingame
|
||||||
|
x: 19
|
||||||
|
y: 53
|
||||||
|
z: 0
|
||||||
|
yaw: 0
|
||||||
|
pitch: 0
|
||||||
|
blue:
|
||||||
|
world: ingame
|
||||||
|
x: -19
|
||||||
|
y: 53
|
||||||
|
z: 0
|
||||||
|
yaw: 180
|
||||||
|
pitch: 0
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,4 +1,6 @@
|
|||||||
name: MLGRush
|
name: MLGRush
|
||||||
version: '1.0-SNAPSHOT'
|
version: '1.0-SNAPSHOT'
|
||||||
main: de.softwarerat.MLGRush.MLGRush
|
main: com.softwarerat.MLGRush.MLGRush.MLGRush
|
||||||
|
author: Softwarerat
|
||||||
|
description: A MLGRush plugin for Minecraft 1.21.1
|
||||||
api-version: '1.21'
|
api-version: '1.21'
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
artifactId=mlgrush
|
||||||
|
groupId=com.softwarerat
|
||||||
|
version=1.0.24-SNAPSHOT
|
||||||
@@ -1,8 +1,9 @@
|
|||||||
/Users/zlavra/code/MLGRush/src/main/java/de/softwarerat/MLGRush/GameState/IngameState.java
|
F:\Devel\mc\mlgrush-main\src\main\java\com\softwarerat\MLGRush\MLGRush\data\Scores.java
|
||||||
/Users/zlavra/code/MLGRush/src/main/java/de/softwarerat/MLGRush/GameState/LobbyState.java
|
F:\Devel\mc\mlgrush-main\src\main\java\com\softwarerat\MLGRush\MLGRush\data\Yaml.java
|
||||||
/Users/zlavra/code/MLGRush/src/main/java/de/softwarerat/MLGRush/IPrefix.java
|
F:\Devel\mc\mlgrush-main\src\main\java\com\softwarerat\MLGRush\MLGRush\GameState\IngameState.java
|
||||||
/Users/zlavra/code/MLGRush/src/main/java/de/softwarerat/MLGRush/MLGRush.java
|
F:\Devel\mc\mlgrush-main\src\main\java\com\softwarerat\MLGRush\MLGRush\GameState\LobbyState.java
|
||||||
/Users/zlavra/code/MLGRush/src/main/java/de/softwarerat/MLGRush/data/Scores.java
|
F:\Devel\mc\mlgrush-main\src\main\java\com\softwarerat\MLGRush\MLGRush\IPrefix.java
|
||||||
/Users/zlavra/code/MLGRush/src/main/java/de/softwarerat/MLGRush/listener/BlockBreakListener.java
|
F:\Devel\mc\mlgrush-main\src\main\java\com\softwarerat\MLGRush\MLGRush\listener\BlockBreakListener.java
|
||||||
/Users/zlavra/code/MLGRush/src/main/java/de/softwarerat/MLGRush/listener/JoinListener.java
|
F:\Devel\mc\mlgrush-main\src\main\java\com\softwarerat\MLGRush\MLGRush\listener\JoinListener.java
|
||||||
/Users/zlavra/code/MLGRush/src/main/java/de/softwarerat/MLGRush/listener/OutOfAreaListener.java
|
F:\Devel\mc\mlgrush-main\src\main\java\com\softwarerat\MLGRush\MLGRush\listener\OutOfAreaListener.java
|
||||||
|
F:\Devel\mc\mlgrush-main\src\main\java\com\softwarerat\MLGRush\MLGRush\MLGRush.java
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user