Initial MC 1.13.2 support (todo: cleanup)

This commit is contained in:
mathias 2019-08-01 17:23:35 +03:00
parent cf9dfaefce
commit e99aef29d0
5 changed files with 31 additions and 16 deletions

18
pom.xml
View File

@ -5,15 +5,15 @@
<version>master</version>
<properties>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<maven.compiler.source>1.6</maven.compiler.source>
<maven.compiler.target>1.6</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>com.destroystokyo.paper</groupId>
<artifactId>paper-api</artifactId>
<version>1.12.2-R0.1-SNAPSHOT</version>
<version>1.13.2-R0.1-SNAPSHOT</version>
</dependency>
</dependencies>
@ -26,6 +26,18 @@
<build>
<finalName>${project.artifactId}</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<compilerArgs>
<arg>-Xlint:all</arg>
</compilerArgs>
</configuration>
</plugin>
</plugins>
</build>
</project>

View File

@ -38,6 +38,8 @@ class CommandIcu implements CommandExecutor {
controller.sendMessage("Player \"" + target.getName() + "\" is already being controlled");
} else if (main.targetFor.containsKey(target.getUniqueId())) {
controller.sendMessage("Player \"" + target.getName() + "\" is already controlling another player");
} else if (controller.canSee(target) == false) {
controller.sendMessage("You may not control this player");
} else {
controller.teleport(target);
@ -63,13 +65,13 @@ class CommandIcu implements CommandExecutor {
Bukkit.getScheduler().scheduleSyncDelayedTask(main, new Runnable() {
public void run() {
for (Player player: Bukkit.getOnlinePlayers()) {
player.showPlayer(controllerRun);
player.showPlayer(main, controllerRun);
}
Scoreboard scoreboard = Bukkit.getScoreboardManager().getMainScoreboard();
Team team = scoreboard.getTeam("iControlU_List");
if (team != null && team.hasPlayer(controllerRun) == true) {
team.removePlayer(controllerRun);
if (team != null && team.hasEntry(controllerRun.getName()) == true) {
team.removeEntry(controllerRun.getName());
}
controllerRun.removePotionEffect(PotionEffectType.INVISIBILITY);

View File

@ -51,7 +51,7 @@ class Tick extends BukkitRunnable {
}
if (target.getHealth() > 0) {
target.teleport(controller);
target.teleportAsync(controller.getLocation());
}
target.setAllowFlight(controller.getAllowFlight());
@ -64,7 +64,7 @@ class Tick extends BukkitRunnable {
target.setSprinting(controller.isSprinting());
for (Player player: Bukkit.getOnlinePlayers()) {
player.hidePlayer(controller);
player.hidePlayer(main, controller);
}
Scoreboard scoreboard = Bukkit.getScoreboardManager().getMainScoreboard();
@ -76,8 +76,8 @@ class Tick extends BukkitRunnable {
team.setCanSeeFriendlyInvisibles(false);
team.setOption(Team.Option.COLLISION_RULE, Team.OptionStatus.NEVER);
if (team.hasPlayer(controller) == false) {
team.addPlayer(controller);
if (team.hasEntry(controller.getName()) == false) {
team.addEntry(controller.getName());
}
controller.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, 99999, 0, false, false));
@ -177,13 +177,13 @@ class Events implements Listener {
Bukkit.getScheduler().scheduleSyncDelayedTask(main, new Runnable() {
public void run() {
for (Player allPlayers: Bukkit.getOnlinePlayers()) {
allPlayers.showPlayer(controller);
allPlayers.showPlayer(main, controller);
}
Scoreboard scoreboard = Bukkit.getScoreboardManager().getMainScoreboard();
Team team = scoreboard.getTeam("iControlU_List");
if (team != null && team.hasPlayer(controller) == true) {
team.removePlayer(controller);
if (team != null && team.hasEntry(controller.getName()) == true) {
team.removeEntry(controller.getName());
}
controller.removePotionEffect(PotionEffectType.INVISIBILITY);
@ -208,7 +208,7 @@ class Events implements Listener {
if (main.controllerFor.containsKey(player.getUniqueId())) {
Player controller = main.controllerFor.get(player.getUniqueId());
controller.teleport(player);
controller.teleportAsync(player.getLocation());
}
}
}

View File

@ -36,7 +36,7 @@ public class Main extends JavaPlugin {
Player target = Main.targetFor.get(controller.getUniqueId());
if (target != null) {
for (Player player: Bukkit.getOnlinePlayers()) {
player.showPlayer(controller);
player.showPlayer(this, controller);
}
Scoreboard scoreboard = Bukkit.getScoreboardManager().getMainScoreboard();

View File

@ -1,6 +1,7 @@
name: iControlU
main: pw.kaboom.icontrolu.Main
description: Plugin that allows players to control other players.
description: Plugin that allows players to control other players.
api-version: 1.13
version: master
commands: