mirror of https://github.com/taoneill/war.git
Compare commits
98 Commits
Author | SHA1 | Date |
---|---|---|
Connor Monahan | 7b982c2687 | |
= | 3217c0a732 | |
= | 2e6466fab2 | |
= | 98afe494c1 | |
Connor Monahan | 20e3e70461 | |
Connor Monahan | 26acfa6a53 | |
Connor Monahan | 3470a0cc54 | |
Connor Monahan | 66ef1b9cc2 | |
Connor Monahan | 0dde3acaed | |
Connor Monahan | 03c9ad95ee | |
Connor Monahan | 87cea1a1b4 | |
Connor Monahan | 2af9379287 | |
Connor Monahan | b24e495df7 | |
Connor Monahan | 6b90371fce | |
Connor Monahan | 81f839a0a2 | |
Connor Monahan | 8b76d2068f | |
Connor Monahan | 99b6bdb3dd | |
Connor Monahan | a0174935fe | |
Connor Monahan | 5e4f0022df | |
Connor Monahan | db7a7864f9 | |
Connor Monahan | 7f7babf104 | |
Connor Monahan | bca78e5d0c | |
Connor Monahan | 4e83ffada1 | |
Connor Monahan | 69a148fc6a | |
Connor Monahan | 0a02e25f4a | |
= | 0babe82368 | |
Connor Monahan | 47be664a93 | |
Connor Monahan | 821c66c556 | |
Connor Monahan | 22cbba62b3 | |
grinning | eb7b600aef | |
Connor Monahan | 4f00befeb2 | |
Connor Monahan | f6b41bd015 | |
Connor Monahan | f1caca70f5 | |
Super0JET0 | e45b0eb0bb | |
Super0JET0 | 910310aab4 | |
Connor Monahan | 8ce9586b8d | |
Connor Monahan | 0f09410c66 | |
Connor Monahan | 57d29f464c | |
Connor Monahan | 9135e5bf22 | |
Connor Monahan | 994fec5a14 | |
Connor Monahan | d3b5795dda | |
Connor Monahan | a4038c6df1 | |
Connor Monahan | 200bb5a3c0 | |
Connor Monahan | 372576a396 | |
Connor Monahan | ddfa24f626 | |
Connor Monahan | b7cf69666c | |
Connor Monahan | ef26173ba1 | |
Connor Monahan | b7138d65bd | |
Connor Monahan | b772b71803 | |
Connor Monahan | 9c3c43c4f6 | |
Connor Monahan | c5adfa7023 | |
Connor Monahan | 00ec38c739 | |
Connor Monahan | 66445eb61d | |
Connor Monahan | 334620e4b1 | |
Connor Monahan | 13e5d38277 | |
Connor Monahan | 5c992c95ee | |
Connor Monahan | 53c683abf3 | |
Connor Monahan | 8d908c1c50 | |
Connor Monahan | 8ad26d51fe | |
Connor Monahan | e3c154ba7a | |
Connor Monahan | f6175451ee | |
Connor Monahan | aa41a11daf | |
Connor Monahan | dc4de5f6a5 | |
Connor Monahan | 82741751cf | |
Connor Monahan | 5b4accb707 | |
Connor Monahan | 624f278734 | |
Connor Monahan | c1ad45e555 | |
Connor Monahan | f7aa952fb6 | |
kugick | 9149b66142 | |
Fikry Abdullah Aziz | 2b5190434d | |
cmastudios | e786c09bd0 | |
cmastudios | 2c529f7647 | |
cmastudios | 7561fd8ffb | |
cmastudios | 4f60ebb780 | |
cmastudios | 33add7df0d | |
cmastudios | 9281ad5c4d | |
cmastudios | df1e5a56df | |
cmastudios | bdc961c7e1 | |
cmastudios | 382261eb83 | |
cmastudios | d4976ecbb4 | |
cmastudios | 92002a06a2 | |
taoneill | 5e93ab6bc4 | |
cmastudios | 463d51d41b | |
cmastudios | aeda124c1c | |
cmastudios | 9bd9f76b9e | |
cmastudios | 14054454af | |
cmastudios | 181fb64c50 | |
cmastudios | 7ed33e8965 | |
cmastudios | a529e0c1fe | |
cmastudios | 0a80198084 | |
cmastudios | 09e0919042 | |
cmastudios | 8bf6d6047d | |
cmastudios | f00ed85c4b | |
cmastudios | 43bbb24dd5 | |
cmastudios | 64ae4c617f | |
cmastudios | 72a2f08d70 | |
cmastudios | 4106dd887f | |
cmastudios | 1d6ffcea7e |
|
@ -2,8 +2,8 @@
|
|||
.*
|
||||
# except for .gitignore
|
||||
!.gitignore
|
||||
!.classpath
|
||||
!.project
|
||||
.classpath
|
||||
.project
|
||||
|
||||
# Ignore all classfiles
|
||||
*.class
|
||||
|
|
|
@ -17,7 +17,6 @@ Features
|
|||
- Other game types: capture points and explosive-based objectives
|
||||
- Up to 16 teams!
|
||||
- Tons of customizable game rules, item loadouts and options (see [Instructions](http://war.tommytony.com/instructions))
|
||||
- SpoutPlugin integration for an enriched UI experience during combat for Spoutcraft users (http://spout.org)
|
||||
|
||||
Downloads
|
||||
---------
|
||||
|
@ -25,7 +24,7 @@ All official releases are at https://github.com/taoneill/war/downloads.
|
|||
|
||||
Dev Builds
|
||||
----------
|
||||
Continuous integration builds are available at http://ci.tommytony.com/job/War.
|
||||
Development builds are available at https://cmastudios.me/cgi-bin/war.py.
|
||||
|
||||
Author
|
||||
------
|
||||
|
@ -34,4 +33,4 @@ Reach him at taoneill@tommytony.com.
|
|||
|
||||
License
|
||||
-------
|
||||
War is licensed loosely under the MIT License (but still comes with the weird baggage of Bukkit licensing)
|
||||
War is licensed loosely under the MIT License (but still comes with the weird baggage of Bukkit licensing)
|
||||
|
|
|
@ -1,33 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" output="target/classes" path="src/main/java">
|
||||
<attributes>
|
||||
<attribute name="optional" value="true"/>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
|
||||
<attributes>
|
||||
<attribute name="optional" value="true"/>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="output" path="target/classes"/>
|
||||
</classpath>
|
35
war/.project
35
war/.project
|
@ -1,35 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>war</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>net.sourceforge.metrics.builder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.maven.ide.eclipse.maven2Builder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.m2e.core.maven2Builder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.m2e.core.maven2Nature</nature>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
<nature>org.maven.ide.eclipse.maven2Nature</nature>
|
||||
<nature>net.sourceforge.metrics.nature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
70
war/pom.xml
70
war/pom.xml
|
@ -3,10 +3,11 @@
|
|||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.tommytony</groupId>
|
||||
<artifactId>war</artifactId>
|
||||
<version>1.8.1</version>
|
||||
<version>2.1.0-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
<name>War</name>
|
||||
<url>http://war.tommytony.com</url>
|
||||
<description>Minecraft PVP arenas (called warzones) for a fast-paced and structured PVP experience with TDM, CTF and more!</description>
|
||||
<prerequisites>
|
||||
<maven>2.2.1</maven>
|
||||
</prerequisites>
|
||||
|
@ -15,40 +16,34 @@
|
|||
</properties>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>bukkit-repo</id>
|
||||
<url>http://repo.bukkit.org/content/groups/public</url>
|
||||
<id>maven.cmastudios.me</id>
|
||||
<url>https://maven.cmastudios.me/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>cma-repo</id>
|
||||
<url>http://maven.cmastudios.me/archiva/repository/internal</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>tagapi-repo</id>
|
||||
<url>http://repo.kitteh.org/content/repositories/public/</url>
|
||||
<id>spigot-repo</id>
|
||||
<url>https://hub.spigotmc.org/nexus/content/groups/public/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>sk89q-repo</id>
|
||||
<url>http://maven.sk89q.com/repo/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>mcstats.releases</id>
|
||||
<url>http://repo.mcstats.org/content/repositories/releases/</url>
|
||||
<url>https://maven.sk89q.com/repo/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
<issueManagement>
|
||||
<system>Github issues</system>
|
||||
<url>https://github.com/taoneill/war/issues</url>
|
||||
</issueManagement>
|
||||
<ciManagement>
|
||||
<system>Jenkins</system>
|
||||
<url>http://ci.tommytony.com</url>
|
||||
</ciManagement>
|
||||
<scm>
|
||||
<connection>scm:git:git://github.com/taoneill/war.git</connection>
|
||||
<developerConnection>scm:git:git@github.com:taoneill/war.git</developerConnection>
|
||||
<tag>HEAD</tag>
|
||||
<url>https://github.com/taoneill/war</url>
|
||||
</scm>
|
||||
<distributionManagement>
|
||||
<repository>
|
||||
<id>maven.cmastudios.me</id>
|
||||
<url>s3://maven.cmastudios.me/</url>
|
||||
</repository>
|
||||
</distributionManagement>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
|
@ -56,8 +51,8 @@
|
|||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>2.0.2</version>
|
||||
<configuration>
|
||||
<source>1.6</source>
|
||||
<target>1.6</target>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
|
@ -88,6 +83,13 @@
|
|||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
<extensions>
|
||||
<extension>
|
||||
<groupId>org.kuali.maven.wagons</groupId>
|
||||
<artifactId>maven-s3-wagon</artifactId>
|
||||
<version>1.2.1</version>
|
||||
</extension>
|
||||
</extensions>
|
||||
<resources>
|
||||
<resource>
|
||||
<filtering>true</filtering>
|
||||
|
@ -96,13 +98,6 @@
|
|||
</resources>
|
||||
</build>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.spout</groupId>
|
||||
<artifactId>spoutplugin</artifactId>
|
||||
<version>1.5.2-R1.0</version>
|
||||
<scope>compile</scope>
|
||||
<type>jar</type>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
|
@ -112,13 +107,7 @@
|
|||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>bukkit</artifactId>
|
||||
<version>1.7.2-R0.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.kitteh</groupId>
|
||||
<artifactId>tagapi</artifactId>
|
||||
<version>2.7.1</version>
|
||||
<scope>compile</scope>
|
||||
<version>1.13-R0.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mockito</groupId>
|
||||
|
@ -128,16 +117,21 @@
|
|||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.sk89q</groupId>
|
||||
<artifactId>worldedit</artifactId>
|
||||
<version>5.5.8</version>
|
||||
<groupId>com.tommytony</groupId>
|
||||
<artifactId>worldedit-bukkit</artifactId>
|
||||
<version>7.0.0-beta-01</version>
|
||||
<type>jar</type>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mcstats.bukkit</groupId>
|
||||
<artifactId>metrics</artifactId>
|
||||
<version>R7</version>
|
||||
<version>R8-SNAPSHOT</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.milkbowl.vault</groupId>
|
||||
<artifactId>Vault</artifactId>
|
||||
<version>1.2.32</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
|
|
@ -1,41 +1,26 @@
|
|||
package com.tommytony.war;
|
||||
|
||||
import java.io.File;
|
||||
import java.text.MessageFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Random;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import com.tommytony.war.config.*;
|
||||
import com.tommytony.war.utility.Direction;
|
||||
import com.tommytony.war.volume.Volume;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.attribute.Attribute;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.material.Sign;
|
||||
import org.bukkit.scoreboard.DisplaySlot;
|
||||
import org.bukkit.scoreboard.Objective;
|
||||
import org.getspout.spoutapi.SpoutManager;
|
||||
import org.getspout.spoutapi.player.SpoutPlayer;
|
||||
import org.kitteh.tag.TagAPI;
|
||||
|
||||
import com.tommytony.war.config.InventoryBag;
|
||||
import com.tommytony.war.config.ScoreboardType;
|
||||
import com.tommytony.war.config.TeamConfig;
|
||||
import com.tommytony.war.config.TeamConfigBag;
|
||||
import com.tommytony.war.config.TeamKind;
|
||||
import com.tommytony.war.config.TeamSpawnStyle;
|
||||
import com.tommytony.war.utility.Direction;
|
||||
import com.tommytony.war.volume.Volume;
|
||||
import java.io.File;
|
||||
import java.text.MessageFormat;
|
||||
import java.util.*;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.logging.Level;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -43,6 +28,8 @@ import com.tommytony.war.volume.Volume;
|
|||
*
|
||||
*/
|
||||
public class Team {
|
||||
private final Warzone warzone;
|
||||
Random teamSpawnRandomizer = new Random();
|
||||
private List<Player> players = new ArrayList<Player>();
|
||||
private List<Player> teamChatPlayers = new ArrayList<Player>();
|
||||
private List<Location> teamSpawns;
|
||||
|
@ -52,9 +39,7 @@ public class Team {
|
|||
private int points = 0;
|
||||
private Map<Location, Volume> spawnVolumes;
|
||||
private Volume flagVolume;
|
||||
private final Warzone warzone;
|
||||
private TeamKind kind;
|
||||
|
||||
private TeamConfigBag teamConfig;
|
||||
private InventoryBag inventories;
|
||||
|
||||
|
@ -81,7 +66,7 @@ public class Team {
|
|||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public Warzone getZone() {
|
||||
return this.warzone;
|
||||
}
|
||||
|
@ -118,12 +103,13 @@ public class Team {
|
|||
initializeTeamSpawn(teamSpawn);
|
||||
}
|
||||
}
|
||||
|
||||
public void initializeTeamSpawn(Location teamSpawn) {
|
||||
// Set the spawn
|
||||
int x = teamSpawn.getBlockX();
|
||||
int y = teamSpawn.getBlockY();
|
||||
int z = teamSpawn.getBlockZ();
|
||||
|
||||
|
||||
ItemStack light = this.warzone.getWarzoneMaterials().getLightBlock();
|
||||
|
||||
TeamSpawnStyle style = this.getTeamConfig().resolveSpawnStyle();
|
||||
|
@ -341,7 +327,7 @@ public class Team {
|
|||
this.getTeamConfig().resolveInt(
|
||||
TeamConfig.LIFEPOOL)).split("\n");
|
||||
}
|
||||
signBlock.setType(Material.SIGN_POST);
|
||||
signBlock.setType(Material.SIGN);
|
||||
org.bukkit.block.Sign block = (org.bukkit.block.Sign) signBlock
|
||||
.getState();
|
||||
org.bukkit.material.Sign data = (Sign) block.getData();
|
||||
|
@ -352,16 +338,11 @@ public class Team {
|
|||
}
|
||||
block.update(true);
|
||||
}
|
||||
|
||||
if (War.war.isSpoutServer()) {
|
||||
War.war.getSpoutDisplayer().updateStats(this.warzone);
|
||||
}
|
||||
}
|
||||
|
||||
private void setBlock(int x, int y, int z, TeamKind kind) {
|
||||
BlockState block = this.warzone.getWorld().getBlockAt(x, y, z).getState();
|
||||
block.setType(kind.getMaterial());
|
||||
block.setData(kind.getBlockData());
|
||||
block.update(true);
|
||||
}
|
||||
|
||||
|
@ -381,19 +362,22 @@ public class Team {
|
|||
return this.teamSpawns;
|
||||
}
|
||||
|
||||
Random teamSpawnRandomizer = new Random();
|
||||
public Location getRandomSpawn() {
|
||||
return this.teamSpawns.get(teamSpawnRandomizer.nextInt(this.teamSpawns.size()));
|
||||
}
|
||||
|
||||
public void addPlayer(Player player) {
|
||||
this.players.add(player);
|
||||
if (War.war.isTagServer()) {
|
||||
TagAPI.refreshPlayer(player);
|
||||
}
|
||||
if (this.warzone.getScoreboard() != null && this.warzone.getScoreboardType() != ScoreboardType.NONE) {
|
||||
player.setScoreboard(this.warzone.getScoreboard());
|
||||
}
|
||||
warzone.updateScoreboard();
|
||||
boolean cooldownEnabled = War.war.getWarConfig().getBoolean(WarConfig.DISABLECOOLDOWN);
|
||||
if(cooldownEnabled) {
|
||||
player.getAttribute(Attribute.GENERIC_ATTACK_SPEED).setBaseValue(1024.0);
|
||||
} else {
|
||||
player.getAttribute(Attribute.GENERIC_ATTACK_SPEED).setBaseValue(4.0);
|
||||
}
|
||||
}
|
||||
|
||||
public List<Player> getPlayers() {
|
||||
|
@ -407,17 +391,7 @@ public class Team {
|
|||
|
||||
public void teamcast(String message, boolean isNotification) {
|
||||
for (Player player : this.players) {
|
||||
if (War.war.isSpoutServer()) {
|
||||
SpoutPlayer sp = SpoutManager.getPlayer(player);
|
||||
if (sp.isSpoutCraftEnabled() && isNotification) {
|
||||
// team notifications go to the top left for Spout players to lessen War spam in chat box
|
||||
War.war.getSpoutDisplayer().msg(sp, message);
|
||||
} else {
|
||||
War.war.msg(player, message);
|
||||
}
|
||||
} else {
|
||||
War.war.msg(player, message);
|
||||
}
|
||||
War.war.msg(player, message);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -428,58 +402,52 @@ public class Team {
|
|||
|
||||
public void teamcast(String message, boolean isNotification, Object... args) {
|
||||
for (Player player : this.players) {
|
||||
if (War.war.isSpoutServer()) {
|
||||
SpoutPlayer sp = SpoutManager.getPlayer(player);
|
||||
if (sp.isSpoutCraftEnabled() && isNotification) {
|
||||
// team notifications go to the top left for Spout players to lessen War spam in chat box
|
||||
War.war.getSpoutDisplayer().msg(sp, MessageFormat.format(message, args));
|
||||
} else {
|
||||
War.war.msg(player, message, args);
|
||||
}
|
||||
} else {
|
||||
War.war.msg(player, message, args);
|
||||
}
|
||||
War.war.msg(player, message, args);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Send an achievement to all players on the team.
|
||||
* Currently implemented using SpoutCraft.
|
||||
* @param line1 Achievement first line
|
||||
* @param line2 Achievement second line
|
||||
* @param icon Item to display in the achievement
|
||||
* @param ticks Duration the achievement should be displayed
|
||||
*/
|
||||
public void sendAchievement(String line1, String line2, ItemStack icon, int ticks) {
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public void removePlayer(Player thePlayer) {
|
||||
this.players.remove(thePlayer);
|
||||
synchronized (teamChatPlayers) {
|
||||
this.teamChatPlayers.remove(thePlayer);
|
||||
}
|
||||
this.warzone.dropAllStolenObjects(thePlayer, false);
|
||||
if (War.war.isTagServer()) {
|
||||
TagAPI.refreshPlayer(thePlayer);
|
||||
}
|
||||
if (War.war.isSpoutServer()) {
|
||||
War.war.getSpoutDisplayer().updateStats(thePlayer);
|
||||
}
|
||||
thePlayer.setFireTicks(0);
|
||||
thePlayer.setRemainingAir(300);
|
||||
this.warzone.restorePlayerState(thePlayer);
|
||||
if (!this.warzone.getReallyDeadFighters().contains(thePlayer.getName())) {
|
||||
this.warzone.restorePlayerState(thePlayer);
|
||||
}
|
||||
this.warzone.getLoadoutSelections().remove(thePlayer);
|
||||
warzone.updateScoreboard();
|
||||
thePlayer.getAttribute(Attribute.GENERIC_ATTACK_SPEED).setBaseValue(4.0);
|
||||
}
|
||||
|
||||
public int getRemainingLives() {
|
||||
return this.remainingLives;
|
||||
}
|
||||
|
||||
public void setRemainingLives(int remainingLives) {
|
||||
this.remainingLives = remainingLives;
|
||||
if (this.warzone.getScoreboard() != null && this.warzone.getScoreboardType() == ScoreboardType.LIFEPOOL) {
|
||||
String teamName = kind.getColor() + name + ChatColor.RESET;
|
||||
OfflinePlayer teamPlayer = Bukkit.getOfflinePlayer(teamName);
|
||||
Objective obj = this.warzone.getScoreboard().getObjective("Lifepool");
|
||||
obj.getScore(teamPlayer).setScore(remainingLives);
|
||||
}
|
||||
}
|
||||
|
||||
public int getRemainingLifes() {
|
||||
return this.remainingLives;
|
||||
warzone.updateScoreboard();
|
||||
}
|
||||
|
||||
public void addPoint() {
|
||||
|
@ -495,11 +463,7 @@ public class Team {
|
|||
} else if (!atLeastOnePlayerOnOtherTeam) {
|
||||
this.teamcast("zone.score.empty");
|
||||
}
|
||||
if (this.warzone.getScoreboardType() == ScoreboardType.POINTS) {
|
||||
String teamName = kind.getColor() + name + ChatColor.RESET;
|
||||
this.warzone.getScoreboard().getObjective(DisplaySlot.SIDEBAR)
|
||||
.getScore(Bukkit.getOfflinePlayer(teamName)).setScore(points);
|
||||
}
|
||||
this.warzone.updateScoreboard();
|
||||
}
|
||||
|
||||
public int getPoints() {
|
||||
|
@ -530,22 +494,17 @@ public class Team {
|
|||
|
||||
public void resetPoints() {
|
||||
this.points = 0;
|
||||
if (this.warzone.getScoreboardType() == ScoreboardType.POINTS
|
||||
&& this.warzone.getScoreboard() != null) {
|
||||
String teamName = kind.getColor() + name + ChatColor.RESET;
|
||||
this.warzone.getScoreboard().getObjective(DisplaySlot.SIDEBAR)
|
||||
.getScore(Bukkit.getOfflinePlayer(teamName)).setScore(points);
|
||||
}
|
||||
}
|
||||
|
||||
public void setFlagVolume(Volume flagVolume) {
|
||||
this.flagVolume = flagVolume;
|
||||
warzone.updateScoreboard();
|
||||
}
|
||||
|
||||
public Volume getFlagVolume() {
|
||||
return this.flagVolume;
|
||||
}
|
||||
|
||||
public void setFlagVolume(Volume flagVolume) {
|
||||
this.flagVolume = flagVolume;
|
||||
}
|
||||
|
||||
private void setFlagVolume() {
|
||||
if (this.flagVolume == null) {
|
||||
this.flagVolume = new Volume(this.getName() + "flag", this.warzone.getWorld());
|
||||
|
@ -617,7 +576,6 @@ public class Team {
|
|||
// flag
|
||||
BlockState flagBlock = this.warzone.getWorld().getBlockAt(x, y + 1, z).getState();
|
||||
flagBlock.setType(this.kind.getMaterial());
|
||||
flagBlock.setData(this.kind.getBlockData());
|
||||
flagBlock.update(true);
|
||||
|
||||
// Flag post using Orientation
|
||||
|
@ -666,16 +624,6 @@ public class Team {
|
|||
}
|
||||
}
|
||||
|
||||
public void setTeamFlag(Location teamFlag) {
|
||||
this.teamFlag = teamFlag;
|
||||
|
||||
// this resets the block to old state
|
||||
this.setFlagVolume();
|
||||
this.getFlagVolume().saveBlocks();
|
||||
|
||||
this.initializeTeamFlag();
|
||||
}
|
||||
|
||||
public boolean isTeamFlagBlock(Block block) {
|
||||
if (this.teamFlag != null) {
|
||||
int flagX = this.teamFlag.getBlockX();
|
||||
|
@ -691,6 +639,16 @@ public class Team {
|
|||
public Location getTeamFlag() {
|
||||
return this.teamFlag;
|
||||
}
|
||||
|
||||
public void setTeamFlag(Location teamFlag) {
|
||||
this.teamFlag = teamFlag;
|
||||
|
||||
// this resets the block to old state
|
||||
this.setFlagVolume();
|
||||
this.getFlagVolume().saveBlocks();
|
||||
|
||||
this.initializeTeamFlag();
|
||||
}
|
||||
|
||||
public void deleteTeamFlag() {
|
||||
this.getFlagVolume().resetBlocks();
|
||||
|
|
|
@ -1,16 +1,24 @@
|
|||
package com.tommytony.war;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.text.MessageFormat;
|
||||
import java.util.*;
|
||||
import java.util.logging.FileHandler;
|
||||
import java.util.logging.Formatter;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import com.tommytony.war.command.WarCommandHandler;
|
||||
import com.tommytony.war.config.*;
|
||||
import com.tommytony.war.event.WarBlockListener;
|
||||
import com.tommytony.war.event.WarEntityListener;
|
||||
import com.tommytony.war.event.WarPlayerListener;
|
||||
import com.tommytony.war.job.CapturePointTimer;
|
||||
import com.tommytony.war.job.HelmetProtectionTask;
|
||||
import com.tommytony.war.job.ScoreboardSwitchTimer;
|
||||
import com.tommytony.war.mapper.WarYmlMapper;
|
||||
import com.tommytony.war.mapper.WarzoneYmlMapper;
|
||||
import com.tommytony.war.structure.*;
|
||||
import com.tommytony.war.ui.UIManager;
|
||||
import com.tommytony.war.utility.*;
|
||||
import com.tommytony.war.volume.Volume;
|
||||
import net.milkbowl.vault.economy.Economy;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
|
@ -20,43 +28,18 @@ import org.bukkit.inventory.ItemStack;
|
|||
import org.bukkit.inventory.PlayerInventory;
|
||||
import org.bukkit.plugin.PluginDescriptionFile;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
import org.bukkit.plugin.RegisteredServiceProvider;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
import com.tommytony.war.command.WarCommandHandler;
|
||||
import com.tommytony.war.config.FlagReturn;
|
||||
import com.tommytony.war.config.InventoryBag;
|
||||
import com.tommytony.war.config.ScoreboardType;
|
||||
import com.tommytony.war.config.KillstreakReward;
|
||||
import com.tommytony.war.config.MySQLConfig;
|
||||
import com.tommytony.war.config.TeamConfig;
|
||||
import com.tommytony.war.config.TeamConfigBag;
|
||||
import com.tommytony.war.config.TeamKind;
|
||||
import com.tommytony.war.config.TeamSpawnStyle;
|
||||
import com.tommytony.war.config.WarConfig;
|
||||
import com.tommytony.war.config.WarConfigBag;
|
||||
import com.tommytony.war.config.WarzoneConfig;
|
||||
import com.tommytony.war.config.WarzoneConfigBag;
|
||||
import com.tommytony.war.event.WarBlockListener;
|
||||
import com.tommytony.war.event.WarEntityListener;
|
||||
import com.tommytony.war.event.WarPlayerListener;
|
||||
import com.tommytony.war.event.WarServerListener;
|
||||
import com.tommytony.war.event.WarTagListener;
|
||||
import com.tommytony.war.job.HelmetProtectionTask;
|
||||
import com.tommytony.war.job.SpoutFadeOutMessageJob;
|
||||
import com.tommytony.war.mapper.WarYmlMapper;
|
||||
import com.tommytony.war.mapper.WarzoneYmlMapper;
|
||||
import com.tommytony.war.spout.SpoutDisplayer;
|
||||
import com.tommytony.war.structure.Bomb;
|
||||
import com.tommytony.war.structure.Cake;
|
||||
import com.tommytony.war.structure.HubLobbyMaterials;
|
||||
import com.tommytony.war.structure.Monument;
|
||||
import com.tommytony.war.structure.WarHub;
|
||||
import com.tommytony.war.structure.ZoneLobby;
|
||||
import com.tommytony.war.utility.Loadout;
|
||||
import com.tommytony.war.utility.PlayerState;
|
||||
import com.tommytony.war.utility.SizeCounter;
|
||||
import com.tommytony.war.utility.WarLogFormatter;
|
||||
import com.tommytony.war.volume.Volume;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.text.MessageFormat;
|
||||
import java.util.*;
|
||||
import java.util.logging.FileHandler;
|
||||
import java.util.logging.Formatter;
|
||||
import java.util.logging.Level;
|
||||
|
||||
/**
|
||||
* Main class of War
|
||||
|
@ -65,55 +48,53 @@ import com.tommytony.war.volume.Volume;
|
|||
* @package bukkit.tommytony.war
|
||||
*/
|
||||
public class War extends JavaPlugin {
|
||||
static final boolean HIDE_BLANK_MESSAGES = true;
|
||||
public static War war;
|
||||
|
||||
private static ResourceBundle messages = ResourceBundle.getBundle("messages");
|
||||
private final List<OfflinePlayer> zoneMakerNames = new ArrayList<>();
|
||||
private final List<String> commandWhitelist = new ArrayList<String>();
|
||||
private final List<Warzone> incompleteZones = new ArrayList<Warzone>();
|
||||
private final List<OfflinePlayer> zoneMakersImpersonatingPlayers = new ArrayList<>();
|
||||
private final HashMap<String, String> wandBearers = new HashMap<String, String>(); // playername to zonename
|
||||
private final List<String> deadlyAdjectives = new ArrayList<String>();
|
||||
private final List<String> killerVerbs = new ArrayList<String>();
|
||||
private final InventoryBag defaultInventories = new InventoryBag();
|
||||
private final WarConfigBag warConfig = new WarConfigBag();
|
||||
private final WarzoneConfigBag warzoneDefaultConfig = new WarzoneConfigBag();
|
||||
private final TeamConfigBag teamDefaultConfig = new TeamConfigBag();
|
||||
// general
|
||||
private WarPlayerListener playerListener = new WarPlayerListener();
|
||||
private WarEntityListener entityListener = new WarEntityListener();
|
||||
private WarBlockListener blockListener = new WarBlockListener();
|
||||
private WarServerListener serverListener = new WarServerListener();
|
||||
|
||||
private WarCommandHandler commandHandler = new WarCommandHandler();
|
||||
private PluginDescriptionFile desc = null;
|
||||
private boolean loaded = false;
|
||||
private boolean isSpoutServer = false;
|
||||
private boolean tagServer = false;
|
||||
|
||||
// Zones and hub
|
||||
private List<Warzone> warzones = new ArrayList<Warzone>();
|
||||
private WarHub warHub;
|
||||
|
||||
private final List<String> zoneMakerNames = new ArrayList<String>();
|
||||
private final List<String> commandWhitelist = new ArrayList<String>();
|
||||
|
||||
private final List<Warzone> incompleteZones = new ArrayList<Warzone>();
|
||||
private final List<String> zoneMakersImpersonatingPlayers = new ArrayList<String>();
|
||||
private HashMap<String, PlayerState> disconnected = new HashMap<String, PlayerState>();
|
||||
private final HashMap<String, String> wandBearers = new HashMap<String, String>(); // playername to zonename
|
||||
|
||||
private final List<String> deadlyAdjectives = new ArrayList<String>();
|
||||
private final List<String> killerVerbs = new ArrayList<String>();
|
||||
|
||||
private final InventoryBag defaultInventories = new InventoryBag();
|
||||
private KillstreakReward killstreakReward;
|
||||
private MySQLConfig mysqlConfig;
|
||||
|
||||
private final WarConfigBag warConfig = new WarConfigBag();
|
||||
private final WarzoneConfigBag warzoneDefaultConfig = new WarzoneConfigBag();
|
||||
private final TeamConfigBag teamDefaultConfig = new TeamConfigBag();
|
||||
private SpoutDisplayer spoutMessenger = null;
|
||||
|
||||
private static ResourceBundle messages = ResourceBundle.getBundle("messages");
|
||||
|
||||
private Economy econ = null;
|
||||
private HubLobbyMaterials warhubMaterials = new HubLobbyMaterials(
|
||||
new ItemStack(Material.GLASS), new ItemStack(Material.WOOD),
|
||||
new ItemStack(Material.GLASS), new ItemStack(Material.OAK_WOOD),
|
||||
new ItemStack(Material.OBSIDIAN), new ItemStack(Material.GLOWSTONE));
|
||||
private UIManager UIManager;
|
||||
|
||||
public War() {
|
||||
super();
|
||||
War.war = this;
|
||||
}
|
||||
|
||||
public static void reloadLanguage() {
|
||||
String[] parts = War.war.getWarConfig().getString(WarConfig.LANGUAGE).replace("-", "_").split("_");
|
||||
Locale lang = new Locale(parts[0]);
|
||||
if (parts.length >= 2) {
|
||||
lang = new Locale(parts[0], parts[1]);
|
||||
}
|
||||
War.messages = ResourceBundle.getBundle("messages", lang);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see JavaPlugin#onEnable()
|
||||
* @see War#loadWar()
|
||||
|
@ -136,15 +117,7 @@ public class War extends JavaPlugin {
|
|||
public void loadWar() {
|
||||
this.setLoaded(true);
|
||||
this.desc = this.getDescription();
|
||||
|
||||
// Spout server detection
|
||||
try {
|
||||
Class.forName("org.getspout.spoutapi.player.SpoutPlayer");
|
||||
isSpoutServer = true;
|
||||
spoutMessenger = new SpoutDisplayer();
|
||||
} catch (ClassNotFoundException e) {
|
||||
isSpoutServer = false;
|
||||
}
|
||||
|
||||
try {
|
||||
Class.forName("org.sqlite.JDBC").newInstance();
|
||||
} catch (Exception e) {
|
||||
|
@ -152,22 +125,14 @@ public class War extends JavaPlugin {
|
|||
this.getServer().getPluginManager().disablePlugin(this);
|
||||
return;
|
||||
}
|
||||
this.UIManager = new UIManager(this);
|
||||
|
||||
// Register events
|
||||
PluginManager pm = this.getServer().getPluginManager();
|
||||
pm.registerEvents(this.playerListener, this);
|
||||
pm.registerEvents(this.entityListener, this);
|
||||
pm.registerEvents(this.blockListener, this);
|
||||
pm.registerEvents(this.serverListener, this);
|
||||
if (pm.isPluginEnabled("TagAPI")) {
|
||||
try {
|
||||
Class.forName("org.kitteh.tag.TagAPI");
|
||||
pm.registerEvents(new WarTagListener(), this);
|
||||
this.tagServer = true;
|
||||
} catch (ClassNotFoundException e) {
|
||||
this.tagServer = false;
|
||||
}
|
||||
}
|
||||
pm.registerEvents(this.UIManager, this);
|
||||
|
||||
// Add defaults
|
||||
warConfig.put(WarConfig.BUILDINZONESONLY, false);
|
||||
|
@ -180,6 +145,9 @@ public class War extends JavaPlugin {
|
|||
warConfig.put(WarConfig.RESETSPEED, 5000);
|
||||
warConfig.put(WarConfig.MAXSIZE, 750);
|
||||
warConfig.put(WarConfig.LANGUAGE, Locale.getDefault().toString());
|
||||
warConfig.put(WarConfig.AUTOJOIN, "");
|
||||
warConfig.put(WarConfig.TPWARMUP, 0);
|
||||
warConfig.put(WarConfig.DISABLECOOLDOWN, false);
|
||||
|
||||
warzoneDefaultConfig.put(WarzoneConfig.AUTOASSIGN, false);
|
||||
warzoneDefaultConfig.put(WarzoneConfig.BLOCKHEADS, true);
|
||||
|
@ -203,10 +171,11 @@ public class War extends JavaPlugin {
|
|||
warzoneDefaultConfig.put(WarzoneConfig.JOINMIDBATTLE, true);
|
||||
warzoneDefaultConfig.put(WarzoneConfig.AUTOJOIN, false);
|
||||
warzoneDefaultConfig.put(WarzoneConfig.SCOREBOARD, ScoreboardType.NONE);
|
||||
warzoneDefaultConfig.put(WarzoneConfig.XPKILLMETER, false);
|
||||
warzoneDefaultConfig.put(WarzoneConfig.SOUPHEALING, false);
|
||||
warzoneDefaultConfig.put(WarzoneConfig.ALLOWENDER, true);
|
||||
warzoneDefaultConfig.put(WarzoneConfig.RESETBLOCKS, true);
|
||||
warzoneDefaultConfig.put(WarzoneConfig.CAPTUREPOINTTIME, 15);
|
||||
warzoneDefaultConfig.put(WarzoneConfig.PREPTIME, 0);
|
||||
|
||||
teamDefaultConfig.put(TeamConfig.FLAGMUSTBEHOME, true);
|
||||
teamDefaultConfig.put(TeamConfig.FLAGPOINTSONLY, false);
|
||||
|
@ -224,40 +193,39 @@ public class War extends JavaPlugin {
|
|||
teamDefaultConfig.put(TeamConfig.KILLSTREAK, false);
|
||||
teamDefaultConfig.put(TeamConfig.BLOCKWHITELIST, "all");
|
||||
teamDefaultConfig.put(TeamConfig.PLACEBLOCK, true);
|
||||
teamDefaultConfig.put(TeamConfig.APPLYPOTION, "");
|
||||
teamDefaultConfig.put(TeamConfig.ECOREWARD, 0.0);
|
||||
teamDefaultConfig.put(TeamConfig.INVENTORYDROP, false);
|
||||
teamDefaultConfig.put(TeamConfig.BORDERDROP, false);
|
||||
|
||||
this.getDefaultInventories().clearLoadouts();
|
||||
HashMap<Integer, ItemStack> defaultLoadout = new HashMap<Integer, ItemStack>();
|
||||
|
||||
ItemStack stoneSword = new ItemStack(Material.STONE_SWORD, 1, (byte) 8);
|
||||
stoneSword.setDurability((short) 8);
|
||||
|
||||
ItemStack stoneSword = Compat.createDamagedIS(Material.STONE_SWORD, 1, (byte) 8);
|
||||
defaultLoadout.put(0, stoneSword);
|
||||
|
||||
ItemStack bow = new ItemStack(Material.BOW, 1, (byte) 8);
|
||||
bow.setDurability((short) 8);
|
||||
|
||||
ItemStack bow = Compat.createDamagedIS(Material.BOW, 1, (byte) 8);
|
||||
defaultLoadout.put(1, bow);
|
||||
|
||||
|
||||
ItemStack arrows = new ItemStack(Material.ARROW, 7);
|
||||
defaultLoadout.put(2, arrows);
|
||||
|
||||
ItemStack stonePick = new ItemStack(Material.IRON_PICKAXE, 1, (byte) 8);
|
||||
stonePick.setDurability((short) 8);
|
||||
|
||||
ItemStack stonePick = Compat.createDamagedIS(Material.IRON_PICKAXE, 1, (byte) 8);
|
||||
defaultLoadout.put(3, stonePick);
|
||||
|
||||
ItemStack stoneSpade = new ItemStack(Material.STONE_SPADE, 1, (byte) 8);
|
||||
stoneSword.setDurability((short) 8);
|
||||
|
||||
ItemStack stoneSpade = Compat.createDamagedIS(Material.STONE_SHOVEL, 1, (byte) 8);
|
||||
defaultLoadout.put(4, stoneSpade);
|
||||
|
||||
|
||||
this.getDefaultInventories().addLoadout("default", defaultLoadout);
|
||||
|
||||
|
||||
HashMap<Integer, ItemStack> reward = new HashMap<Integer, ItemStack>();
|
||||
reward.put(0, new ItemStack(Material.CAKE, 1));
|
||||
this.getDefaultInventories().setReward(reward);
|
||||
|
||||
|
||||
this.getCommandWhitelist().add("who");
|
||||
this.getZoneMakerNames().add("tommytony");
|
||||
this.setKillstreakReward(new KillstreakReward());
|
||||
this.setMysqlConfig(new MySQLConfig());
|
||||
|
||||
|
||||
// Add constants
|
||||
this.getDeadlyAdjectives().clear();
|
||||
for (String adjective : this.getString("pvp.kill.adjectives").split(";")) {
|
||||
|
@ -267,18 +235,19 @@ public class War extends JavaPlugin {
|
|||
for (String verb : this.getString("pvp.kill.verbs").split(";")) {
|
||||
this.getKillerVerbs().add(verb);
|
||||
}
|
||||
|
||||
|
||||
// Load files
|
||||
WarYmlMapper.load();
|
||||
|
||||
|
||||
// Start tasks
|
||||
HelmetProtectionTask helmetProtectionTask = new HelmetProtectionTask();
|
||||
this.getServer().getScheduler().scheduleSyncRepeatingTask(this, helmetProtectionTask, 250, 100);
|
||||
|
||||
if (this.isSpoutServer) {
|
||||
SpoutFadeOutMessageJob fadeOutMessagesTask = new SpoutFadeOutMessageJob();
|
||||
this.getServer().getScheduler().scheduleSyncRepeatingTask(this, fadeOutMessagesTask, 100, 100);
|
||||
}
|
||||
|
||||
CapturePointTimer cpt = new CapturePointTimer();
|
||||
cpt.runTaskTimer(this, 100, 20);
|
||||
ScoreboardSwitchTimer sst = new ScoreboardSwitchTimer();
|
||||
sst.runTaskTimer(this, 500, 20 * 60);
|
||||
|
||||
if (this.mysqlConfig.isEnabled()) {
|
||||
try {
|
||||
Class.forName("com.mysql.jdbc.Driver").newInstance();
|
||||
|
@ -287,6 +256,13 @@ public class War extends JavaPlugin {
|
|||
this.getServer().getPluginManager().disablePlugin(this);
|
||||
}
|
||||
}
|
||||
if (this.getServer().getPluginManager().isPluginEnabled("Vault")) {
|
||||
RegisteredServiceProvider<Economy> rsp = this.getServer().getServicesManager()
|
||||
.getRegistration(Economy.class);
|
||||
if (rsp != null) {
|
||||
this.econ = rsp.getProvider();
|
||||
}
|
||||
}
|
||||
|
||||
War.reloadLanguage();
|
||||
|
||||
|
@ -303,25 +279,16 @@ public class War extends JavaPlugin {
|
|||
} catch (IOException e) {
|
||||
this.getLogger().log(Level.WARNING, "Failed to create War log file");
|
||||
}
|
||||
|
||||
|
||||
// Size check
|
||||
long datSize = SizeCounter.getFileOrDirectorySize(new File(this.getDataFolder() + "/dat/")) / 1024 / 1024;
|
||||
long tempSize = SizeCounter.getFileOrDirectorySize(new File(this.getDataFolder() + "/temp/")) / 1024 / 1024;
|
||||
|
||||
|
||||
if (datSize + tempSize > 100) {
|
||||
this.log("War data files are taking " + datSize + "MB and its temp files " + tempSize + "MB. Consider permanently deleting old warzone versions and backups in /plugins/War/temp/.", Level.WARNING);
|
||||
}
|
||||
|
||||
this.log("War v" + this.desc.getVersion() + " is on.", Level.INFO);
|
||||
}
|
||||
|
||||
public static void reloadLanguage() {
|
||||
String[] parts = War.war.getWarConfig().getString(WarConfig.LANGUAGE).replace("-", "_").split("_");
|
||||
Locale lang = new Locale(parts[0]);
|
||||
if (parts.length >= 2) {
|
||||
lang = new Locale(parts[0], parts[1]);
|
||||
}
|
||||
War.messages = ResourceBundle.getBundle("messages", lang);
|
||||
this.log("War v" + this.desc.getVersion() + " is on.", Level.INFO);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -363,7 +330,7 @@ public class War extends JavaPlugin {
|
|||
private void inventoryToLoadout(PlayerInventory inv, HashMap<Integer, ItemStack> loadout) {
|
||||
loadout.clear();
|
||||
int i = 0;
|
||||
for (ItemStack stack : inv.getContents()) {
|
||||
for (ItemStack stack : inv.getStorageContents()) {
|
||||
if (stack != null && stack.getType() != Material.AIR) {
|
||||
loadout.put(i, stack.clone());
|
||||
i++;
|
||||
|
@ -402,7 +369,7 @@ public class War extends JavaPlugin {
|
|||
private void inventoryToLoadout(Player player, HashMap<Integer, ItemStack> loadout) {
|
||||
this.inventoryToLoadout(player.getInventory(), loadout);
|
||||
}
|
||||
|
||||
|
||||
public String updateTeamFromNamedParams(Team team, CommandSender commandSender, String[] arguments) {
|
||||
try {
|
||||
Map<String, String> namedParams = new HashMap<String, String>();
|
||||
|
@ -416,10 +383,10 @@ public class War extends JavaPlugin {
|
|||
thirdParameter.put(pairSplit[0].toLowerCase(), pairSplit[2]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
StringBuilder returnMessage = new StringBuilder();
|
||||
returnMessage.append(team.getTeamConfig().updateFromNamedParams(namedParams));
|
||||
|
||||
|
||||
if (commandSender instanceof Player) {
|
||||
Player player = (Player) commandSender;
|
||||
if (namedParams.containsKey("loadout")) {
|
||||
|
@ -438,7 +405,7 @@ public class War extends JavaPlugin {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
loadout = new HashMap<Integer, ItemStack>();
|
||||
team.getInventories().setLoadout(loadoutName, loadout);
|
||||
returnMessage.append(loadoutName + " respawn loadout added.");
|
||||
|
@ -455,7 +422,7 @@ public class War extends JavaPlugin {
|
|||
ldt.setPermission(null);
|
||||
returnMessage.append(' ').append(loadoutName).append(" respawn loadout permission deleted.");
|
||||
}
|
||||
}
|
||||
}
|
||||
if (namedParams.containsKey("deleteloadout")) {
|
||||
String loadoutName = namedParams.get("deleteloadout");
|
||||
if (team.getInventories().containsLoadout(loadoutName)) {
|
||||
|
@ -492,7 +459,7 @@ public class War extends JavaPlugin {
|
|||
thirdParameter.put(pairSplit[0].toLowerCase(), pairSplit[2]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
StringBuilder returnMessage = new StringBuilder();
|
||||
if (namedParams.containsKey("author")) {
|
||||
for(String author : namedParams.get("author").split(",")) {
|
||||
|
@ -510,7 +477,7 @@ public class War extends JavaPlugin {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
returnMessage.append(warzone.getWarzoneConfig().updateFromNamedParams(namedParams));
|
||||
returnMessage.append(warzone.getTeamDefaultConfig().updateFromNamedParams(namedParams));
|
||||
|
||||
|
@ -533,11 +500,11 @@ public class War extends JavaPlugin {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
warzone.getDefaultInventories().setLoadout(loadoutName, loadout);
|
||||
returnMessage.append(loadoutName + " respawn loadout added.");
|
||||
returnMessage.append(loadoutName).append(" respawn loadout added.");
|
||||
} else {
|
||||
returnMessage.append(loadoutName + " respawn loadout updated.");
|
||||
returnMessage.append(loadoutName).append(" respawn loadout updated.");
|
||||
}
|
||||
this.inventoryToLoadout(player, loadout);
|
||||
Loadout ldt = warzone.getDefaultInventories().getNewLoadout(loadoutName);
|
||||
|
@ -549,7 +516,7 @@ public class War extends JavaPlugin {
|
|||
ldt.setPermission(null);
|
||||
returnMessage.append(' ').append(loadoutName).append(" respawn loadout permission deleted.");
|
||||
}
|
||||
}
|
||||
}
|
||||
if (namedParams.containsKey("deleteloadout")) {
|
||||
String loadoutName = namedParams.get("deleteloadout");
|
||||
if (warzone.getDefaultInventories().containsLoadout(loadoutName)) {
|
||||
|
@ -567,30 +534,30 @@ public class War extends JavaPlugin {
|
|||
}
|
||||
if (namedParams.containsKey("lobbymaterial")) {
|
||||
String whichBlocks = namedParams.get("lobbymaterial");
|
||||
ItemStack blockInHand = player.getItemInHand();
|
||||
ItemStack blockInHand = player.getInventory().getItemInMainHand();
|
||||
boolean updatedLobbyMaterials = false;
|
||||
|
||||
|
||||
if (!blockInHand.getType().isBlock() && !blockInHand.getType().equals(Material.AIR)) {
|
||||
this.badMsg(player, "Can only use blocks or air as lobby material.");
|
||||
} else {
|
||||
if (whichBlocks.equals("floor")) {
|
||||
warzone.getLobbyMaterials().setFloorBlock(blockInHand);
|
||||
returnMessage.append(" lobby floor material set to " + blockInHand.getType());
|
||||
returnMessage.append(" lobby floor material set to ").append(blockInHand.getType());
|
||||
updatedLobbyMaterials = true;
|
||||
} else if (whichBlocks.equals("outline")) {
|
||||
warzone.getLobbyMaterials().setOutlineBlock(blockInHand);
|
||||
returnMessage.append(" lobby outline material set to " + blockInHand.getType());
|
||||
returnMessage.append(" lobby outline material set to ").append(blockInHand.getType());
|
||||
updatedLobbyMaterials = true;
|
||||
} else if (whichBlocks.equals("gate")) {
|
||||
warzone.getLobbyMaterials().setGateBlock(blockInHand);
|
||||
returnMessage.append(" lobby gate material set to " + blockInHand.getType());
|
||||
returnMessage.append(" lobby gate material set to ").append(blockInHand.getType());
|
||||
updatedLobbyMaterials = true;
|
||||
} else if (whichBlocks.equals("light")) {
|
||||
warzone.getLobbyMaterials().setLightBlock(blockInHand);
|
||||
returnMessage.append(" lobby light material set to " + blockInHand.getType());
|
||||
returnMessage.append(" lobby light material set to ").append(blockInHand.getType());
|
||||
updatedLobbyMaterials = true;
|
||||
}
|
||||
|
||||
|
||||
if (updatedLobbyMaterials && warzone.getLobby() != null) {
|
||||
warzone.getLobby().getVolume().resetBlocks();
|
||||
warzone.getLobby().initialize();
|
||||
|
@ -599,26 +566,26 @@ public class War extends JavaPlugin {
|
|||
}
|
||||
if (namedParams.containsKey("material")) {
|
||||
String whichBlocks = namedParams.get("material");
|
||||
ItemStack blockInHand = player.getItemInHand();
|
||||
ItemStack blockInHand = player.getInventory().getItemInMainHand();
|
||||
boolean updatedMaterials = false;
|
||||
|
||||
|
||||
if (!blockInHand.getType().isBlock()) {
|
||||
this.badMsg(player, "Can only use blocks as material.");
|
||||
} else {
|
||||
if (whichBlocks.equals("main")) {
|
||||
warzone.getWarzoneMaterials().setMainBlock(blockInHand);
|
||||
returnMessage.append(" main material set to " + blockInHand.getType());
|
||||
returnMessage.append(" main material set to ").append(blockInHand.getType());
|
||||
updatedMaterials = true;
|
||||
} else if (whichBlocks.equals("stand")) {
|
||||
warzone.getWarzoneMaterials().setStandBlock(blockInHand);
|
||||
returnMessage.append(" stand material set to " + blockInHand.getType());
|
||||
returnMessage.append(" stand material set to ").append(blockInHand.getType());
|
||||
updatedMaterials = true;
|
||||
} else if (whichBlocks.equals("light")) {
|
||||
warzone.getWarzoneMaterials().setLightBlock(blockInHand);
|
||||
returnMessage.append(" light material set to " + blockInHand.getType());
|
||||
returnMessage.append(" light material set to ").append(blockInHand.getType());
|
||||
updatedMaterials = true;
|
||||
}
|
||||
|
||||
|
||||
if (updatedMaterials) {
|
||||
// reset all structures
|
||||
for (Monument monument : warzone.getMonuments()) {
|
||||
|
@ -667,13 +634,13 @@ public class War extends JavaPlugin {
|
|||
thirdParameter.put(pairSplit[0].toLowerCase(), pairSplit[2]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
StringBuilder returnMessage = new StringBuilder();
|
||||
|
||||
|
||||
returnMessage.append(this.getWarConfig().updateFromNamedParams(namedParams));
|
||||
returnMessage.append(this.getWarzoneDefaultConfig().updateFromNamedParams(namedParams));
|
||||
returnMessage.append(this.getTeamDefaultConfig().updateFromNamedParams(namedParams));
|
||||
|
||||
|
||||
if (commandSender instanceof Player) {
|
||||
Player player = (Player) commandSender;
|
||||
if (namedParams.containsKey("loadout")) {
|
||||
|
@ -696,7 +663,7 @@ public class War extends JavaPlugin {
|
|||
ldt.setPermission(null);
|
||||
returnMessage.append(' ').append(loadoutName).append(" respawn loadout permission deleted.");
|
||||
}
|
||||
}
|
||||
}
|
||||
if (namedParams.containsKey("deleteloadout")) {
|
||||
String loadoutName = namedParams.get("deleteloadout");
|
||||
if (this.getDefaultInventories().containsLoadout(loadoutName)) {
|
||||
|
@ -723,9 +690,9 @@ public class War extends JavaPlugin {
|
|||
}
|
||||
if (namedParams.containsKey("warhubmaterial")) {
|
||||
String whichBlocks = namedParams.get("warhubmaterial");
|
||||
ItemStack blockInHand = player.getItemInHand();
|
||||
ItemStack blockInHand = player.getInventory().getItemInMainHand();
|
||||
boolean updatedWarhubMaterials = false;
|
||||
|
||||
|
||||
if (!blockInHand.getType().isBlock() && !blockInHand.getType().equals(Material.AIR)) {
|
||||
this.badMsg(player, "Can only use blocks or air as warhub material.");
|
||||
} else {
|
||||
|
@ -746,7 +713,7 @@ public class War extends JavaPlugin {
|
|||
returnMessage.append(" warhub light material set to " + blockInHand.getType());
|
||||
updatedWarhubMaterials = true;
|
||||
}
|
||||
|
||||
|
||||
if (updatedWarhubMaterials && War.war.getWarHub() != null) {
|
||||
War.war.getWarHub().getVolume().resetBlocks();
|
||||
War.war.getWarHub().initialize();
|
||||
|
@ -760,24 +727,24 @@ public class War extends JavaPlugin {
|
|||
return "PARSE-ERROR";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public String printConfig(Team team) {
|
||||
ChatColor teamColor = ChatColor.AQUA;
|
||||
|
||||
|
||||
ChatColor normalColor = ChatColor.WHITE;
|
||||
|
||||
|
||||
String teamConfigStr = "";
|
||||
InventoryBag invs = team.getInventories();
|
||||
teamConfigStr += getLoadoutsString(invs);
|
||||
|
||||
|
||||
for (TeamConfig teamConfig : TeamConfig.values()) {
|
||||
Object value = team.getTeamConfig().getValue(teamConfig);
|
||||
if (value != null) {
|
||||
teamConfigStr += " " + teamConfig.toStringWithValue(value).replace(":", ":" + teamColor) + normalColor;
|
||||
}
|
||||
}
|
||||
|
||||
return " ::" + teamColor + "Team " + team.getName() + teamColor + " config" + normalColor + "::"
|
||||
|
||||
return " ::" + teamColor + "Team " + team.getName() + teamColor + " config" + normalColor + "::"
|
||||
+ ifEmptyInheritedForTeam(teamConfigStr);
|
||||
}
|
||||
|
||||
|
@ -785,7 +752,7 @@ public class War extends JavaPlugin {
|
|||
StringBuilder loadoutsString = new StringBuilder();
|
||||
ChatColor loadoutColor = ChatColor.GREEN;
|
||||
ChatColor normalColor = ChatColor.WHITE;
|
||||
|
||||
|
||||
if (invs.hasLoadouts()) {
|
||||
StringBuilder loadouts = new StringBuilder();
|
||||
for (Loadout ldt : invs.getNewLoadouts()) {
|
||||
|
@ -797,11 +764,11 @@ public class War extends JavaPlugin {
|
|||
}
|
||||
loadoutsString.append(" loadout:").append(loadoutColor).append(loadouts.toString()).append(normalColor);
|
||||
}
|
||||
|
||||
|
||||
if (invs.hasReward()) {
|
||||
loadoutsString.append(" reward:").append(loadoutColor).append("default").append(normalColor);
|
||||
}
|
||||
|
||||
|
||||
return loadoutsString.toString();
|
||||
}
|
||||
|
||||
|
@ -810,7 +777,7 @@ public class War extends JavaPlugin {
|
|||
ChatColor zoneColor = ChatColor.DARK_AQUA;
|
||||
ChatColor authorColor = ChatColor.GREEN;
|
||||
ChatColor normalColor = ChatColor.WHITE;
|
||||
|
||||
|
||||
String warzoneConfigStr = "";
|
||||
for (WarzoneConfig warzoneConfig : WarzoneConfig.values()) {
|
||||
Object value = zone.getWarzoneConfig().getValue(warzoneConfig);
|
||||
|
@ -818,7 +785,7 @@ public class War extends JavaPlugin {
|
|||
warzoneConfigStr += " " + warzoneConfig.toStringWithValue(value).replace(":", ":" + zoneColor) + normalColor;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
String teamDefaultsStr = "";
|
||||
teamDefaultsStr += getLoadoutsString( zone.getDefaultInventories());
|
||||
for (TeamConfig teamConfig : TeamConfig.values()) {
|
||||
|
@ -827,8 +794,8 @@ public class War extends JavaPlugin {
|
|||
teamDefaultsStr += " " + teamConfig.toStringWithValue(value).replace(":", ":" + teamColor) + normalColor;
|
||||
}
|
||||
}
|
||||
|
||||
return "::" + zoneColor + "Warzone " + authorColor + zone.getName() + zoneColor + " config" + normalColor + "::"
|
||||
|
||||
return "::" + zoneColor + "Warzone " + authorColor + zone.getName() + zoneColor + " config" + normalColor + "::"
|
||||
+ " author:" + authorColor + ifEmptyEveryone(zone.getAuthorsString()) + normalColor
|
||||
+ ifEmptyInheritedForWarzone(warzoneConfigStr)
|
||||
+ " ::" + teamColor + "Team defaults" + normalColor + "::"
|
||||
|
@ -841,10 +808,10 @@ public class War extends JavaPlugin {
|
|||
}
|
||||
return maybeEmpty;
|
||||
}
|
||||
|
||||
|
||||
private String ifEmptyInheritedForTeam(String maybeEmpty) {
|
||||
if (maybeEmpty.equals("")) {
|
||||
maybeEmpty = " all values inherited (see " + ChatColor.GREEN + "/warcfg -p" + ChatColor.WHITE
|
||||
maybeEmpty = " all values inherited (see " + ChatColor.GREEN + "/warcfg -p" + ChatColor.WHITE
|
||||
+ " and " + ChatColor.GREEN + "/zonecfg -p" + ChatColor.WHITE + ")";
|
||||
}
|
||||
return maybeEmpty;
|
||||
|
@ -862,26 +829,26 @@ public class War extends JavaPlugin {
|
|||
ChatColor zoneColor = ChatColor.DARK_AQUA;
|
||||
ChatColor globalColor = ChatColor.DARK_GREEN;
|
||||
ChatColor normalColor = ChatColor.WHITE;
|
||||
|
||||
|
||||
String warConfigStr = "";
|
||||
for (WarConfig warConfig : WarConfig.values()) {
|
||||
warConfigStr += " " + warConfig.toStringWithValue(this.getWarConfig().getValue(warConfig)).replace(":", ":" + globalColor) + normalColor;
|
||||
}
|
||||
|
||||
|
||||
String warzoneDefaultsStr = "";
|
||||
for (WarzoneConfig warzoneConfig : WarzoneConfig.values()) {
|
||||
warzoneDefaultsStr += " " + warzoneConfig.toStringWithValue(this.getWarzoneDefaultConfig().getValue(warzoneConfig)).replace(":", ":" + zoneColor) + normalColor;
|
||||
}
|
||||
|
||||
|
||||
String teamDefaultsStr = "";
|
||||
teamDefaultsStr += getLoadoutsString(this.getDefaultInventories());
|
||||
for (TeamConfig teamConfig : TeamConfig.values()) {
|
||||
teamDefaultsStr += " " + teamConfig.toStringWithValue(this.getTeamDefaultConfig().getValue(teamConfig)).replace(":", ":" + teamColor) + normalColor;
|
||||
}
|
||||
|
||||
return normalColor + "::" + globalColor + "War config" + normalColor + "::" + warConfigStr
|
||||
|
||||
return normalColor + "::" + globalColor + "War config" + normalColor + "::" + warConfigStr
|
||||
+ normalColor + " ::" + zoneColor + "Warzone defaults" + normalColor + "::" + warzoneDefaultsStr
|
||||
+ normalColor + " ::" + teamColor + "Team defaults" + normalColor + "::" + teamDefaultsStr;
|
||||
+ normalColor + " ::" + teamColor + "Team defaults" + normalColor + "::" + teamDefaultsStr;
|
||||
}
|
||||
|
||||
private void setZoneRallyPoint(String warzoneName, Player player) {
|
||||
|
@ -932,78 +899,59 @@ public class War extends JavaPlugin {
|
|||
}
|
||||
|
||||
public void msg(CommandSender sender, String str) {
|
||||
if (messages.containsKey(str)) str = this.getString(str);
|
||||
if (HIDE_BLANK_MESSAGES && (str == null || str.isEmpty())) return;
|
||||
if (sender instanceof Player) {
|
||||
StringBuilder output = new StringBuilder(ChatColor.GRAY.toString())
|
||||
.append(this.getString("war.prefix")).append(ChatColor.WHITE).append(' ');
|
||||
if (messages.containsKey(str)) {
|
||||
output.append(this.colorKnownTokens(this.getString(str),
|
||||
ChatColor.WHITE));
|
||||
} else {
|
||||
output.append(this.colorKnownTokens(str, ChatColor.WHITE));
|
||||
}
|
||||
output.append(this.colorKnownTokens(str, ChatColor.WHITE));
|
||||
sender.sendMessage(output.toString());
|
||||
} else {
|
||||
sender.sendMessage(messages.containsKey(str) ? messages.getString(str) : str);
|
||||
sender.sendMessage(str);
|
||||
}
|
||||
}
|
||||
|
||||
public void badMsg(CommandSender sender, String str) {
|
||||
if (messages.containsKey(str)) str = this.getString(str);
|
||||
if (HIDE_BLANK_MESSAGES && (str == null || str.isEmpty())) return;
|
||||
if (sender instanceof Player) {
|
||||
StringBuilder output = new StringBuilder(ChatColor.GRAY.toString())
|
||||
.append(this.getString("war.prefix")).append(ChatColor.RED).append(' ');
|
||||
if (messages.containsKey(str)) {
|
||||
output.append(this.colorKnownTokens(this.getString(str), ChatColor.RED));
|
||||
} else {
|
||||
output.append(this.colorKnownTokens(str, ChatColor.RED));
|
||||
}
|
||||
output.append(this.colorKnownTokens(str, ChatColor.RED));
|
||||
sender.sendMessage(output.toString());
|
||||
} else {
|
||||
sender.sendMessage(messages.containsKey(str) ? messages.getString(str) : str);
|
||||
sender.sendMessage(str);
|
||||
}
|
||||
}
|
||||
|
||||
public void msg(CommandSender sender, String str, Object... obj) {
|
||||
if (messages.containsKey(str)) str = this.getString(str);
|
||||
if (HIDE_BLANK_MESSAGES && (str == null || str.isEmpty())) return;
|
||||
if (sender instanceof Player) {
|
||||
StringBuilder output = new StringBuilder(ChatColor.GRAY.toString())
|
||||
.append(this.getString("war.prefix")).append(ChatColor.WHITE).append(' ');
|
||||
if (messages.containsKey(str)) {
|
||||
output.append(MessageFormat.format(this.colorKnownTokens(
|
||||
this.getString(str), ChatColor.WHITE), obj));
|
||||
} else {
|
||||
output.append(MessageFormat.format(
|
||||
output.append(MessageFormat.format(
|
||||
this.colorKnownTokens(str, ChatColor.WHITE), obj));
|
||||
}
|
||||
sender.sendMessage(output.toString());
|
||||
} else {
|
||||
StringBuilder output = new StringBuilder();
|
||||
if (messages.containsKey(str)) {
|
||||
output.append(MessageFormat.format(this.getString(str), obj));
|
||||
} else {
|
||||
output.append(MessageFormat.format(str, obj));
|
||||
}
|
||||
output.append(MessageFormat.format(str, obj));
|
||||
sender.sendMessage(output.toString());
|
||||
}
|
||||
}
|
||||
|
||||
public void badMsg(CommandSender sender, String str, Object... obj) {
|
||||
if (messages.containsKey(str)) str = this.getString(str);
|
||||
if (HIDE_BLANK_MESSAGES && (str == null || str.isEmpty())) return;
|
||||
if (sender instanceof Player) {
|
||||
StringBuilder output = new StringBuilder(ChatColor.GRAY.toString())
|
||||
.append(this.getString("war.prefix")).append(ChatColor.RED).append(' ');
|
||||
if (messages.containsKey(str)) {
|
||||
output.append(MessageFormat.format(this.colorKnownTokens(
|
||||
this.getString(str), ChatColor.RED), obj));
|
||||
} else {
|
||||
output.append(MessageFormat.format(
|
||||
output.append(MessageFormat.format(
|
||||
this.colorKnownTokens(str, ChatColor.RED), obj));
|
||||
}
|
||||
sender.sendMessage(output.toString());
|
||||
} else {
|
||||
StringBuilder output = new StringBuilder();
|
||||
if (messages.containsKey(str)) {
|
||||
output.append(MessageFormat.format(this.getString(str), obj));
|
||||
} else {
|
||||
output.append(MessageFormat.format(str, obj));
|
||||
}
|
||||
output.append(MessageFormat.format(str, obj));
|
||||
sender.sendMessage(output.toString());
|
||||
}
|
||||
}
|
||||
|
@ -1119,14 +1067,14 @@ public class War extends JavaPlugin {
|
|||
*/
|
||||
public boolean isZoneMaker(Player player) {
|
||||
// sort out disguised first
|
||||
for (String disguised : this.zoneMakersImpersonatingPlayers) {
|
||||
if (disguised.equals(player.getName())) {
|
||||
for (OfflinePlayer disguised : this.zoneMakersImpersonatingPlayers) {
|
||||
if (disguised.isOnline() && disguised.getPlayer().equals(player)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
for (String zoneMaker : this.zoneMakerNames) {
|
||||
if (zoneMaker.equals(player.getName())) {
|
||||
for (OfflinePlayer zoneMaker : this.zoneMakerNames) {
|
||||
if (zoneMaker.isOnline() && zoneMaker.getPlayer().equals(player)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -1147,7 +1095,7 @@ public class War extends JavaPlugin {
|
|||
public void addWandBearer(Player player, String zoneName) {
|
||||
if (this.wandBearers.containsKey(player.getName())) {
|
||||
String alreadyHaveWand = this.wandBearers.get(player.getName());
|
||||
if (player.getInventory().first(Material.WOOD_SWORD) != -1) {
|
||||
if (player.getInventory().first(Material.WOODEN_SWORD) != -1) {
|
||||
if (zoneName.equals(alreadyHaveWand)) {
|
||||
this.badMsg(player, "You already have a wand for zone " + alreadyHaveWand + ". Drop the wooden sword first.");
|
||||
} else {
|
||||
|
@ -1160,7 +1108,7 @@ public class War extends JavaPlugin {
|
|||
// lost his sword, or new warzone
|
||||
if (zoneName.equals(alreadyHaveWand)) {
|
||||
// same zone, give him a new sword
|
||||
player.getInventory().addItem(new ItemStack(Material.WOOD_SWORD, 1, (byte) 8));
|
||||
player.getInventory().addItem(Compat.createDamagedIS(Material.WOODEN_SWORD, 1, 8));
|
||||
this.msg(player, "Here's a new sword for zone " + zoneName + ".");
|
||||
}
|
||||
}
|
||||
|
@ -1169,8 +1117,7 @@ public class War extends JavaPlugin {
|
|||
this.badMsg(player, "Your inventory is full. Please drop an item and try again.");
|
||||
} else {
|
||||
this.wandBearers.put(player.getName(), zoneName);
|
||||
player.getInventory().addItem(new ItemStack(Material.WOOD_SWORD, 1, (byte) 8));
|
||||
// player.getWorld().dropItem(player.getLocation(), new ItemStack(Material.WOOD_SWORD));
|
||||
player.getInventory().addItem(Compat.createDamagedIS(Material.WOODEN_SWORD, 1, 8));
|
||||
this.msg(player, "You now have a wand for zone " + zoneName + ". Left-click with wooden sword for corner 1. Right-click for corner 2.");
|
||||
War.war.log(player.getName() + " now has a wand for warzone " + zoneName, Level.INFO);
|
||||
}
|
||||
|
@ -1189,13 +1136,7 @@ public class War extends JavaPlugin {
|
|||
}
|
||||
|
||||
public void removeWandBearer(Player player) {
|
||||
if (this.wandBearers.containsKey(player.getName())) {
|
||||
this.wandBearers.remove(player.getName());
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isSpoutServer() {
|
||||
return this.isSpoutServer;
|
||||
this.wandBearers.remove(player.getName());
|
||||
}
|
||||
|
||||
public Warzone zoneOfZoneWallAtProximity(Location location) {
|
||||
|
@ -1207,7 +1148,7 @@ public class War extends JavaPlugin {
|
|||
return null;
|
||||
}
|
||||
|
||||
public List<String> getZoneMakerNames() {
|
||||
public List<OfflinePlayer> getZoneMakerNames() {
|
||||
return this.zoneMakerNames;
|
||||
}
|
||||
|
||||
|
@ -1216,13 +1157,10 @@ public class War extends JavaPlugin {
|
|||
}
|
||||
|
||||
public boolean inAnyWarzoneLobby(Location location) {
|
||||
if (ZoneLobby.getLobbyByLocation(location) == null) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
return ZoneLobby.getLobbyByLocation(location) != null;
|
||||
}
|
||||
|
||||
public List<String> getZoneMakersImpersonatingPlayers() {
|
||||
public List<OfflinePlayer> getZoneMakersImpersonatingPlayers() {
|
||||
return this.zoneMakersImpersonatingPlayers;
|
||||
}
|
||||
|
||||
|
@ -1278,20 +1216,12 @@ public class War extends JavaPlugin {
|
|||
return this.warConfig;
|
||||
}
|
||||
|
||||
public SpoutDisplayer getSpoutDisplayer() {
|
||||
return this.spoutMessenger ;
|
||||
}
|
||||
|
||||
public void setWarhubMaterials(HubLobbyMaterials warhubMaterials) {
|
||||
this.warhubMaterials = warhubMaterials;
|
||||
}
|
||||
|
||||
public HubLobbyMaterials getWarhubMaterials() {
|
||||
return this.warhubMaterials;
|
||||
}
|
||||
|
||||
public boolean isTagServer() {
|
||||
return tagServer;
|
||||
public void setWarhubMaterials(HubLobbyMaterials warhubMaterials) {
|
||||
this.warhubMaterials = warhubMaterials;
|
||||
}
|
||||
|
||||
public KillstreakReward getKillstreakReward() {
|
||||
|
@ -1317,4 +1247,35 @@ public class War extends JavaPlugin {
|
|||
public Locale getLoadedLocale() {
|
||||
return messages.getLocale();
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert serialized effect to actual effect.
|
||||
* @param serializedEffect String stored in configuration.
|
||||
* Format: TYPE;DURATION;AMPLIFY
|
||||
* @return Potion effect or null otherwise
|
||||
*/
|
||||
public PotionEffect getPotionEffect(String serializedEffect) {
|
||||
String[] arr = serializedEffect.split(";");
|
||||
if (arr.length != 3) return null;
|
||||
try {
|
||||
PotionEffectType type = PotionEffectType.getByName(arr[0]);
|
||||
int duration = Integer.parseInt(arr[1]);
|
||||
int amplification = Integer.parseInt(arr[2]);
|
||||
return new PotionEffect(type, duration, amplification);
|
||||
} catch (RuntimeException ex) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public Economy getEconomy() {
|
||||
return econ;
|
||||
}
|
||||
|
||||
public UIManager getUIManager() {
|
||||
return UIManager;
|
||||
}
|
||||
|
||||
public void setUIManager(UIManager UIManager) {
|
||||
this.UIManager = UIManager;
|
||||
}
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,68 @@
|
|||
package com.tommytony.war.command;
|
||||
|
||||
import com.tommytony.war.War;
|
||||
import com.tommytony.war.Warzone;
|
||||
import com.tommytony.war.mapper.WarzoneYmlMapper;
|
||||
import com.tommytony.war.structure.CapturePoint;
|
||||
import com.tommytony.war.structure.Monument;
|
||||
import com.tommytony.war.structure.ZoneLobby;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.logging.Level;
|
||||
|
||||
/**
|
||||
* Deletes a capture point.
|
||||
*
|
||||
* @author Connor Monahan
|
||||
*/
|
||||
public class DeleteCapturePointCommand extends AbstractZoneMakerCommand {
|
||||
public DeleteCapturePointCommand(WarCommandHandler handler, CommandSender sender, String[] args) throws NotZoneMakerException {
|
||||
super(handler, sender, args);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle() {
|
||||
Warzone zone;
|
||||
|
||||
if (this.args.length == 0) {
|
||||
return false;
|
||||
} else if (this.args.length == 2) {
|
||||
zone = Warzone.getZoneByName(this.args[0]);
|
||||
this.args[0] = this.args[1];
|
||||
} else if (this.args.length == 1) {
|
||||
if (!(this.getSender() instanceof Player)) {
|
||||
return false;
|
||||
}
|
||||
zone = Warzone.getZoneByLocation((Player) this.getSender());
|
||||
if (zone == null) {
|
||||
ZoneLobby lobby = ZoneLobby.getLobbyByLocation((Player) this.getSender());
|
||||
if (lobby == null) {
|
||||
return false;
|
||||
}
|
||||
zone = lobby.getZone();
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (zone == null) {
|
||||
return false;
|
||||
} else if (!this.isSenderAuthorOfZone(zone)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
CapturePoint cp = zone.getCapturePoint(this.args[0]);
|
||||
if (cp != null) {
|
||||
cp.getVolume().resetBlocks();
|
||||
zone.getCapturePoints().remove(cp);
|
||||
WarzoneYmlMapper.save(zone);
|
||||
this.msg("Capture point " + cp.getName() + " removed.");
|
||||
War.war.log(this.getSender().getName() + " deleted capture point " + cp.getName() + " in warzone " + zone.getName(), Level.INFO);
|
||||
} else {
|
||||
this.badMsg("No such capture point.");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -1,15 +1,13 @@
|
|||
package com.tommytony.war.command;
|
||||
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
|
||||
import com.tommytony.war.War;
|
||||
import com.tommytony.war.Warzone;
|
||||
import com.tommytony.war.mapper.VolumeMapper;
|
||||
import com.tommytony.war.mapper.WarYmlMapper;
|
||||
import com.tommytony.war.structure.WarHub;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import java.util.logging.Level;
|
||||
|
||||
/**
|
||||
* Deletes the warhub.
|
||||
|
@ -30,7 +28,7 @@ public class DeleteWarhubCommand extends AbstractWarAdminCommand {
|
|||
if (War.war.getWarHub() != null) {
|
||||
// reset existing hub
|
||||
War.war.getWarHub().getVolume().resetBlocks();
|
||||
VolumeMapper.delete(War.war.getWarHub().getVolume());
|
||||
VolumeMapper.deleteSimpleVolume(War.war.getWarHub().getVolume());
|
||||
War.war.setWarHub((WarHub) null);
|
||||
for (Warzone zone : War.war.getWarzones()) {
|
||||
if (zone.getLobby() != null) {
|
||||
|
|
|
@ -1,15 +1,14 @@
|
|||
package com.tommytony.war.command;
|
||||
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.tommytony.war.War;
|
||||
import com.tommytony.war.Warzone;
|
||||
import com.tommytony.war.mapper.WarYmlMapper;
|
||||
import com.tommytony.war.mapper.WarzoneYmlMapper;
|
||||
import com.tommytony.war.structure.ZoneLobby;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.logging.Level;
|
||||
|
||||
/**
|
||||
* Deletes a warzone.
|
||||
|
@ -21,6 +20,22 @@ public class DeleteZoneCommand extends AbstractZoneMakerCommand {
|
|||
super(handler, sender, args);
|
||||
}
|
||||
|
||||
public static void forceDeleteZone(Warzone zone, CommandSender sender) {
|
||||
War.war.getWarzones().remove(zone);
|
||||
WarYmlMapper.save();
|
||||
|
||||
WarzoneYmlMapper.delete(zone);
|
||||
|
||||
if (War.war.getWarHub() != null) { // warhub has to change
|
||||
War.war.getWarHub().getVolume().resetBlocks();
|
||||
War.war.getWarHub().initialize();
|
||||
}
|
||||
|
||||
String msg = "Warzone " + zone.getName() + " removed by " + sender.getName() + ".";
|
||||
War.war.log(msg, Level.INFO);
|
||||
War.war.msg(sender, msg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle() {
|
||||
Warzone zone;
|
||||
|
@ -49,19 +64,7 @@ public class DeleteZoneCommand extends AbstractZoneMakerCommand {
|
|||
return true;
|
||||
}
|
||||
|
||||
War.war.getWarzones().remove(zone);
|
||||
WarYmlMapper.save();
|
||||
|
||||
WarzoneYmlMapper.delete(zone);
|
||||
|
||||
if (War.war.getWarHub() != null) { // warhub has to change
|
||||
War.war.getWarHub().getVolume().resetBlocks();
|
||||
War.war.getWarHub().initialize();
|
||||
}
|
||||
|
||||
String msg = "Warzone " + zone.getName() + " removed by " + this.getSender().getName() + ".";
|
||||
War.war.log(msg, Level.INFO);
|
||||
this.msg(msg);
|
||||
forceDeleteZone(zone, getSender());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -31,10 +31,15 @@ public class JoinCommand extends AbstractWarCommand {
|
|||
|
||||
Warzone zone;
|
||||
TeamKind kind;
|
||||
boolean signup = false;
|
||||
if (this.args.length == 2) {
|
||||
// zone by name
|
||||
zone = Warzone.getZoneByName(this.args[0]);
|
||||
kind = TeamKind.teamKindFromString(this.args[1]);
|
||||
} else if (this.args.length == 3 && args[0].equals("delayed")) {
|
||||
signup = true;
|
||||
zone = Warzone.getZoneByName(this.args[1]);
|
||||
kind = TeamKind.teamKindFromString(this.args[2]);
|
||||
} else if (this.args.length == 1) {
|
||||
zone = Warzone.getZoneByLocation((Player) this.getSender());
|
||||
if (zone == null) {
|
||||
|
@ -77,6 +82,11 @@ public class JoinCommand extends AbstractWarCommand {
|
|||
previousTeam.removePlayer(player);
|
||||
previousTeam.resetSign();
|
||||
}
|
||||
if (signup && !zone.testEnoughPlayers(kind, false)) {
|
||||
// player wants to automatically join the zone when everyone else is ready
|
||||
zone.signup(player, team);
|
||||
return true;
|
||||
}
|
||||
zone.assign(player, team);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,17 +1,16 @@
|
|||
package com.tommytony.war.command;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.tommytony.war.Team;
|
||||
import com.tommytony.war.War;
|
||||
import com.tommytony.war.Warzone;
|
||||
import com.tommytony.war.Warzone.LeaveCause;
|
||||
import com.tommytony.war.job.PartialZoneResetJob;
|
||||
import com.tommytony.war.structure.ZoneLobby;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.logging.Level;
|
||||
|
||||
|
||||
public class ResetZoneCommand extends AbstractZoneMakerCommand {
|
||||
|
@ -19,6 +18,31 @@ public class ResetZoneCommand extends AbstractZoneMakerCommand {
|
|||
super(handler, sender, args);
|
||||
}
|
||||
|
||||
public static void forceResetZone(Warzone zone, CommandSender sender) {
|
||||
zone.clearThieves();
|
||||
for (Team team : zone.getTeams()) {
|
||||
team.teamcast("The war has ended. " + zone.getTeamInformation() + " Resetting warzone " + zone.getName() + " and teams...");
|
||||
for (Iterator<Player> it = team.getPlayers().iterator(); it.hasNext(); ) {
|
||||
Player p = it.next();
|
||||
it.remove();
|
||||
team.removePlayer(p);
|
||||
if (!zone.getReallyDeadFighters().contains(p.getName())) {
|
||||
p.teleport(zone.getEndTeleport(LeaveCause.RESET));
|
||||
}
|
||||
}
|
||||
team.resetPoints();
|
||||
team.getPlayers().clear();
|
||||
}
|
||||
|
||||
War.war.msg(sender, "Reloading warzone " + zone.getName() + ".");
|
||||
|
||||
PartialZoneResetJob.setSenderToNotify(zone, sender);
|
||||
|
||||
zone.reinitialize();
|
||||
|
||||
War.war.log(sender.getName() + " reset warzone " + zone.getName(), Level.INFO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle() {
|
||||
Warzone zone;
|
||||
|
@ -39,33 +63,14 @@ public class ResetZoneCommand extends AbstractZoneMakerCommand {
|
|||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if (zone == null) {
|
||||
return false;
|
||||
} else if (!this.isSenderAuthorOfZone(zone)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
zone.clearThieves();
|
||||
for (Team team : zone.getTeams()) {
|
||||
team.teamcast("The war has ended. " + zone.getTeamInformation() + " Resetting warzone " + zone.getName() + " and teams...");
|
||||
for (Iterator<Player> it = team.getPlayers().iterator(); it.hasNext();) {
|
||||
Player p = it.next();
|
||||
it.remove();
|
||||
team.removePlayer(p);
|
||||
p.teleport(zone.getEndTeleport(LeaveCause.RESET));
|
||||
}
|
||||
team.resetPoints();
|
||||
team.getPlayers().clear();
|
||||
}
|
||||
|
||||
this.msg("Reloading warzone " + zone.getName() + ".");
|
||||
|
||||
PartialZoneResetJob.setSenderToNotify(zone, this.getSender());
|
||||
|
||||
zone.reinitialize();
|
||||
|
||||
War.war.log(this.getSender().getName() + " reset warzone " + zone.getName(), Level.INFO);
|
||||
forceResetZone(zone, this.getSender());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,77 @@
|
|||
package com.tommytony.war.command;
|
||||
|
||||
import com.tommytony.war.War;
|
||||
import com.tommytony.war.Warzone;
|
||||
import com.tommytony.war.config.TeamKind;
|
||||
import com.tommytony.war.mapper.WarzoneYmlMapper;
|
||||
import com.tommytony.war.structure.CapturePoint;
|
||||
import com.tommytony.war.structure.Monument;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.logging.Level;
|
||||
|
||||
/**
|
||||
* Sets a capture point
|
||||
*
|
||||
* @author Connor Monahan
|
||||
*/
|
||||
public class SetCapturePointCommand extends AbstractZoneMakerCommand {
|
||||
public SetCapturePointCommand(WarCommandHandler handler, CommandSender sender, String[] args) throws NotZoneMakerException {
|
||||
super(handler, sender, args);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle() {
|
||||
if (!(this.getSender() instanceof Player)) {
|
||||
this.badMsg("You can't do this if you are not in-game.");
|
||||
return true;
|
||||
}
|
||||
|
||||
Player player = (Player) this.getSender();
|
||||
|
||||
if (this.args.length < 1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Warzone zone = Warzone.getZoneByLocation(player);
|
||||
|
||||
if (zone == null) {
|
||||
return false;
|
||||
} else if (!this.isSenderAuthorOfZone(zone)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (this.args[0].equals(zone.getName())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (zone.hasCapturePoint(this.args[0])) {
|
||||
// move the existing capture point
|
||||
CapturePoint cp = zone.getCapturePoint(this.args[0]);
|
||||
cp.getVolume().resetBlocks();
|
||||
cp.setLocation(player.getLocation());
|
||||
this.msg("Capture point " + cp.getName() + " was moved.");
|
||||
War.war.log(this.getSender().getName() + " moved capture point " + cp.getName() + " in warzone " + zone.getName(), Level.INFO);
|
||||
} else {
|
||||
// create a new capture point
|
||||
TeamKind controller = null;
|
||||
int strength = 0;
|
||||
if (args.length > 1) {
|
||||
controller = TeamKind.teamKindFromString(args[1]);
|
||||
strength = 4;
|
||||
if (controller == null || zone.getTeamByKind(controller) == null) {
|
||||
this.badMsg("Failed to create capture point: team {0} does not exist", args[1]);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
CapturePoint cp = new CapturePoint(this.args[0], player.getLocation(), controller, strength, zone);
|
||||
zone.getCapturePoints().add(cp);
|
||||
War.war.log(this.getSender().getName() + " created capture point " + cp.getName() + " in warzone " + zone.getName(), Level.INFO);
|
||||
}
|
||||
|
||||
WarzoneYmlMapper.save(zone);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -2,6 +2,7 @@ package com.tommytony.war.command;
|
|||
|
||||
import java.util.logging.Level;
|
||||
|
||||
import com.tommytony.war.config.TeamConfigBag;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
|
@ -139,27 +140,7 @@ public class SetTeamConfigCommand extends AbstractOptionalZoneMakerCommand {
|
|||
// We have a warzone, a team and indexed-from-0 arguments, let's update
|
||||
String namedParamReturn = War.war.updateTeamFromNamedParams(team, player, this.args);
|
||||
if (!namedParamReturn.equals("") && !namedParamReturn.equals("PARSE-ERROR")) {
|
||||
|
||||
WarzoneYmlMapper.save(zone);
|
||||
|
||||
String zoneReset = "Some changes may require a /resetzone. ";
|
||||
if (zone.getWarzoneConfig().getBoolean(WarzoneConfig.RESETONCONFIGCHANGE)) {
|
||||
zone.reinitialize(); // bring back team spawns etc
|
||||
zoneReset = "Zone reset. ";
|
||||
}
|
||||
|
||||
if (wantsToPrint) {
|
||||
this.msg("Team config saved. " + zoneReset + namedParamReturn + " " + War.war.printConfig(team));
|
||||
} else {
|
||||
this.msg("Team config saved. " + zoneReset + namedParamReturn);
|
||||
}
|
||||
|
||||
War.war.log(this.getSender().getName() + " updated team " + team.getName() + " configuration in warzone " + zone.getName() + "." + namedParamReturn, Level.INFO);
|
||||
|
||||
if (War.war.getWarHub() != null) { // maybe the zone was disabled/enabled
|
||||
War.war.getWarHub().getVolume().resetBlocks();
|
||||
War.war.getWarHub().initialize();
|
||||
}
|
||||
TeamConfigBag.afterUpdate(team, player, namedParamReturn, wantsToPrint);
|
||||
} else if (namedParamReturn.equals("PARSE-ERROR")) {
|
||||
this.badMsg("Failed to read named parameter(s).");
|
||||
} else {
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.tommytony.war.command;
|
|||
|
||||
import java.util.logging.Level;
|
||||
|
||||
import com.tommytony.war.config.WarConfigBag;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
|
||||
|
@ -34,14 +35,7 @@ public class SetWarConfigCommand extends AbstractOptionalWarAdminCommand {
|
|||
|
||||
String namedParamReturn = War.war.updateFromNamedParams(this.getSender(), this.args);
|
||||
if (!namedParamReturn.equals("") && !namedParamReturn.equals("PARSE-ERROR")) {
|
||||
WarYmlMapper.save();
|
||||
if (wantsToPrint) {
|
||||
String config = War.war.printConfig();
|
||||
this.msg("War config saved. " + namedParamReturn + " " + config);
|
||||
} else {
|
||||
this.msg("War config saved. " + namedParamReturn);
|
||||
}
|
||||
War.war.log(this.getSender().getName() + " updated War configuration. " + namedParamReturn, Level.INFO);
|
||||
WarConfigBag.afterUpdate(this.getSender(), namedParamReturn, wantsToPrint);
|
||||
} else if (namedParamReturn.equals("PARSE-ERROR")) {
|
||||
this.msg("Failed to read named parameters.");
|
||||
} else {
|
||||
|
|
|
@ -1,13 +1,9 @@
|
|||
package com.tommytony.war.command;
|
||||
|
||||
import com.sk89q.worldedit.bukkit.WorldEditPlugin;
|
||||
import com.sk89q.worldedit.bukkit.selections.CuboidSelection;
|
||||
import com.sk89q.worldedit.bukkit.selections.Selection;
|
||||
import com.tommytony.war.War;
|
||||
import com.tommytony.war.utility.Compat;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.Location;
|
||||
|
||||
import com.tommytony.war.War;
|
||||
|
||||
|
||||
public class SetZoneCommand extends AbstractZoneMakerCommand {
|
||||
|
@ -30,20 +26,15 @@ public class SetZoneCommand extends AbstractZoneMakerCommand {
|
|||
} else if (this.args.length > 2) {
|
||||
return false;
|
||||
} else if (this.args.length == 1) {
|
||||
if (War.war.getServer().getPluginManager().isPluginEnabled("WorldEdit")) {
|
||||
WorldEditPlugin worldEdit = (WorldEditPlugin) War.war.getServer().getPluginManager().getPlugin("WorldEdit");
|
||||
Selection selection = worldEdit.getSelection(player);
|
||||
if (selection != null && selection instanceof CuboidSelection) {
|
||||
Location min = selection.getMinimumPoint();
|
||||
Location max = selection.getMaximumPoint();
|
||||
ZoneSetter setter = new ZoneSetter(player, this.args[0]);
|
||||
setter.placeCorner1(min.getBlock());
|
||||
setter.placeCorner2(max.getBlock());
|
||||
return true;
|
||||
}
|
||||
Compat.BlockPair pair = Compat.getWorldEditSelection(player);
|
||||
if (pair != null) {
|
||||
ZoneSetter setter = new ZoneSetter(player, this.args[0]);
|
||||
setter.placeCorner1(pair.getBlock1());
|
||||
setter.placeCorner2(pair.getBlock2());
|
||||
return true;
|
||||
}
|
||||
War.war.addWandBearer(player, this.args[0]);
|
||||
} else if (this.args.length == 2) {
|
||||
} else {
|
||||
if (!this.args[1].equals("southeast") && !this.args[1].equals("northwest") && !this.args[1].equals("se") && !this.args[1].equals("nw") && !this.args[1].equals("corner1") && !this.args[1].equals("corner2") && !this.args[1].equals("c1") && !this.args[1].equals("c2") && !this.args[1].equals("pos1") && !this.args[1].equals("pos2") && !this.args[1].equals("wand")) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.tommytony.war.command;
|
|||
|
||||
import java.util.logging.Level;
|
||||
|
||||
import com.tommytony.war.config.WarzoneConfigBag;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
|
@ -100,27 +101,7 @@ public class SetZoneConfigCommand extends AbstractOptionalZoneMakerCommand {
|
|||
// We have a warzone and indexed-from-0 arguments, let's update
|
||||
String namedParamReturn = War.war.updateZoneFromNamedParams(zone, player, this.args);
|
||||
if (!namedParamReturn.equals("") && !namedParamReturn.equals("PARSE-ERROR")) {
|
||||
|
||||
WarzoneYmlMapper.save(zone);
|
||||
|
||||
String zoneReset = "Some changes may require a /resetzone. ";
|
||||
if (zone.getWarzoneConfig().getBoolean(WarzoneConfig.RESETONCONFIGCHANGE)) {
|
||||
zone.reinitialize(); // bring back team spawns etc
|
||||
zoneReset = "Zone reset. ";
|
||||
}
|
||||
|
||||
if (wantsToPrint) {
|
||||
this.msg("Warzone config saved. " + zoneReset + namedParamReturn + " " + War.war.printConfig(zone));
|
||||
} else {
|
||||
this.msg("Warzone config saved. " + zoneReset + namedParamReturn);
|
||||
}
|
||||
|
||||
War.war.log(this.getSender().getName() + " updated warzone " + zone.getName() + " configuration." + namedParamReturn, Level.INFO);
|
||||
|
||||
if (War.war.getWarHub() != null) { // maybe the zone was disabled/enabled
|
||||
War.war.getWarHub().getVolume().resetBlocks();
|
||||
War.war.getWarHub().initialize();
|
||||
}
|
||||
WarzoneConfigBag.afterUpdate(zone, player, namedParamReturn, wantsToPrint);
|
||||
} else if (namedParamReturn.equals("PARSE-ERROR")) {
|
||||
this.badMsg("Failed to read named parameter(s).");
|
||||
} else {
|
||||
|
|
|
@ -34,11 +34,12 @@ public class SetZoneLobbyCommand extends AbstractZoneMakerCommand {
|
|||
return false;
|
||||
}
|
||||
Player player = (Player) this.getSender();
|
||||
ZoneLobby origLobby = null;
|
||||
Warzone zone = Warzone.getZoneByLocation((Player) this.getSender());
|
||||
if (zone == null) {
|
||||
ZoneLobby lobby = ZoneLobby.getLobbyByLocation((Player) this.getSender());
|
||||
if (lobby != null) {
|
||||
zone = lobby.getZone();
|
||||
origLobby = ZoneLobby.getLobbyByLocation((Player) this.getSender());
|
||||
if (origLobby != null) {
|
||||
zone = origLobby.getZone();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -75,6 +76,12 @@ public class SetZoneLobbyCommand extends AbstractZoneMakerCommand {
|
|||
} else {
|
||||
// Inside a warzone: use the classic n/s/e/w mode
|
||||
if (!this.args[0].equals("north") && !this.args[0].equals("n") && !this.args[0].equals("east") && !this.args[0].equals("e") && !this.args[0].equals("south") && !this.args[0].equals("s") && !this.args[0].equals("west") && !this.args[0].equals("w")) {
|
||||
if (Warzone.getZoneByName(this.args[0]) == zone && origLobby != null) {
|
||||
origLobby.setLocation(player.getLocation());
|
||||
origLobby.initialize();
|
||||
this.msg("Warzone lobby moved to your location.");
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
ZoneLobby lobby = zone.getLobby();
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
package com.tommytony.war.command;
|
||||
|
||||
import java.util.logging.Level;
|
||||
|
||||
import com.tommytony.war.War;
|
||||
import com.tommytony.war.ui.WarUI;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.tommytony.war.War;
|
||||
import java.util.logging.Level;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -45,8 +46,11 @@ public class WarCommandHandler {
|
|||
return true;
|
||||
}
|
||||
} else if (command.equals("war") || command.equals("War")) {
|
||||
// show /war help
|
||||
War.war.msg(sender, cmd.getUsage());
|
||||
if (sender instanceof Player) {
|
||||
War.war.getUIManager().assignUI((Player) sender, new WarUI());
|
||||
} else {
|
||||
War.war.badMsg(sender, "Use /war help for information.");
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
arguments = args;
|
||||
|
@ -94,6 +98,10 @@ public class WarCommandHandler {
|
|||
commandObj = new SetMonumentCommand(this, sender, arguments);
|
||||
} else if (command.equals("deletemonument")) {
|
||||
commandObj = new DeleteMonumentCommand(this, sender, arguments);
|
||||
} else if (command.equals("setcapturepoint")) {
|
||||
commandObj = new SetCapturePointCommand(this, sender, arguments);
|
||||
} else if (command.equals("deletecapturepoint")) {
|
||||
commandObj = new DeleteCapturePointCommand(this, sender, arguments);
|
||||
} else if (command.equals("setbomb")) {
|
||||
commandObj = new SetBombCommand(this, sender, arguments);
|
||||
} else if (command.equals("deletebomb")) {
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package com.tommytony.war.command;
|
||||
|
||||
import com.tommytony.war.config.WarConfig;
|
||||
import com.tommytony.war.job.TeleportPlayerJob;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
|
@ -36,7 +38,15 @@ public class WarhubCommand extends AbstractWarCommand {
|
|||
if (playerWarzone != null) { // was in zone
|
||||
playerWarzone.handlePlayerLeave(player, War.war.getWarHub().getLocation(), true);
|
||||
}
|
||||
player.teleport(War.war.getWarHub().getLocation());
|
||||
int warmup = War.war.getWarConfig().getInt(WarConfig.TPWARMUP);
|
||||
if (warmup > 0 && !player.hasPermission("war.warmupexempt")) {
|
||||
final int TICKS_PER_SECOND = 20;
|
||||
TeleportPlayerJob job = new TeleportPlayerJob(player, War.war.getWarHub().getLocation());
|
||||
job.runTaskLater(War.war, warmup);
|
||||
this.msg("command.tp.init", warmup / TICKS_PER_SECOND);
|
||||
} else {
|
||||
player.teleport(War.war.getWarHub().getLocation());
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package com.tommytony.war.command;
|
||||
|
||||
import com.tommytony.war.config.WarConfig;
|
||||
import com.tommytony.war.job.TeleportPlayerJob;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
|
@ -30,8 +32,15 @@ public class WarzoneCommand extends AbstractWarCommand {
|
|||
Warzone warzone = Warzone.getZoneByName(args[0]);
|
||||
if (warzone != null && warzone.getTeleport() != null) {
|
||||
Warzone playerWarzone = Warzone.getZoneByPlayerName(player.getName());
|
||||
int warmup = War.war.getWarConfig().getInt(WarConfig.TPWARMUP);
|
||||
if (playerWarzone != null) {
|
||||
playerWarzone.handlePlayerLeave(player, warzone.getTeleport(), true);
|
||||
}
|
||||
if (warmup > 0 && !player.hasPermission("war.warmupexempt")) {
|
||||
final int TICKS_PER_SECOND = 20;
|
||||
TeleportPlayerJob job = new TeleportPlayerJob(player, warzone.getTeleport());
|
||||
job.runTaskLater(War.war, warmup);
|
||||
this.msg("command.tp.init", warmup / TICKS_PER_SECOND);
|
||||
} else {
|
||||
player.teleport(warzone.getTeleport());
|
||||
}
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
package com.tommytony.war.command;
|
||||
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
|
||||
import com.tommytony.war.War;
|
||||
import com.tommytony.war.mapper.WarYmlMapper;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.logging.Level;
|
||||
|
||||
/**
|
||||
* Makes a player zonemaker and other way round.
|
||||
|
@ -21,8 +21,8 @@ public class ZoneMakerCommand extends AbstractWarCommand {
|
|||
|
||||
if (sender instanceof Player) { // i hate java for this.
|
||||
if (!War.war.isZoneMaker((Player) sender)) {
|
||||
for (String name : War.war.getZoneMakersImpersonatingPlayers()) {
|
||||
if (((Player) sender).getName().equals(name)) {
|
||||
for (OfflinePlayer offlinePlayer : War.war.getZoneMakersImpersonatingPlayers()) {
|
||||
if (offlinePlayer.isOnline() && sender.equals(offlinePlayer.getPlayer())) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -41,29 +41,29 @@ public class ZoneMakerCommand extends AbstractWarCommand {
|
|||
|
||||
if (War.war.isZoneMaker(player)) {
|
||||
if (this.args.length == 0) {
|
||||
War.war.getZoneMakersImpersonatingPlayers().add(player.getName());
|
||||
War.war.getZoneMakersImpersonatingPlayers().add(player);
|
||||
this.msg("You are now impersonating a regular player. Type /zonemaker again to toggle back to war maker mode.");
|
||||
} else if (this.args.length == 1) {
|
||||
OfflinePlayer other = Bukkit.getOfflinePlayer(this.args[0]);
|
||||
// make someone zonemaker or remove the right
|
||||
if (War.war.getZoneMakerNames().contains(this.args[0])) {
|
||||
if (War.war.getZoneMakerNames().contains(other)) {
|
||||
// kick
|
||||
War.war.getZoneMakerNames().remove(this.args[0]);
|
||||
War.war.getZoneMakerNames().remove(other);
|
||||
this.msg(this.args[0] + " is not a zone maker anymore.");
|
||||
Player kickedMaker = War.war.getServer().getPlayer(this.args[0]);
|
||||
if (kickedMaker != null) {
|
||||
War.war.msg(kickedMaker, player.getName() + " took away your warzone maker priviledges.");
|
||||
War.war.log(player.getName() + " took away zonemaker rights from " + kickedMaker, Level.INFO);
|
||||
if (other.isOnline()) {
|
||||
War.war.msg(other.getPlayer(), player.getName() + " took away your warzone maker priviledges.");
|
||||
War.war.log(player.getName() + " took away zonemaker rights from " + other.getName(), Level.INFO);
|
||||
}
|
||||
} else {
|
||||
// add
|
||||
War.war.getZoneMakerNames().add(this.args[0]);
|
||||
War.war.getZoneMakerNames().add(other);
|
||||
this.msg(this.args[0] + " is now a zone maker.");
|
||||
Player newMaker = War.war.getServer().getPlayer(this.args[0]);
|
||||
if (newMaker != null) {
|
||||
War.war.msg(newMaker, player.getName() + " made you warzone maker.");
|
||||
War.war.log(player.getName() + " made " + newMaker + " a zonemaker", Level.INFO);
|
||||
if (other.isOnline()) {
|
||||
War.war.msg(other.getPlayer(), player.getName() + " made you warzone maker.");
|
||||
War.war.log(player.getName() + " made " + other.getName() + " a zonemaker", Level.INFO);
|
||||
}
|
||||
}
|
||||
WarYmlMapper.save();
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ public class ZoneMakerCommand extends AbstractWarCommand {
|
|||
return false;
|
||||
}
|
||||
|
||||
War.war.getZoneMakersImpersonatingPlayers().remove(player.getName());
|
||||
War.war.getZoneMakersImpersonatingPlayers().remove(player);
|
||||
this.msg("You are back as a zone maker.");
|
||||
WarYmlMapper.save();
|
||||
}
|
||||
|
|
|
@ -4,12 +4,15 @@ import com.google.common.collect.ImmutableList;
|
|||
import com.tommytony.war.Team;
|
||||
import com.tommytony.war.War;
|
||||
import com.tommytony.war.Warzone;
|
||||
|
||||
import java.text.MessageFormat;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Effect;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.configuration.MemoryConfiguration;
|
||||
|
@ -41,7 +44,8 @@ public class KillstreakReward {
|
|||
section.set("5.reward.points", 1);
|
||||
section.set("5.reward.airstrike", true);
|
||||
section.set("5.reward.items", ImmutableList.of(new ItemStack(Material.ARROW, 15), new ItemStack(Material.EGG)));
|
||||
ItemStack sword = new ItemStack(Material.WOOD_SWORD);
|
||||
section.set("5.reward.effect", Effect.GHAST_SHRIEK.name());
|
||||
ItemStack sword = new ItemStack(Material.WOODEN_SWORD);
|
||||
sword.addEnchantment(Enchantment.DAMAGE_ALL, 2);
|
||||
sword.addEnchantment(Enchantment.KNOCKBACK, 1);
|
||||
ItemMeta meta = sword.getItemMeta();
|
||||
|
@ -131,6 +135,10 @@ public class KillstreakReward {
|
|||
if (killSection.getBoolean("reward.airstrike")) {
|
||||
this.airstrikePlayers.add(player.getName());
|
||||
}
|
||||
if (killSection.contains("reward.effect")) {
|
||||
Effect effect = Effect.valueOf(killSection.getString("reward.effect"));
|
||||
player.getWorld().playEffect(player.getLocation(), effect, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -4,18 +4,16 @@ public enum ScoreboardType {
|
|||
|
||||
NONE(null),
|
||||
POINTS("Points"),
|
||||
LIFEPOOL("Lifepool");
|
||||
LIFEPOOL("Lifepool"),
|
||||
TOPKILLS("Top kills"),
|
||||
PLAYERCOUNT("Player count"),
|
||||
SWITCHING("Switching");
|
||||
private final String displayName;
|
||||
|
||||
private ScoreboardType(String displayName) {
|
||||
ScoreboardType(String displayName) {
|
||||
this.displayName = displayName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return super.toString().toLowerCase();
|
||||
}
|
||||
|
||||
public static ScoreboardType getFromString(String string) {
|
||||
for (ScoreboardType boardMode : ScoreboardType.values()) {
|
||||
if (string.toLowerCase().equals(boardMode.toString())) {
|
||||
|
@ -26,6 +24,11 @@ public enum ScoreboardType {
|
|||
return ScoreboardType.NONE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return super.toString().toLowerCase();
|
||||
}
|
||||
|
||||
public String getDisplayName() {
|
||||
return displayName;
|
||||
}
|
||||
|
|
|
@ -2,33 +2,49 @@ package com.tommytony.war.config;
|
|||
|
||||
|
||||
public enum TeamConfig {
|
||||
FLAGMUSTBEHOME (Boolean.class),
|
||||
FLAGPOINTSONLY (Boolean.class),
|
||||
FLAGRETURN (FlagReturn.class),
|
||||
LIFEPOOL (Integer.class),
|
||||
MAXSCORE (Integer.class),
|
||||
NOHUNGER (Boolean.class),
|
||||
PLAYERLOADOUTASDEFAULT (Boolean.class),
|
||||
RESPAWNTIMER (Integer.class),
|
||||
SATURATION (Integer.class),
|
||||
SPAWNSTYLE (TeamSpawnStyle.class),
|
||||
TEAMSIZE (Integer.class),
|
||||
PERMISSION (String.class),
|
||||
XPKILLMETER (Boolean.class),
|
||||
KILLSTREAK (Boolean.class),
|
||||
BLOCKWHITELIST (String.class),
|
||||
PLACEBLOCK (Boolean.class);
|
||||
FLAGMUSTBEHOME (Boolean.class, "Flag Must Be Home", "If true, enemy flag cannot be captured if your flag is out"),
|
||||
FLAGPOINTSONLY (Boolean.class, null, null), // obsolete
|
||||
FLAGRETURN (FlagReturn.class, "Flag Return Destination", "Defines where the flag must be returned to capture\nOptions: spawn, flag, or both"),
|
||||
LIFEPOOL (Integer.class, "Lifepool", "Sets maximum team lives"),
|
||||
MAXSCORE (Integer.class, "Max Score", "Sets the point limit for when a team will win"),
|
||||
NOHUNGER (Boolean.class, "No Hunger", "If true, player hunger will not decrease"),
|
||||
PLAYERLOADOUTASDEFAULT (Boolean.class, "Player Loadout As Default", "If true, the default loadout will be the items the player brings into the zone"),
|
||||
RESPAWNTIMER (Integer.class, "Respawn Time", "Time, in seconds, required to wait after each death"),
|
||||
SATURATION (Integer.class, "Saturation", "Set player saturation to this level after each death"),
|
||||
SPAWNSTYLE (TeamSpawnStyle.class, "Spawn Style", "Sets the type spawn point\nOptions: small, big, flat, invisible"),
|
||||
TEAMSIZE (Integer.class, "Team Size", "Maximum players that may play on a team"),
|
||||
PERMISSION (String.class, "Required Permission", "Only allow players with a certain permission to join a team"),
|
||||
XPKILLMETER (Boolean.class, "XP Kill Meter", "Use the XP bar to count kills"),
|
||||
KILLSTREAK (Boolean.class, "Killstreak Rewards", "Reward players for kills based on war.yml configuration"),
|
||||
BLOCKWHITELIST (String.class, "Block Whitelist", "Comma-separated list of blocks players may break or place, 'all' removes this limit"),
|
||||
PLACEBLOCK (Boolean.class, "Place Blocks", "If true, players can place blocks"),
|
||||
APPLYPOTION(String.class, "Apply Potion Effect", "Give players a potion effect after each death, Format: EFFECT;DURATION;STRENGTH"),
|
||||
ECOREWARD(Double.class, "Economy Reward", "Give the winning team this much money, requires Vault plugin"),
|
||||
INVENTORYDROP(Boolean.class, "Drop Inventory", "If true, players will drop items on death"),
|
||||
BORDERDROP(Boolean.class, "Drop Near Border", "If true, players can drop items near the border\nUsually enabled to prevent duping");
|
||||
|
||||
private final Class<?> configType;
|
||||
private final String title;
|
||||
private final String description;
|
||||
|
||||
private TeamConfig(Class<?> configType) {
|
||||
this.configType = configType;
|
||||
TeamConfig(Class<?> configType, String title, String description) {
|
||||
this.configType = configType;
|
||||
this.title = title;
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public Class<?> getConfigType() {
|
||||
return configType;
|
||||
}
|
||||
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public static TeamConfig teamConfigFromString(String str) {
|
||||
String lowered = str.toLowerCase();
|
||||
for (TeamConfig config : TeamConfig.values()) {
|
||||
|
|
|
@ -1,13 +1,15 @@
|
|||
package com.tommytony.war.config;
|
||||
|
||||
import com.tommytony.war.Team;
|
||||
import com.tommytony.war.War;
|
||||
import com.tommytony.war.Warzone;
|
||||
import com.tommytony.war.mapper.WarzoneYmlMapper;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
|
||||
import java.util.EnumMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
|
||||
|
||||
import com.tommytony.war.War;
|
||||
import com.tommytony.war.Warzone;
|
||||
import java.util.logging.Level;
|
||||
|
||||
public class TeamConfigBag {
|
||||
|
||||
|
@ -21,15 +23,43 @@ public class TeamConfigBag {
|
|||
public TeamConfigBag() {
|
||||
this.warzone = null;
|
||||
}
|
||||
|
||||
|
||||
public static void afterUpdate(Team team, CommandSender sender, String namedParamReturn, boolean wantsToPrint) {
|
||||
final Warzone zone = team.getZone();
|
||||
WarzoneYmlMapper.save(zone);
|
||||
|
||||
String zoneReset = "Some changes may require a /resetzone. ";
|
||||
if (zone.getWarzoneConfig().getBoolean(WarzoneConfig.RESETONCONFIGCHANGE)) {
|
||||
zone.reinitialize(); // bring back team spawns etc
|
||||
zoneReset = "Zone reset. ";
|
||||
}
|
||||
|
||||
if (wantsToPrint) {
|
||||
War.war.msg(sender, "Team config saved. " + zoneReset + namedParamReturn + " " + War.war.printConfig(team));
|
||||
} else {
|
||||
War.war.msg(sender, "Team config saved. " + zoneReset + namedParamReturn);
|
||||
}
|
||||
|
||||
War.war.log(sender.getName() + " updated team " + team.getName() + " configuration in warzone " + zone.getName() + "." + namedParamReturn, Level.INFO);
|
||||
|
||||
if (War.war.getWarHub() != null) { // maybe the zone was disabled/enabled
|
||||
War.war.getWarHub().getVolume().resetBlocks();
|
||||
War.war.getWarHub().initialize();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean contains(TeamConfig config) {
|
||||
return this.bag.containsKey(config);
|
||||
}
|
||||
|
||||
public void reset() {
|
||||
this.bag.clear();
|
||||
}
|
||||
|
||||
public boolean isEmpty() {
|
||||
return this.bag.keySet().size() == 0;
|
||||
}
|
||||
|
||||
|
||||
public void put(TeamConfig config, Object value) {
|
||||
this.bag.put(config, value);
|
||||
}
|
||||
|
@ -44,7 +74,7 @@ public class TeamConfigBag {
|
|||
|
||||
public Object resolveValue(TeamConfig config) {
|
||||
if (this.contains(config)) {
|
||||
return this.bag.get(config);
|
||||
return this.bag.get(config);
|
||||
} else if (this.warzone != null && this.warzone.getTeamDefaultConfig().contains(config)){
|
||||
// use Warzone default config
|
||||
return this.warzone.getTeamDefaultConfig().resolveValue(config);
|
||||
|
@ -53,7 +83,26 @@ public class TeamConfigBag {
|
|||
return War.war.getTeamDefaultConfig().resolveValue(config);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public Double getDouble(TeamConfig config) {
|
||||
if (this.contains(config)) {
|
||||
return (Double)this.bag.get(config);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public Double resolveDouble(TeamConfig config) {
|
||||
if (this.contains(config)) {
|
||||
return (Double)this.bag.get(config);
|
||||
} else if (this.warzone != null && this.warzone.getTeamDefaultConfig().contains(config)){
|
||||
// use Warzone default config
|
||||
return this.warzone.getTeamDefaultConfig().resolveDouble(config);
|
||||
} else {
|
||||
// use War default config
|
||||
return War.war.getTeamDefaultConfig().resolveDouble(config);
|
||||
}
|
||||
}
|
||||
|
||||
public Integer getInt(TeamConfig config) {
|
||||
if (this.contains(config)) {
|
||||
return (Integer)this.bag.get(config);
|
||||
|
@ -63,7 +112,7 @@ public class TeamConfigBag {
|
|||
|
||||
public Integer resolveInt(TeamConfig config) {
|
||||
if (this.contains(config)) {
|
||||
return (Integer)this.bag.get(config);
|
||||
return (Integer) this.bag.get(config);
|
||||
} else if (this.warzone != null && this.warzone.getTeamDefaultConfig().contains(config)){
|
||||
// use Warzone default config
|
||||
return this.warzone.getTeamDefaultConfig().resolveInt(config);
|
||||
|
@ -82,7 +131,7 @@ public class TeamConfigBag {
|
|||
|
||||
public Boolean resolveBoolean(TeamConfig config) {
|
||||
if (this.contains(config)) {
|
||||
return (Boolean)this.bag.get(config);
|
||||
return (Boolean) this.bag.get(config);
|
||||
} else if (this.warzone != null && this.warzone.getTeamDefaultConfig().contains(config)){
|
||||
// use Warzone default config
|
||||
return this.warzone.getTeamDefaultConfig().resolveBoolean(config);
|
||||
|
@ -101,7 +150,7 @@ public class TeamConfigBag {
|
|||
|
||||
public String resolveString(TeamConfig config) {
|
||||
if (this.contains(config)) {
|
||||
return (String)this.bag.get(config);
|
||||
return (String) this.bag.get(config);
|
||||
} else if (this.warzone != null && this.warzone.getTeamDefaultConfig().contains(config)){
|
||||
// use Warzone default config
|
||||
return this.warzone.getTeamDefaultConfig().resolveString(config);
|
||||
|
@ -113,7 +162,7 @@ public class TeamConfigBag {
|
|||
|
||||
public FlagReturn resolveFlagReturn() {
|
||||
if (this.contains(TeamConfig.FLAGRETURN)) {
|
||||
return (FlagReturn)this.bag.get(TeamConfig.FLAGRETURN);
|
||||
return (FlagReturn) this.bag.get(TeamConfig.FLAGRETURN);
|
||||
} else if (this.warzone != null && this.warzone.getTeamDefaultConfig().contains(TeamConfig.FLAGRETURN)){
|
||||
// use Warzone default config
|
||||
return this.warzone.getTeamDefaultConfig().resolveFlagReturn();
|
||||
|
@ -125,14 +174,14 @@ public class TeamConfigBag {
|
|||
|
||||
public FlagReturn getFlagReturn() {
|
||||
if (this.contains(TeamConfig.FLAGRETURN)) {
|
||||
return (FlagReturn)this.bag.get(TeamConfig.FLAGRETURN);
|
||||
return (FlagReturn) this.bag.get(TeamConfig.FLAGRETURN);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public TeamSpawnStyle resolveSpawnStyle() {
|
||||
if (this.contains(TeamConfig.SPAWNSTYLE)) {
|
||||
return (TeamSpawnStyle)this.bag.get(TeamConfig.SPAWNSTYLE);
|
||||
return (TeamSpawnStyle) this.bag.get(TeamConfig.SPAWNSTYLE);
|
||||
} else if (this.warzone != null && this.warzone.getTeamDefaultConfig().contains(TeamConfig.SPAWNSTYLE)){
|
||||
// use War default config
|
||||
return this.warzone.getTeamDefaultConfig().resolveSpawnStyle();
|
||||
|
@ -143,11 +192,11 @@ public class TeamConfigBag {
|
|||
|
||||
public TeamSpawnStyle getSpawnStyle() {
|
||||
if (this.contains(TeamConfig.SPAWNSTYLE)) {
|
||||
return (TeamSpawnStyle)this.bag.get(TeamConfig.SPAWNSTYLE);
|
||||
return (TeamSpawnStyle) this.bag.get(TeamConfig.SPAWNSTYLE);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public void loadFrom(ConfigurationSection teamConfigSection) {
|
||||
for (TeamConfig config : TeamConfig.values()) {
|
||||
if (teamConfigSection.contains(config.toString())) {
|
||||
|
@ -157,6 +206,8 @@ public class TeamConfigBag {
|
|||
this.put(config, teamConfigSection.getBoolean(config.toString()));
|
||||
} else if (config.getConfigType().equals(String.class)) {
|
||||
this.put(config, teamConfigSection.getString(config.toString()));
|
||||
} else if (config.getConfigType().equals(Double.class)) {
|
||||
this.put(config, teamConfigSection.getDouble(config.toString()));
|
||||
} else if (config.getConfigType().equals(FlagReturn.class)) {
|
||||
String flagReturnStr = teamConfigSection.getString(config.toString());
|
||||
FlagReturn returnMode = FlagReturn.getFromString(flagReturnStr);
|
||||
|
@ -169,7 +220,7 @@ public class TeamConfigBag {
|
|||
if (style != null) {
|
||||
this.put(config, style);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -177,8 +228,9 @@ public class TeamConfigBag {
|
|||
public void saveTo(ConfigurationSection teamConfigSection) {
|
||||
for (TeamConfig config : TeamConfig.values()) {
|
||||
if (this.contains(config)) {
|
||||
if (config.getConfigType().equals(Integer.class)
|
||||
|| config.getConfigType().equals(Boolean.class)) {
|
||||
if (config.getConfigType().equals(Integer.class)
|
||||
|| config.getConfigType().equals(Boolean.class)
|
||||
|| config.getConfigType().equals(Double.class)) {
|
||||
teamConfigSection.set(config.toString(), this.bag.get(config));
|
||||
} else {
|
||||
teamConfigSection.set(config.toString(), this.bag.get(config).toString());
|
||||
|
@ -186,7 +238,7 @@ public class TeamConfigBag {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public String updateFromNamedParams(Map<String, String> namedParams) {
|
||||
String returnMessage = "";
|
||||
for (String namedParam : namedParams.keySet()) {
|
||||
|
@ -195,6 +247,9 @@ public class TeamConfigBag {
|
|||
if (teamConfig.getConfigType().equals(Integer.class)) {
|
||||
int intValue = Integer.parseInt(namedParams.get(namedParam));
|
||||
this.bag.put(teamConfig, intValue);
|
||||
} else if (teamConfig.getConfigType().equals(Double.class)) {
|
||||
double doubleValue = Double.parseDouble(namedParams.get(namedParam));
|
||||
this.bag.put(teamConfig, doubleValue);
|
||||
} else if (teamConfig.getConfigType().equals(Boolean.class)) {
|
||||
String onOff = namedParams.get(namedParam);
|
||||
this.bag.put(teamConfig, onOff.equals("on") || onOff.equals("true"));
|
||||
|
@ -208,11 +263,11 @@ public class TeamConfigBag {
|
|||
TeamSpawnStyle spawnValue = TeamSpawnStyle.getStyleFromString(namedParams.get(namedParam));
|
||||
this.bag.put(teamConfig, spawnValue);
|
||||
}
|
||||
returnMessage += " " + teamConfig.toString() + " set to " + namedParams.get(namedParam);
|
||||
returnMessage += " " + teamConfig.toString() + " set to " + namedParams.get(namedParam);
|
||||
} else if (namedParam.equals("delete")) {
|
||||
String toDelete = namedParams.get(namedParam);
|
||||
teamConfig = TeamConfig.teamConfigFromString(toDelete);
|
||||
|
||||
|
||||
// param delete (to restore inheritance)
|
||||
if (teamConfig != null) {
|
||||
this.bag.remove(teamConfig);
|
||||
|
|
|
@ -6,34 +6,31 @@ import org.bukkit.Material;
|
|||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.LeatherArmorMeta;
|
||||
import org.bukkit.material.MaterialData;
|
||||
import org.bukkit.material.Wool;
|
||||
import org.getspout.spoutapi.gui.Color;
|
||||
|
||||
public enum TeamKind {
|
||||
WHITE (DyeColor.WHITE, Material.WOOL, ChatColor.WHITE, 450),
|
||||
ORANGE (DyeColor.ORANGE, Material.WOOL, ChatColor.GOLD, 51),
|
||||
MAGENTA (DyeColor.MAGENTA, Material.WOOL, ChatColor.LIGHT_PURPLE, 353),
|
||||
BLUE (DyeColor.LIGHT_BLUE, Material.WOOL, ChatColor.BLUE, 23),
|
||||
GOLD (DyeColor.YELLOW, Material.WOOL, ChatColor.YELLOW, 403), // yellow = gold
|
||||
GREEN (DyeColor.LIME, Material.WOOL, ChatColor.GREEN, 612),
|
||||
PINK (DyeColor.PINK, Material.WOOL, ChatColor.LIGHT_PURPLE, 929),
|
||||
GRAY (DyeColor.GRAY, Material.WOOL, ChatColor.DARK_GRAY, 600),
|
||||
IRON (DyeColor.SILVER, Material.WOOL, ChatColor.GRAY, 154), // lightgrey = iron
|
||||
DIAMOND (DyeColor.CYAN, Material.WOOL, ChatColor.DARK_AQUA, 738), // cyan = diamond
|
||||
PURPLE (DyeColor.PURPLE, Material.WOOL, ChatColor.DARK_PURPLE, 153),
|
||||
NAVY (DyeColor.BLUE, Material.WOOL, ChatColor.DARK_BLUE, 939),
|
||||
BROWN (DyeColor.BROWN, Material.WOOL, ChatColor.DARK_RED, 908),
|
||||
DARKGREEN (DyeColor.GREEN, Material.WOOL, ChatColor.DARK_GREEN, 612),
|
||||
RED (DyeColor.RED, Material.WOOL, ChatColor.RED, 245),
|
||||
BLACK (DyeColor.BLACK, Material.WOOL, ChatColor.BLACK, 0);
|
||||
WHITE (DyeColor.WHITE, Material.WHITE_WOOL, ChatColor.WHITE, 450),
|
||||
ORANGE (DyeColor.ORANGE, Material.ORANGE_WOOL, ChatColor.GOLD, 51),
|
||||
MAGENTA (DyeColor.MAGENTA, Material.MAGENTA_WOOL, ChatColor.LIGHT_PURPLE, 353),
|
||||
BLUE (DyeColor.LIGHT_BLUE, Material.LIGHT_BLUE_WOOL, ChatColor.BLUE, 23),
|
||||
GOLD (DyeColor.YELLOW, Material.YELLOW_WOOL, ChatColor.YELLOW, 403), // yellow = gold
|
||||
GREEN (DyeColor.LIME, Material.LIME_WOOL, ChatColor.GREEN, 612),
|
||||
PINK (DyeColor.PINK, Material.PINK_WOOL, ChatColor.LIGHT_PURPLE, 929),
|
||||
GRAY (DyeColor.GRAY, Material.GRAY_WOOL, ChatColor.DARK_GRAY, 600),
|
||||
IRON (DyeColor.GRAY, Material.GRAY_WOOL, ChatColor.GRAY, 154), // lightgrey = iron
|
||||
DIAMOND (DyeColor.CYAN, Material.CYAN_WOOL, ChatColor.DARK_AQUA, 738), // cyan = diamond
|
||||
PURPLE (DyeColor.PURPLE, Material.PURPLE_WOOL, ChatColor.DARK_PURPLE, 153),
|
||||
NAVY (DyeColor.BLUE, Material.BLUE_WOOL, ChatColor.DARK_BLUE, 939),
|
||||
BROWN (DyeColor.BROWN, Material.BROWN_WOOL, ChatColor.DARK_RED, 908),
|
||||
DARKGREEN (DyeColor.GREEN, Material.GREEN_WOOL, ChatColor.DARK_GREEN, 612),
|
||||
RED (DyeColor.RED, Material.RED_WOOL, ChatColor.RED, 245),
|
||||
BLACK (DyeColor.BLACK, Material.BLACK_WOOL, ChatColor.BLACK, 0);
|
||||
|
||||
private final DyeColor dyeColor;
|
||||
private final ChatColor chatColor;
|
||||
private final Material material;
|
||||
private final int potionEffectColor;
|
||||
|
||||
private TeamKind(DyeColor blockHeadColor, Material material, ChatColor color, int potionEffectColor) {
|
||||
TeamKind(DyeColor blockHeadColor, Material material, ChatColor color, int potionEffectColor) {
|
||||
this.dyeColor = blockHeadColor;
|
||||
this.material = material;
|
||||
this.chatColor = color;
|
||||
|
@ -50,23 +47,22 @@ public enum TeamKind {
|
|||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get wool block data for the dye color.
|
||||
*
|
||||
* @return wool color data value
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
public byte getData() {
|
||||
return this.dyeColor.getWoolData();
|
||||
public static TeamKind getTeam(String teamName) {
|
||||
for (TeamKind team : TeamKind.values()) {
|
||||
if (team.toString().equalsIgnoreCase(teamName)) {
|
||||
return team;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the color of the wool head block.
|
||||
*
|
||||
* @return head wool color.
|
||||
* Get wool block data for the dye color.
|
||||
* @deprecated TODO remove all spout craft support
|
||||
* @return wool color data value
|
||||
*/
|
||||
public DyeColor getDyeColor() {
|
||||
return this.dyeColor;
|
||||
public byte getData() {
|
||||
return this.dyeColor.getWoolData();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -78,17 +74,6 @@ public enum TeamKind {
|
|||
return this.chatColor;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the color of this team in the Spout client GUI.
|
||||
*
|
||||
* @return spout chat GUI color
|
||||
*/
|
||||
public Color getSpoutColor() {
|
||||
return new org.getspout.spoutapi.gui.Color(
|
||||
dyeColor.getColor().getRed(), dyeColor.getColor().getGreen(),
|
||||
dyeColor.getColor().getBlue());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the color of the wool block as a bukkit color.
|
||||
*
|
||||
|
@ -99,7 +84,7 @@ public enum TeamKind {
|
|||
}
|
||||
|
||||
/**
|
||||
* Get head block material. Should always be {@link Material#WOOL}.
|
||||
* Get head block material.
|
||||
*
|
||||
* @return team head block material.
|
||||
*/
|
||||
|
@ -122,31 +107,12 @@ public enum TeamKind {
|
|||
}
|
||||
|
||||
/**
|
||||
* Get a single item of this team's wool head block. Creates a single block
|
||||
* with data from {@link #getBlockData()}.
|
||||
* Get a single item of this team's wool head block.
|
||||
*
|
||||
* @return single block head item.
|
||||
*/
|
||||
public ItemStack getBlockHead() {
|
||||
return new Wool(this.dyeColor).toItemStack(1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get wool head block data (for creating blocks).
|
||||
*
|
||||
* @return wool head block data.
|
||||
*/
|
||||
public MaterialData getBlockData() {
|
||||
return new Wool(this.dyeColor);
|
||||
}
|
||||
|
||||
public static TeamKind getTeam(String teamName) {
|
||||
for (TeamKind team : TeamKind.values()) {
|
||||
if (team.toString().equalsIgnoreCase(teamName)) {
|
||||
return team;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
return new ItemStack(this.material, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -156,11 +122,7 @@ public enum TeamKind {
|
|||
* @return true if block is this team's color.
|
||||
*/
|
||||
public boolean isTeamBlock(BlockState block) {
|
||||
if (block.getType() != Material.WOOL || !(block.getData() instanceof Wool)) {
|
||||
return false;
|
||||
}
|
||||
Wool wool = (Wool) block.getData();
|
||||
return wool.getColor() == dyeColor;
|
||||
return block.getType() == material;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -170,27 +132,17 @@ public enum TeamKind {
|
|||
* @return true if item is this team's color.
|
||||
*/
|
||||
public boolean isTeamItem(ItemStack item) {
|
||||
if (item.getType() != Material.WOOL || !(item.getData() instanceof Wool)) {
|
||||
return false;
|
||||
}
|
||||
Wool wool = (Wool) item.getData();
|
||||
return wool.getColor() == dyeColor;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a block data is this team's block data.
|
||||
*
|
||||
* @param data Wool block data.
|
||||
* @return true if data is this team's data.
|
||||
*/
|
||||
public boolean isTeamBlock(MaterialData data) {
|
||||
return data instanceof Wool && ((Wool)data).getColor() == this.dyeColor;
|
||||
return item.getType() == material;
|
||||
}
|
||||
|
||||
public String getFormattedName() {
|
||||
return this.getColor() + this.name().toLowerCase() + ChatColor.WHITE;
|
||||
}
|
||||
|
||||
public String getCapsName() {
|
||||
return String.valueOf(name().charAt(0)) + name().substring(1).toLowerCase();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a colored hat item for the team.
|
||||
* @return Hat item with the team's color.
|
||||
|
|
|
@ -2,27 +2,42 @@ package com.tommytony.war.config;
|
|||
|
||||
|
||||
public enum WarConfig {
|
||||
BUILDINZONESONLY (Boolean.class),
|
||||
DISABLEBUILDMESSAGE (Boolean.class),
|
||||
DISABLEPVPMESSAGE (Boolean.class),
|
||||
KEEPOLDZONEVERSIONS (Boolean.class),
|
||||
MAXZONES (Integer.class),
|
||||
PVPINZONESONLY (Boolean.class),
|
||||
TNTINZONESONLY (Boolean.class),
|
||||
RESETSPEED (Integer.class),
|
||||
MAXSIZE (Integer.class),
|
||||
LANGUAGE (String.class);
|
||||
BUILDINZONESONLY (Boolean.class, "Build in zones only", "Allow building in zones only"),
|
||||
DISABLEBUILDMESSAGE (Boolean.class, "Disable build message", "Silently prevent building outside zones"),
|
||||
DISABLEPVPMESSAGE (Boolean.class, "Disable PVP message", "Silently prevent PVP"),
|
||||
KEEPOLDZONEVERSIONS (Boolean.class, "Keep old zone versions", "If true, archive the warzone on each save"),
|
||||
MAXZONES (Integer.class, "Max zones", "Limit on number of zones that can be created"),
|
||||
PVPINZONESONLY (Boolean.class, "PVP in zones only", "If true, limits PVP to warzones"),
|
||||
TNTINZONESONLY (Boolean.class, "TNT in zones only", "If true, limits TNT to warzones"),
|
||||
RESETSPEED (Integer.class, "Reset speed", "Number of blocks to reset per tick"),
|
||||
MAXSIZE (Integer.class, "Max size", "Maximum volume of a warzone"),
|
||||
LANGUAGE (String.class, "Language", "Preferred server language"),
|
||||
AUTOJOIN (String.class, "Auto-join", "Name of warzone to send players to upon join"),
|
||||
TPWARMUP(Integer.class, "TP warmup", "Amount of seconds a player must wait after requesting a teleport"),
|
||||
DISABLECOOLDOWN (Boolean.class, "Disable the 1.9 combat cooldown", "Disables the attack cooldown when swinging a weapon");
|
||||
|
||||
private final Class<?> configType;
|
||||
private final String title;
|
||||
private final String description;
|
||||
|
||||
private WarConfig(Class<?> configType) {
|
||||
this.configType = configType;
|
||||
WarConfig(Class<?> configType, String title, String description) {
|
||||
this.configType = configType;
|
||||
this.title = title;
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public Class<?> getConfigType() {
|
||||
return configType;
|
||||
}
|
||||
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public static WarConfig warConfigFromString(String str) {
|
||||
String lowered = str.toLowerCase();
|
||||
for (WarConfig config : WarConfig.values()) {
|
||||
|
|
|
@ -2,8 +2,11 @@ package com.tommytony.war.config;
|
|||
|
||||
import java.util.EnumMap;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import com.tommytony.war.War;
|
||||
import com.tommytony.war.mapper.WarYmlMapper;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
|
||||
public class WarConfigBag {
|
||||
|
@ -92,4 +95,15 @@ public class WarConfigBag {
|
|||
}
|
||||
return returnMessage;
|
||||
}
|
||||
|
||||
public static void afterUpdate(CommandSender sender, String namedParamReturn, boolean wantsToPrint) {
|
||||
WarYmlMapper.save();
|
||||
if (wantsToPrint) {
|
||||
String config = War.war.printConfig();
|
||||
War.war.msg(sender, "War config saved. " + namedParamReturn + " " + config);
|
||||
} else {
|
||||
War.war.msg(sender, "War config saved. " + namedParamReturn);
|
||||
}
|
||||
War.war.log(sender.getName() + " updated War configuration. " + namedParamReturn, Level.INFO);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,44 +1,57 @@
|
|||
package com.tommytony.war.config;
|
||||
|
||||
public enum WarzoneConfig {
|
||||
AUTOASSIGN (Boolean.class),
|
||||
BLOCKHEADS (Boolean.class),
|
||||
DEATHMESSAGES (Boolean.class),
|
||||
DISABLED (Boolean.class),
|
||||
FRIENDLYFIRE (Boolean.class),
|
||||
GLASSWALLS (Boolean.class),
|
||||
INSTABREAK (Boolean.class),
|
||||
MINTEAMS (Integer.class),
|
||||
MINPLAYERS (Integer.class),
|
||||
MONUMENTHEAL (Integer.class),
|
||||
NOCREATURES (Boolean.class),
|
||||
NODROPS (Boolean.class),
|
||||
PVPINZONE (Boolean.class),
|
||||
REALDEATHS (Boolean.class),
|
||||
RESETONEMPTY (Boolean.class),
|
||||
RESETONCONFIGCHANGE (Boolean.class),
|
||||
RESETONLOAD (Boolean.class),
|
||||
RESETONUNLOAD (Boolean.class),
|
||||
UNBREAKABLE (Boolean.class),
|
||||
JOINMIDBATTLE (Boolean.class),
|
||||
AUTOJOIN (Boolean.class),
|
||||
SCOREBOARD (ScoreboardType.class),
|
||||
XPKILLMETER (Boolean.class),
|
||||
SOUPHEALING (Boolean.class),
|
||||
ALLOWENDER (Boolean.class),
|
||||
RESETBLOCKS (Boolean.class);
|
||||
AUTOASSIGN (Boolean.class, "Auto-Assign", "If true, distributes players across teams"),
|
||||
BLOCKHEADS (Boolean.class, "Team Helmets", "If true, players are given a team-colored hat"),
|
||||
DEATHMESSAGES (Boolean.class, "Death Notification", "If true, notify the zone when players are killed"),
|
||||
DISABLED (Boolean.class, "Disable Zone", "If true, prevent players from joining the zone"),
|
||||
FRIENDLYFIRE (Boolean.class, "Friendly Fire", "If true, players are allowed to injure teammates"),
|
||||
GLASSWALLS (Boolean.class, "Glass Walls", "If true, use magic glass walls to keep players in/out of zones"),
|
||||
INSTABREAK (Boolean.class, "Insta-Break", "If true, players break blocks instantly\nUseful for Spleef gamemodes"),
|
||||
MINTEAMS (Integer.class, "Minimum Teams", "Minimum number of active teams required to start the battle"),
|
||||
MINPLAYERS (Integer.class, "Minimum Players", "Minimum number of players required per team to start the battle"),
|
||||
MONUMENTHEAL (Integer.class, "Monument Heal", "Number of hearts given to players jumping on the monument"),
|
||||
NOCREATURES (Boolean.class, "No Mobs", "If true, prevent mob spawning"),
|
||||
NODROPS (Boolean.class, "No Drops", "If true, prevent players from dropping items"),
|
||||
PVPINZONE (Boolean.class, "PVP", "If true, PVP is enabled\nUseful for Spleef gamemodes"),
|
||||
REALDEATHS (Boolean.class, "Real Deaths", "If true, send players to the real Minecraft death screen"),
|
||||
RESETONEMPTY (Boolean.class, "Reset on Empty", "If true, reset the zone when all players leave"),
|
||||
RESETONCONFIGCHANGE (Boolean.class, "Reset on Config Change", "If true, reset every time the zone config is modified"),
|
||||
RESETONLOAD (Boolean.class, "Reset on Load", "If true, reset warzone when the server starts"),
|
||||
RESETONUNLOAD (Boolean.class, "Reset on Unload", "If true, reset warzone when the server stops"),
|
||||
UNBREAKABLE (Boolean.class, "Unbreakable Blocks", "If true, prevent block breaking"),
|
||||
JOINMIDBATTLE (Boolean.class, "Join Mid-Battle", "If true, players are allowed to join during a battle"),
|
||||
AUTOJOIN (Boolean.class, "Auto-Join", "If true, bypass the zone lobby and auto-assign the player a team"),
|
||||
SCOREBOARD (ScoreboardType.class, "Scoreboard Type", "Type of scoreboard for this zone\nOptions: none, points, lifepool, top kills"),
|
||||
SOUPHEALING (Boolean.class, "Soup Healing", "If true, allow players to heal by consuming soup"),
|
||||
ALLOWENDER (Boolean.class, "Allow Ender Chests", "If true, ender chests are allowed\nEnder chests are usually blocked to prevent item duplication"),
|
||||
RESETBLOCKS (Boolean.class, "Reset Blocks", "If true, reset warzone blocks each battle"),
|
||||
CAPTUREPOINTTIME (Integer.class, "Capture Control Time", "Time, in seconds, required to gain control of a capture point"),
|
||||
PREPTIME(Integer.class, "Preparation Time", "Time, in seconds, before players are allowed to fight");
|
||||
|
||||
|
||||
private final Class<?> configType;
|
||||
private final String title;
|
||||
private final String description;
|
||||
|
||||
private WarzoneConfig(Class<?> configType) {
|
||||
this.configType = configType;
|
||||
WarzoneConfig(Class<?> configType, String title, String description) {
|
||||
this.configType = configType;
|
||||
this.title = title;
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public Class<?> getConfigType() {
|
||||
return configType;
|
||||
}
|
||||
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public static WarzoneConfig warzoneConfigFromString(String str) {
|
||||
String lowered = str.toLowerCase();
|
||||
for (WarzoneConfig config : WarzoneConfig.values()) {
|
||||
|
|
|
@ -1,18 +1,20 @@
|
|||
package com.tommytony.war.config;
|
||||
|
||||
import java.util.EnumMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
|
||||
import com.tommytony.war.War;
|
||||
import com.tommytony.war.Warzone;
|
||||
import com.tommytony.war.mapper.WarzoneYmlMapper;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
|
||||
import java.util.EnumMap;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Level;
|
||||
|
||||
|
||||
public class WarzoneConfigBag {
|
||||
|
||||
EnumMap<WarzoneConfig, Object> bag = new EnumMap<WarzoneConfig, Object>(WarzoneConfig.class);
|
||||
private final Warzone warzone;
|
||||
EnumMap<WarzoneConfig, Object> bag = new EnumMap<WarzoneConfig, Object>(WarzoneConfig.class);
|
||||
|
||||
public WarzoneConfigBag(Warzone warzone) {
|
||||
this.warzone = warzone;
|
||||
|
@ -23,6 +25,29 @@ public class WarzoneConfigBag {
|
|||
this.warzone = null;
|
||||
}
|
||||
|
||||
public static void afterUpdate(Warzone zone, CommandSender sender, String namedParamReturn, boolean wantsToPrint) {
|
||||
WarzoneYmlMapper.save(zone);
|
||||
|
||||
String zoneReset = "Some changes may require a /resetzone. ";
|
||||
if (zone.getWarzoneConfig().getBoolean(WarzoneConfig.RESETONCONFIGCHANGE)) {
|
||||
zone.reinitialize(); // bring back team spawns etc
|
||||
zoneReset = "Zone reset. ";
|
||||
}
|
||||
|
||||
if (wantsToPrint) {
|
||||
War.war.msg(sender, "Warzone config saved. " + zoneReset + namedParamReturn + " " + War.war.printConfig(zone));
|
||||
} else {
|
||||
War.war.msg(sender, "Warzone config saved. " + zoneReset + namedParamReturn);
|
||||
}
|
||||
|
||||
War.war.log(sender.getName() + " updated warzone " + zone.getName() + " configuration." + namedParamReturn, Level.INFO);
|
||||
|
||||
if (War.war.getWarHub() != null) { // maybe the zone was disabled/enabled
|
||||
War.war.getWarHub().getVolume().resetBlocks();
|
||||
War.war.getWarHub().initialize();
|
||||
}
|
||||
}
|
||||
|
||||
public void put(WarzoneConfig config, Object value) {
|
||||
bag.put(config, value);
|
||||
}
|
||||
|
@ -33,7 +58,7 @@ public class WarzoneConfigBag {
|
|||
|
||||
public Object getValue(WarzoneConfig config) {
|
||||
if (bag.containsKey(config)) {
|
||||
return bag.get(config);
|
||||
return bag.get(config);
|
||||
} else {
|
||||
// use War default config
|
||||
return War.war.getWarzoneDefaultConfig().getValue(config);
|
||||
|
@ -42,16 +67,16 @@ public class WarzoneConfigBag {
|
|||
|
||||
public Integer getInt(WarzoneConfig config) {
|
||||
if (bag.containsKey(config)) {
|
||||
return (Integer)bag.get(config);
|
||||
return (Integer) bag.get(config);
|
||||
} else {
|
||||
// use War default config
|
||||
return War.war.getWarzoneDefaultConfig().getInt(config);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public Boolean getBoolean(WarzoneConfig config) {
|
||||
if (bag.containsKey(config)) {
|
||||
return (Boolean)bag.get(config);
|
||||
return (Boolean) bag.get(config);
|
||||
} else {
|
||||
// use War default config
|
||||
return War.war.getWarzoneDefaultConfig().getBoolean(config);
|
||||
|
@ -67,6 +92,14 @@ public class WarzoneConfigBag {
|
|||
}
|
||||
}
|
||||
|
||||
public boolean contains(WarzoneConfig config) {
|
||||
return this.bag.containsKey(config);
|
||||
}
|
||||
|
||||
public void reset() {
|
||||
this.bag.clear();
|
||||
}
|
||||
|
||||
public void loadFrom(ConfigurationSection warzoneConfigSection) {
|
||||
for (WarzoneConfig config : WarzoneConfig.values()) {
|
||||
if (warzoneConfigSection.contains(config.toString())) {
|
||||
|
@ -93,12 +126,12 @@ public class WarzoneConfigBag {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public String updateFromNamedParams(Map<String, String> namedParams) {
|
||||
String returnMessage = "";
|
||||
for (String namedParam : namedParams.keySet()) {
|
||||
WarzoneConfig warzoneConfig = WarzoneConfig.warzoneConfigFromString(namedParam);
|
||||
|
||||
|
||||
// param update
|
||||
if (warzoneConfig != null) {
|
||||
if (warzoneConfig.getConfigType().equals(Integer.class)) {
|
||||
|
@ -115,11 +148,11 @@ public class WarzoneConfigBag {
|
|||
String type = namedParams.get(namedParam);
|
||||
this.bag.put(warzoneConfig, ScoreboardType.getFromString(type));
|
||||
}
|
||||
returnMessage += " " + warzoneConfig.toString() + " set to " + namedParams.get(namedParam);
|
||||
returnMessage += " " + warzoneConfig.toString() + " set to " + namedParams.get(namedParam);
|
||||
} else if (namedParam.equals("delete")) {
|
||||
String toDelete = namedParams.get(namedParam);
|
||||
warzoneConfig = WarzoneConfig.warzoneConfigFromString(toDelete);
|
||||
|
||||
|
||||
// param delete (to restore inheritance)
|
||||
if (warzoneConfig != null) {
|
||||
this.bag.remove(warzoneConfig);
|
||||
|
|
|
@ -1,33 +1,32 @@
|
|||
package com.tommytony.war.event;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.block.BlockBreakEvent;
|
||||
import org.bukkit.event.block.BlockBurnEvent;
|
||||
import org.bukkit.event.block.BlockDamageEvent;
|
||||
import org.bukkit.event.block.BlockPistonExtendEvent;
|
||||
import org.bukkit.event.block.BlockPistonRetractEvent;
|
||||
import org.bukkit.event.block.BlockPlaceEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.getspout.spoutapi.SpoutManager;
|
||||
import org.getspout.spoutapi.player.SpoutPlayer;
|
||||
|
||||
import com.tommytony.war.Team;
|
||||
import com.tommytony.war.War;
|
||||
import com.tommytony.war.Warzone;
|
||||
import com.tommytony.war.config.TeamConfig;
|
||||
import com.tommytony.war.config.WarConfig;
|
||||
import com.tommytony.war.config.WarzoneConfig;
|
||||
import com.tommytony.war.spout.SpoutDisplayer;
|
||||
import com.tommytony.war.structure.Bomb;
|
||||
import com.tommytony.war.structure.Cake;
|
||||
import com.tommytony.war.structure.Monument;
|
||||
import com.tommytony.war.utility.Compat;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.block.*;
|
||||
import org.bukkit.event.world.StructureGrowEvent;
|
||||
import org.bukkit.inventory.EquipmentSlot;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -36,9 +35,6 @@ import com.tommytony.war.structure.Monument;
|
|||
*/
|
||||
public class WarBlockListener implements Listener {
|
||||
|
||||
/**
|
||||
* @see BlockListener.onBlockPlace()
|
||||
*/
|
||||
@EventHandler
|
||||
public void onBlockPlace(final BlockPlaceEvent event) {
|
||||
if (!War.war.isLoaded()) {
|
||||
|
@ -54,25 +50,10 @@ public class WarBlockListener implements Listener {
|
|||
Team team = Team.getTeamByPlayerName(player.getName());
|
||||
Warzone zone = Warzone.getZoneByLocation(player);
|
||||
// Monument capturing
|
||||
if (team != null && block != null && zone != null
|
||||
&& zone.isMonumentCenterBlock(block)
|
||||
&& team.getKind().isTeamBlock(block.getState())) {
|
||||
if (team != null && zone != null && zone.isMonumentCenterBlock(block) && team.getKind().isTeamBlock(block.getState())) {
|
||||
Monument monument = zone.getMonumentFromCenterBlock(block);
|
||||
if (monument != null && !monument.hasOwner()) {
|
||||
monument.capture(team);
|
||||
if (War.war.isSpoutServer()) {
|
||||
for (Player p : team.getPlayers()) {
|
||||
SpoutPlayer sp = SpoutManager.getPlayer(p);
|
||||
if (sp.isSpoutCraftEnabled()) {
|
||||
sp.sendNotification(
|
||||
SpoutDisplayer.cleanForNotification("Monument " + ChatColor.WHITE + monument.getName()),
|
||||
SpoutDisplayer.cleanForNotification(ChatColor.YELLOW + "capped by " + team.getKind().getColor() + player.getName() + ChatColor.YELLOW + "!"),
|
||||
team.getKind().getMaterial(),
|
||||
team.getKind().getData(),
|
||||
10000);
|
||||
}
|
||||
}
|
||||
}
|
||||
zone.broadcast("zone.monument.capture", monument.getName(), team.getName());
|
||||
event.setCancelled(false);
|
||||
return; // important otherwise cancelled down a few line by isImportantblock
|
||||
|
@ -85,9 +66,7 @@ public class WarBlockListener implements Listener {
|
|||
|
||||
boolean isZoneMaker = War.war.isZoneMaker(player);
|
||||
// prevent build in important parts
|
||||
if (zone != null
|
||||
&& (zone.isImportantBlock(block) || zone.isOpponentSpawnPeripheryBlock(team, block))
|
||||
&& (!isZoneMaker || (isZoneMaker && team != null))) {
|
||||
if (zone != null && (zone.isImportantBlock(block) || zone.isOpponentSpawnPeripheryBlock(team, block)) && (!isZoneMaker || team != null)) {
|
||||
War.war.badMsg(player, "build.denied.location");
|
||||
cancelAndKeepItem(event);
|
||||
return;
|
||||
|
@ -119,37 +98,35 @@ public class WarBlockListener implements Listener {
|
|||
}
|
||||
|
||||
// can't place a block of your team's color
|
||||
if (team != null && block.getType() == team.getKind().getMaterial() && block.getState().getData() == team.getKind().getBlockData()) {
|
||||
if (team != null && block.getType() == team.getKind().getMaterial()) {
|
||||
War.war.badMsg(player, "build.denied.teamblock");
|
||||
cancelAndKeepItem(event);
|
||||
return;
|
||||
}
|
||||
|
||||
// a flag thief can't drop his flag
|
||||
if (team != null && zone != null && zone.isFlagThief(player.getName())) {
|
||||
if (team != null && zone != null && zone.isFlagThief(player)) {
|
||||
War.war.badMsg(player, "drop.flag.disabled");
|
||||
cancelAndKeepItem(event);
|
||||
return;
|
||||
}
|
||||
|
||||
// a bomb thief can't drop his bomb
|
||||
if (team != null && zone != null && zone.isBombThief(player.getName())) {
|
||||
if (team != null && zone != null && zone.isBombThief(player)) {
|
||||
War.war.badMsg(player, "drop.bomb.disabled");
|
||||
cancelAndKeepItem(event);
|
||||
return;
|
||||
}
|
||||
|
||||
// a cake thief can't drop his cake
|
||||
if (team != null && zone != null && zone.isCakeThief(player.getName())) {
|
||||
if (team != null && zone != null && zone.isCakeThief(player)) {
|
||||
War.war.badMsg(player, "drop.cake.disabled");
|
||||
cancelAndKeepItem(event);
|
||||
return;
|
||||
}
|
||||
|
||||
// unbreakableZoneBlocks
|
||||
if (zone != null && (zone.getWarzoneConfig().getBoolean(WarzoneConfig.UNBREAKABLE)
|
||||
|| (team != null && !team.getTeamConfig().resolveBoolean(TeamConfig.PLACEBLOCK)))
|
||||
&& (!isZoneMaker || (isZoneMaker && team != null))) {
|
||||
if (zone != null && (zone.getWarzoneConfig().getBoolean(WarzoneConfig.UNBREAKABLE) || team != null && !team.getTeamConfig().resolveBoolean(TeamConfig.PLACEBLOCK)) && (!isZoneMaker || team != null)) {
|
||||
// if the zone is unbreakable, no one but zone makers can break blocks (even then, zone makers in a team can't break blocks)
|
||||
War.war.badMsg(player, "build.denied.zone.place");
|
||||
cancelAndKeepItem(event);
|
||||
|
@ -166,33 +143,36 @@ public class WarBlockListener implements Listener {
|
|||
private void cancelAndKeepItem(BlockPlaceEvent event) {
|
||||
event.setCancelled(true);
|
||||
ItemStack inHand = event.getItemInHand();
|
||||
ItemStack newItemInHand = null;
|
||||
ItemStack newItemInHand;
|
||||
|
||||
if (inHand.getType() == Material.FIRE) {
|
||||
// Weird bukkit/mc behavior where item in hand is reported as fire while using flint & steel.
|
||||
// Just give the user his f&s back but almost broken (max durability is 8).
|
||||
newItemInHand = new ItemStack(Material.FLINT_AND_STEEL, 1, (short)1);
|
||||
newItemInHand = Compat.createDamagedIS(Material.FLINT_AND_STEEL, 1, 1);
|
||||
} else {
|
||||
newItemInHand = inHand.clone();
|
||||
}
|
||||
|
||||
event.getPlayer().setItemInHand(newItemInHand);
|
||||
if (event.getHand() == EquipmentSlot.OFF_HAND) {
|
||||
event.getPlayer().getInventory().setItemInOffHand(newItemInHand);
|
||||
} else {
|
||||
event.getPlayer().getInventory().setItemInMainHand(newItemInHand);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
// Do not allow moving of block into or from important zones
|
||||
public void onBlockPistonExtend(final BlockPistonExtendEvent event) {
|
||||
Warzone zone = Warzone.getZoneByLocation(event.getBlock().getLocation());
|
||||
if (zone!=null) {
|
||||
if (zone != null) {
|
||||
for (Block b : event.getBlocks()) {
|
||||
if (zone.isImportantBlock(b)) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
//noinspection deprecation
|
||||
if (zone.isImportantBlock(event.getBlock().getRelative(event.getDirection(), event.getLength()+1))) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -209,9 +189,6 @@ public class WarBlockListener implements Listener {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see BlockListener.onBlockBreak()
|
||||
*/
|
||||
@EventHandler
|
||||
public void onBlockBreak(final BlockBreakEvent event) {
|
||||
if (!War.war.isLoaded()) {
|
||||
|
@ -264,19 +241,6 @@ public class WarBlockListener implements Listener {
|
|||
Monument monument = warzone.getMonumentFromCenterBlock(block);
|
||||
if (monument.hasOwner()) {
|
||||
Team ownerTeam = monument.getOwnerTeam();
|
||||
if (War.war.isSpoutServer()) {
|
||||
for (Player p : team.getPlayers()) {
|
||||
SpoutPlayer sp = SpoutManager.getPlayer(p);
|
||||
if (sp.isSpoutCraftEnabled()) {
|
||||
sp.sendNotification(
|
||||
SpoutDisplayer.cleanForNotification("Monument " + ChatColor.WHITE + monument.getName()),
|
||||
SpoutDisplayer.cleanForNotification(ChatColor.YELLOW + "freed by " + team.getKind().getColor() + player.getName() + ChatColor.YELLOW + "!"),
|
||||
ownerTeam.getKind().getMaterial(),
|
||||
ownerTeam.getKind().getData(),
|
||||
10000);
|
||||
}
|
||||
}
|
||||
}
|
||||
warzone.broadcast("zone.monument.lose", ownerTeam.getName(), monument.getName());
|
||||
monument.uncapture();
|
||||
}
|
||||
|
@ -284,9 +248,9 @@ public class WarBlockListener implements Listener {
|
|||
return;
|
||||
}
|
||||
// changes in parts of important areas
|
||||
if (warzone != null && warzone.isImportantBlock(block) && (!isZoneMaker || (isZoneMaker && team != null))) {
|
||||
if (warzone != null && warzone.isImportantBlock(block) && (!isZoneMaker || team != null)) {
|
||||
// breakage of spawn
|
||||
if (team != null && team.isSpawnLocation(block.getLocation())) {
|
||||
if (team.isSpawnLocation(block.getLocation())) {
|
||||
// let team members loot one block the spawn for monument captures
|
||||
if (player.getInventory().containsAtLeast(team.getKind().getBlockHead(), 1)) {
|
||||
War.war.badMsg(player, "build.denied.zone.multteam", team.getName());
|
||||
|
@ -298,11 +262,11 @@ public class WarBlockListener implements Listener {
|
|||
}
|
||||
}
|
||||
// stealing of flag
|
||||
if (team != null && warzone.isEnemyTeamFlagBlock(team, block)) {
|
||||
if (warzone.isFlagThief(player.getName())) {
|
||||
if (warzone.isEnemyTeamFlagBlock(team, block)) {
|
||||
if (warzone.isFlagThief(player)) {
|
||||
// detect audacious thieves
|
||||
War.war.badMsg(player, "zone.stealextra.flag");
|
||||
} else if (warzone.isBombThief(player.getName()) || warzone.isCakeThief(player.getName())) {
|
||||
} else if (warzone.isBombThief(player) || warzone.isCakeThief(player)) {
|
||||
War.war.badMsg(player, "zone.stealextra.other");
|
||||
} else {
|
||||
Team lostFlagTeam = warzone.getTeamForFlagBlock(block);
|
||||
|
@ -311,24 +275,11 @@ public class WarBlockListener implements Listener {
|
|||
ItemStack teamKindBlock = lostFlagTeam.getKind().getBlockHead();
|
||||
player.getInventory().clear();
|
||||
player.getInventory().addItem(teamKindBlock);
|
||||
warzone.addFlagThief(lostFlagTeam, player.getName());
|
||||
warzone.addFlagThief(lostFlagTeam, player);
|
||||
block.setType(Material.AIR);
|
||||
for (Team t : warzone.getTeams()) {
|
||||
t.teamcast("zone.steal.flag.broadcast", team.getKind().getColor() + player.getName() + ChatColor.WHITE, lostFlagTeam.getName());
|
||||
if (t.getName().equals(lostFlagTeam.getName())) {
|
||||
if (War.war.isSpoutServer()) {
|
||||
for (Player p : t.getPlayers()) {
|
||||
SpoutPlayer sp = SpoutManager.getPlayer(p);
|
||||
if (sp.isSpoutCraftEnabled()) {
|
||||
sp.sendNotification(
|
||||
SpoutDisplayer.cleanForNotification(team.getKind().getColor() + player.getName() + ChatColor.YELLOW + " stole"),
|
||||
SpoutDisplayer.cleanForNotification(ChatColor.YELLOW + "your flag!"),
|
||||
lostFlagTeam.getKind().getMaterial(),
|
||||
lostFlagTeam.getKind().getData(),
|
||||
5000);
|
||||
}
|
||||
}
|
||||
}
|
||||
t.teamcast("zone.steal.flag.prevent", team.getKind().getColor() + player.getName() + ChatColor.WHITE, team.getName());
|
||||
}
|
||||
}
|
||||
|
@ -339,11 +290,11 @@ public class WarBlockListener implements Listener {
|
|||
}
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
} else if (team != null && warzone.isBombBlock(block)) {
|
||||
if (warzone.isBombThief(player.getName())) {
|
||||
} else if (warzone.isBombBlock(block)) {
|
||||
if (warzone.isBombThief(player)) {
|
||||
// detect audacious thieves
|
||||
War.war.badMsg(player, "zone.stealextra.bomb");
|
||||
} else if (warzone.isFlagThief(player.getName()) || warzone.isCakeThief(player.getName())) {
|
||||
} else if (warzone.isFlagThief(player) || warzone.isCakeThief(player)) {
|
||||
War.war.badMsg(player, "zone.stealextra.other");
|
||||
} else {
|
||||
Bomb bomb = warzone.getBombForBlock(block);
|
||||
|
@ -352,34 +303,21 @@ public class WarBlockListener implements Listener {
|
|||
tntBlock.setDurability((short)8);
|
||||
player.getInventory().clear();
|
||||
player.getInventory().addItem(tntBlock);
|
||||
warzone.addBombThief(bomb, player.getName());
|
||||
warzone.addBombThief(bomb, player);
|
||||
block.setType(Material.AIR);
|
||||
for (Team t : warzone.getTeams()) {
|
||||
t.teamcast("zone.steal.bomb.broadcast", team.getKind().getColor() + player.getName() + ChatColor.WHITE, ChatColor.GREEN + bomb.getName() + ChatColor.WHITE);
|
||||
if (War.war.isSpoutServer()) {
|
||||
for (Player p : t.getPlayers()) {
|
||||
SpoutPlayer sp = SpoutManager.getPlayer(p);
|
||||
if (sp.isSpoutCraftEnabled()) {
|
||||
sp.sendNotification(
|
||||
SpoutDisplayer.cleanForNotification(team.getKind().getColor() + player.getName() + ChatColor.YELLOW + " has "),
|
||||
SpoutDisplayer.cleanForNotification(ChatColor.YELLOW + "bomb " + ChatColor.GREEN + bomb.getName() + ChatColor.YELLOW + "!"),
|
||||
Material.TNT,
|
||||
(short)0,
|
||||
5000);
|
||||
}
|
||||
}
|
||||
}
|
||||
t.teamcast("zone.steal.bomb.prevent", team.getKind().getColor() + player.getName() + ChatColor.WHITE);
|
||||
}
|
||||
War.war.msg(player, "zone.steal.bomb.notice", bomb.getName());
|
||||
}
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
} else if (team != null && warzone.isCakeBlock(block)) {
|
||||
if (warzone.isCakeThief(player.getName())) {
|
||||
} else if (warzone.isCakeBlock(block)) {
|
||||
if (warzone.isCakeThief(player)) {
|
||||
// detect audacious thieves
|
||||
War.war.badMsg(player, "zone.stealextra.cake");
|
||||
} else if (warzone.isFlagThief(player.getName()) || warzone.isBombThief(player.getName())) {
|
||||
} else if (warzone.isFlagThief(player) || warzone.isBombThief(player)) {
|
||||
War.war.badMsg(player, "zone.stealextra.other");
|
||||
} else {
|
||||
Cake cake = warzone.getCakeForBlock(block);
|
||||
|
@ -388,23 +326,10 @@ public class WarBlockListener implements Listener {
|
|||
cakeBlock.setDurability((short)8);
|
||||
player.getInventory().clear();
|
||||
player.getInventory().addItem(cakeBlock);
|
||||
warzone.addCakeThief(cake, player.getName());
|
||||
warzone.addCakeThief(cake, player);
|
||||
block.setType(Material.AIR);
|
||||
for (Team t : warzone.getTeams()) {
|
||||
t.teamcast("zone.steal.cake.broadcast", team.getKind().getColor() + player.getName() + ChatColor.WHITE, ChatColor.GREEN + cake.getName() + ChatColor.WHITE);
|
||||
if (War.war.isSpoutServer()) {
|
||||
for (Player p : t.getPlayers()) {
|
||||
SpoutPlayer sp = SpoutManager.getPlayer(p);
|
||||
if (sp.isSpoutCraftEnabled()) {
|
||||
sp.sendNotification(
|
||||
SpoutDisplayer.cleanForNotification(team.getKind().getColor() + player.getName() + ChatColor.YELLOW + " has "),
|
||||
SpoutDisplayer.cleanForNotification(ChatColor.YELLOW + "cake " + ChatColor.GREEN + cake.getName() + ChatColor.YELLOW + "!"),
|
||||
Material.CAKE,
|
||||
(short)0,
|
||||
5000);
|
||||
}
|
||||
}
|
||||
}
|
||||
t.teamcast("zone.steal.cake.prevent", team.getKind().getColor() + player.getName() + ChatColor.WHITE);
|
||||
}
|
||||
War.war.msg(player, "zone.steal.cake.notice", cake.getName());
|
||||
|
@ -460,4 +385,23 @@ public class WarBlockListener implements Listener {
|
|||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void onStructureGrowth(final StructureGrowEvent event) {
|
||||
Warzone zone = Warzone.getZoneByLocation(event.getLocation());
|
||||
if (zone != null) {
|
||||
List<BlockState> canceledBlocks = new ArrayList<BlockState>();
|
||||
for (BlockState state : event.getBlocks()) {
|
||||
if (!zone.getVolume().contains(state.getLocation())
|
||||
|| zone.isImportantBlock(state.getBlock())) {
|
||||
canceledBlocks.add(state);
|
||||
}
|
||||
}
|
||||
for (BlockState state : canceledBlocks) {
|
||||
event.getBlocks().remove(state);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -2,35 +2,31 @@ package com.tommytony.war.event;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.logging.Level;
|
||||
import java.text.MessageFormat;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.entity.Arrow;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Projectile;
|
||||
import org.bukkit.entity.TNTPrimed;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.entity.CreatureSpawnEvent;
|
||||
import org.bukkit.event.entity.EntityCombustEvent;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.event.entity.EntityDeathEvent;
|
||||
import org.bukkit.event.entity.EntityExplodeEvent;
|
||||
import org.bukkit.event.entity.EntityRegainHealthEvent;
|
||||
import org.bukkit.event.entity.*;
|
||||
import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason;
|
||||
import org.bukkit.event.entity.ExplosionPrimeEvent;
|
||||
import org.bukkit.event.entity.FoodLevelChangeEvent;
|
||||
import org.getspout.spoutapi.SpoutManager;
|
||||
import org.getspout.spoutapi.player.SpoutPlayer;
|
||||
import org.bukkit.event.hanging.HangingPlaceEvent;
|
||||
import org.bukkit.event.hanging.HangingBreakByEntityEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.metadata.FixedMetadataValue;
|
||||
import org.bukkit.projectiles.ProjectileSource;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import com.tommytony.war.Team;
|
||||
import com.tommytony.war.War;
|
||||
|
@ -39,15 +35,8 @@ import com.tommytony.war.config.TeamConfig;
|
|||
import com.tommytony.war.config.WarConfig;
|
||||
import com.tommytony.war.config.WarzoneConfig;
|
||||
import com.tommytony.war.job.DeferredBlockResetsJob;
|
||||
import com.tommytony.war.spout.SpoutDisplayer;
|
||||
import com.tommytony.war.structure.Bomb;
|
||||
import com.tommytony.war.utility.LoadoutSelection;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.event.entity.ProjectileHitEvent;
|
||||
import org.bukkit.event.entity.ProjectileLaunchEvent;
|
||||
import org.bukkit.metadata.FixedMetadataValue;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
/**
|
||||
* Handles Entity-Events
|
||||
|
@ -57,8 +46,6 @@ import org.bukkit.util.Vector;
|
|||
*/
|
||||
public class WarEntityListener implements Listener {
|
||||
|
||||
private final Random killSeed = new Random();
|
||||
|
||||
/**
|
||||
* Handles PVP-Damage
|
||||
*
|
||||
|
@ -68,7 +55,7 @@ public class WarEntityListener implements Listener {
|
|||
private void handlerAttackDefend(EntityDamageByEntityEvent event) {
|
||||
Entity attacker = event.getDamager();
|
||||
Entity defender = event.getEntity();
|
||||
|
||||
|
||||
// Maybe an arrow was thrown
|
||||
if (attacker != null && event.getDamager() instanceof Projectile && ((Projectile)event.getDamager()).getShooter() instanceof Player){
|
||||
attacker = ((Player)((Projectile)event.getDamager()).getShooter());
|
||||
|
@ -82,24 +69,24 @@ public class WarEntityListener implements Listener {
|
|||
Team attackerTeam = Team.getTeamByPlayerName(a.getName());
|
||||
Warzone defenderWarzone = Warzone.getZoneByPlayerName(d.getName());
|
||||
Team defenderTeam = Team.getTeamByPlayerName(d.getName());
|
||||
|
||||
|
||||
if ((attackerTeam != null && defenderTeam != null && attackerTeam != defenderTeam && attackerWarzone == defenderWarzone)
|
||||
|| (attackerTeam != null && defenderTeam != null && attacker.getEntityId() == defender.getEntityId())) {
|
||||
|
||||
|
||||
LoadoutSelection defenderLoadoutState = defenderWarzone.getLoadoutSelections().get(d.getName());
|
||||
if (defenderLoadoutState != null && defenderLoadoutState.isStillInSpawn()) {
|
||||
War.war.badMsg(a, "pvp.target.spawn");
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
LoadoutSelection attackerLoadoutState = attackerWarzone.getLoadoutSelections().get(a.getName());
|
||||
if (attackerLoadoutState != null && attackerLoadoutState.isStillInSpawn()) {
|
||||
War.war.badMsg(a, "pvp.self.spawn");
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Make sure none of them are locked in by respawn timer
|
||||
if (defenderWarzone.isRespawning(d)) {
|
||||
War.war.badMsg(a, "pvp.target.respawn");
|
||||
|
@ -109,8 +96,14 @@ public class WarEntityListener implements Listener {
|
|||
War.war.badMsg(a, "pvp.self.respawn");
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if(!defenderWarzone.getPvpReady()) {
|
||||
//if the timer is still tickin we gotta handle defense! (there be notchz in virgina)
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!attackerWarzone.getWarzoneConfig().getBoolean(WarzoneConfig.PVPINZONE)) {
|
||||
// spleef-like, non-pvp, zone
|
||||
event.setCancelled(true);
|
||||
|
@ -120,78 +113,35 @@ public class WarEntityListener implements Listener {
|
|||
// Detect death, prevent it and respawn the player
|
||||
if (event.getDamage() >= d.getHealth()) {
|
||||
if (defenderWarzone.getReallyDeadFighters().contains(d.getName())) {
|
||||
// don't re-kill a dead person
|
||||
if (d.getHealth() != 0) {
|
||||
d.setHealth(0);
|
||||
}
|
||||
|
||||
// don't re-kill a dead person
|
||||
return;
|
||||
}
|
||||
|
||||
if (attackerWarzone.getWarzoneConfig().getBoolean(WarzoneConfig.DEATHMESSAGES)) {
|
||||
String attackerString = attackerTeam.getKind().getColor() + a.getName();
|
||||
String defenderString = defenderTeam.getKind().getColor() + d.getName();
|
||||
if (attacker.getEntityId() != defender.getEntityId()) {
|
||||
Material killerWeapon = a.getItemInHand().getType();
|
||||
String weaponString = killerWeapon.toString();
|
||||
if (a.getItemInHand().hasItemMeta() && a.getItemInHand().getItemMeta().hasDisplayName()) {
|
||||
weaponString = a.getItemInHand().getItemMeta().getDisplayName() + ChatColor.WHITE;
|
||||
}
|
||||
if (killerWeapon == Material.AIR) {
|
||||
weaponString = War.war.getString("pvp.kill.weapon.hand");
|
||||
} else if (killerWeapon == Material.BOW || event.getDamager() instanceof Arrow) {
|
||||
int rand = killSeed.nextInt(3);
|
||||
if (rand == 0) {
|
||||
weaponString = War.war.getString("pvp.kill.weapon.bow");
|
||||
} else {
|
||||
weaponString = War.war.getString("pvp.kill.weapon.aim");
|
||||
}
|
||||
} else if (event.getDamager() instanceof Projectile) {
|
||||
weaponString = War.war.getString("pvp.kill.weapon.aim");
|
||||
}
|
||||
String adjectiveString = War.war.getDeadlyAdjectives().isEmpty() ? "" : War.war.getDeadlyAdjectives().get(this.killSeed.nextInt(War.war.getDeadlyAdjectives().size()));
|
||||
String verbString = War.war.getKillerVerbs().isEmpty() ? "" : War.war.getKillerVerbs().get(this.killSeed.nextInt(War.war.getKillerVerbs().size()));
|
||||
defenderWarzone.broadcast("pvp.kill.format", attackerString + ChatColor.WHITE, adjectiveString,
|
||||
weaponString.toLowerCase().replace('_', ' '), verbString, defenderString);
|
||||
} else {
|
||||
defenderWarzone.broadcast("pvp.kill.self", defenderString + ChatColor.WHITE);
|
||||
}
|
||||
}
|
||||
if (attacker.getEntityId() != defender.getEntityId()) {
|
||||
defenderWarzone.addKillCount(a.getName(), 1);
|
||||
defenderWarzone.addKillDeathRecord(a, 1, 0);
|
||||
defenderWarzone.addKillDeathRecord(d, 0, 1);
|
||||
if (attackerTeam.getTeamConfig().resolveBoolean(TeamConfig.XPKILLMETER)) {
|
||||
a.setLevel(defenderWarzone.getKillCount(a.getName()));
|
||||
}
|
||||
if (attackerTeam.getTeamConfig().resolveBoolean(TeamConfig.KILLSTREAK)) {
|
||||
War.war.getKillstreakReward().rewardPlayer(a, defenderWarzone.getKillCount(a.getName()));
|
||||
}
|
||||
}
|
||||
WarPlayerDeathEvent event1 = new WarPlayerDeathEvent(defenderWarzone, d, a, event.getCause());
|
||||
War.war.getServer().getPluginManager().callEvent(event1);
|
||||
defenderWarzone.handleDeath(d);
|
||||
if (!defenderWarzone.getWarzoneConfig().getBoolean(WarzoneConfig.REALDEATHS)) {
|
||||
// fast respawn, don't really die
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
} else if (defenderWarzone.isBombThief(d.getName()) && d.getLocation().distance(a.getLocation()) < 2) {
|
||||
// Close combat, close enough to detonate
|
||||
Bomb bomb = defenderWarzone.getBombForThief(d.getName());
|
||||
|
||||
// Kill the bomber
|
||||
if (d == a) {
|
||||
defenderWarzone.handleSuicide(d);
|
||||
} else {
|
||||
defenderWarzone.handleKill(a, d, event.getDamager());
|
||||
}
|
||||
} else if (defenderWarzone.isBombThief(d) && d.getLocation().distance(a.getLocation()) < 2) {
|
||||
// Close combat, close enough to detonate
|
||||
Bomb bomb = defenderWarzone.getBombForThief(d);
|
||||
|
||||
// Kill the bomber
|
||||
WarPlayerDeathEvent event1 = new WarPlayerDeathEvent(defenderWarzone, d, null, event.getCause());
|
||||
War.war.getServer().getPluginManager().callEvent(event1);
|
||||
defenderWarzone.handleDeath(d);
|
||||
|
||||
|
||||
if (defenderWarzone.getWarzoneConfig().getBoolean(WarzoneConfig.REALDEATHS)) {
|
||||
// and respawn him and remove from deadmen (cause realdeath + handleDeath means no respawn and getting queued up for onPlayerRespawn)
|
||||
defenderWarzone.getReallyDeadFighters().remove(d.getName());
|
||||
defenderWarzone.respawnPlayer(defenderTeam, d);
|
||||
}
|
||||
|
||||
|
||||
// Blow up bomb
|
||||
if (!defenderWarzone.getWarzoneConfig().getBoolean(WarzoneConfig.UNBREAKABLE)) {
|
||||
defenderWarzone.getWorld().createExplosion(a.getLocation(), 2F);
|
||||
|
@ -200,27 +150,14 @@ public class WarEntityListener implements Listener {
|
|||
// bring back tnt
|
||||
bomb.getVolume().resetBlocks();
|
||||
bomb.addBombBlocks();
|
||||
|
||||
|
||||
// Notify everyone
|
||||
for (Team t : defenderWarzone.getTeams()) {
|
||||
if (War.war.isSpoutServer()) {
|
||||
for (Player p : t.getPlayers()) {
|
||||
SpoutPlayer sp = SpoutManager.getPlayer(p);
|
||||
if (sp.isSpoutCraftEnabled()) {
|
||||
sp.sendNotification(
|
||||
SpoutDisplayer.cleanForNotification(attackerTeam.getKind().getColor() + a.getName() + ChatColor.YELLOW + " made "),
|
||||
SpoutDisplayer.cleanForNotification(defenderTeam.getKind().getColor() + d.getName() + ChatColor.YELLOW + " blow up!"),
|
||||
Material.TNT,
|
||||
(short)0,
|
||||
10000);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
t.sendAchievement(attackerTeam.getKind().getColor() + a.getName() + ChatColor.YELLOW + " made ",
|
||||
defenderTeam.getKind().getColor() + d.getName() + ChatColor.YELLOW + " blow up!", new ItemStack(Material.TNT), 10000);
|
||||
t.teamcast("pvp.kill.bomb", attackerTeam.getKind().getColor() + a.getName() + ChatColor.WHITE,
|
||||
defenderTeam.getKind().getColor() + d.getName() + ChatColor.WHITE);
|
||||
}
|
||||
|
||||
}
|
||||
} else if (attackerTeam != null && defenderTeam != null && attackerTeam == defenderTeam && attackerWarzone == defenderWarzone && attacker.getEntityId() != defender.getEntityId()) {
|
||||
// same team, but not same person
|
||||
|
@ -236,7 +173,7 @@ public class WarEntityListener implements Listener {
|
|||
if (!War.war.getWarConfig().getBoolean(WarConfig.DISABLEPVPMESSAGE)) {
|
||||
War.war.badMsg(a, "pvp.outside.permission");
|
||||
}
|
||||
|
||||
|
||||
event.setCancelled(true); // global pvp is off
|
||||
} else {
|
||||
if (attackerTeam == null) {
|
||||
|
@ -265,31 +202,17 @@ public class WarEntityListener implements Listener {
|
|||
return;
|
||||
}
|
||||
if (defenderWarzone.getReallyDeadFighters().contains(d.getName())) {
|
||||
// don't re-kill a dead person
|
||||
if (d.getHealth() != 0) {
|
||||
d.setHealth(0);
|
||||
}
|
||||
|
||||
// don't re-kill a dead person
|
||||
return;
|
||||
}
|
||||
|
||||
if (defenderWarzone.getWarzoneConfig().getBoolean(WarzoneConfig.DEATHMESSAGES)) {
|
||||
String defenderString = Team.getTeamByPlayerName(d.getName()).getKind().getColor() + d.getName();
|
||||
if (event.getDamager() instanceof TNTPrimed) {
|
||||
defenderWarzone.broadcast("pvp.death.explosion", defenderString + ChatColor.WHITE);
|
||||
} else {
|
||||
defenderWarzone.broadcast("pvp.death.other", defenderString + ChatColor.WHITE);
|
||||
}
|
||||
}
|
||||
|
||||
WarPlayerDeathEvent event1 = new WarPlayerDeathEvent(defenderWarzone, d, null, event.getCause());
|
||||
War.war.getServer().getPluginManager().callEvent(event1);
|
||||
defenderWarzone.handleDeath(d);
|
||||
|
||||
if (!defenderWarzone.getWarzoneConfig().getBoolean(WarzoneConfig.REALDEATHS)) {
|
||||
// fast respawn, don't really die
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
defenderWarzone.handleNaturalKill(d, event);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -307,15 +230,15 @@ public class WarEntityListener implements Listener {
|
|||
// protect zones elements, lobbies and warhub from creepers and tnt
|
||||
List<Block> explodedBlocks = event.blockList();
|
||||
List<Block> dontExplode = new ArrayList<Block>();
|
||||
|
||||
|
||||
boolean explosionInAWarzone = event.getEntity() != null && Warzone.getZoneByLocation(event.getEntity().getLocation()) != null;
|
||||
|
||||
|
||||
if (!explosionInAWarzone && War.war.getWarConfig().getBoolean(WarConfig.TNTINZONESONLY) && event.getEntity() instanceof TNTPrimed) {
|
||||
// if tntinzonesonly:true, no tnt blows up outside zones
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
for (Block block : explodedBlocks) {
|
||||
if (block.getType() == Material.TNT) {
|
||||
continue; // don't restore TNT (failed to track down regression cause)
|
||||
|
@ -346,28 +269,28 @@ public class WarEntityListener implements Listener {
|
|||
inOneZone = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!inOneZone && explosionInAWarzone) {
|
||||
// if the explosion originated in warzone, always rollback
|
||||
dontExplode.add(block);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int dontExplodeSize = dontExplode.size();
|
||||
if (dontExplode.size() > 0) {
|
||||
// Reset the exploded blocks that shouldn't have exploded (some of these are zone artifacts, if rollbackexplosion some may be outside-of-zone blocks
|
||||
// Reset the exploded blocks that shouldn't have exploded (some of these are zone artifacts, if rollbackexplosion some may be outside-of-zone blocks
|
||||
DeferredBlockResetsJob job = new DeferredBlockResetsJob();
|
||||
for (Block dont : dontExplode) {
|
||||
job.add(dont.getState());
|
||||
}
|
||||
War.war.getServer().getScheduler().scheduleSyncDelayedTask(War.war, job);
|
||||
|
||||
// Changed explosion yield following proportion of explosion prevention (makes drops less buggy too)
|
||||
|
||||
// Changed explosion yield following proportion of explosion prevention (makes drops less buggy too)
|
||||
int explodedSize = explodedBlocks.size();
|
||||
float middleYeild = (float)(explodedSize - dontExplodeSize) / (float)explodedSize;
|
||||
float newYeild = middleYeild * event.getYield();
|
||||
|
||||
|
||||
event.setYield(newYeild);
|
||||
}
|
||||
}
|
||||
|
@ -380,14 +303,14 @@ public class WarEntityListener implements Listener {
|
|||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onEntityDamage(final EntityDamageEvent event) {
|
||||
|
||||
|
||||
if (!War.war.isLoaded()) {
|
||||
|
||||
if (!War.war.isLoaded()) {
|
||||
return;
|
||||
}
|
||||
|
||||
Entity entity = event.getEntity();
|
||||
if (!(entity instanceof Player)) {
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
Player player = (Player) entity;
|
||||
|
@ -399,84 +322,36 @@ public class WarEntityListener implements Listener {
|
|||
}
|
||||
|
||||
// pass pvp-damage
|
||||
if (event instanceof EntityDamageByEntityEvent) {
|
||||
if (event instanceof EntityDamageByEntityEvent) {
|
||||
this.handlerAttackDefend((EntityDamageByEntityEvent) event);
|
||||
} else {
|
||||
Team team = Team.getTeamByPlayerName(player.getName());
|
||||
|
||||
|
||||
if (zone != null && team != null) {
|
||||
LoadoutSelection playerLoadoutState = zone.getLoadoutSelections().get(player.getName());
|
||||
LoadoutSelection playerLoadoutState = zone.getLoadoutSelections().get(player.getName());
|
||||
if (team.isSpawnLocation(player.getLocation())
|
||||
&& playerLoadoutState != null && playerLoadoutState.isStillInSpawn()) {
|
||||
// don't let a player still in spawn get damaged
|
||||
event.setCancelled(true);
|
||||
} else if (event.getDamage() >= player.getHealth()) {
|
||||
if (zone.getReallyDeadFighters().contains(player.getName())) {
|
||||
// don't re-count the death points of an already dead person, make sure they are dead though
|
||||
// (reason for this is that onEntityDamage sometimes fires more than once for one death)
|
||||
if (player.getHealth() != 0) {
|
||||
player.setHealth(0);
|
||||
}
|
||||
// don't re-count the death points of an already dead person
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Detect death, prevent it and respawn the player
|
||||
if (zone.getWarzoneConfig().getBoolean(WarzoneConfig.DEATHMESSAGES)) {
|
||||
String playerName = Team.getTeamByPlayerName(player.getName()).getKind().getColor() + player.getName() + ChatColor.WHITE;
|
||||
if (event.getCause() == DamageCause.FIRE || event.getCause() == DamageCause.FIRE_TICK
|
||||
|| event.getCause() == DamageCause.LAVA || event.getCause() == DamageCause.LIGHTNING) {
|
||||
zone.broadcast("pvp.death.fire", playerName);
|
||||
} else if (event.getCause() == DamageCause.DROWNING) {
|
||||
zone.broadcast("pvp.death.drown", playerName);
|
||||
} else if (event.getCause() == DamageCause.FALL) {
|
||||
zone.broadcast("pvp.death.fall", playerName);
|
||||
} else {
|
||||
zone.broadcast("pvp.death.other", playerName);
|
||||
}
|
||||
}
|
||||
WarPlayerDeathEvent event1 = new WarPlayerDeathEvent(zone, player, null, event.getCause());
|
||||
War.war.getServer().getPluginManager().callEvent(event1);
|
||||
zone.handleDeath(player);
|
||||
|
||||
if (!zone.getWarzoneConfig().getBoolean(WarzoneConfig.REALDEATHS)) {
|
||||
// fast respawn, don't really die
|
||||
event.setCancelled(true);
|
||||
}
|
||||
zone.handleNaturalKill(player, event);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onEntityCombust(final EntityCombustEvent event) {
|
||||
if (!War.war.isLoaded()) {
|
||||
return;
|
||||
}
|
||||
|
||||
Entity entity = event.getEntity();
|
||||
if (entity instanceof Player) {
|
||||
Player player = (Player) entity;
|
||||
Team team = Team.getTeamByPlayerName(player.getName());
|
||||
Warzone zone = Warzone.getZoneByPlayerName(player.getName());
|
||||
LoadoutSelection playerLoadoutState = null;
|
||||
|
||||
if (zone != null) {
|
||||
playerLoadoutState = zone.getLoadoutSelections().get(player.getName());
|
||||
}
|
||||
|
||||
if (team != null
|
||||
&& zone != null
|
||||
&& team.isSpawnLocation(player.getLocation())
|
||||
&& playerLoadoutState != null
|
||||
&& playerLoadoutState.isStillInSpawn()) {
|
||||
// smother out the fire that didn't burn out when you respawned
|
||||
// Stop fire (but not if you came back to spawn after leaving it a first time)
|
||||
player.setFireTicks(0);
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Prevents creatures from spawning in warzones if no creatures is active
|
||||
*
|
||||
|
@ -502,10 +377,7 @@ public class WarEntityListener implements Listener {
|
|||
*/
|
||||
@EventHandler
|
||||
public void onEntityRegainHealth(final EntityRegainHealthEvent event) {
|
||||
if (!War.war.isLoaded() ||
|
||||
(event.getRegainReason() != RegainReason.REGEN
|
||||
&& event.getRegainReason() != RegainReason.EATING
|
||||
&& event.getRegainReason() != RegainReason.SATIATED)) {
|
||||
if (!War.war.isLoaded()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -518,8 +390,7 @@ public class WarEntityListener implements Listener {
|
|||
Warzone zone = Warzone.getZoneByPlayerName(player.getName());
|
||||
if (zone != null) {
|
||||
Team team = Team.getTeamByPlayerName(player.getName());
|
||||
if ((event.getRegainReason() == RegainReason.EATING
|
||||
|| event.getRegainReason() != RegainReason.SATIATED )
|
||||
if (event.getRegainReason() == RegainReason.SATIATED
|
||||
&& team.getTeamConfig().resolveBoolean(TeamConfig.NOHUNGER)) {
|
||||
// noHunger setting means you can't auto-heal with full hunger bar (use saturation instead to control how fast you get hungry)
|
||||
event.setCancelled(true);
|
||||
|
@ -529,13 +400,13 @@ public class WarEntityListener implements Listener {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@EventHandler
|
||||
public void onFoodLevelChange(final FoodLevelChangeEvent event) {
|
||||
if (!War.war.isLoaded() || !(event.getEntity() instanceof Player)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Player player = (Player) event.getEntity();
|
||||
Warzone zone = Warzone.getZoneByPlayerName(player.getName());
|
||||
Team team = Team.getTeamByPlayerName(player.getName());
|
||||
|
@ -543,14 +414,10 @@ public class WarEntityListener implements Listener {
|
|||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onEntityDeath(final EntityDeathEvent event) {
|
||||
if (!War.war.isLoaded() || !(event.getEntity() instanceof Player)) {
|
||||
return;
|
||||
}
|
||||
|
||||
Player player = (Player) event.getEntity();
|
||||
public void onPlayerDeath(final PlayerDeathEvent event) {
|
||||
Player player = event.getEntity();
|
||||
Warzone zone = Warzone.getZoneByPlayerName(player.getName());
|
||||
if (zone != null) {
|
||||
event.getDrops().clear();
|
||||
|
@ -561,18 +428,21 @@ public class WarEntityListener implements Listener {
|
|||
if (zone.getWarzoneConfig().getBoolean(WarzoneConfig.DEATHMESSAGES)) {
|
||||
zone.broadcast("pvp.death.other", team.getKind().getColor() + player.getName());
|
||||
}
|
||||
War.war.getLogger().log(Level.WARNING, "We missed the death of player {0} - something went wrong.", player.getName());
|
||||
} else {
|
||||
event.setDeathMessage("");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@EventHandler
|
||||
public void onExplosionPrime(final ExplosionPrimeEvent event) {
|
||||
if (!War.war.isLoaded()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Location eventLocation = event.getEntity().getLocation();
|
||||
|
||||
|
||||
for (Warzone zone : War.war.getWarzones()) {
|
||||
if (zone.isBombBlock(eventLocation.getBlock())) {
|
||||
// prevent the Bomb from exploding on its pedestral
|
||||
|
@ -610,7 +480,7 @@ public class WarEntityListener implements Listener {
|
|||
return;
|
||||
}
|
||||
if (event.getEntityType() == EntityType.EGG) {
|
||||
LivingEntity shooter = event.getEntity().getShooter();
|
||||
ProjectileSource shooter = event.getEntity().getShooter();
|
||||
if (shooter instanceof Player) {
|
||||
Player player = (Player) shooter;
|
||||
Warzone zone = Warzone.getZoneByPlayerName(player.getName());
|
||||
|
@ -625,4 +495,57 @@ public class WarEntityListener implements Listener {
|
|||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPaintingBreakByEntity(final HangingBreakByEntityEvent event) {
|
||||
if (!War.war.isLoaded()) {
|
||||
return;
|
||||
}
|
||||
if (!(event.getRemover() instanceof Player)) {
|
||||
return;
|
||||
}
|
||||
Player player = (Player) event.getRemover();
|
||||
Warzone zone = Warzone.getZoneByLocation(event.getEntity().getLocation());
|
||||
Team team = Team.getTeamByPlayerName(player.getName());
|
||||
boolean isZoneMaker = War.war.isZoneMaker(player);
|
||||
if (team == null && isZoneMaker) {
|
||||
return;
|
||||
}
|
||||
if (zone != null && zone.getWarzoneConfig().getBoolean(WarzoneConfig.UNBREAKABLE)) {
|
||||
event.setCancelled(true);
|
||||
War.war.badMsg(player, "build.denied.zone.break");
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPaintingPlaceByEntity(final HangingPlaceEvent event) {
|
||||
if (!War.war.isLoaded()) {
|
||||
return;
|
||||
}
|
||||
Player player = event.getPlayer();
|
||||
Warzone zone = Warzone.getZoneByLocation(event.getBlock().getLocation());
|
||||
Team team = Team.getTeamByPlayerName(player.getName());
|
||||
boolean isZoneMaker = War.war.isZoneMaker(player);
|
||||
if (team == null && isZoneMaker) {
|
||||
return;
|
||||
}
|
||||
if (zone != null && (zone.getWarzoneConfig().getBoolean(WarzoneConfig.UNBREAKABLE)
|
||||
|| (team != null && !team.getTeamConfig().resolveBoolean(TeamConfig.PLACEBLOCK)))) {
|
||||
event.setCancelled(true);
|
||||
War.war.badMsg(player, "build.denied.zone.place");
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onEntityTeleport(final EntityTeleportEvent event) {
|
||||
if (!War.war.isLoaded()) {
|
||||
return;
|
||||
}
|
||||
if (event.getEntityType() == EntityType.WOLF) {
|
||||
if (Warzone.getZoneByLocation(event.getTo()) != null) {
|
||||
// prevent wolves from teleporting to players in zones
|
||||
event.setCancelled(true);
|
||||
event.setTo(event.getFrom());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,13 +1,24 @@
|
|||
package com.tommytony.war.event;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Effect;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import com.tommytony.war.Team;
|
||||
import com.tommytony.war.War;
|
||||
import com.tommytony.war.Warzone;
|
||||
import com.tommytony.war.Warzone.LeaveCause;
|
||||
import com.tommytony.war.command.ZoneSetter;
|
||||
import com.tommytony.war.config.FlagReturn;
|
||||
import com.tommytony.war.config.TeamConfig;
|
||||
import com.tommytony.war.config.WarConfig;
|
||||
import com.tommytony.war.config.WarzoneConfig;
|
||||
import com.tommytony.war.structure.Bomb;
|
||||
import com.tommytony.war.structure.Cake;
|
||||
import com.tommytony.war.structure.WarHub;
|
||||
import com.tommytony.war.structure.ZoneLobby;
|
||||
import com.tommytony.war.utility.Direction;
|
||||
import com.tommytony.war.utility.Loadout;
|
||||
import com.tommytony.war.utility.LoadoutSelection;
|
||||
import com.tommytony.war.volume.Volume;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.block.Sign;
|
||||
import org.bukkit.entity.Item;
|
||||
|
@ -17,33 +28,17 @@ import org.bukkit.event.EventHandler;
|
|||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.block.Action;
|
||||
import org.bukkit.event.entity.EntityPickupItemEvent;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.event.inventory.InventoryType;
|
||||
import org.bukkit.event.player.*;
|
||||
import org.bukkit.inventory.InventoryHolder;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.getspout.spoutapi.SpoutManager;
|
||||
import org.getspout.spoutapi.player.SpoutPlayer;
|
||||
|
||||
import com.tommytony.war.Team;
|
||||
import com.tommytony.war.War;
|
||||
import com.tommytony.war.Warzone;
|
||||
import com.tommytony.war.Warzone.LeaveCause;
|
||||
import com.tommytony.war.command.ZoneSetter;
|
||||
import com.tommytony.war.config.FlagReturn;
|
||||
import com.tommytony.war.config.TeamConfig;
|
||||
import com.tommytony.war.config.WarzoneConfig;
|
||||
import com.tommytony.war.spout.SpoutDisplayer;
|
||||
import com.tommytony.war.structure.Bomb;
|
||||
import com.tommytony.war.structure.Cake;
|
||||
import com.tommytony.war.structure.WarHub;
|
||||
import com.tommytony.war.structure.ZoneLobby;
|
||||
import com.tommytony.war.utility.Direction;
|
||||
import com.tommytony.war.utility.Loadout;
|
||||
import com.tommytony.war.utility.LoadoutSelection;
|
||||
import com.tommytony.war.volume.Volume;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
|
||||
/**
|
||||
|
@ -51,7 +46,7 @@ import java.util.logging.Level;
|
|||
*/
|
||||
public class WarPlayerListener implements Listener {
|
||||
private java.util.Random random = new java.util.Random();
|
||||
private HashMap<String, Location> latestLocations = new HashMap<String, Location>();
|
||||
private HashMap<String, Location> latestLocations = new HashMap<String, Location>();
|
||||
|
||||
/**
|
||||
* Correctly removes quitting players from warzones
|
||||
|
@ -73,6 +68,34 @@ public class WarPlayerListener implements Listener {
|
|||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
||||
public void onPlayerJoin(final PlayerJoinEvent event) {
|
||||
String autojoinName = War.war.getWarConfig().getString(WarConfig.AUTOJOIN);
|
||||
boolean autojoinEnabled = !autojoinName.isEmpty();
|
||||
if (autojoinEnabled) { // Won't be able to find warzone if unset
|
||||
Warzone autojoinWarzone = Warzone.getZoneByNameExact(autojoinName);
|
||||
if (autojoinWarzone == null) {
|
||||
War.war.getLogger().log(Level.WARNING, "Failed to find autojoin warzone ''{0}''.", new Object[] {autojoinName});
|
||||
return;
|
||||
}
|
||||
if (autojoinWarzone.getWarzoneConfig().getBoolean(WarzoneConfig.DISABLED) || autojoinWarzone.isReinitializing()) {
|
||||
War.war.badMsg(event.getPlayer(), "join.disabled");
|
||||
event.getPlayer().teleport(autojoinWarzone.getTeleport());
|
||||
} else if (!autojoinWarzone.getWarzoneConfig().getBoolean(WarzoneConfig.JOINMIDBATTLE) && autojoinWarzone.isEnoughPlayers()) {
|
||||
War.war.badMsg(event.getPlayer(), "join.progress");
|
||||
event.getPlayer().teleport(autojoinWarzone.getTeleport());
|
||||
} else if (autojoinWarzone.isFull()) {
|
||||
War.war.badMsg(event.getPlayer(), "join.full.all");
|
||||
event.getPlayer().teleport(autojoinWarzone.getTeleport());
|
||||
} else if (autojoinWarzone.isFull(event.getPlayer())) {
|
||||
War.war.badMsg(event.getPlayer(), "join.permission.all");
|
||||
event.getPlayer().teleport(autojoinWarzone.getTeleport());
|
||||
} else { // Player will only ever be autoassigned to a team
|
||||
autojoinWarzone.autoAssign(event.getPlayer());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerDropItem(final PlayerDropItemEvent event) {
|
||||
if (War.war.isLoaded()) {
|
||||
|
@ -81,15 +104,15 @@ public class WarPlayerListener implements Listener {
|
|||
if (team != null) {
|
||||
Warzone zone = Warzone.getZoneByPlayerName(player.getName());
|
||||
|
||||
if (zone.isFlagThief(player.getName())) {
|
||||
if (zone.isFlagThief(player)) {
|
||||
// a flag thief can't drop his flag
|
||||
War.war.badMsg(player, "drop.flag.disabled");
|
||||
event.setCancelled(true);
|
||||
} else if (zone.isBombThief(player.getName())) {
|
||||
} else if (zone.isBombThief(player)) {
|
||||
// a bomb thief can't drop his bomb
|
||||
War.war.badMsg(player, "drop.bomb.disabled");
|
||||
event.setCancelled(true);
|
||||
} else if (zone.isCakeThief(player.getName())) {
|
||||
} else if (zone.isCakeThief(player)) {
|
||||
// a cake thief can't drop his cake
|
||||
War.war.badMsg(player, "drop.cake.disabled");
|
||||
event.setCancelled(true);
|
||||
|
@ -107,7 +130,8 @@ public class WarPlayerListener implements Listener {
|
|||
return;
|
||||
}
|
||||
|
||||
if (zone.isNearWall(player.getLocation()) && itemStack != null) {
|
||||
if (zone.isNearWall(player.getLocation()) && itemStack != null
|
||||
&& !team.getTeamConfig().resolveBoolean(TeamConfig.BORDERDROP)) {
|
||||
War.war.badMsg(player, "drop.item.border");
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
|
@ -126,7 +150,7 @@ public class WarPlayerListener implements Listener {
|
|||
|
||||
if (War.war.isWandBearer(player)) {
|
||||
Item item = event.getItemDrop();
|
||||
if (item.getItemStack().getType() == Material.WOOD_SWORD) {
|
||||
if (item.getItemStack().getType() == Material.WOODEN_SWORD) {
|
||||
String zoneName = War.war.getWandBearerZone(player);
|
||||
War.war.removeWandBearer(player);
|
||||
War.war.msg(player, "drop.wand", zoneName);
|
||||
|
@ -137,14 +161,17 @@ public class WarPlayerListener implements Listener {
|
|||
|
||||
private static final int MINIMUM_TEAM_BLOCKS = 1;
|
||||
@EventHandler
|
||||
public void onPlayerPickupItem(final PlayerPickupItemEvent event) {
|
||||
public void onPlayerPickupItem(final EntityPickupItemEvent event) {
|
||||
if (War.war.isLoaded()) {
|
||||
Player player = event.getPlayer();
|
||||
if (!(event.getEntity() instanceof Player)) {
|
||||
return;
|
||||
}
|
||||
Player player = (Player) event.getEntity();
|
||||
Team team = Team.getTeamByPlayerName(player.getName());
|
||||
if (team != null) {
|
||||
Warzone zone = Warzone.getZoneByPlayerName(player.getName());
|
||||
Warzone zone = team.getZone();
|
||||
|
||||
if (zone.isFlagThief(player.getName())) {
|
||||
if (zone.isFlagThief(player)) {
|
||||
// a flag thief can't pick up anything
|
||||
event.setCancelled(true);
|
||||
} else {
|
||||
|
@ -205,7 +232,7 @@ public class WarPlayerListener implements Listener {
|
|||
public void onPlayerInteract(PlayerInteractEvent event) {
|
||||
if (War.war.isLoaded()) {
|
||||
Player player = event.getPlayer();
|
||||
if (player.getItemInHand().getType() == Material.WOOD_SWORD && War.war.isWandBearer(player)) {
|
||||
if (event.getItem() != null && event.getItem().getType() == Material.WOODEN_SWORD && War.war.isWandBearer(player)) {
|
||||
String zoneName = War.war.getWandBearerZone(player);
|
||||
ZoneSetter setter = new ZoneSetter(player, zoneName);
|
||||
if (event.getAction() == Action.LEFT_CLICK_AIR || event.getAction() == Action.RIGHT_CLICK_AIR) {
|
||||
|
@ -228,7 +255,7 @@ public class WarPlayerListener implements Listener {
|
|||
// Whenever a player dies in the middle of conflict they will
|
||||
// likely respawn still trying to use their items to attack
|
||||
// another player.
|
||||
player.playSound(player.getLocation(), Sound.ITEM_BREAK, 1, 0);
|
||||
player.playSound(player.getLocation(), Sound.ENTITY_ITEM_BREAK, 1, 0);
|
||||
}
|
||||
|
||||
if (zone != null && event.getAction() == Action.RIGHT_CLICK_BLOCK && event.getClickedBlock().getType() == Material.ENDER_CHEST && !zone.getWarzoneConfig().getBoolean(WarzoneConfig.ALLOWENDER)) {
|
||||
|
@ -236,7 +263,7 @@ public class WarPlayerListener implements Listener {
|
|||
War.war.badMsg(player, "use.ender");
|
||||
}
|
||||
Team team = Team.getTeamByPlayerName(player.getName());
|
||||
if (zone != null && team != null && event.getAction() == Action.RIGHT_CLICK_BLOCK && event.getClickedBlock().getType() == Material.ENCHANTMENT_TABLE && team.getTeamConfig().resolveBoolean(TeamConfig.XPKILLMETER)) {
|
||||
if (zone != null && team != null && event.getAction() == Action.RIGHT_CLICK_BLOCK && event.getClickedBlock().getType() == Material.ENCHANTING_TABLE && team.getTeamConfig().resolveBoolean(TeamConfig.XPKILLMETER)) {
|
||||
event.setCancelled(true);
|
||||
War.war.badMsg(player, "use.enchant");
|
||||
if (zone.getAuthors().contains(player.getName())) {
|
||||
|
@ -252,10 +279,18 @@ public class WarPlayerListener implements Listener {
|
|||
}
|
||||
if (zone != null && team != null && event.getAction() == Action.RIGHT_CLICK_BLOCK
|
||||
&& event.getClickedBlock().getState() instanceof InventoryHolder
|
||||
&& zone.isFlagThief(player.getName())) {
|
||||
&& zone.isFlagThief(player)) {
|
||||
event.setCancelled(true);
|
||||
War.war.badMsg(player, "drop.flag.disabled");
|
||||
}
|
||||
if (zone == null && event.getAction() == Action.RIGHT_CLICK_BLOCK
|
||||
&& (event.getClickedBlock().getType() == Material.CHEST || event.getClickedBlock().getType() == Material.TRAPPED_CHEST)
|
||||
&& Warzone.getZoneByLocation(event.getClickedBlock().getLocation()) != null
|
||||
&& !War.war.isZoneMaker(event.getPlayer())) {
|
||||
// prevent opening chests inside a warzone if a player is not a zone maker
|
||||
event.setCancelled(true);
|
||||
player.playSound(player.getLocation(), Sound.BLOCK_CHEST_LOCKED, 1, 0);
|
||||
}
|
||||
}
|
||||
|
||||
if (event.getAction() == Action.RIGHT_CLICK_BLOCK
|
||||
|
@ -264,7 +299,7 @@ public class WarPlayerListener implements Listener {
|
|||
Warzone zone = Warzone.getZoneByPlayerName(player.getName());
|
||||
if (zone != null && zone.getWarzoneConfig().getBoolean(WarzoneConfig.SOUPHEALING)) {
|
||||
ItemStack item = event.getItem();
|
||||
if ((item != null) && (item.getType() == Material.MUSHROOM_SOUP)) {
|
||||
if ((item != null) && (item.getType() == Material.MUSHROOM_STEW)) {
|
||||
if (player.getHealth() < 20) {
|
||||
player.setHealth(Math.min(20, player.getHealth() + 7));
|
||||
item.setType(Material.BOWL);
|
||||
|
@ -299,7 +334,7 @@ public class WarPlayerListener implements Listener {
|
|||
latestLocations.put(player.getName(), playerLoc);
|
||||
|
||||
// Signs can automatically teleport you to specific or random warzones
|
||||
if (playerLoc.getBlock().getType() == Material.SIGN_POST) {
|
||||
if (playerLoc.getBlock().getType() == Material.SIGN) {
|
||||
Sign sign = (Sign) playerLoc.getBlock().getState();
|
||||
if (sign.getLine(0).equals("[zone]")) {
|
||||
Warzone indicated = Warzone.getZoneByName(sign.getLine(1));
|
||||
|
@ -512,9 +547,9 @@ public class WarPlayerListener implements Listener {
|
|||
return;
|
||||
}
|
||||
} else if (loadoutSelectionState != null && !loadoutSelectionState.isStillInSpawn()
|
||||
&& !playerWarzone.isCakeThief(player.getName())
|
||||
&& !playerWarzone.isCakeThief(player)
|
||||
&& (flagReturn.equals(FlagReturn.BOTH) || flagReturn.equals(FlagReturn.SPAWN))
|
||||
&& !playerWarzone.isFlagThief(player.getName())) {
|
||||
&& !playerWarzone.isFlagThief(player)) {
|
||||
|
||||
// player is in spawn, but has left already: he should NOT be let back in - kick him out gently
|
||||
// if he sticks around too long.
|
||||
|
@ -539,7 +574,7 @@ public class WarPlayerListener implements Listener {
|
|||
}
|
||||
|
||||
// Flag capture
|
||||
if (playerWarzone.isFlagThief(player.getName())) {
|
||||
if (playerWarzone.isFlagThief(player)) {
|
||||
|
||||
// smoky
|
||||
if (System.currentTimeMillis() % 13 == 0) {
|
||||
|
@ -587,23 +622,10 @@ public class WarPlayerListener implements Listener {
|
|||
} else {
|
||||
// All good - proceed with scoring
|
||||
playerTeam.addPoint();
|
||||
Team victim = playerWarzone.getVictimTeamForFlagThief(player.getName());
|
||||
Team victim = playerWarzone.getVictimTeamForFlagThief(player);
|
||||
|
||||
// Notify everyone
|
||||
for (Team t : playerWarzone.getTeams()) {
|
||||
if (War.war.isSpoutServer()) {
|
||||
for (Player p : t.getPlayers()) {
|
||||
SpoutPlayer sp = SpoutManager.getPlayer(p);
|
||||
if (sp.isSpoutCraftEnabled()) {
|
||||
sp.sendNotification(
|
||||
SpoutDisplayer.cleanForNotification(playerTeam.getKind().getColor() + player.getName() + ChatColor.YELLOW + " captured"),
|
||||
SpoutDisplayer.cleanForNotification(victim.getKind().getColor() + victim.getName() + ChatColor.YELLOW + " flag!"),
|
||||
victim.getKind().getMaterial(),
|
||||
victim.getKind().getData(),
|
||||
10000);
|
||||
}
|
||||
}
|
||||
}
|
||||
t.teamcast("zone.flagcapture.broadcast", playerTeam.getKind().getColor() + player.getName() + ChatColor.WHITE,
|
||||
victim.getName(), playerTeam.getName());
|
||||
}
|
||||
|
@ -626,14 +648,14 @@ public class WarPlayerListener implements Listener {
|
|||
}
|
||||
}
|
||||
|
||||
playerWarzone.removeFlagThief(player.getName());
|
||||
playerWarzone.removeFlagThief(player);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Bomb detonation
|
||||
if (playerWarzone.isBombThief(player.getName())) {
|
||||
if (playerWarzone.isBombThief(player)) {
|
||||
// smoky
|
||||
playerWarzone.getWorld().playEffect(player.getLocation(), Effect.SMOKE, 0);
|
||||
|
||||
|
@ -654,7 +676,7 @@ public class WarPlayerListener implements Listener {
|
|||
if (inEnemySpawn && playerTeam.getPlayers().contains(player)) {
|
||||
// Made sure player is still part of team, game may have ended while waiting.
|
||||
// Ignored the scorers that happened immediately after the game end.
|
||||
Bomb bomb = playerWarzone.getBombForThief(player.getName());
|
||||
Bomb bomb = playerWarzone.getBombForThief(player);
|
||||
|
||||
// Boom!
|
||||
if (!playerWarzone.getWarzoneConfig().getBoolean(WarzoneConfig.UNBREAKABLE)) {
|
||||
|
@ -671,19 +693,6 @@ public class WarPlayerListener implements Listener {
|
|||
|
||||
// Notify everyone
|
||||
for (Team t : playerWarzone.getTeams()) {
|
||||
if (War.war.isSpoutServer()) {
|
||||
for (Player p : t.getPlayers()) {
|
||||
SpoutPlayer sp = SpoutManager.getPlayer(p);
|
||||
if (sp.isSpoutCraftEnabled()) {
|
||||
sp.sendNotification(
|
||||
SpoutDisplayer.cleanForNotification(playerTeam.getKind().getColor() + player.getName() + ChatColor.YELLOW + " blew up "),
|
||||
SpoutDisplayer.cleanForNotification(victim.getKind().getColor() + victim.getName() + ChatColor.YELLOW + "'s spawn!"),
|
||||
victim.getKind().getMaterial(),
|
||||
victim.getKind().getData(),
|
||||
10000);
|
||||
}
|
||||
}
|
||||
}
|
||||
t.teamcast("zone.bomb.broadcast", playerTeam.getKind().getColor() + player.getName() + ChatColor.WHITE,
|
||||
victim.getName(), playerTeam.getName());
|
||||
}
|
||||
|
@ -714,14 +723,14 @@ public class WarPlayerListener implements Listener {
|
|||
}
|
||||
}
|
||||
|
||||
playerWarzone.removeBombThief(player.getName());
|
||||
playerWarzone.removeBombThief(player);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Cake retrieval
|
||||
if (playerWarzone.isCakeThief(player.getName())) {
|
||||
if (playerWarzone.isCakeThief(player)) {
|
||||
// smoky
|
||||
if (System.currentTimeMillis() % 13 == 0) {
|
||||
playerWarzone.getWorld().playEffect(player.getLocation(), Effect.POTION_BREAK, playerTeam.getKind().getPotionEffectColor());
|
||||
|
@ -743,7 +752,7 @@ public class WarPlayerListener implements Listener {
|
|||
|
||||
// Don't let someone alone make points off cakes
|
||||
if (hasOpponent) {
|
||||
Cake cake = playerWarzone.getCakeForThief(player.getName());
|
||||
Cake cake = playerWarzone.getCakeForThief(player);
|
||||
|
||||
if (playerWarzone.isReinitializing()) {
|
||||
// Battle already ended or interrupted
|
||||
|
@ -756,19 +765,6 @@ public class WarPlayerListener implements Listener {
|
|||
|
||||
// Notify everyone
|
||||
for (Team t : playerWarzone.getTeams()) {
|
||||
if (War.war.isSpoutServer()) {
|
||||
for (Player p : t.getPlayers()) {
|
||||
SpoutPlayer sp = SpoutManager.getPlayer(p);
|
||||
if (sp.isSpoutCraftEnabled()) {
|
||||
sp.sendNotification(
|
||||
SpoutDisplayer.cleanForNotification(playerTeam.getKind().getColor() + player.getName() + ChatColor.YELLOW + " captured"),
|
||||
SpoutDisplayer.cleanForNotification(ChatColor.YELLOW + "cake " + ChatColor.GREEN + cake.getName() + ChatColor.YELLOW + "!"),
|
||||
playerTeam.getKind().getMaterial(),
|
||||
playerTeam.getKind().getData(),
|
||||
10000);
|
||||
}
|
||||
}
|
||||
}
|
||||
t.teamcast("zone.cake.broadcast", playerTeam.getKind().getColor() + player.getName() + ChatColor.WHITE,
|
||||
ChatColor.GREEN + cake.getName() + ChatColor.WHITE, playerTeam.getName());
|
||||
}
|
||||
|
@ -793,7 +789,7 @@ public class WarPlayerListener implements Listener {
|
|||
}
|
||||
}
|
||||
|
||||
playerWarzone.removeCakeThief(player.getName());
|
||||
playerWarzone.removeCakeThief(player);
|
||||
}
|
||||
|
||||
return;
|
||||
|
@ -845,27 +841,30 @@ public class WarPlayerListener implements Listener {
|
|||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void onPlayerRespawn(PlayerRespawnEvent event) {
|
||||
if (War.war.isLoaded()) {
|
||||
// Anyone who died in warzones needs to go back there pronto!
|
||||
for (Warzone zone : War.war.getWarzones()) {
|
||||
if (zone.getReallyDeadFighters().contains(event.getPlayer().getName())) {
|
||||
zone.getReallyDeadFighters().remove(event.getPlayer().getName());
|
||||
for (Team team : zone.getTeams()) {
|
||||
if (team.getPlayers().contains(event.getPlayer())) {
|
||||
event.setRespawnLocation(team.getRandomSpawn());
|
||||
zone.respawnPlayer(team, event.getPlayer());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (zone.hasPlayerState(event.getPlayer().getName())) {
|
||||
// If not member of a team and zone has your state, then game ended while you were dead
|
||||
War.war.log("Failed to restore game state to dead player.", Level.WARNING);
|
||||
}
|
||||
break;
|
||||
}
|
||||
Warzone playingZone = Warzone.getZoneByPlayerName(event.getPlayer().getName());
|
||||
Warzone deadZone = Warzone.getZoneForDeadPlayer(event.getPlayer());
|
||||
if (playingZone == null && deadZone != null) {
|
||||
// Game ended while player was dead, so restore state
|
||||
deadZone.getReallyDeadFighters().remove(event.getPlayer().getName());
|
||||
if (deadZone.hasPlayerState(event.getPlayer().getName())) {
|
||||
deadZone.restorePlayerState(event.getPlayer());
|
||||
}
|
||||
event.setRespawnLocation(deadZone.getEndTeleport(LeaveCause.DISCONNECT));
|
||||
return;
|
||||
} else if (playingZone == null) {
|
||||
// Player not playing war
|
||||
return;
|
||||
} else if (deadZone == null) {
|
||||
// Player is not a 'really' dead player, nothing to do here
|
||||
return;
|
||||
}
|
||||
Team team = playingZone.getPlayerTeam(event.getPlayer().getName());
|
||||
Validate.notNull(team, String.format(
|
||||
"Failed to find a team for player %s in warzone %s on respawn.",
|
||||
event.getPlayer().getName(), playingZone.getName()));
|
||||
playingZone.getReallyDeadFighters().remove(event.getPlayer().getName());
|
||||
event.setRespawnLocation(team.getRandomSpawn());
|
||||
playingZone.respawnPlayer(team, event.getPlayer());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
@ -915,15 +914,17 @@ public class WarPlayerListener implements Listener {
|
|||
if (zone == null) {
|
||||
return;
|
||||
}
|
||||
// Prevent thieves from taking their bomb/wool/cake into a chest, etc.
|
||||
if (zone.isThief(player.getName())) {
|
||||
if (zone.isThief(player)) {
|
||||
// Prevent thieves from taking their bomb/wool/cake into a chest, etc.
|
||||
event.setCancelled(true);
|
||||
player.playSound(player.getLocation(), Sound.FIZZ, 10, 10);
|
||||
} else // Magically give player a wool block when they click their helmet
|
||||
if (event.getSlotType() == InventoryType.SlotType.ARMOR && event.getSlot() == 39
|
||||
player.playSound(player.getLocation(), Sound.BLOCK_LAVA_EXTINGUISH, 10, 10);
|
||||
} else if (event.getSlotType() == InventoryType.SlotType.ARMOR && event.getSlot() == 39
|
||||
&& zone.getWarzoneConfig().getBoolean(WarzoneConfig.BLOCKHEADS)) {
|
||||
// Magically give player a wool block when they click their helmet
|
||||
ItemStack teamBlock = zone.getPlayerTeam(player.getName()).getKind().getBlockHead();
|
||||
player.getInventory().remove(teamBlock.getType());
|
||||
// Deprecated behavior cannot be removed as it is essential to this function
|
||||
//noinspection deprecation
|
||||
event.setCursor(teamBlock);
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
@ -932,4 +933,17 @@ public class WarPlayerListener implements Listener {
|
|||
public void purgeLatestPositions() {
|
||||
this.latestLocations.clear();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onBucketEmpty(PlayerBucketEmptyEvent event) {
|
||||
Player player = (Player) event.getPlayer();
|
||||
Warzone zone = Warzone.getZoneByPlayerName(player.getName());
|
||||
if (zone == null) {
|
||||
return;
|
||||
}
|
||||
if (zone.isImportantBlock(event.getBlockClicked())) {
|
||||
event.setCancelled(true);
|
||||
player.playSound(player.getLocation(), Sound.BLOCK_LAVA_EXTINGUISH, 10, 10);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,28 +0,0 @@
|
|||
package com.tommytony.war.event;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.server.PluginDisableEvent;
|
||||
import org.getspout.spoutapi.SpoutManager;
|
||||
import org.getspout.spoutapi.player.SpoutPlayer;
|
||||
|
||||
import com.tommytony.war.War;
|
||||
|
||||
public class WarServerListener implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onPluginDisable(final PluginDisableEvent event) {
|
||||
if (event.getPlugin().getDataFolder().getName().equals("Spout")) {
|
||||
if (War.war.isSpoutServer()) {
|
||||
for (Player player : War.war.getServer().getOnlinePlayers()) {
|
||||
SpoutPlayer sp = SpoutManager.getPlayer(player);
|
||||
if (sp.isSpoutCraftEnabled()) {
|
||||
sp.getMainScreen().removeWidgets(War.war);
|
||||
}
|
||||
}
|
||||
War.war.getSpoutDisplayer().clearAll();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,19 +0,0 @@
|
|||
package com.tommytony.war.event;
|
||||
|
||||
import com.tommytony.war.Team;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.kitteh.tag.PlayerReceiveNameTagEvent;
|
||||
|
||||
public class WarTagListener implements Listener {
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void onNameTag(PlayerReceiveNameTagEvent event) {
|
||||
Team team = Team.getTeamByPlayerName(event.getNamedPlayer().getName());
|
||||
if (team != null) {
|
||||
ChatColor teamColor = team.getKind().getColor();
|
||||
event.setTag(teamColor + event.getNamedPlayer().getName());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,119 @@
|
|||
package com.tommytony.war.job;
|
||||
|
||||
import com.tommytony.war.Team;
|
||||
import com.tommytony.war.War;
|
||||
import com.tommytony.war.Warzone;
|
||||
import com.tommytony.war.config.TeamConfig;
|
||||
import com.tommytony.war.structure.CapturePoint;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
public class CapturePointTimer extends BukkitRunnable {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
if (!War.war.isLoaded()) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (Player player : War.war.getServer().getOnlinePlayers()) {
|
||||
Warzone zone = Warzone.getZoneByPlayerName(player.getName());
|
||||
Team team = Team.getTeamByPlayerName(player.getName());
|
||||
|
||||
if (zone == null || team == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
for (CapturePoint cp : zone.getCapturePoints()) {
|
||||
if (cp.getVolume().contains(player.getLocation())) {
|
||||
// player is maintaining or contesting capture point.
|
||||
if (cp.getController() == null) {
|
||||
// take control of unclaimed point
|
||||
incrementStrength(cp, player, zone, team);
|
||||
} else if (cp.getController() != team.getKind()) {
|
||||
// contest other team's point
|
||||
decrementStrength(cp, player, zone, team);
|
||||
} else if (cp.getController() == team.getKind()) {
|
||||
// maintain your team's point
|
||||
incrementStrength(cp, player, zone, team);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (Warzone zone : War.war.getWarzones()) {
|
||||
for (CapturePoint cp : zone.getCapturePoints()) {
|
||||
if (cp.getController() != null && cp.getController() != cp.getDefaultController()
|
||||
&& cp.getStrength() == cp.getMaxStrength()) {
|
||||
int controlTime = cp.getControlTime() + 1;
|
||||
cp.setControlTime(controlTime);
|
||||
if (controlTime % cp.getMaxStrength() == 0) {
|
||||
// give points for every control time which is a multiple of the time taken to capture
|
||||
Team team = zone.getTeamByKind(cp.getController());
|
||||
team.addPoint();
|
||||
zone.broadcast("zone.capturepoint.addpoint",
|
||||
cp.getController().getFormattedName(), cp.getName());
|
||||
// Detect win conditions
|
||||
if (team.getPoints() >= team.getTeamConfig().resolveInt(TeamConfig.MAXSCORE)) {
|
||||
zone.handleScoreCapReached(team.getName());
|
||||
} else {
|
||||
// just added a point
|
||||
team.resetSign();
|
||||
zone.getLobby().resetTeamGateSign(team);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void decrementStrength(CapturePoint cp, Player player, Warzone zone, Team team) {
|
||||
int strength = cp.getStrength();
|
||||
if (strength < 1) {
|
||||
// strength is already at minimum, ensure attributes are wiped
|
||||
cp.setController(null);
|
||||
cp.setStrength(0);
|
||||
return;
|
||||
}
|
||||
strength -= 1;
|
||||
if (strength == 0) {
|
||||
if (cp.antiChatSpam()) {
|
||||
zone.broadcast("zone.capturepoint.lose", cp.getController().getFormattedName(), cp.getName());
|
||||
}
|
||||
cp.setControlTime(0);
|
||||
cp.setController(null);
|
||||
} else if (strength == cp.getMaxStrength() - 1) {
|
||||
if (cp.antiChatSpam()) {
|
||||
zone.broadcast("zone.capturepoint.contest", cp.getName(),
|
||||
team.getKind().getColor() + player.getName() + ChatColor.WHITE);
|
||||
}
|
||||
}
|
||||
cp.setStrength(strength);
|
||||
}
|
||||
|
||||
private static void incrementStrength(CapturePoint cp, Player player, Warzone zone, Team team) {
|
||||
int strength = cp.getStrength();
|
||||
if (strength > cp.getMaxStrength()) {
|
||||
// cap strength at CapturePoint.MAX_STRENGTH
|
||||
cp.setStrength(cp.getMaxStrength());
|
||||
return;
|
||||
} else if (strength == cp.getMaxStrength()) {
|
||||
// do nothing
|
||||
return;
|
||||
}
|
||||
strength += 1;
|
||||
if (strength == cp.getMaxStrength()) {
|
||||
if (cp.antiChatSpam()) {
|
||||
zone.broadcast("zone.capturepoint.capture", cp.getController().getFormattedName(), cp.getName());
|
||||
}
|
||||
team.addPoint();
|
||||
} else if (strength == 1) {
|
||||
if (cp.antiChatSpam()) {
|
||||
zone.broadcast("zone.capturepoint.fortify", team.getKind().getFormattedName(), cp.getName());
|
||||
}
|
||||
cp.setController(team.getKind());
|
||||
}
|
||||
cp.setStrength(strength);
|
||||
}
|
||||
}
|
|
@ -20,9 +20,6 @@ import com.tommytony.war.config.WarzoneConfig;
|
|||
*/
|
||||
public class HelmetProtectionTask implements Runnable {
|
||||
|
||||
/**
|
||||
* @see Runnable.run()
|
||||
*/
|
||||
public void run() {
|
||||
if (!War.war.isLoaded()) {
|
||||
return;
|
||||
|
@ -47,7 +44,7 @@ public class HelmetProtectionTask implements Runnable {
|
|||
int removed = 0;
|
||||
for (ItemStack item : playerInv.getContents()) {
|
||||
// remove only same colored wool
|
||||
if (item != null && item.getType() == teamBlockMaterial && item.getData() == team.getKind().getBlockData()) {
|
||||
if (item != null && item.getType() == teamBlockMaterial) {
|
||||
playerInv.clear(i);
|
||||
removed++;
|
||||
}
|
||||
|
@ -66,16 +63,22 @@ public class HelmetProtectionTask implements Runnable {
|
|||
}
|
||||
|
||||
// check for thieves without their treasure in their hands
|
||||
if (zone.isFlagThief(player.getName())) {
|
||||
Team victim = zone.getVictimTeamForFlagThief(player.getName());
|
||||
player.setItemInHand(null);
|
||||
player.getInventory().addItem(victim.getKind().getBlockData().toItemStack(2240));
|
||||
} else if (zone.isBombThief(player.getName())) {
|
||||
player.setItemInHand(null);
|
||||
if (zone.isFlagThief(player)) {
|
||||
Team victim = zone.getVictimTeamForFlagThief(player);
|
||||
player.getInventory().setItemInMainHand(null);
|
||||
player.getInventory().setItemInOffHand(null);
|
||||
player.getInventory().setHeldItemSlot(0);
|
||||
player.getInventory().addItem(new ItemStack(victim.getKind().getMaterial(), 2240));
|
||||
} else if (zone.isBombThief(player)) {
|
||||
player.getInventory().setItemInMainHand(null);
|
||||
player.getInventory().setItemInOffHand(null);
|
||||
player.getInventory().setHeldItemSlot(0);
|
||||
player.getInventory().addItem(new ItemStack(Material.TNT, 2240));
|
||||
} else if (zone.isCakeThief(player.getName())) {
|
||||
player.setItemInHand(null);
|
||||
player.getInventory().addItem(new ItemStack(Material.CAKE_BLOCK, 2240));
|
||||
} else if (zone.isCakeThief(player)) {
|
||||
player.getInventory().setItemInMainHand(null);
|
||||
player.getInventory().setItemInOffHand(null);
|
||||
player.getInventory().setHeldItemSlot(0);
|
||||
player.getInventory().addItem(new ItemStack(Material.CAKE, 2240));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,9 +23,6 @@ public class LoadoutResetJob implements Runnable {
|
|||
|
||||
public void run() {
|
||||
this.zone.equipPlayerLoadoutSelection(player, team, isFirstRespawn, isToggle);
|
||||
|
||||
// Stop fire here, since doing it in the same tick as death doesn't extinguish it
|
||||
this.player.setFireTicks(0);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,24 +1,25 @@
|
|||
package com.tommytony.war.job;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
import java.text.DecimalFormat;
|
||||
import java.text.MessageFormat;
|
||||
import java.text.NumberFormat;
|
||||
import java.util.*;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import com.tommytony.war.War;
|
||||
import com.tommytony.war.Warzone;
|
||||
import com.tommytony.war.mapper.ZoneVolumeMapper;
|
||||
import com.tommytony.war.structure.ZoneLobby;
|
||||
import com.tommytony.war.volume.ZoneVolume;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import com.tommytony.war.War;
|
||||
import com.tommytony.war.Warzone;
|
||||
import com.tommytony.war.structure.ZoneLobby;
|
||||
import com.tommytony.war.volume.ZoneVolume;
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
import java.text.DecimalFormat;
|
||||
import java.text.MessageFormat;
|
||||
import java.text.NumberFormat;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Level;
|
||||
|
||||
public class PartialZoneResetJob extends BukkitRunnable implements Cloneable {
|
||||
|
||||
|
@ -61,7 +62,7 @@ public class PartialZoneResetJob extends BukkitRunnable implements Cloneable {
|
|||
public void run() {
|
||||
try {
|
||||
if (conn == null || conn.isClosed()) {
|
||||
conn = ZoneVolumeMapper.getZoneConnection(volume, zone.getName(), volume.getWorld());
|
||||
conn = ZoneVolumeMapper.getZoneConnection(volume, zone.getName());
|
||||
}
|
||||
if (completed >= total) {
|
||||
int airChanges = 0;
|
||||
|
@ -88,6 +89,7 @@ public class PartialZoneResetJob extends BukkitRunnable implements Cloneable {
|
|||
}
|
||||
totalChanges += airChanges;
|
||||
if (this.doneAir()) {
|
||||
volume.resetEntities(conn);
|
||||
String secondsAsText = formatter.format(((double)(System.currentTimeMillis() - startTime)) / 1000);
|
||||
String message = MessageFormat.format(
|
||||
War.war.getString("zone.battle.resetcomplete"), secondsAsText);
|
||||
|
@ -98,14 +100,14 @@ public class PartialZoneResetJob extends BukkitRunnable implements Cloneable {
|
|||
new Object[]{volume.getName(), secondsAsText});
|
||||
conn.close();
|
||||
} else {
|
||||
War.war.getServer().getScheduler().runTaskLater(War.war, this.clone(), JOB_INTERVAL);
|
||||
War.war.getServer().getScheduler().runTaskLater(War.war, (Runnable) this.clone(), JOB_INTERVAL);
|
||||
}
|
||||
} else {
|
||||
int solidChanges = volume.resetSection(conn, completed, speed, changes);
|
||||
completed += solidChanges;
|
||||
totalChanges += solidChanges;
|
||||
this.displayStatusMessage();
|
||||
War.war.getServer().getScheduler().runTaskLater(War.war, this.clone(), JOB_INTERVAL);
|
||||
War.war.getServer().getScheduler().runTaskLater(War.war, (Runnable) this.clone(), JOB_INTERVAL);
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
War.war.getLogger().log(Level.WARNING, "Failed to load zone during reset loop", e);
|
||||
|
|
|
@ -1,69 +0,0 @@
|
|||
package com.tommytony.war.job;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
|
||||
|
||||
import com.tommytony.war.War;
|
||||
import com.tommytony.war.Warzone;
|
||||
import com.tommytony.war.mapper.VolumeMapper;
|
||||
import com.tommytony.war.structure.WarHub;
|
||||
import com.tommytony.war.volume.Volume;
|
||||
|
||||
public class RestoreWarhubJob implements Runnable {
|
||||
|
||||
private final String hubStr;
|
||||
|
||||
public RestoreWarhubJob(String hubStr) {
|
||||
this.hubStr = hubStr;
|
||||
}
|
||||
|
||||
public void run() {
|
||||
String[] hubStrSplit = this.hubStr.split(",");
|
||||
|
||||
int hubX = Integer.parseInt(hubStrSplit[0]);
|
||||
int hubY = Integer.parseInt(hubStrSplit[1]);
|
||||
int hubZ = Integer.parseInt(hubStrSplit[2]);
|
||||
World world = null;
|
||||
String worldName;
|
||||
String hubOrientation = "west";
|
||||
if (hubStrSplit.length > 3) {
|
||||
worldName = hubStrSplit[3];
|
||||
world = War.war.getServer().getWorld(worldName);
|
||||
if (hubStrSplit.length > 4) {
|
||||
hubOrientation = hubStrSplit[4];
|
||||
}
|
||||
} else {
|
||||
worldName = "DEFAULT";
|
||||
world = War.war.getServer().getWorlds().get(0); // default to first world
|
||||
}
|
||||
if (world != null) {
|
||||
Location hubLocation = new Location(world, hubX, hubY, hubZ);
|
||||
WarHub hub = new WarHub(hubLocation, hubOrientation);
|
||||
War.war.setWarHub(hub);
|
||||
Volume vol;
|
||||
try {
|
||||
vol = VolumeMapper.loadVolume("warhub", "", world);
|
||||
} catch (SQLException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
hub.setVolume(vol);
|
||||
hub.getVolume().resetBlocks();
|
||||
hub.initialize();
|
||||
|
||||
// In the previous job started by the mapper, warzones were created, but their lobbies are missing the war hub gate (because it didn't exist yet)
|
||||
for (Warzone zone : War.war.getWarzones()) {
|
||||
if (zone.getLobby() != null) {
|
||||
zone.getLobby().getVolume().resetBlocks();
|
||||
zone.getLobby().initialize();
|
||||
}
|
||||
}
|
||||
War.war.log("Warhub ready.", Level.INFO);
|
||||
} else {
|
||||
War.war.log("Failed to restore warhub. The specified world (name: " + worldName + ") does not exist!", Level.WARNING);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,69 +0,0 @@
|
|||
package com.tommytony.war.job;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import com.tommytony.war.War;
|
||||
import com.tommytony.war.Warzone;
|
||||
import com.tommytony.war.config.WarzoneConfig;
|
||||
import com.tommytony.war.mapper.WarYmlMapper;
|
||||
import com.tommytony.war.mapper.WarzoneTxtMapper;
|
||||
import com.tommytony.war.mapper.WarzoneYmlMapper;
|
||||
|
||||
public class RestoreWarzonesJob implements Runnable {
|
||||
|
||||
private final String warzonesStr;
|
||||
private final boolean newWarInstall;
|
||||
private final boolean convertingToYml;
|
||||
|
||||
public RestoreWarzonesJob(String warzonesStr, boolean newWarInstall, boolean convertingToYml) {
|
||||
this.warzonesStr = warzonesStr;
|
||||
this.newWarInstall = newWarInstall;
|
||||
this.convertingToYml = convertingToYml;
|
||||
}
|
||||
|
||||
public void run() {
|
||||
String[] warzoneSplit = this.warzonesStr.split(",");
|
||||
War.war.getWarzones().clear();
|
||||
|
||||
for (String warzoneName : warzoneSplit) {
|
||||
if (warzoneName != null && !warzoneName.equals("")) {
|
||||
War.war.log("Loading zone " + warzoneName + "...", Level.INFO);
|
||||
Warzone zone = WarzoneTxtMapper.load(warzoneName, !this.newWarInstall);
|
||||
if (zone != null) { // could have failed, would've been logged already
|
||||
War.war.getWarzones().add(zone);
|
||||
try {
|
||||
zone.getVolume().loadCorners();
|
||||
} catch (SQLException ex) {
|
||||
War.war.log("Failed to load warzone " + warzoneName + ": " + ex.getMessage(), Level.WARNING);
|
||||
throw new RuntimeException(ex);
|
||||
}
|
||||
|
||||
if (zone.getLobby() != null) {
|
||||
zone.getLobby().getVolume().resetBlocks();
|
||||
}
|
||||
if (zone.getWarzoneConfig().getBoolean(WarzoneConfig.RESETONLOAD)) {
|
||||
zone.getVolume().resetBlocks();
|
||||
}
|
||||
zone.initializeZone();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (War.war.getWarzones().size() > 0) {
|
||||
War.war.log("Warzones ready.", Level.INFO);
|
||||
}
|
||||
|
||||
if (convertingToYml) {
|
||||
// Loading process is over, we can convert (i.e. save in new format)
|
||||
WarYmlMapper.save();
|
||||
War.war.log("Converted war.txt to war.yml.", Level.INFO);
|
||||
|
||||
for (Warzone zone : War.war.getWarzones()) {
|
||||
WarzoneYmlMapper.save(zone);
|
||||
War.war.log("Converted warzone-" + zone.getName() + ".txt to warzone-" + zone.getName() + ".yml.", Level.INFO);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,18 +1,16 @@
|
|||
package com.tommytony.war.job;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import com.tommytony.war.War;
|
||||
import com.tommytony.war.Warzone;
|
||||
import com.tommytony.war.mapper.VolumeMapper;
|
||||
import com.tommytony.war.structure.WarHub;
|
||||
import com.tommytony.war.volume.Volume;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.logging.Level;
|
||||
|
||||
public class RestoreYmlWarhubJob implements Runnable {
|
||||
|
||||
|
@ -22,7 +20,6 @@ public class RestoreYmlWarhubJob implements Runnable {
|
|||
this.warhubConfig = warhubConfig;
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public void run() {
|
||||
int hubX = warhubConfig.getInt("x");
|
||||
int hubY = warhubConfig.getInt("y");
|
||||
|
@ -35,50 +32,18 @@ public class RestoreYmlWarhubJob implements Runnable {
|
|||
if (warhubConfig.isItemStack("materials.floor")) {
|
||||
War.war.getWarhubMaterials().setFloorBlock(
|
||||
warhubConfig.getItemStack("materials.floor"));
|
||||
} else {
|
||||
ConfigurationSection floorMaterialSection = warhubConfig
|
||||
.getConfigurationSection("materials.floor");
|
||||
if (floorMaterialSection != null) {
|
||||
War.war.getWarhubMaterials().setFloorBlock(
|
||||
new ItemStack(floorMaterialSection.getInt("id"), 1,
|
||||
(short) floorMaterialSection.getInt("data")));
|
||||
}
|
||||
}
|
||||
if (warhubConfig.isItemStack("materials.outline")) {
|
||||
War.war.getWarhubMaterials().setOutlineBlock(
|
||||
warhubConfig.getItemStack("materials.outline"));
|
||||
} else {
|
||||
ConfigurationSection floorMaterialSection = warhubConfig
|
||||
.getConfigurationSection("materials.outline");
|
||||
if (floorMaterialSection != null) {
|
||||
War.war.getWarhubMaterials().setOutlineBlock(
|
||||
new ItemStack(floorMaterialSection.getInt("id"), 1,
|
||||
(short) floorMaterialSection.getInt("data")));
|
||||
}
|
||||
}
|
||||
if (warhubConfig.isItemStack("materials.gate")) {
|
||||
War.war.getWarhubMaterials().setGateBlock(
|
||||
warhubConfig.getItemStack("materials.gate"));
|
||||
} else {
|
||||
ConfigurationSection floorMaterialSection = warhubConfig
|
||||
.getConfigurationSection("materials.gate");
|
||||
if (floorMaterialSection != null) {
|
||||
War.war.getWarhubMaterials().setGateBlock(
|
||||
new ItemStack(floorMaterialSection.getInt("id"), 1,
|
||||
(short) floorMaterialSection.getInt("data")));
|
||||
}
|
||||
}
|
||||
if (warhubConfig.isItemStack("materials.light")) {
|
||||
War.war.getWarhubMaterials().setLightBlock(
|
||||
warhubConfig.getItemStack("materials.light"));
|
||||
} else {
|
||||
ConfigurationSection floorMaterialSection = warhubConfig
|
||||
.getConfigurationSection("materials.light");
|
||||
if (floorMaterialSection != null) {
|
||||
War.war.getWarhubMaterials().setLightBlock(
|
||||
new ItemStack(floorMaterialSection.getInt("id"), 1,
|
||||
(short) floorMaterialSection.getInt("data")));
|
||||
}
|
||||
}
|
||||
World world = War.war.getServer().getWorld(worldName);
|
||||
if (world != null) {
|
||||
|
@ -87,7 +52,7 @@ public class RestoreYmlWarhubJob implements Runnable {
|
|||
War.war.setWarHub(hub);
|
||||
Volume vol;
|
||||
try {
|
||||
vol = VolumeMapper.loadVolume("warhub", "", world);
|
||||
vol = VolumeMapper.loadSimpleVolume("warhub", world);
|
||||
} catch (SQLException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
|
|
@ -1,21 +1,18 @@
|
|||
package com.tommytony.war.job;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
import java.util.Locale;
|
||||
|
||||
import com.tommytony.war.War;
|
||||
import com.tommytony.war.Warzone;
|
||||
import com.tommytony.war.config.WarzoneConfig;
|
||||
import com.tommytony.war.mapper.WarzoneYmlMapper;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
import org.mcstats.Metrics;
|
||||
import org.mcstats.Metrics.Graph;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.logging.Level;
|
||||
|
||||
public class RestoreYmlWarzonesJob implements Runnable {
|
||||
|
||||
private final List<String> warzones;
|
||||
|
@ -63,18 +60,12 @@ public class RestoreYmlWarzonesJob implements Runnable {
|
|||
}
|
||||
language.addPlotter(new PlotterEnabled(langName));
|
||||
Graph plugins = metrics.createGraph("Extensions");
|
||||
if (War.war.isSpoutServer()) {
|
||||
plugins.addPlotter(new PlotterEnabled("Spout"));
|
||||
}
|
||||
if (War.war.isTagServer()) {
|
||||
plugins.addPlotter(new PlotterEnabled("TagAPI"));
|
||||
}
|
||||
if (Bukkit.getPluginManager().isPluginEnabled("WorldEdit")) {
|
||||
plugins.addPlotter(new PlotterEnabled("WorldEdit"));
|
||||
}
|
||||
plugins.addPlotter(new PlotterEnabled("War")); // of course
|
||||
metrics.start();
|
||||
} catch (IOException ignored) {
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
package com.tommytony.war.job;
|
||||
|
||||
import com.tommytony.war.War;
|
||||
import com.tommytony.war.Warzone;
|
||||
import com.tommytony.war.config.ScoreboardType;
|
||||
import com.tommytony.war.config.WarzoneConfig;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
/**
|
||||
* Switches scoreboards periodically
|
||||
* Github #790
|
||||
*/
|
||||
public class ScoreboardSwitchTimer extends BukkitRunnable {
|
||||
@Override
|
||||
public void run() {
|
||||
if (!War.war.isLoaded()) {
|
||||
return;
|
||||
}
|
||||
for (Warzone zone : War.war.getEnabledWarzones()) {
|
||||
if (zone.getWarzoneConfig().getScoreboardType(WarzoneConfig.SCOREBOARD) == ScoreboardType.SWITCHING) {
|
||||
switch (zone.getScoreboardType()) {
|
||||
case SWITCHING:
|
||||
zone.setScoreboardType(ScoreboardType.POINTS);
|
||||
break;
|
||||
case POINTS:
|
||||
zone.setScoreboardType(ScoreboardType.LIFEPOOL);
|
||||
break;
|
||||
case LIFEPOOL:
|
||||
zone.setScoreboardType(ScoreboardType.TOPKILLS);
|
||||
break;
|
||||
case TOPKILLS:
|
||||
zone.setScoreboardType(ScoreboardType.PLAYERCOUNT);
|
||||
break;
|
||||
case PLAYERCOUNT:
|
||||
zone.setScoreboardType(ScoreboardType.POINTS);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
zone.updateScoreboard();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,14 +0,0 @@
|
|||
package com.tommytony.war.job;
|
||||
|
||||
import com.tommytony.war.War;
|
||||
|
||||
public class SpoutFadeOutMessageJob implements Runnable {
|
||||
|
||||
public SpoutFadeOutMessageJob() {
|
||||
}
|
||||
|
||||
public void run() {
|
||||
War.war.getSpoutDisplayer().fadeOutOldMessages();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
package com.tommytony.war.job;
|
||||
|
||||
import com.tommytony.war.War;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.player.PlayerTeleportEvent;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
public class TeleportPlayerJob extends BukkitRunnable {
|
||||
private final Player player;
|
||||
private final Location location;
|
||||
private final Location originalLocation;
|
||||
private final double originalHealth;
|
||||
|
||||
public TeleportPlayerJob(Player player, Location location) {
|
||||
this.player = player;
|
||||
this.location = location;
|
||||
this.originalLocation = player.getLocation().clone();
|
||||
this.originalHealth = player.getHealth();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
if (!player.isOnline()) {
|
||||
} else if (hasPlayerMoved()) {
|
||||
War.war.badMsg(player, "command.tp.moved");
|
||||
} else if (hasPlayerTakenDamage()) {
|
||||
War.war.badMsg(player, "command.tp.damaged");
|
||||
} else {
|
||||
player.teleport(location, PlayerTeleportEvent.TeleportCause.COMMAND);
|
||||
War.war.msg(player, "command.tp.success");
|
||||
}
|
||||
}
|
||||
|
||||
boolean hasPlayerMoved() {
|
||||
final double MAX_MOVE_TOLERANCE = 1.5;
|
||||
return distance3D(player.getLocation(), originalLocation) > MAX_MOVE_TOLERANCE;
|
||||
}
|
||||
|
||||
boolean hasPlayerTakenDamage() {
|
||||
final double MAX_DAMAGE_TOLERANCE = 2;
|
||||
return Math.abs(originalHealth - player.getHealth()) > MAX_DAMAGE_TOLERANCE;
|
||||
}
|
||||
|
||||
double distance3D(Location pos1, Location pos2) {
|
||||
double distX = pos2.getX() - pos1.getX();
|
||||
double distY = pos2.getY() - pos1.getY();
|
||||
double distZ = pos2.getZ() - pos1.getZ();
|
||||
return Math.sqrt(Math.pow(distX, 2) + Math.pow(distY, 2) + Math.pow(distZ, 2));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
package com.tommytony.war.job;
|
||||
|
||||
import com.tommytony.war.Warzone;
|
||||
|
||||
/**
|
||||
* @author grinning
|
||||
*/
|
||||
public class ZoneTimeJob implements Runnable {
|
||||
|
||||
private Warzone zone;
|
||||
|
||||
public ZoneTimeJob(Warzone zone) {
|
||||
this.zone = zone;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
zone.setPvpReady(true);
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,29 +0,0 @@
|
|||
package com.tommytony.war.job;
|
||||
|
||||
import com.tommytony.war.War;
|
||||
import com.tommytony.war.mapper.ZoneVolumeMapper;
|
||||
import com.tommytony.war.volume.Volume;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
public class ZoneVolumeSaveJob extends BukkitRunnable {
|
||||
private final Volume volume;
|
||||
private final String zoneName;
|
||||
|
||||
public ZoneVolumeSaveJob(Volume volume, String zoneName) {
|
||||
this.volume = volume;
|
||||
this.zoneName = zoneName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
ZoneVolumeMapper.save(this.volume, this.zoneName);
|
||||
} catch (SQLException ex) {
|
||||
War.war.log(ex.getMessage(), Level.SEVERE);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,46 +0,0 @@
|
|||
package com.tommytony.war.mapper;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import com.tommytony.war.War;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public class LoadoutTxtMapper {
|
||||
|
||||
public static void fromStringToLoadout(String loadoutString, HashMap<Integer, ItemStack> destinationLoadout) {
|
||||
String[] rewardStrSplit = loadoutString.split(";");
|
||||
destinationLoadout.clear();
|
||||
for (String itemStr : rewardStrSplit) {
|
||||
if (itemStr != null && !itemStr.equals("")) {
|
||||
String[] itemStrSplit = itemStr.split(",");
|
||||
ItemStack item = null;
|
||||
if (itemStrSplit.length == 3) {
|
||||
item = new ItemStack(Integer.parseInt(itemStrSplit[0]), Integer.parseInt(itemStrSplit[1]));
|
||||
} else if (itemStrSplit.length == 5) {
|
||||
short durability = Short.parseShort(itemStrSplit[3]);
|
||||
item = new ItemStack(Integer.parseInt(itemStrSplit[0]), Integer.parseInt(itemStrSplit[1]), durability);
|
||||
item.setDurability(durability);
|
||||
} else if (itemStrSplit.length == 6) {
|
||||
short durability = Short.parseShort(itemStrSplit[3]);
|
||||
item = new ItemStack(Integer.parseInt(itemStrSplit[0]), Integer.parseInt(itemStrSplit[1]), durability);
|
||||
item.setDurability(durability);
|
||||
|
||||
// enchantments
|
||||
String[] enchantmentsSplit = itemStrSplit[5].split("::");
|
||||
for (String enchantmentStr : enchantmentsSplit) {
|
||||
if (!enchantmentStr.equals("")) {
|
||||
String[] enchantmentSplit = enchantmentStr.split(":");
|
||||
int enchantId = Integer.parseInt(enchantmentSplit[0]);
|
||||
int level = Integer.parseInt(enchantmentSplit[1]);
|
||||
War.war.safelyEnchant(item, Enchantment.getById(enchantId), level);
|
||||
}
|
||||
}
|
||||
}
|
||||
destinationLoadout.put(Integer.parseInt(itemStrSplit[2]), item);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -50,66 +50,16 @@ public class LoadoutYmlMapper {
|
|||
* @param loadoutName The name of the loadout
|
||||
* @return new style loadout
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
public static Loadout fromConfigToLoadout(ConfigurationSection config, HashMap<Integer, ItemStack> loadout, String loadoutName) {
|
||||
List<Integer> slots = config.getIntegerList(loadoutName + ".slots");
|
||||
for (Integer slot : slots) {
|
||||
if (config.isItemStack(loadoutName + "." + Integer.toString(slot))) {
|
||||
loadout.put(slot, config.getItemStack(loadoutName + "." + Integer.toString(slot)));
|
||||
continue;
|
||||
}
|
||||
String prefix = loadoutName + "." + slot + ".";
|
||||
int id = config.getInt(prefix + "id");
|
||||
int amount = config.getInt(prefix + "amount");
|
||||
short durability = (short)config.getInt(prefix + "durability");
|
||||
|
||||
ItemStack stack = new ItemStack(id, amount, durability);
|
||||
stack.setDurability(durability);
|
||||
|
||||
if (config.contains(prefix + "enchantments")) {
|
||||
List<String> enchantmentStringList = config.getStringList(prefix + "enchantments");
|
||||
for (String enchantmentString : enchantmentStringList) {
|
||||
String[] enchantmentStringSplit = enchantmentString.split(",");
|
||||
if (enchantmentStringSplit.length == 2) {
|
||||
int enchantId = Integer.parseInt(enchantmentStringSplit[0]);
|
||||
int level = Integer.parseInt(enchantmentStringSplit[1]);
|
||||
War.war.safelyEnchant(stack, Enchantment.getById(enchantId), level);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (config.contains(prefix + "armorcolor")) {
|
||||
int rgb = config.getInt(prefix + "armorcolor");
|
||||
Color clr = Color.fromRGB(rgb);
|
||||
LeatherArmorMeta meta = (LeatherArmorMeta) stack.getItemMeta();
|
||||
meta.setColor(clr);
|
||||
stack.setItemMeta(meta);
|
||||
}
|
||||
if (config.contains(prefix + "name")) {
|
||||
String itemName = config.getString(prefix + "name");
|
||||
ItemMeta meta = stack.getItemMeta();
|
||||
meta.setDisplayName(itemName);
|
||||
stack.setItemMeta(meta);
|
||||
}
|
||||
if (config.contains(prefix + "lore")) {
|
||||
List<String> itemLore = config.getStringList(prefix + "lore");
|
||||
ItemMeta meta = stack.getItemMeta();
|
||||
meta.setLore(itemLore);
|
||||
stack.setItemMeta(meta);
|
||||
}
|
||||
loadout.put(slot, stack);
|
||||
}
|
||||
String permission = config.getString(loadoutName + ".permission", "");
|
||||
return new Loadout(loadoutName, loadout, permission);
|
||||
}
|
||||
|
||||
public static void fromLoadoutsToConfig(HashMap<String, HashMap<Integer, ItemStack>> loadouts, ConfigurationSection section) {
|
||||
List<String> sortedNames = sortNames(loadouts);
|
||||
|
||||
section.set("names", sortedNames);
|
||||
for (String name : sortedNames) {
|
||||
fromLoadoutToConfig(name, loadouts.get(name), section);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes a list of new style loadouts to the configuration.
|
||||
|
@ -144,11 +94,7 @@ public class LoadoutYmlMapper {
|
|||
}
|
||||
|
||||
private static List<Integer> toIntList(Set<Integer> keySet) {
|
||||
List<Integer> list = new ArrayList<Integer>();
|
||||
for (Integer key : keySet) {
|
||||
list.add(key);
|
||||
}
|
||||
return list;
|
||||
return new ArrayList<Integer>(keySet);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,282 +0,0 @@
|
|||
package com.tommytony.war.mapper;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.block.Chest;
|
||||
import org.bukkit.block.Dispenser;
|
||||
import org.bukkit.block.Sign;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.material.MaterialData;
|
||||
|
||||
import com.tommytony.war.War;
|
||||
import com.tommytony.war.job.DeferredBlockResetsJob;
|
||||
import com.tommytony.war.utility.DeferredBlockReset;
|
||||
import com.tommytony.war.volume.ZoneVolume;
|
||||
|
||||
/**
|
||||
* The ZoneVolumeMapper take the blocks from disk and sets them in the worlds, since the ZoneVolume doesn't hold its blocks in memory like regular Volumes.
|
||||
*
|
||||
* @author tommytony
|
||||
*
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
public class PreDeGaulleZoneVolumeMapper {
|
||||
|
||||
private static List<ItemStack> readInventoryString(String invString) {
|
||||
List<ItemStack> items = new ArrayList<ItemStack>();
|
||||
String[] itemsStrSplit = invString.split(";;");
|
||||
for (String itemStr : itemsStrSplit) {
|
||||
String[] itemStrSplit = itemStr.split(";");
|
||||
if (itemStrSplit.length == 4) {
|
||||
ItemStack stack = new ItemStack(Integer.parseInt(itemStrSplit[0]), Integer.parseInt(itemStrSplit[1]));
|
||||
stack.setData(new MaterialData(stack.getTypeId(), Byte.parseByte(itemStrSplit[3])));
|
||||
short durability = (short) Integer.parseInt(itemStrSplit[2]);
|
||||
stack.setDurability(durability);
|
||||
items.add(stack);
|
||||
} else if (itemStrSplit.length == 3) {
|
||||
ItemStack stack = new ItemStack(Integer.parseInt(itemStrSplit[0]), Integer.parseInt(itemStrSplit[1]));
|
||||
short durability = (short) Integer.parseInt(itemStrSplit[2]);
|
||||
stack.setDurability(durability);
|
||||
items.add(stack);
|
||||
} else {
|
||||
items.add(new ItemStack(Integer.parseInt(itemStrSplit[0]), Integer.parseInt(itemStrSplit[1])));
|
||||
}
|
||||
}
|
||||
return items;
|
||||
}
|
||||
|
||||
public static int load(ZoneVolume volume, String zoneName, World world, boolean onlyLoadCorners) {
|
||||
BufferedReader in = null;
|
||||
int noOfResetBlocks = 0;
|
||||
try {
|
||||
in = new BufferedReader(new FileReader(new File(War.war.getDataFolder().getPath() + "/dat/warzone-" + zoneName + "/volume-" + volume.getName() + ".dat")));
|
||||
String firstLine = in.readLine();
|
||||
|
||||
if (firstLine != null && !firstLine.equals("")) {
|
||||
boolean height129Fix = false;
|
||||
int x1 = Integer.parseInt(in.readLine());
|
||||
int y1 = Integer.parseInt(in.readLine());
|
||||
if (y1 == 128) {
|
||||
height129Fix = true;
|
||||
y1 = 127;
|
||||
}
|
||||
int z1 = Integer.parseInt(in.readLine());
|
||||
in.readLine();
|
||||
int x2 = Integer.parseInt(in.readLine());
|
||||
int y2 = Integer.parseInt(in.readLine());
|
||||
if (y2 == 128) {
|
||||
height129Fix = true;
|
||||
y2 = 127;
|
||||
}
|
||||
int z2 = Integer.parseInt(in.readLine());
|
||||
|
||||
volume.setCornerOne(world.getBlockAt(x1, y1, z1));
|
||||
volume.setCornerTwo(world.getBlockAt(x2, y2, z2));
|
||||
|
||||
if (!onlyLoadCorners) {
|
||||
DeferredBlockResetsJob deferred = new DeferredBlockResetsJob(world);
|
||||
int blockReads = 0, visitedBlocks = 0, x = 0, y = 0, z = 0, i = 0, j = 0, k = 0;
|
||||
int diskBlockType;
|
||||
byte diskBlockData;
|
||||
Block worldBlock;
|
||||
int worldBlockId;
|
||||
volume.clearBlocksThatDontFloat();
|
||||
x = volume.getMinX();
|
||||
String blockLine;
|
||||
String[] blockSplit;
|
||||
for (i = 0; i < volume.getSizeX(); i++) {
|
||||
y = volume.getMinY();
|
||||
for (j = 0; j < volume.getSizeY(); j++) {
|
||||
z = volume.getMinZ();
|
||||
for (k = 0; k < volume.getSizeZ(); k++) {
|
||||
try {
|
||||
blockLine = in.readLine();
|
||||
|
||||
if (blockLine != null && !blockLine.equals("")) {
|
||||
blockSplit = blockLine.split(",");
|
||||
if (blockLine != null && !blockLine.equals("") && blockSplit.length > 1) {
|
||||
diskBlockType = Integer.parseInt(blockSplit[0]);
|
||||
diskBlockData = Byte.parseByte(blockSplit[1]);
|
||||
worldBlock = volume.getWorld().getBlockAt(x, y, z);
|
||||
worldBlockId = worldBlock.getTypeId();
|
||||
if (worldBlockId != diskBlockType || (worldBlockId == diskBlockType && worldBlock.getData() != diskBlockData) || (worldBlockId == diskBlockType && worldBlock.getData() == diskBlockData && (diskBlockType == Material.WALL_SIGN.getId() || diskBlockType == Material.SIGN_POST.getId() || diskBlockType == Material.CHEST.getId() || diskBlockType == Material.DISPENSER.getId()))) {
|
||||
if (diskBlockType == Material.WALL_SIGN.getId() || diskBlockType == Material.SIGN_POST.getId()) {
|
||||
// Signs read
|
||||
String linesStr = "";
|
||||
if (blockSplit.length > 2) {
|
||||
for (int o = 2; o < blockSplit.length; o++) {
|
||||
linesStr += blockSplit[o];
|
||||
}
|
||||
String[] lines = linesStr.split(";;");
|
||||
|
||||
// Signs set
|
||||
// A sign post hanging on a wall south of here will
|
||||
if (diskBlockType == Material.SIGN_POST.getId() && ((diskBlockData & 0x04) == 0x04) && i + 1 != volume.getSizeX()) {
|
||||
deferred.add(new DeferredBlockReset(x, y, z, diskBlockType, diskBlockData, lines));
|
||||
} else {
|
||||
worldBlock.setType(Material.getMaterial(diskBlockType));
|
||||
BlockState state = worldBlock.getState();
|
||||
state.setData(new org.bukkit.material.Sign(diskBlockType, diskBlockData));
|
||||
if (state instanceof Sign) {
|
||||
Sign sign = (Sign) state;
|
||||
if (lines != null && sign.getLines() != null) {
|
||||
if (lines.length > 0) {
|
||||
sign.setLine(0, lines[0]);
|
||||
}
|
||||
if (lines.length > 1) {
|
||||
sign.setLine(1, lines[1]);
|
||||
}
|
||||
if (lines.length > 2) {
|
||||
sign.setLine(2, lines[2]);
|
||||
}
|
||||
if (lines.length > 3) {
|
||||
sign.setLine(3, lines[3]);
|
||||
}
|
||||
sign.update(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (diskBlockType == Material.CHEST.getId()) {
|
||||
// Chests read
|
||||
List<ItemStack> items = null;
|
||||
if (blockSplit.length > 2) {
|
||||
String itemsStr = blockSplit[2];
|
||||
items = PreDeGaulleZoneVolumeMapper.readInventoryString(itemsStr);
|
||||
}
|
||||
|
||||
// Chests set
|
||||
worldBlock.setType(Material.getMaterial(diskBlockType));
|
||||
worldBlock.setData(diskBlockData);
|
||||
BlockState state = worldBlock.getState();
|
||||
if (state instanceof Chest) {
|
||||
Chest chest = (Chest) state;
|
||||
if (items != null) {
|
||||
int ii = 0;
|
||||
chest.getInventory().clear();
|
||||
for (ItemStack item : items) {
|
||||
if (item != null) {
|
||||
chest.getInventory().setItem(ii, item);
|
||||
ii++;
|
||||
}
|
||||
}
|
||||
chest.update(true);
|
||||
}
|
||||
}
|
||||
} else if (diskBlockType == Material.DISPENSER.getId()) {
|
||||
// Dispensers read
|
||||
List<ItemStack> items = null;
|
||||
if (blockSplit.length > 2) {
|
||||
String itemsStr = blockSplit[2];
|
||||
// String itemsStr = lineScanner.nextLine();
|
||||
items = PreDeGaulleZoneVolumeMapper.readInventoryString(itemsStr);
|
||||
}
|
||||
|
||||
// Dispensers set
|
||||
worldBlock.setType(Material.getMaterial(diskBlockType));
|
||||
worldBlock.setData(diskBlockData);
|
||||
BlockState state = worldBlock.getState();
|
||||
if (state instanceof Dispenser) {
|
||||
Dispenser dispenser = (Dispenser) state;
|
||||
if (items != null) {
|
||||
int ii = 0;
|
||||
dispenser.getInventory().clear();
|
||||
for (ItemStack item : items) {
|
||||
if (item != null) {
|
||||
dispenser.getInventory().setItem(ii, item);
|
||||
ii++;
|
||||
}
|
||||
}
|
||||
dispenser.update(true);
|
||||
}
|
||||
}
|
||||
} else if (diskBlockType == Material.WOODEN_DOOR.getId() || diskBlockType == Material.IRON_DOOR_BLOCK.getId()) {
|
||||
// Door blocks
|
||||
|
||||
if (j - 1 > 0) {
|
||||
Block blockBelow = world.getBlockAt(x, y - 1, z);
|
||||
boolean belowIsGlass = blockBelow.getTypeId() == Material.GLASS.getId();
|
||||
// Set current block to glass if block below isn't glass.
|
||||
// Having a glass block below means the current block is a door top.
|
||||
if (belowIsGlass) {
|
||||
// Top door block. Set both it and the block below as door.
|
||||
blockBelow.setType(Material.getMaterial(diskBlockType));
|
||||
blockBelow.setData(diskBlockData);
|
||||
worldBlock.setType(Material.getMaterial(diskBlockType));
|
||||
worldBlock.setData(diskBlockData);
|
||||
} else {
|
||||
worldBlock.setType(Material.GLASS);
|
||||
}
|
||||
}
|
||||
|
||||
} else if (((diskBlockType == Material.TORCH.getId() && ((diskBlockData & 0x02) == 0x02)) || (diskBlockType == Material.REDSTONE_TORCH_OFF.getId() && ((diskBlockData & 0x02) == 0x02)) || (diskBlockType == Material.REDSTONE_TORCH_ON.getId() && ((diskBlockData & 0x02) == 0x02)) || (diskBlockType == Material.LEVER.getId() && ((diskBlockData & 0x02) == 0x02)) || (diskBlockType == Material.STONE_BUTTON.getId() && ((diskBlockData & 0x02) == 0x02)) || (diskBlockType == Material.LADDER.getId() && ((diskBlockData & 0x04) == 0x04)) || (diskBlockType == Material.RAILS.getId() && ((diskBlockData & 0x02) == 0x02))) && i + 1 != volume.getSizeX()) {
|
||||
// Blocks that hang on a block south of themselves need to make sure that block is there before placing themselves... lol
|
||||
// Change the block itself later on:
|
||||
deferred.add(new DeferredBlockReset(x, y, z, diskBlockType, diskBlockData));
|
||||
} else {
|
||||
// regular block
|
||||
worldBlock.setType(Material.getMaterial(diskBlockType));
|
||||
worldBlock.setData(diskBlockData);
|
||||
}
|
||||
noOfResetBlocks++;
|
||||
}
|
||||
visitedBlocks++;
|
||||
}
|
||||
blockReads++;
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
War.war.getLogger().warning("Failed to reset block in zone volume " + volume.getName() + ". " + "Blocks read: " + blockReads + ". Visited blocks so far:" + visitedBlocks + ". Blocks reset: " + noOfResetBlocks + ". Error at x:" + x + " y:" + y + " z:" + z + ". Exception:" + e.getClass().toString() + " " + e.getMessage());
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
z++;
|
||||
}
|
||||
}
|
||||
if (height129Fix && j == volume.getSizeY() - 1) {
|
||||
for (int skip = 0; skip < volume.getSizeZ(); skip++) {
|
||||
in.readLine(); // throw away the extra vertical block I used to save pre 0.8
|
||||
// scanner.nextLine();
|
||||
}
|
||||
}
|
||||
y++;
|
||||
}
|
||||
x++;
|
||||
}
|
||||
if (!deferred.isEmpty()) {
|
||||
War.war.getServer().getScheduler().scheduleSyncDelayedTask(War.war, deferred, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
War.war.log("Failed to read volume file " + volume.getName() + " for warzone " + zoneName + ". " + e.getClass().getName() + " " + e.getMessage(), Level.WARNING);
|
||||
e.printStackTrace();
|
||||
} catch (Exception e) {
|
||||
War.war.log("Unexpected error caused failure to read volume file " + zoneName + " for warzone " + volume.getName() + ". " + e.getClass().getName() + " " + e.getMessage(), Level.WARNING);
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
if (in != null) {
|
||||
// if (scanner != null)
|
||||
try {
|
||||
in.close();
|
||||
in = null;
|
||||
// scanner.close();
|
||||
// scanner = null;
|
||||
} catch (IOException e) {
|
||||
War.war.log("Failed to close file reader for volume " + volume.getName() + " for warzone " + zoneName + ". " + e.getClass().getName() + " " + e.getMessage(), Level.WARNING);
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
return noOfResetBlocks;
|
||||
}
|
||||
}
|
|
@ -1,459 +0,0 @@
|
|||
package com.tommytony.war.mapper;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.FileReader;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.block.Chest;
|
||||
import org.bukkit.block.Dispenser;
|
||||
import org.bukkit.block.Sign;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
|
||||
import com.tommytony.war.War;
|
||||
import com.tommytony.war.job.DeferredBlockResetsJob;
|
||||
import com.tommytony.war.job.ZoneVolumeSaveJob;
|
||||
import com.tommytony.war.utility.DeferredBlockReset;
|
||||
import com.tommytony.war.volume.Volume;
|
||||
import com.tommytony.war.volume.ZoneVolume;
|
||||
|
||||
/**
|
||||
* The ZoneVolumeMapper take the blocks from disk and sets them in the worlds, since the ZoneVolume doesn't hold its blocks in memory like regular Volumes.
|
||||
*
|
||||
* @author tommytony, Tim Düsterhus
|
||||
* @package com.tommytony.war.mappers
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
public class PreNimitzZoneVolumeMapper {
|
||||
|
||||
/**
|
||||
* Loads the given volume
|
||||
*
|
||||
* @param ZoneVolume
|
||||
* volume Volume to load
|
||||
* @param String
|
||||
* zoneName Zone to load the volume from
|
||||
* @param World
|
||||
* world The world the zone is located
|
||||
* @param boolean onlyLoadCorners Should only the corners be loaded
|
||||
* @return integer Changed blocks
|
||||
*/
|
||||
public static int load(ZoneVolume volume, String zoneName, World world, boolean onlyLoadCorners) {
|
||||
File cornersFile = new File(War.war.getDataFolder().getPath() + "/dat/warzone-" + zoneName + "/volume-" + volume.getName() + ".corners");
|
||||
File blocksFile = new File(War.war.getDataFolder().getPath() + "/dat/warzone-" + zoneName + "/volume-" + volume.getName() + ".blocks");
|
||||
File signsFile = new File(War.war.getDataFolder().getPath() + "/dat/warzone-" + zoneName + "/volume-" + volume.getName() + ".signs");
|
||||
File invsFile = new File(War.war.getDataFolder().getPath() + "/dat/warzone-" + zoneName + "/volume-" + volume.getName() + ".invs");
|
||||
int noOfResetBlocks = 0;
|
||||
boolean failed = false;
|
||||
if (!blocksFile.exists()) {
|
||||
// The post 1.6 formatted files haven't been created yet so
|
||||
// we need to use the old load.
|
||||
noOfResetBlocks = PreDeGaulleZoneVolumeMapper.load(volume, zoneName, world, onlyLoadCorners);
|
||||
|
||||
// The new 1.6 files aren't created yet. We just reset the zone (except deferred blocks which will soon execute on main thread ),
|
||||
// so let's save to the new format as soon as the zone is fully reset.
|
||||
PreNimitzZoneVolumeMapper.saveAsJob(volume, zoneName, 2);
|
||||
War.war.log("Warzone " + zoneName + " file converted!", Level.INFO);
|
||||
|
||||
return noOfResetBlocks;
|
||||
} else {
|
||||
// 1.6 file exist, so go ahead with reset
|
||||
BufferedReader cornersReader = null;
|
||||
FileInputStream blocksStream = null;
|
||||
BufferedReader signsReader = null;
|
||||
BufferedReader invsReader = null;
|
||||
try {
|
||||
cornersReader = new BufferedReader(new FileReader(cornersFile));
|
||||
blocksStream = new FileInputStream(blocksFile);
|
||||
signsReader = new BufferedReader(new FileReader(signsFile));
|
||||
invsReader = new BufferedReader(new FileReader(invsFile));
|
||||
|
||||
// Get the corners
|
||||
cornersReader.readLine();
|
||||
int x1 = Integer.parseInt(cornersReader.readLine());
|
||||
int y1 = Integer.parseInt(cornersReader.readLine());
|
||||
int z1 = Integer.parseInt(cornersReader.readLine());
|
||||
cornersReader.readLine();
|
||||
int x2 = Integer.parseInt(cornersReader.readLine());
|
||||
int y2 = Integer.parseInt(cornersReader.readLine());
|
||||
int z2 = Integer.parseInt(cornersReader.readLine());
|
||||
|
||||
volume.setCornerOne(world.getBlockAt(x1, y1, z1));
|
||||
volume.setCornerTwo(world.getBlockAt(x2, y2, z2));
|
||||
|
||||
// Allocate block byte arrays
|
||||
int noOfBlocks = volume.getSizeX() * volume.getSizeY() * volume.getSizeZ();
|
||||
byte[] blockBytes = new byte[noOfBlocks * 2]; // one byte for type, one for data
|
||||
|
||||
blocksStream.read(blockBytes); // read it all
|
||||
|
||||
// Now use the block bytes to reset the world blocks
|
||||
if (!onlyLoadCorners) {
|
||||
DeferredBlockResetsJob deferred = new DeferredBlockResetsJob(world);
|
||||
int blockReads = 0, visitedBlocks = 0, x = 0, y = 0, z = 0, i = 0, j = 0, k = 0;
|
||||
int diskBlockType;
|
||||
byte diskBlockData;
|
||||
Block worldBlock;
|
||||
int worldBlockId;
|
||||
volume.clearBlocksThatDontFloat();
|
||||
x = volume.getMinX();
|
||||
for (i = 0; i < volume.getSizeX(); i++) {
|
||||
y = volume.getMinY();
|
||||
for (j = 0; j < volume.getSizeY(); j++) {
|
||||
z = volume.getMinZ();
|
||||
for (k = 0; k < volume.getSizeZ(); k++) {
|
||||
try {
|
||||
diskBlockType = blockBytes[visitedBlocks * 2];
|
||||
diskBlockData = blockBytes[visitedBlocks * 2 + 1];
|
||||
|
||||
worldBlock = volume.getWorld().getBlockAt(x, y, z);
|
||||
worldBlockId = worldBlock.getTypeId();
|
||||
if (worldBlockId != diskBlockType || (worldBlockId == diskBlockType && worldBlock.getData() != diskBlockData) || (worldBlockId == diskBlockType && worldBlock.getData() == diskBlockData && (diskBlockType == Material.WALL_SIGN.getId() || diskBlockType == Material.SIGN_POST.getId() || diskBlockType == Material.CHEST.getId() || diskBlockType == Material.DISPENSER.getId()))) {
|
||||
if (diskBlockType == Material.WALL_SIGN.getId() || diskBlockType == Material.SIGN_POST.getId()) {
|
||||
// Signs read
|
||||
String linesStr = signsReader.readLine();
|
||||
String[] lines = linesStr.split(";;");
|
||||
|
||||
// Signs set
|
||||
if (diskBlockType == Material.WALL_SIGN.getId() && ((diskBlockData & 0x04) == 0x04) && i + 1 != volume.getSizeX()) {
|
||||
// A sign post hanging on a wall south of here needs that block to be set first
|
||||
deferred.add(new DeferredBlockReset(x, y, z, diskBlockType, diskBlockData, lines));
|
||||
} else {
|
||||
worldBlock.setType(Material.getMaterial(diskBlockType));
|
||||
BlockState state = worldBlock.getState();
|
||||
state.setData(new org.bukkit.material.Sign(diskBlockType, diskBlockData));
|
||||
if (state instanceof Sign) {
|
||||
Sign sign = (Sign) state;
|
||||
if (lines != null && sign.getLines() != null) {
|
||||
if (lines.length > 0) {
|
||||
sign.setLine(0, lines[0]);
|
||||
}
|
||||
if (lines.length > 1) {
|
||||
sign.setLine(1, lines[1]);
|
||||
}
|
||||
if (lines.length > 2) {
|
||||
sign.setLine(2, lines[2]);
|
||||
}
|
||||
if (lines.length > 3) {
|
||||
sign.setLine(3, lines[3]);
|
||||
}
|
||||
sign.update(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (diskBlockType == Material.CHEST.getId()) {
|
||||
// Chests read
|
||||
List<ItemStack> items = VolumeMapper.readInventoryString(invsReader.readLine());
|
||||
|
||||
// Chests set
|
||||
worldBlock.setType(Material.getMaterial(diskBlockType));
|
||||
worldBlock.setData(diskBlockData);
|
||||
BlockState state = worldBlock.getState();
|
||||
if (state instanceof Chest) {
|
||||
Chest chest = (Chest) state;
|
||||
if (items != null) {
|
||||
int ii = 0;
|
||||
chest.getInventory().clear();
|
||||
for (ItemStack item : items) {
|
||||
if (item != null) {
|
||||
chest.getInventory().setItem(ii, item);
|
||||
ii++;
|
||||
}
|
||||
}
|
||||
chest.update(true);
|
||||
}
|
||||
}
|
||||
} else if (diskBlockType == Material.DISPENSER.getId()) {
|
||||
// Dispensers read
|
||||
List<ItemStack> items = VolumeMapper.readInventoryString(invsReader.readLine());
|
||||
|
||||
// Dispensers set
|
||||
worldBlock.setType(Material.getMaterial(diskBlockType));
|
||||
worldBlock.setData(diskBlockData);
|
||||
BlockState state = worldBlock.getState();
|
||||
if (state instanceof Dispenser) {
|
||||
Dispenser dispenser = (Dispenser) state;
|
||||
if (items != null) {
|
||||
int ii = 0;
|
||||
dispenser.getInventory().clear();
|
||||
for (ItemStack item : items) {
|
||||
if (item != null) {
|
||||
dispenser.getInventory().setItem(ii, item);
|
||||
ii++;
|
||||
}
|
||||
}
|
||||
dispenser.update(true);
|
||||
}
|
||||
}
|
||||
} else if (diskBlockType == Material.WOODEN_DOOR.getId() || diskBlockType == Material.IRON_DOOR_BLOCK.getId()) {
|
||||
// Door blocks
|
||||
deferred.add(new DeferredBlockReset(x, y, z, diskBlockType, diskBlockData));
|
||||
} else if (((diskBlockType == Material.TORCH.getId() && ((diskBlockData & 0x02) == 0x02)) || (diskBlockType == Material.REDSTONE_TORCH_OFF.getId() && ((diskBlockData & 0x02) == 0x02)) || (diskBlockType == Material.REDSTONE_TORCH_ON.getId() && ((diskBlockData & 0x02) == 0x02)) || (diskBlockType == Material.LEVER.getId() && ((diskBlockData & 0x02) == 0x02)) || (diskBlockType == Material.STONE_BUTTON.getId() && ((diskBlockData & 0x02) == 0x02)) || (diskBlockType == Material.LADDER.getId() && ((diskBlockData & 0x04) == 0x04)) || (diskBlockType == Material.RAILS.getId() && ((diskBlockData & 0x02) == 0x02))) && i + 1 != volume.getSizeX()) {
|
||||
// Blocks that hang on a block south of themselves need to make sure that block is there before placing themselves... lol
|
||||
// Change the block itself later on:
|
||||
deferred.add(new DeferredBlockReset(x, y, z, diskBlockType, diskBlockData));
|
||||
} else {
|
||||
// regular block
|
||||
if (diskBlockType >= 0) {
|
||||
worldBlock.setType(Material.getMaterial(diskBlockType));
|
||||
worldBlock.setData(diskBlockData);
|
||||
} else {
|
||||
// The larger than 127 block types were stored as bytes,
|
||||
// but now -128 to -1 are the result of the bad cast from byte
|
||||
// to int array above. To make matters worse let's make this
|
||||
// quick a dirty patch. Anyway everything will break horribly
|
||||
// once block ids get higher than 255.
|
||||
worldBlock.setType(Material.getMaterial(256 + diskBlockType));
|
||||
worldBlock.setData(diskBlockData);
|
||||
}
|
||||
}
|
||||
noOfResetBlocks++;
|
||||
}
|
||||
visitedBlocks++;
|
||||
|
||||
blockReads++;
|
||||
|
||||
} catch (Exception e) {
|
||||
if (!failed) {
|
||||
// Don't spam the console
|
||||
War.war.getLogger().warning("Failed to reset block in zone volume " + volume.getName() + ". " + "Blocks read: " + blockReads + ". Visited blocks so far:" + visitedBlocks + ". Blocks reset: " + noOfResetBlocks + ". Error at x:" + x + " y:" + y + " z:" + z + ". Exception:" + e.getClass().toString() + " " + e.getMessage());
|
||||
e.printStackTrace();
|
||||
failed = true;
|
||||
}
|
||||
} finally {
|
||||
z++;
|
||||
}
|
||||
}
|
||||
y++;
|
||||
}
|
||||
x++;
|
||||
}
|
||||
if (!deferred.isEmpty()) {
|
||||
War.war.getServer().getScheduler().scheduleSyncDelayedTask(War.war, deferred, 2);
|
||||
}
|
||||
}
|
||||
} catch (FileNotFoundException e) {
|
||||
War.war.log("Failed to find volume file " + volume.getName() + " for warzone " + zoneName + ". " + e.getClass().getName() + " " + e.getMessage(), Level.WARNING);
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
War.war.log("Failed to read volume file " + volume.getName() + " for warzone " + zoneName + ". " + e.getClass().getName() + " " + e.getMessage(), Level.WARNING);
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
try {
|
||||
if (cornersReader != null) {
|
||||
cornersReader.close();
|
||||
}
|
||||
if (blocksStream != null) {
|
||||
blocksStream.close();
|
||||
}
|
||||
if (signsReader != null) {
|
||||
signsReader.close();
|
||||
}
|
||||
if (invsReader != null) {
|
||||
invsReader.close();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
War.war.log("Failed to close volume file " + volume.getName() + " for warzone " + zoneName + ". " + e.getClass().getName() + " " + e.getMessage(), Level.WARNING);
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
return noOfResetBlocks;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves the given volume
|
||||
*
|
||||
* @param Volume
|
||||
* volume Volume to save
|
||||
* @param String
|
||||
* zoneName The warzone the volume is located
|
||||
* @return integer Number of written blocks
|
||||
*/
|
||||
public static int save(Volume volume, String zoneName) {
|
||||
int noOfSavedBlocks = 0;
|
||||
if (volume.hasTwoCorners()) {
|
||||
BufferedWriter cornersWriter = null;
|
||||
FileOutputStream blocksOutput = null;
|
||||
BufferedWriter signsWriter = null;
|
||||
BufferedWriter invsWriter = null;
|
||||
try {
|
||||
(new File(War.war.getDataFolder().getPath() + "/dat/warzone-" + zoneName)).mkdir();
|
||||
String path = War.war.getDataFolder().getPath() + "/dat/warzone-" + zoneName + "/volume-" + volume.getName();
|
||||
cornersWriter = new BufferedWriter(new FileWriter(new File(path + ".corners")));
|
||||
blocksOutput = new FileOutputStream(new File(path + ".blocks"));
|
||||
signsWriter = new BufferedWriter(new FileWriter(new File(path + ".signs")));
|
||||
invsWriter = new BufferedWriter(new FileWriter(new File(path + ".invs")));
|
||||
|
||||
cornersWriter.write("corner1");
|
||||
cornersWriter.newLine();
|
||||
cornersWriter.write(Integer.toString(volume.getCornerOne().getBlockX()));
|
||||
cornersWriter.newLine();
|
||||
cornersWriter.write(Integer.toString(volume.getCornerOne().getBlockY()));
|
||||
cornersWriter.newLine();
|
||||
cornersWriter.write(Integer.toString(volume.getCornerOne().getBlockZ()));
|
||||
cornersWriter.newLine();
|
||||
cornersWriter.write("corner2");
|
||||
cornersWriter.newLine();
|
||||
cornersWriter.write(Integer.toString(volume.getCornerTwo().getBlockX()));
|
||||
cornersWriter.newLine();
|
||||
cornersWriter.write(Integer.toString(volume.getCornerTwo().getBlockY()));
|
||||
cornersWriter.newLine();
|
||||
cornersWriter.write(Integer.toString(volume.getCornerTwo().getBlockZ()));
|
||||
cornersWriter.newLine();
|
||||
|
||||
int x = 0;
|
||||
int y = 0;
|
||||
int z = 0;
|
||||
Block block;
|
||||
int typeId;
|
||||
byte data;
|
||||
BlockState state;
|
||||
|
||||
x = volume.getMinX();
|
||||
for (int i = 0; i < volume.getSizeX(); i++) {
|
||||
y = volume.getMinY();
|
||||
for (int j = 0; j < volume.getSizeY(); j++) {
|
||||
z = volume.getMinZ();
|
||||
for (int k = 0; k < volume.getSizeZ(); k++) {
|
||||
try {
|
||||
block = volume.getWorld().getBlockAt(x, y, z);
|
||||
typeId = block.getTypeId();
|
||||
data = block.getData();
|
||||
state = block.getState();
|
||||
|
||||
blocksOutput.write((byte) typeId);
|
||||
blocksOutput.write(data);
|
||||
|
||||
if (state instanceof Sign) {
|
||||
// Signs
|
||||
String extra = "";
|
||||
Sign sign = (Sign) state;
|
||||
if (sign.getLines() != null) {
|
||||
for (String line : sign.getLines()) {
|
||||
extra += line + ";;";
|
||||
}
|
||||
signsWriter.write(extra);
|
||||
signsWriter.newLine();
|
||||
}
|
||||
} else if (state instanceof Chest) {
|
||||
// Chests
|
||||
Chest chest = (Chest) state;
|
||||
Inventory inv = chest.getInventory();
|
||||
List<ItemStack> items = VolumeMapper.getItemListFromInv(inv);
|
||||
invsWriter.write(VolumeMapper.buildInventoryStringFromItemList(items));
|
||||
invsWriter.newLine();
|
||||
} else if (state instanceof Dispenser) {
|
||||
// Dispensers
|
||||
Dispenser dispenser = (Dispenser) state;
|
||||
Inventory inv = dispenser.getInventory();
|
||||
List<ItemStack> items = VolumeMapper.getItemListFromInv(inv);
|
||||
invsWriter.write(VolumeMapper.buildInventoryStringFromItemList(items));
|
||||
invsWriter.newLine();
|
||||
}
|
||||
noOfSavedBlocks++;
|
||||
} catch (Exception e) {
|
||||
War.war.log("Unexpected error while saving a block to " + " file for zone " + zoneName + ". Blocks saved so far: " + noOfSavedBlocks + "Position: x:" + x + " y:" + y + " z:" + z + ". " + e.getClass().getName() + " " + e.getMessage(), Level.WARNING);
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
z++;
|
||||
}
|
||||
}
|
||||
y++;
|
||||
}
|
||||
x++;
|
||||
}
|
||||
} catch (IOException e) {
|
||||
War.war.log("Failed to write volume file " + zoneName + " for warzone " + volume.getName() + ". " + e.getClass().getName() + " " + e.getMessage(), Level.WARNING);
|
||||
e.printStackTrace();
|
||||
} catch (Exception e) {
|
||||
War.war.log("Unexpected error caused failure to write volume file " + zoneName + " for warzone " + volume.getName() + ". " + e.getClass().getName() + " " + e.getMessage(), Level.WARNING);
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
try {
|
||||
if (cornersWriter != null) {
|
||||
cornersWriter.close();
|
||||
}
|
||||
if (blocksOutput != null) {
|
||||
blocksOutput.close();
|
||||
}
|
||||
if (signsWriter != null) {
|
||||
signsWriter.close();
|
||||
}
|
||||
if (invsWriter != null) {
|
||||
invsWriter.close();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
War.war.log("Failed to close volume file " + volume.getName() + " for warzone " + zoneName + ". " + e.getClass().getName() + " " + e.getMessage(), Level.WARNING);
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
return noOfSavedBlocks;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Saves the Volume as a background-job
|
||||
*
|
||||
* @param ZoneVolme
|
||||
* volume volume to save
|
||||
* @param String
|
||||
* zoneName The zone the volume is located
|
||||
* @param War
|
||||
* war Instance of war
|
||||
* @param long tickDelay delay before beginning the task
|
||||
*/
|
||||
private static void saveAsJob(ZoneVolume volume, String zoneName, long tickDelay) {
|
||||
ZoneVolumeSaveJob job = new ZoneVolumeSaveJob(volume, zoneName);
|
||||
War.war.getServer().getScheduler().scheduleSyncDelayedTask(War.war, job, tickDelay);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes the given volume
|
||||
*
|
||||
* @param Volume
|
||||
* volume volume to delete
|
||||
* @param War
|
||||
* war Instance of war
|
||||
*/
|
||||
public static void delete(Volume volume) {
|
||||
PreNimitzZoneVolumeMapper.deleteFile(War.war.getDataFolder().getPath() + "/dat/volume-" + volume.getName() + ".dat");
|
||||
PreNimitzZoneVolumeMapper.deleteFile(War.war.getDataFolder().getPath() + "/dat/volume-" + volume.getName() + ".corners");
|
||||
PreNimitzZoneVolumeMapper.deleteFile(War.war.getDataFolder().getPath() + "/dat/volume-" + volume.getName() + ".blocks");
|
||||
PreNimitzZoneVolumeMapper.deleteFile(War.war.getDataFolder().getPath() + "/dat/volume-" + volume.getName() + ".signs");
|
||||
PreNimitzZoneVolumeMapper.deleteFile(War.war.getDataFolder().getPath() + "/dat/volume-" + volume.getName() + ".invs");
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes a volume file
|
||||
*
|
||||
* @param String
|
||||
* path path of file
|
||||
* @param War
|
||||
* war Instance of war
|
||||
*/
|
||||
private static void deleteFile(String path) {
|
||||
File volFile = new File(path);
|
||||
if (volFile.exists()) {
|
||||
boolean deletedData = volFile.delete();
|
||||
if (!deletedData) {
|
||||
War.war.log("Failed to delete file " + volFile.getName(), Level.WARNING);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,407 +0,0 @@
|
|||
package com.tommytony.war.mapper;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.logging.Logger;
|
||||
import java.io.FileInputStream;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
|
||||
/**
|
||||
* Used for accessing and creating .[properties] files, reads them as utf-8, saves as utf-8. Internationalization is key importance especially for character codes.
|
||||
*
|
||||
* @author Nijikokun
|
||||
* @version 1.0.4, %G%
|
||||
*/
|
||||
public final class PropertiesFile {
|
||||
|
||||
private static final Logger log = Logger.getLogger("Minecraft");
|
||||
private String fileName;
|
||||
private Properties props = new Properties();
|
||||
private FileInputStream inputStream;
|
||||
private FileOutputStream outputStream;
|
||||
|
||||
// private List<String> lines = new ArrayList<String>();
|
||||
// private Map<String, String> props = new HashMap<String, String>();
|
||||
|
||||
/**
|
||||
* Creates or opens a properties file using specified filename
|
||||
*
|
||||
* @param fileName
|
||||
*/
|
||||
public PropertiesFile(String fileName) {
|
||||
this.fileName = fileName;
|
||||
|
||||
File file = new File(fileName);
|
||||
|
||||
try {
|
||||
if (file.exists()) {
|
||||
this.load();
|
||||
} else {
|
||||
this.save();
|
||||
}
|
||||
} catch (IOException ex) {
|
||||
PropertiesFile.log.severe("[PropertiesFile] Unable to load " + fileName + "!");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The loader for property files, it reads the file as UTF8 or converts the string into UTF8. Used for simple runthrough's, loading, or reloading of the file.
|
||||
*
|
||||
* @throws IOException
|
||||
*/
|
||||
public void load() throws IOException {
|
||||
this.inputStream = new FileInputStream(this.fileName);
|
||||
this.props.load(this.inputStream);
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes out the <code>key=value</code> properties that were changed into a .[properties] file in UTF8.
|
||||
*/
|
||||
public void save() {
|
||||
try {
|
||||
this.outputStream = new FileOutputStream(this.fileName);
|
||||
this.props.store(this.outputStream, null);
|
||||
} catch (IOException ex) {
|
||||
PropertiesFile.log.severe("[PropertiesFile] Unable to save " + this.fileName + "!");
|
||||
}
|
||||
}
|
||||
|
||||
public void close() {
|
||||
if (this.outputStream != null) {
|
||||
try {
|
||||
this.outputStream.close();
|
||||
} catch (IOException e) {
|
||||
PropertiesFile.log.severe("[PropertiesFile] Failed to close " + this.fileName + " writer!");
|
||||
}
|
||||
} else if (this.inputStream != null) {
|
||||
try {
|
||||
this.inputStream.close();
|
||||
} catch (IOException e) {
|
||||
PropertiesFile.log.severe("[PropertiesFile] Failed to close " + this.fileName + " reader!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a Map of all <code>key=value</code> properties in the file as <code><key (java.lang.String), value (java.lang.String)></code> <br />
|
||||
* <br />
|
||||
* Example: <blockquote>
|
||||
*
|
||||
* <pre>
|
||||
* PropertiesFile settings = new PropertiesFile("settings.properties");
|
||||
* Map<String, String> mappedSettings;
|
||||
*
|
||||
* try {
|
||||
* mappedSettings = settings.returnMap();
|
||||
* } catch (Exception ex) {
|
||||
* log.info("Failed mapping settings.properties");
|
||||
* }
|
||||
* </pre>
|
||||
*
|
||||
* </blockquote>
|
||||
*
|
||||
* @return <code>map</code> - Simple Map HashMap of the entire <code>key=value</code> as <code><key (java.lang.String), value (java.lang.String)></code>
|
||||
* @throws Exception
|
||||
* If the properties file doesn't exist.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public Map<String, String> returnMap() throws Exception {
|
||||
return (Map<String, String>) this.props.clone();
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks to see if the .[properties] file contains the given <code>key</code>.
|
||||
*
|
||||
* @param var
|
||||
* The key we are going to be checking the existance of.
|
||||
* @return <code>Boolean</code> - True if the <code>key</code> exists, false if it cannot be found.
|
||||
*/
|
||||
public boolean containsKey(String var) {
|
||||
return this.props.containsKey(var);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks to see if this <code>key</code> exists in the .[properties] file.
|
||||
*
|
||||
* @param var
|
||||
* The key we are grabbing the value of.
|
||||
* @return <code>java.lang.String</code> - True if the <code>key</code> exists, false if it cannot be found.
|
||||
*/
|
||||
public String getProperty(String var) {
|
||||
return this.props.getProperty(var);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a key from the file if it exists. This will save() which will invoke a load() on the file.
|
||||
*
|
||||
* @see #save()
|
||||
* @param var
|
||||
* The <code>key</code> that will be removed from the file
|
||||
*/
|
||||
public void removeKey(String var) {
|
||||
if (this.props.containsKey(var)) {
|
||||
this.props.remove(var);
|
||||
this.save();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks the existance of a <code>key</code>.
|
||||
*
|
||||
* @see #containsKey(java.lang.String)
|
||||
* @param key
|
||||
* The <code>key</code> in question of existance.
|
||||
* @return <code>Boolean</code> - True for existance, false for <code>key</code> found.
|
||||
*/
|
||||
public boolean keyExists(String key) {
|
||||
return this.containsKey(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the value of the <code>key</code> given as a <code>String</code>, however we do not set a string if no <code>key</code> is found.
|
||||
*
|
||||
* @see #getProperty(java.lang.String)
|
||||
* @param key
|
||||
* The <code>key</code> we will retrieve the property from, if no <code>key</code> is found default to "" or empty.
|
||||
*/
|
||||
public String getString(String key) {
|
||||
if (this.containsKey(key)) {
|
||||
return this.getProperty(key);
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the value of the <code>key</code> given as a <code>String</code>. If it is not found, it will invoke saving the default <code>value</code> to the properties file.
|
||||
*
|
||||
* @see #setString(java.lang.String, java.lang.String)
|
||||
* @see #getProperty(java.lang.String)
|
||||
* @param key
|
||||
* The key that we will be grabbing the value from, if no value is found set and return <code>value</code>
|
||||
* @param value
|
||||
* The default value that we will be setting if no prior <code>key</code> is found.
|
||||
* @return java.lang.String Either we will return the default value or a prior existing value depending on existance.
|
||||
*/
|
||||
public String getString(String key, String value) {
|
||||
if (this.containsKey(key)) {
|
||||
return this.getProperty(key);
|
||||
}
|
||||
|
||||
this.setString(key, value);
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Save the value given as a <code>String</code> on the specified key.
|
||||
*
|
||||
* @see #save()
|
||||
* @param key
|
||||
* The <code>key</code> that we will be addressing the <code>value</code> to.
|
||||
* @param value
|
||||
* The <code>value</code> we will be setting inside the <code>.[properties]</code> file.
|
||||
*/
|
||||
public void setString(String key, String value) {
|
||||
this.props.put(key, value);
|
||||
this.save();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the value of the <code>key</code> given in a Integer, however we do not set a string if no <code>key</code> is found.
|
||||
*
|
||||
* @see #getProperty(String var)
|
||||
* @param key
|
||||
* The <code>key</code> we will retrieve the property from, if no <code>key</code> is found default to 0
|
||||
*/
|
||||
public int getInt(String key) {
|
||||
if (this.containsKey(key)) {
|
||||
return Integer.parseInt(this.getProperty(key));
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the int value of a key
|
||||
*
|
||||
* @see #setInt(String key, int value)
|
||||
* @param key
|
||||
* The key that we will be grabbing the value from, if no value is found set and return <code>value</code>
|
||||
* @param value
|
||||
* The default value that we will be setting if no prior <code>key</code> is found.
|
||||
* @return <code>Integer</code> - Either we will return the default value or a prior existing value depending on existance.
|
||||
*/
|
||||
public int getInt(String key, int value) {
|
||||
if (this.containsKey(key)) {
|
||||
return Integer.parseInt(this.getProperty(key));
|
||||
}
|
||||
|
||||
this.setInt(key, value);
|
||||
return value;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Save the value given as a <code>int</code> on the specified key.
|
||||
*
|
||||
* @see #save()
|
||||
* @param key
|
||||
* The <code>key</code> that we will be addressing the <code>value</code> to.
|
||||
* @param value
|
||||
* The <code>value</code> we will be setting inside the <code>.[properties]</code> file.
|
||||
*/
|
||||
public void setInt(String key, int value) {
|
||||
this.props.put(key, String.valueOf(value));
|
||||
|
||||
this.save();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the value of the <code>key</code> given in a Double, however we do not set a string if no <code>key</code> is found.
|
||||
*
|
||||
* @see #getProperty(String var)
|
||||
* @param key
|
||||
* The <code>key</code> we will retrieve the property from, if no <code>key</code> is found default to 0.0
|
||||
*/
|
||||
public double getDouble(String key) {
|
||||
if (this.containsKey(key)) {
|
||||
return Double.parseDouble(this.getProperty(key));
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the double value of a key
|
||||
*
|
||||
* @see #setDouble(String key, double value)
|
||||
* @param key
|
||||
* The key that we will be grabbing the value from, if no value is found set and return <code>value</code>
|
||||
* @param value
|
||||
* The default value that we will be setting if no prior <code>key</code> is found.
|
||||
* @return <code>Double</code> - Either we will return the default value or a prior existing value depending on existance.
|
||||
*/
|
||||
public double getDouble(String key, double value) {
|
||||
if (this.containsKey(key)) {
|
||||
return Double.parseDouble(this.getProperty(key));
|
||||
}
|
||||
|
||||
this.setDouble(key, value);
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Save the value given as a <code>double</code> on the specified key.
|
||||
*
|
||||
* @see #save()
|
||||
* @param key
|
||||
* The <code>key</code> that we will be addressing the <code>value</code> to.
|
||||
* @param value
|
||||
* The <code>value</code> we will be setting inside the <code>.[properties]</code> file.
|
||||
*/
|
||||
public void setDouble(String key, double value) {
|
||||
this.props.put(key, String.valueOf(value));
|
||||
|
||||
this.save();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the value of the <code>key</code> given in a Long, however we do not set a string if no <code>key</code> is found.
|
||||
*
|
||||
* @see #getProperty(String var)
|
||||
* @param key
|
||||
* The <code>key</code> we will retrieve the property from, if no <code>key</code> is found default to 0L
|
||||
*/
|
||||
public long getLong(String key) {
|
||||
if (this.containsKey(key)) {
|
||||
return Long.parseLong(this.getProperty(key));
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the long value of a key
|
||||
*
|
||||
* @see #setLong(String key, long value)
|
||||
* @param key
|
||||
* The key that we will be grabbing the value from, if no value is found set and return <code>value</code>
|
||||
* @param value
|
||||
* The default value that we will be setting if no prior <code>key</code> is found.
|
||||
* @return <code>Long</code> - Either we will return the default value or a prior existing value depending on existance.
|
||||
*/
|
||||
public long getLong(String key, long value) {
|
||||
if (this.containsKey(key)) {
|
||||
return Long.parseLong(this.getProperty(key));
|
||||
}
|
||||
|
||||
this.setLong(key, value);
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Save the value given as a <code>long</code> on the specified key.
|
||||
*
|
||||
* @see #save()
|
||||
* @param key
|
||||
* The <code>key</code> that we will be addressing the <code>value</code> to.
|
||||
* @param value
|
||||
* The <code>value</code> we will be setting inside the <code>.[properties]</code> file.
|
||||
*/
|
||||
public void setLong(String key, long value) {
|
||||
this.props.put(key, String.valueOf(value));
|
||||
|
||||
this.save();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the value of the <code>key</code> given in a Boolean, however we do not set a string if no <code>key</code> is found.
|
||||
*
|
||||
* @see #getProperty(String var)
|
||||
* @param key
|
||||
* The <code>key</code> we will retrieve the property from, if no <code>key</code> is found default to false
|
||||
*/
|
||||
public boolean getBoolean(String key) {
|
||||
if (this.containsKey(key)) {
|
||||
return Boolean.parseBoolean(this.getProperty(key));
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the boolean value of a key
|
||||
*
|
||||
* @see #setBoolean(String key, boolean value)
|
||||
* @param key
|
||||
* The key that we will be grabbing the value from, if no value is found set and return <code>value</code>
|
||||
* @param value
|
||||
* The default value that we will be setting if no prior <code>key</code> is found.
|
||||
* @return <code>Boolean</code> - Either we will return the default value or a prior existing value depending on existance.
|
||||
*/
|
||||
public boolean getBoolean(String key, boolean value) {
|
||||
if (this.containsKey(key)) {
|
||||
return Boolean.parseBoolean(this.getProperty(key));
|
||||
}
|
||||
|
||||
this.setBoolean(key, value);
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Save the value given as a <code>boolean</code> on the specified key.
|
||||
*
|
||||
* @see #save()
|
||||
* @param key
|
||||
* The <code>key</code> that we will be addressing the <code>value</code> to.
|
||||
* @param value
|
||||
* The <code>value</code> we will be setting inside the <code>.[properties]</code> file.
|
||||
*/
|
||||
public void setBoolean(String key, boolean value) {
|
||||
this.props.put(key, String.valueOf(value));
|
||||
|
||||
this.save();
|
||||
}
|
||||
}
|
|
@ -1,31 +1,23 @@
|
|||
package com.tommytony.war.mapper;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.sql.Connection;
|
||||
import java.sql.DriverManager;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.material.MaterialData;
|
||||
|
||||
import com.tommytony.war.War;
|
||||
import com.tommytony.war.volume.Volume;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.block.*;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.entity.*;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.InventoryHolder;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.io.File;
|
||||
import java.sql.*;
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.*;
|
||||
import java.util.logging.Level;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -34,44 +26,17 @@ import com.tommytony.war.volume.Volume;
|
|||
*/
|
||||
public class VolumeMapper {
|
||||
|
||||
public static Volume loadVolume(String volumeName, String zoneName, World world) throws SQLException {
|
||||
Volume volume = new Volume(volumeName, world);
|
||||
VolumeMapper.load(volume, zoneName, world);
|
||||
return volume;
|
||||
protected static final String delim = "-------mcwar iSdgraIyMvOanTEJjZgocczfuG------";
|
||||
protected static final int DATABASE_VERSION = 3;
|
||||
|
||||
private static String getBlockDescriptor(Location loc, String type, String data, String metadata) {
|
||||
return String.format("<%d,%d,%d> type: %s, data: %s, meta: %s", loc.getBlockX(), loc.getBlockY(), loc.getBlockZ(), type, data, metadata);
|
||||
}
|
||||
|
||||
public static void load(Volume volume, String zoneName, World world) throws SQLException {
|
||||
File databaseFile = new File(War.war.getDataFolder(), String.format(
|
||||
"/dat/volume-%s.sl3", volume.getName()));
|
||||
if (!zoneName.isEmpty()) {
|
||||
databaseFile = new File(War.war.getDataFolder(),
|
||||
String.format("/dat/warzone-%s/volume-%s.sl3", zoneName,
|
||||
volume.getName()));
|
||||
}
|
||||
if (!databaseFile.exists()) {
|
||||
legacyLoad(volume, zoneName, world);
|
||||
save(volume, zoneName);
|
||||
War.war.getLogger().info("Volume " + volume.getName() + " for warzone " + zoneName + " converted to nimitz format!");
|
||||
return;
|
||||
}
|
||||
Connection databaseConnection = DriverManager.getConnection("jdbc:sqlite:" + databaseFile.getPath());
|
||||
public static void loadCorners(Connection databaseConnection, Volume volume, World world, String prefix) throws SQLException {
|
||||
Validate.isTrue(!databaseConnection.isClosed());
|
||||
Statement stmt = databaseConnection.createStatement();
|
||||
ResultSet versionQuery = stmt.executeQuery("PRAGMA user_version");
|
||||
int version = versionQuery.getInt("user_version");
|
||||
versionQuery.close();
|
||||
if (version > DATABASE_VERSION) {
|
||||
try {
|
||||
throw new IllegalStateException("Unsupported zone format " + version);
|
||||
} finally {
|
||||
stmt.close();
|
||||
databaseConnection.close();
|
||||
}
|
||||
} else if (version < DATABASE_VERSION) {
|
||||
switch (version) {
|
||||
// Run some update SQL for each old version
|
||||
}
|
||||
}
|
||||
ResultSet cornerQuery = stmt.executeQuery("SELECT * FROM corners");
|
||||
ResultSet cornerQuery = stmt.executeQuery("SELECT * FROM " + prefix + "corners");
|
||||
cornerQuery.next();
|
||||
final Block corner1 = world.getBlockAt(cornerQuery.getInt("x"), cornerQuery.getInt("y"), cornerQuery.getInt("z"));
|
||||
cornerQuery.next();
|
||||
|
@ -79,121 +44,217 @@ public class VolumeMapper {
|
|||
cornerQuery.close();
|
||||
volume.setCornerOne(corner1);
|
||||
volume.setCornerTwo(corner2);
|
||||
ResultSet query = stmt.executeQuery("SELECT * FROM blocks");
|
||||
stmt.close();
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads the given volume
|
||||
*
|
||||
* @param databaseConnection Open connection to zone database
|
||||
* @param volume Volume to load
|
||||
* @param start Starting position to load blocks at
|
||||
* @param total Amount of blocks to read
|
||||
* @return Changed blocks
|
||||
* @throws SQLException Error communicating with SQLite3 database
|
||||
*/
|
||||
public static int loadBlocks(Connection databaseConnection, Volume volume, int start, int total, boolean[][][] changes, boolean inMemory, String prefix) throws SQLException {
|
||||
Validate.isTrue(!databaseConnection.isClosed());
|
||||
if (inMemory) {
|
||||
volume.getBlocks().clear();
|
||||
}
|
||||
final Block corner1 = volume.getCornerOne().getBlock();
|
||||
Statement stmt = databaseConnection.createStatement();
|
||||
Map<Integer, String> stringCache = new HashMap<>();
|
||||
stringCache.put(0, null);
|
||||
ResultSet cacheQuery = stmt.executeQuery("SELECT * FROM "+ prefix +"strings");
|
||||
while (cacheQuery.next()) {
|
||||
stringCache.put(cacheQuery.getInt("id"), cacheQuery.getString("type"));
|
||||
}
|
||||
cacheQuery.close();
|
||||
int minX = volume.getMinX(), minY = volume.getMinY(), minZ = volume.getMinZ();
|
||||
int changed = 0;
|
||||
ResultSet query = stmt.executeQuery("SELECT * FROM "+ prefix + "blocks ORDER BY rowid LIMIT " + start + ", " + total);
|
||||
while (query.next()) {
|
||||
int x = query.getInt("x"), y = query.getInt("y"), z = query.getInt("z");
|
||||
BlockState modify = corner1.getRelative(x, y, z).getState();
|
||||
ItemStack data = new ItemStack(Material.valueOf(query.getString("type")), 0, query.getShort("data"));
|
||||
modify.setType(data.getType());
|
||||
modify.setData(data.getData());
|
||||
volume.getBlocks().add(modify);
|
||||
changed++;
|
||||
Block relative = corner1.getRelative(x, y, z);
|
||||
int xi = relative.getX() - minX, yi = relative.getY() - minY, zi = relative.getZ() - minZ;
|
||||
if (changes != null) {
|
||||
changes[xi][yi][zi] = true;
|
||||
}
|
||||
BlockState modify = relative.getState();
|
||||
// Load information from database, or null if not set
|
||||
String type = stringCache.get(query.getInt("type"));
|
||||
String data = stringCache.get(query.getInt("data"));
|
||||
String metadata = stringCache.get(query.getInt("metadata"));
|
||||
|
||||
// Try to look up the material. May fail due to mods or MC updates.
|
||||
Material mat = Material.getMaterial(type);
|
||||
if (mat == null) {
|
||||
War.war.getLogger().log(Level.WARNING, "Failed to parse block type. " + getBlockDescriptor(modify.getLocation(), type, data, metadata));
|
||||
continue;
|
||||
}
|
||||
// Try to get the block data (damage, non-tile information) using the 1.13 functions
|
||||
BlockData bdata = null;
|
||||
try {
|
||||
if (data != null) {
|
||||
bdata = Bukkit.createBlockData(data);
|
||||
}
|
||||
} catch (IllegalArgumentException iae) {
|
||||
War.war.getLogger().log(Level.WARNING, "Exception loading some block data. " + getBlockDescriptor(modify.getLocation(), type, data, metadata), iae);
|
||||
}
|
||||
// Update the block type/data in memory if they have changed
|
||||
boolean updatedType = false;
|
||||
if (modify.getType() != mat) {
|
||||
modify.setType(mat);
|
||||
updatedType = true;
|
||||
}
|
||||
boolean updatedData = false;
|
||||
if (bdata != null && !modify.getBlockData().equals(bdata)) {
|
||||
modify.setBlockData(bdata);
|
||||
updatedData = true;
|
||||
}
|
||||
if (!inMemory && (updatedType || updatedData)) {
|
||||
// Update the type & data if it has changed, needed here for tile entity check
|
||||
modify.update(true, false); // No-physics update, preventing the need for deferring blocks
|
||||
relative = corner1.getRelative(x, y, z);
|
||||
modify = relative.getState();
|
||||
}
|
||||
// Try to update the tile entity data
|
||||
if (metadata != null) {
|
||||
try {
|
||||
if (modify instanceof Sign) {
|
||||
final String[] lines = metadata.split("\n");
|
||||
for (int i = 0; i < lines.length; i++) {
|
||||
((Sign) modify).setLine(i, lines[i]);
|
||||
}
|
||||
}
|
||||
|
||||
// Containers
|
||||
if (modify instanceof Container) {
|
||||
YamlConfiguration config = new YamlConfiguration();
|
||||
config.loadFromString(metadata);
|
||||
Inventory inv = ((Container) modify).getSnapshotInventory();
|
||||
inv.clear();
|
||||
int slot = 0;
|
||||
for (Object obj : config.getList("items")) {
|
||||
if (obj instanceof ItemStack) {
|
||||
inv.setItem(slot, (ItemStack) obj);
|
||||
}
|
||||
++slot;
|
||||
}
|
||||
}
|
||||
|
||||
// Records
|
||||
if (modify instanceof Jukebox) {
|
||||
((Jukebox) modify).setPlaying(Material.valueOf(metadata));
|
||||
}
|
||||
|
||||
// Skulls
|
||||
if (modify instanceof Skull) {
|
||||
UUID playerId = UUID.fromString(metadata);
|
||||
OfflinePlayer player = Bukkit.getOfflinePlayer(playerId);
|
||||
((Skull) modify).setOwningPlayer(player);
|
||||
}
|
||||
|
||||
// Command blocks
|
||||
if (modify instanceof CommandBlock) {
|
||||
final String[] commandArray = metadata.split("\n");
|
||||
((CommandBlock) modify).setName(commandArray[0]);
|
||||
((CommandBlock) modify).setCommand(commandArray[1]);
|
||||
}
|
||||
|
||||
// Creature spawner
|
||||
if (modify instanceof CreatureSpawner) {
|
||||
((CreatureSpawner) modify).setSpawnedType(EntityType.valueOf(metadata));
|
||||
}
|
||||
|
||||
if (!inMemory) {
|
||||
modify.update(true, false);
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
War.war.getLogger().log(Level.WARNING, "Exception loading some tile entity data. " + getBlockDescriptor(modify.getLocation(), type, data, metadata), ex);
|
||||
}
|
||||
}
|
||||
|
||||
if (inMemory) {
|
||||
volume.getBlocks().add(modify);
|
||||
}
|
||||
}
|
||||
query.close();
|
||||
stmt.close();
|
||||
databaseConnection.close();
|
||||
return changed;
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public static void legacyLoad(Volume volume, String zoneName, World world) {
|
||||
BufferedReader in = null;
|
||||
try {
|
||||
if (zoneName.equals("")) {
|
||||
in = new BufferedReader(new FileReader(new File(War.war.getDataFolder().getPath() + "/dat/volume-" + volume.getName() + ".dat"))); // for the warhub
|
||||
} else {
|
||||
in = new BufferedReader(new FileReader(new File(War.war.getDataFolder().getPath() + "/dat/warzone-" + zoneName + "/volume-" + volume.getName() + ".dat")));
|
||||
}
|
||||
String firstLine = in.readLine();
|
||||
if (firstLine != null && !firstLine.equals("")) {
|
||||
boolean height129Fix = false;
|
||||
int x1 = Integer.parseInt(in.readLine());
|
||||
int y1 = Integer.parseInt(in.readLine());
|
||||
if (y1 == 128) {
|
||||
height129Fix = true;
|
||||
y1 = 127;
|
||||
}
|
||||
int z1 = Integer.parseInt(in.readLine());
|
||||
in.readLine();
|
||||
int x2 = Integer.parseInt(in.readLine());
|
||||
int y2 = Integer.parseInt(in.readLine());
|
||||
if (y2 == 128) {
|
||||
height129Fix = true;
|
||||
y2 = 127;
|
||||
}
|
||||
int z2 = Integer.parseInt(in.readLine());
|
||||
|
||||
volume.setCornerOne(world.getBlockAt(x1, y1, z1));
|
||||
volume.setCornerTwo(world.getBlockAt(x2, y2, z2));
|
||||
|
||||
int blockReads = 0;
|
||||
for (int i = 0; i < volume.getSizeX(); i++) {
|
||||
for (int j = 0; j < volume.getSizeY(); j++) {
|
||||
for (int k = 0; k < volume.getSizeZ(); k++) {
|
||||
try {
|
||||
String blockLine = in.readLine();
|
||||
if (blockLine != null && !blockLine.equals("")) {
|
||||
String[] blockSplit = blockLine.split(",");
|
||||
if (blockLine != null && !blockLine.equals("") && blockSplit.length > 1) {
|
||||
int typeID = Integer.parseInt(blockSplit[0]);
|
||||
byte data = Byte.parseByte(blockSplit[1]);
|
||||
|
||||
BlockState dummy = volume.getWorld().getBlockAt(x1 + i, y1 + j, z1 + k).getState();
|
||||
dummy.setTypeId(typeID);
|
||||
dummy.setRawData(data);
|
||||
volume.getBlocks().add(dummy);
|
||||
}
|
||||
blockReads++;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
War.war.log("Unexpected error while reading block from volume " + volume.getName() + " file for zone " + zoneName + ". Blocks read so far: " + blockReads + "Position: x:" + i + " y:" + j + " z:" + k + ". " + e.getClass().getName() + " " + e.getMessage(), Level.WARNING);
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
if (height129Fix && j == volume.getSizeY() - 1) {
|
||||
for (int skip = 0; skip < volume.getSizeZ(); skip++) {
|
||||
in.readLine(); // throw away the extra vertical block I used to save pre 0.8
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
War.war.log("Failed to read volume file " + volume.getName() + " for warzone " + zoneName + ". " + e.getClass().getName() + " " + e.getMessage(), Level.WARNING);
|
||||
e.printStackTrace();
|
||||
} catch (Exception e) {
|
||||
War.war.log("Unexpected error caused failure to read volume file " + zoneName + " for warzone " + volume.getName() + ". " + e.getClass().getName() + " " + e.getMessage(), Level.WARNING);
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
if (in != null) {
|
||||
try {
|
||||
in.close();
|
||||
} catch (IOException e) {
|
||||
War.war.log("Failed to close file reader for volume " + volume.getName() + " for warzone " + zoneName + ". " + e.getClass().getName() + " " + e.getMessage(), Level.WARNING);
|
||||
e.printStackTrace();
|
||||
}
|
||||
/**
|
||||
* Load saved entities.
|
||||
*
|
||||
* @param databaseConnection Open databaseConnection to warzone DB file.
|
||||
* @param volume Volume for warzone.
|
||||
* @return number affected
|
||||
* @throws SQLException SQLite error
|
||||
*/
|
||||
public static int loadEntities(Connection databaseConnection, Volume volume) throws SQLException {
|
||||
Validate.isTrue(!databaseConnection.isClosed());
|
||||
// first, clear entities from the area
|
||||
for (Entity e : volume.getWorld().getEntitiesByClass(Hanging.class)) {
|
||||
if (volume.contains(e.getLocation())) {
|
||||
e.remove();
|
||||
}
|
||||
}
|
||||
int changed = 0;
|
||||
Statement stmt = databaseConnection.createStatement();
|
||||
final Block corner1 = volume.getCornerOne().getBlock();
|
||||
Location test = new Location(volume.getWorld(), 0, 253, 0); // admins pls don't build stuff here kthx
|
||||
ResultSet query = stmt.executeQuery("SELECT * FROM entities ORDER BY rowid");
|
||||
while (query.next()) {
|
||||
double x = query.getDouble("x"), y = query.getDouble("y"), z = query.getDouble("z");
|
||||
changed++;
|
||||
// translate from relative DB location to absolute
|
||||
Location absolute = corner1.getLocation().clone().add(x, y, z);
|
||||
int type = query.getInt("type");
|
||||
String facing = query.getString("facing");
|
||||
String metadata = query.getString("metadata");
|
||||
BlockFace face = BlockFace.valueOf(facing);
|
||||
|
||||
// Spawn the paintings in the sky somewhere, works because I can only get them to spawn north/south
|
||||
test.getBlock().setType(Material.AIR);
|
||||
test.add(2, 0, 0).getBlock().setType(Material.STONE);
|
||||
|
||||
try {
|
||||
if (type == 1) {
|
||||
Painting p = (Painting) volume.getWorld().spawnEntity(test.clone().add(0, 0, 1), EntityType.PAINTING);
|
||||
Art art = Art.valueOf(metadata);
|
||||
p.teleport(calculatePainting(art, face, absolute));
|
||||
p.setFacingDirection(face, true);
|
||||
p.setArt(art, true);
|
||||
} else if (type == 2) {
|
||||
ItemFrame itemFrame = (ItemFrame) volume.getWorld().spawnEntity(test.clone().add(0, 0, 1), EntityType.ITEM_FRAME);
|
||||
itemFrame.teleport(absolute);
|
||||
itemFrame.setFacingDirection(face, true);
|
||||
String[] args = metadata.split(delim);
|
||||
itemFrame.setRotation(Rotation.valueOf(args[0]));
|
||||
YamlConfiguration config = new YamlConfiguration();
|
||||
config.loadFromString(args[1]);
|
||||
itemFrame.setItem(config.getItemStack("item"));
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
War.war.getLogger().log(Level.WARNING, "Exception loading entity. x:" + x + " y:" + y + " z:" + z + " type:" + type, ex);
|
||||
}
|
||||
}
|
||||
test.getBlock().setType(Material.AIR);
|
||||
query.close();
|
||||
stmt.close();
|
||||
return changed;
|
||||
}
|
||||
|
||||
public static final int DATABASE_VERSION = 1;
|
||||
public static void save(Volume volume, String zoneName) throws SQLException {
|
||||
File databaseFile = new File(War.war.getDataFolder(), String.format(
|
||||
"/dat/volume-%s.sl3", volume.getName()));
|
||||
if (!zoneName.isEmpty()) {
|
||||
databaseFile = new File(War.war.getDataFolder(),
|
||||
String.format("/dat/warzone-%s/volume-%s.sl3", zoneName,
|
||||
volume.getName()));
|
||||
}
|
||||
Connection databaseConnection = DriverManager
|
||||
.getConnection("jdbc:sqlite:" + databaseFile.getPath());
|
||||
public static void saveCorners(Connection databaseConnection, Volume volume, String prefix) throws SQLException {
|
||||
Statement stmt = databaseConnection.createStatement();
|
||||
stmt.executeUpdate("PRAGMA user_version = " + DATABASE_VERSION);
|
||||
stmt.executeUpdate("CREATE TABLE IF NOT EXISTS blocks (x BIGINT, y BIGINT, z BIGINT, type TEXT, data SMALLINT)");
|
||||
stmt.executeUpdate("CREATE TABLE IF NOT EXISTS corners (pos INTEGER PRIMARY KEY NOT NULL UNIQUE, x INTEGER NOT NULL, y INTEGER NOT NULL, z INTEGER NOT NULL)");
|
||||
stmt.executeUpdate("DELETE FROM blocks");
|
||||
stmt.executeUpdate("DELETE FROM corners");
|
||||
stmt.executeUpdate("CREATE TABLE IF NOT EXISTS "+prefix+"corners (pos INTEGER PRIMARY KEY NOT NULL UNIQUE, x INTEGER NOT NULL, y INTEGER NOT NULL, z INTEGER NOT NULL)");
|
||||
stmt.executeUpdate("DELETE FROM "+prefix+"corners");
|
||||
stmt.close();
|
||||
PreparedStatement cornerStmt = databaseConnection
|
||||
.prepareStatement("INSERT INTO corners SELECT 1 AS pos, ? AS x, ? AS y, ? AS z UNION SELECT 2, ?, ?, ?");
|
||||
PreparedStatement cornerStmt = databaseConnection.prepareStatement("INSERT INTO " + prefix + "corners SELECT 1 AS pos, ? AS x, ? AS y, ? AS z UNION SELECT 2, ?, ?, ?");
|
||||
cornerStmt.setInt(1, volume.getCornerOne().getBlockX());
|
||||
cornerStmt.setInt(2, volume.getCornerOne().getBlockY());
|
||||
cornerStmt.setInt(3, volume.getCornerOne().getBlockZ());
|
||||
|
@ -202,136 +263,296 @@ public class VolumeMapper {
|
|||
cornerStmt.setInt(6, volume.getCornerTwo().getBlockZ());
|
||||
cornerStmt.executeUpdate();
|
||||
cornerStmt.close();
|
||||
PreparedStatement dataStmt = databaseConnection
|
||||
.prepareStatement("INSERT INTO blocks VALUES (?, ?, ?, ?, ?)");
|
||||
databaseConnection.setAutoCommit(false);
|
||||
final int batchSize = 1000;
|
||||
}
|
||||
|
||||
public static int saveEntities(Connection databaseConnection, Volume volume) throws SQLException {
|
||||
Statement stmt = databaseConnection.createStatement();
|
||||
stmt.executeUpdate("CREATE TABLE IF NOT EXISTS entities (x NUMERIC, y NUMERIC, z NUMERIC, type SMALLINT, facing TEXT, metadata TEXT)");
|
||||
stmt.executeUpdate("DELETE FROM entities");
|
||||
stmt.close();
|
||||
PreparedStatement entityStmt = databaseConnection.prepareStatement("INSERT INTO entities (x, y, z, type, facing, metadata) VALUES (?, ?, ?, ?, ?, ?)");
|
||||
int i = 0;
|
||||
for (Entity e : volume.getWorld().getEntities()) {
|
||||
if (volume.contains(e.getLocation()) && e instanceof Hanging) {
|
||||
entityStmt.setDouble(1, e.getLocation().getX() - volume.getCornerOne().getBlockX());
|
||||
entityStmt.setDouble(2, e.getLocation().getY() - volume.getCornerOne().getBlockY());
|
||||
entityStmt.setDouble(3, e.getLocation().getZ() - volume.getCornerOne().getBlockZ());
|
||||
entityStmt.setString(5, ((Hanging) e).getFacing().name());
|
||||
if (e instanceof Painting) {
|
||||
Painting p = (Painting) e;
|
||||
entityStmt.setInt(4, 1);
|
||||
entityStmt.setString(6, p.getArt().name());
|
||||
} else if (e instanceof ItemFrame) {
|
||||
ItemFrame itemFrame = (ItemFrame) e;
|
||||
YamlConfiguration config = new YamlConfiguration();
|
||||
config.set("item", itemFrame.getItem());
|
||||
entityStmt.setInt(4, 2);
|
||||
entityStmt.setString(6, itemFrame.getRotation().name() + delim + config.saveToString());
|
||||
} else {
|
||||
entityStmt.setInt(4, 0);
|
||||
entityStmt.setString(6, "");
|
||||
}
|
||||
entityStmt.addBatch();
|
||||
++i;
|
||||
}
|
||||
}
|
||||
entityStmt.executeBatch();
|
||||
entityStmt.close();
|
||||
return i;
|
||||
}
|
||||
|
||||
public static int saveBlocks(Connection databaseConnection, Volume volume, String prefix) throws SQLException {
|
||||
Statement stmt = databaseConnection.createStatement();
|
||||
stmt.executeUpdate("CREATE TABLE IF NOT EXISTS "+prefix+"blocks (x BIGINT, y BIGINT, z BIGINT, type BIGINT, data BIGINT, metadata BIGINT)");
|
||||
stmt.executeUpdate("CREATE TABLE IF NOT EXISTS "+prefix+"strings (id INTEGER PRIMARY KEY NOT NULL UNIQUE, type TEXT)");
|
||||
stmt.executeUpdate("DELETE FROM "+prefix+"blocks");
|
||||
stmt.executeUpdate("DELETE FROM "+prefix+"strings");
|
||||
stmt.close();
|
||||
Map<String, Integer> stringCache = new HashMap<>();
|
||||
int cachei = 1;
|
||||
int changed = 0;
|
||||
for (BlockState block : volume.getBlocks()) {
|
||||
final Location relLoc = ZoneVolumeMapper.rebase(
|
||||
volume.getCornerOne(), block.getLocation());
|
||||
dataStmt.setInt(1, relLoc.getBlockX());
|
||||
dataStmt.setInt(2, relLoc.getBlockY());
|
||||
dataStmt.setInt(3, relLoc.getBlockZ());
|
||||
dataStmt.setString(4, block.getType().toString());
|
||||
dataStmt.setShort(5, block.getData().toItemStack().getDurability());
|
||||
dataStmt.addBatch();
|
||||
if (++changed % batchSize == 0) {
|
||||
dataStmt.executeBatch();
|
||||
long startTime = System.currentTimeMillis();
|
||||
PreparedStatement dataStmt = databaseConnection.prepareStatement("INSERT INTO "+prefix+"blocks (x, y, z, type, data, metadata) VALUES (?, ?, ?, ?, ?, ?)");
|
||||
databaseConnection.setAutoCommit(false);
|
||||
final int batchSize = 10000;
|
||||
for (int i = 0, x = volume.getMinX(); i < volume.getSizeX(); i++, x++) {
|
||||
for (int j = 0, y = volume.getMinY(); j < volume.getSizeY(); j++, y++) {
|
||||
for (int k = 0, z = volume.getMinZ(); k < volume.getSizeZ(); k++, z++) {
|
||||
// Make sure we are using zone volume-relative coords
|
||||
final Block block = volume.getWorld().getBlockAt(x, y, z);
|
||||
if (block.getType() == Material.AIR) {
|
||||
continue; // Do not save air blocks to the file anymore.
|
||||
}
|
||||
int typeid, dataid, metaid;
|
||||
// Save even more space by writing each string only once
|
||||
if (stringCache.containsKey(block.getType().name())) {
|
||||
typeid = stringCache.get(block.getType().name());
|
||||
} else {
|
||||
typeid = cachei;
|
||||
stringCache.put(block.getType().name(), cachei++);
|
||||
}
|
||||
// Save new-style data
|
||||
if (BlockData.class.isAssignableFrom(block.getType().data)) {
|
||||
String data = block.getBlockData().getAsString();
|
||||
if (stringCache.containsKey(data)) {
|
||||
dataid = stringCache.get(data);
|
||||
} else {
|
||||
dataid = cachei;
|
||||
stringCache.put(data, cachei++);
|
||||
}
|
||||
} else {
|
||||
dataid = 0;
|
||||
}
|
||||
|
||||
// Save tile entities
|
||||
BlockState state = block.getState();
|
||||
String metadata = "";
|
||||
if (state instanceof Sign) {
|
||||
metadata = StringUtils.join(((Sign) state).getLines(), "\n");
|
||||
} else if (state instanceof InventoryHolder) {
|
||||
List<ItemStack> items = Arrays.asList(((InventoryHolder) state).getInventory().getContents());
|
||||
YamlConfiguration config = new YamlConfiguration();
|
||||
// Serialize to config, then store config in database
|
||||
config.set("items", items);
|
||||
metadata = config.saveToString();
|
||||
} else if (state instanceof Jukebox) {
|
||||
metadata = ((Jukebox) state).getPlaying().toString();
|
||||
} else if (state instanceof Skull) {
|
||||
OfflinePlayer player = ((Skull) state).getOwningPlayer();
|
||||
metadata = player == null ? "" : player.getUniqueId().toString();
|
||||
} else if (state instanceof CommandBlock) {
|
||||
metadata = ((CommandBlock) state).getName() + "\n" + ((CommandBlock) state).getCommand();
|
||||
} else if (state instanceof CreatureSpawner) {
|
||||
metadata = ((CreatureSpawner) state).getSpawnedType().toString();
|
||||
}
|
||||
if (metadata.isEmpty()) {
|
||||
metaid = 0;
|
||||
} else if (stringCache.containsKey(metadata)) {
|
||||
metaid = stringCache.get(metadata);
|
||||
} else {
|
||||
metaid = cachei;
|
||||
stringCache.put(metadata, cachei++);
|
||||
}
|
||||
|
||||
dataStmt.setInt(1, block.getX() - volume.getCornerOne().getBlockX());
|
||||
dataStmt.setInt(2, block.getY() - volume.getCornerOne().getBlockY());
|
||||
dataStmt.setInt(3, block.getZ() - volume.getCornerOne().getBlockZ());
|
||||
dataStmt.setInt(4, typeid);
|
||||
dataStmt.setInt(5, dataid);
|
||||
dataStmt.setInt(6, metaid);
|
||||
|
||||
dataStmt.addBatch();
|
||||
|
||||
if (++changed % batchSize == 0) {
|
||||
dataStmt.executeBatch();
|
||||
if ((System.currentTimeMillis() - startTime) >= 5000L) {
|
||||
String seconds = new DecimalFormat("#0.00").format((double) (System.currentTimeMillis() - startTime) / 1000.0D);
|
||||
War.war.getLogger().log(Level.FINE, "Still saving volume {0} , {1} seconds elapsed.", new Object[] {volume.getName(), seconds});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
dataStmt.executeBatch(); // insert remaining records
|
||||
databaseConnection.commit();
|
||||
dataStmt.close();
|
||||
databaseConnection.close();
|
||||
PreparedStatement stringStmt = databaseConnection.prepareStatement("INSERT INTO "+prefix+"strings (id, type) VALUES (?, ?)");
|
||||
for (Map.Entry<String, Integer> mapping : stringCache.entrySet()) {
|
||||
stringStmt.setInt(1, mapping.getValue());
|
||||
stringStmt.setString(2, mapping.getKey());
|
||||
stringStmt.addBatch();
|
||||
}
|
||||
stringStmt.executeBatch();
|
||||
databaseConnection.commit();
|
||||
databaseConnection.setAutoCommit(true);
|
||||
return changed;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Parses an inventory string
|
||||
* Save a simple volume, like the WarHub.
|
||||
*
|
||||
* @param String
|
||||
* invString string to parse
|
||||
* @return List<ItemStack> Parsed items
|
||||
* @param volume Volume to save (takes corner data and loads from world).
|
||||
* @return amount of changed blocks
|
||||
* @throws SQLException
|
||||
*/
|
||||
@Deprecated
|
||||
public static List<ItemStack> readInventoryString(String invString) {
|
||||
List<ItemStack> items = new ArrayList<ItemStack>();
|
||||
if (invString != null && !invString.equals("")) {
|
||||
String[] itemsStrSplit = invString.split(";;");
|
||||
for (String itemStr : itemsStrSplit) {
|
||||
String[] itemStrSplit = itemStr.split(";");
|
||||
if (itemStrSplit.length == 5) {
|
||||
ItemStack stack = new ItemStack(Integer.parseInt(itemStrSplit[0]), Integer.parseInt(itemStrSplit[1]));
|
||||
stack.setData(new MaterialData(stack.getTypeId(), Byte.parseByte(itemStrSplit[3])));
|
||||
short durability = (short) Integer.parseInt(itemStrSplit[2]);
|
||||
stack.setDurability(durability);
|
||||
|
||||
// enchantments
|
||||
String[] enchantmentsSplit = itemStrSplit[4].split("::");
|
||||
for (String enchantmentStr : enchantmentsSplit) {
|
||||
if (!enchantmentStr.equals("")) {
|
||||
String[] enchantmentSplit = enchantmentStr.split(":");
|
||||
int enchantId = Integer.parseInt(enchantmentSplit[0]);
|
||||
int level = Integer.parseInt(enchantmentSplit[1]);
|
||||
War.war.safelyEnchant(stack, Enchantment.getById(enchantId), level);
|
||||
}
|
||||
}
|
||||
|
||||
items.add(stack);
|
||||
} else if (itemStrSplit.length == 4) {
|
||||
ItemStack stack = new ItemStack(Integer.parseInt(itemStrSplit[0]), Integer.parseInt(itemStrSplit[1]));
|
||||
stack.setData(new MaterialData(stack.getTypeId(), Byte.parseByte(itemStrSplit[3])));
|
||||
short durability = (short) Integer.parseInt(itemStrSplit[2]);
|
||||
stack.setDurability(durability);
|
||||
items.add(stack);
|
||||
} else if (itemStrSplit.length == 3) {
|
||||
ItemStack stack = new ItemStack(Integer.parseInt(itemStrSplit[0]), Integer.parseInt(itemStrSplit[1]));
|
||||
short durability = (short) Integer.parseInt(itemStrSplit[2]);
|
||||
stack.setDurability(durability);
|
||||
items.add(stack);
|
||||
} else {
|
||||
items.add(new ItemStack(Integer.parseInt(itemStrSplit[0]), Integer.parseInt(itemStrSplit[1])));
|
||||
}
|
||||
}
|
||||
}
|
||||
return items;
|
||||
public static int saveSimpleVolume(Volume volume) throws SQLException {
|
||||
File volFile = new File(War.war.getDataFolder(), String.format("/dat/volume-%s.sl3", volume.getName()));
|
||||
Connection databaseConnection = getConnection(volFile);
|
||||
int changed = 0;
|
||||
saveCorners(databaseConnection, volume, "");
|
||||
saveBlocks(databaseConnection, volume, "");
|
||||
databaseConnection.close();
|
||||
return changed;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a string out of a list of items
|
||||
*
|
||||
* @param items The list of items
|
||||
* @return The list as a string
|
||||
*/
|
||||
@Deprecated
|
||||
public static String buildInventoryStringFromItemList(List<ItemStack> items) {
|
||||
String extra = "";
|
||||
for (ItemStack item : items) {
|
||||
if (item != null) {
|
||||
extra += item.getTypeId() + ";" + item.getAmount() + ";" + item.getDurability();
|
||||
if (item.getData() != null) {
|
||||
extra += ";" + item.getData().getData();
|
||||
}
|
||||
if (item.getEnchantments().keySet().size() > 0) {
|
||||
String enchantmentsStr = "";
|
||||
for (Enchantment enchantment : item.getEnchantments().keySet()) {
|
||||
enchantmentsStr += enchantment.getId() + ":" + item.getEnchantments().get(enchantment) + "::";
|
||||
}
|
||||
extra += ";" + enchantmentsStr;
|
||||
}
|
||||
extra += ";;";
|
||||
}
|
||||
}
|
||||
|
||||
return extra;
|
||||
}
|
||||
|
||||
/**
|
||||
* Extracts a list of items from and inventory
|
||||
*
|
||||
* @param inv The inventory
|
||||
* @return The inventory as a list
|
||||
*/
|
||||
@Deprecated
|
||||
public static List<ItemStack> getItemListFromInv(Inventory inv) {
|
||||
int size = inv.getSize();
|
||||
List<ItemStack> items = new ArrayList<ItemStack>();
|
||||
for (int invIndex = 0; invIndex < size; invIndex++) {
|
||||
ItemStack item = inv.getItem(invIndex);
|
||||
if (item != null && item.getType().getId() != Material.AIR.getId()) {
|
||||
items.add(item);
|
||||
}
|
||||
}
|
||||
return items;
|
||||
}
|
||||
|
||||
public static void delete(Volume volume) {
|
||||
File volFile = new File(War.war.getDataFolder(), String.format(
|
||||
"/dat/volume-%s.sl3", volume.getName()));
|
||||
public static boolean deleteSimpleVolume(Volume volume) {
|
||||
File volFile = new File(War.war.getDataFolder(), String.format("/dat/volume-%s.sl3", volume.getName()));
|
||||
boolean deletedData = volFile.delete();
|
||||
if (!deletedData) {
|
||||
War.war.log("Failed to delete file " + volFile.getName(), Level.WARNING);
|
||||
}
|
||||
return deletedData;
|
||||
}
|
||||
|
||||
public static Volume loadSimpleVolume(String volumeName, World world) throws SQLException {
|
||||
File volFile = new File(War.war.getDataFolder(), String.format("/dat/volume-%s.sl3", volumeName));
|
||||
Connection databaseConnection = getConnection(volFile);
|
||||
int version = checkConvert(databaseConnection);
|
||||
Volume v = new Volume(volumeName, world);
|
||||
switch (version) {
|
||||
case 1:
|
||||
case 2:
|
||||
War.war.log(volumeName + " cannot be migrated from War 1.9 due to breaking MC1.13 changes - please resave.", Level.WARNING);
|
||||
loadCorners(databaseConnection, v, world, "");
|
||||
convertSchema2_3(databaseConnection, "", true);
|
||||
return v;
|
||||
case 3:
|
||||
break;
|
||||
default:
|
||||
throw new IllegalStateException(String.format("Unsupported volume format (was already converted to version: %d, current format: %d)", version, DATABASE_VERSION));
|
||||
}
|
||||
loadCorners(databaseConnection, v, world, "");
|
||||
loadBlocks(databaseConnection, v, 0, 0, null, true, "");
|
||||
return v;
|
||||
}
|
||||
|
||||
protected static Connection getConnection(File filename) throws SQLException {
|
||||
return DriverManager.getConnection("jdbc:sqlite:" + filename.getPath());
|
||||
}
|
||||
|
||||
protected static int checkConvert(Connection databaseConnection) throws SQLException {
|
||||
Statement stmt = databaseConnection.createStatement();
|
||||
ResultSet versionQuery = stmt.executeQuery("PRAGMA user_version");
|
||||
int version = versionQuery.getInt("user_version");
|
||||
versionQuery.close();
|
||||
stmt.close();
|
||||
return version;
|
||||
}
|
||||
|
||||
protected static void convertSchema2_3(Connection databaseConnection, String prefix, boolean isSimple) throws SQLException {
|
||||
Statement stmt = databaseConnection.createStatement();
|
||||
stmt.executeUpdate("DROP TABLE " + prefix + "blocks");
|
||||
stmt.executeUpdate("CREATE TABLE IF NOT EXISTS "+prefix+"blocks (x BIGINT, y BIGINT, z BIGINT, type BIGINT, data BIGINT, metadata BIGINT)");
|
||||
stmt.executeUpdate("CREATE TABLE IF NOT EXISTS "+prefix+"strings (id INTEGER PRIMARY KEY NOT NULL UNIQUE, type TEXT)");
|
||||
stmt.executeUpdate("PRAGMA user_version = " + DATABASE_VERSION);
|
||||
stmt.close();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Finds the correct location to place a painting based on its characteristics.
|
||||
* Credit goes to whatever forum I got this from.
|
||||
*
|
||||
* @param art Painting type
|
||||
* @param facing Block face
|
||||
* @param loc Desired location
|
||||
* @return Corrected location
|
||||
*/
|
||||
private static Location calculatePainting(Art art, BlockFace facing, Location loc) {
|
||||
switch(art) {
|
||||
|
||||
// 1x1
|
||||
case ALBAN:
|
||||
case AZTEC:
|
||||
case AZTEC2:
|
||||
case BOMB:
|
||||
case KEBAB:
|
||||
case PLANT:
|
||||
case WASTELAND:
|
||||
return loc; // No calculation needed.
|
||||
|
||||
// 1x2
|
||||
case GRAHAM:
|
||||
case WANDERER:
|
||||
return loc.getBlock().getLocation().add(0, -1, 0);
|
||||
|
||||
// 2x1
|
||||
case CREEBET:
|
||||
case COURBET:
|
||||
case POOL:
|
||||
case SEA:
|
||||
case SUNSET: // Use same as 4x3
|
||||
|
||||
// 4x3
|
||||
case DONKEY_KONG:
|
||||
case SKELETON:
|
||||
if(facing == BlockFace.WEST)
|
||||
return loc.getBlock().getLocation().add(0, 0, -1);
|
||||
else if(facing == BlockFace.SOUTH)
|
||||
return loc.getBlock().getLocation().add(-1, 0, 0);
|
||||
else
|
||||
return loc;
|
||||
|
||||
// 2x2
|
||||
case BUST:
|
||||
case MATCH:
|
||||
case SKULL_AND_ROSES:
|
||||
case STAGE:
|
||||
case VOID:
|
||||
case WITHER: // Use same as 4x2
|
||||
|
||||
// 4x2
|
||||
case FIGHTERS: // Use same as 4x4
|
||||
|
||||
// 4x4
|
||||
case BURNING_SKULL:
|
||||
case PIGSCENE:
|
||||
case POINTER:
|
||||
if(facing == BlockFace.WEST)
|
||||
return loc.getBlock().getLocation().add(0, -1, -1);
|
||||
else if(facing == BlockFace.SOUTH)
|
||||
return loc.getBlock().getLocation().add(-1, -1, 0);
|
||||
else
|
||||
return loc.add(0, -1, 0);
|
||||
|
||||
// Unsupported artwork
|
||||
default:
|
||||
return loc;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,459 +0,0 @@
|
|||
package com.tommytony.war.mapper;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
|
||||
import com.tommytony.war.War;
|
||||
import com.tommytony.war.config.FlagReturn;
|
||||
import com.tommytony.war.config.TeamConfig;
|
||||
import com.tommytony.war.config.TeamSpawnStyle;
|
||||
import com.tommytony.war.config.WarConfig;
|
||||
import com.tommytony.war.config.WarzoneConfig;
|
||||
import com.tommytony.war.job.RestoreWarhubJob;
|
||||
import com.tommytony.war.job.RestoreWarzonesJob;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author tommytony
|
||||
*
|
||||
*/
|
||||
public class WarTxtMapper {
|
||||
|
||||
public static void load() {
|
||||
load(false);
|
||||
}
|
||||
|
||||
public static void load(boolean convertingToYml) {
|
||||
(War.war.getDataFolder()).mkdir();
|
||||
(new File(War.war.getDataFolder().getPath() + "/dat")).mkdir();
|
||||
PropertiesFile warConfig = new PropertiesFile(War.war.getDataFolder().getPath() + "/war.txt");
|
||||
try {
|
||||
warConfig.load();
|
||||
} catch (IOException e) {
|
||||
War.war.log("Failed to load war.txt file.", Level.WARNING);
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
// Create file if need be
|
||||
boolean newWar = false;
|
||||
if (!warConfig.containsKey("warzones")) {
|
||||
newWar = true;
|
||||
WarTxtMapper.save();
|
||||
War.war.log("war.txt settings file created.", Level.INFO);
|
||||
try {
|
||||
warConfig.load();
|
||||
} catch (IOException e) {
|
||||
War.war.log("Failed to reload war.txt file after creating it.", Level.WARNING);
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
// warzones
|
||||
String warzonesStr = warConfig.getString("warzones");
|
||||
RestoreWarzonesJob restoreWarzones = new RestoreWarzonesJob(warzonesStr, newWar, convertingToYml);
|
||||
// make sure warhub job is over before this one ends, because this job will launch conversion (which needs the warhub)
|
||||
if (War.war.getServer().getScheduler().scheduleSyncDelayedTask(War.war, restoreWarzones, 20) == -1) {
|
||||
War.war.log("Failed to schedule warzone-restore job. No warzone was loaded.", Level.WARNING);
|
||||
}
|
||||
|
||||
// zone makers
|
||||
String[] makers = warConfig.getString("zoneMakers").split(",");
|
||||
War.war.getZoneMakerNames().clear();
|
||||
for (String makerName : makers) {
|
||||
if (makerName != null && !makerName.equals("")) {
|
||||
War.war.getZoneMakerNames().add(makerName);
|
||||
}
|
||||
}
|
||||
|
||||
// command whitelist
|
||||
String[] whitelist = warConfig.getString("commandWhitelist").split(",");
|
||||
War.war.getCommandWhitelist().clear();
|
||||
for (String command : whitelist) {
|
||||
if (command != null && !command.equals("")) {
|
||||
War.war.getCommandWhitelist().add(command);
|
||||
}
|
||||
}
|
||||
|
||||
// defaultLoadout
|
||||
War.war.getDefaultInventories().clearLoadouts();
|
||||
|
||||
String loadoutStr = warConfig.getString("defaultLoadout");
|
||||
if (loadoutStr != null && !loadoutStr.equals("")) {
|
||||
War.war.getDefaultInventories().addLoadout("default", new HashMap<Integer, ItemStack>());
|
||||
LoadoutTxtMapper.fromStringToLoadout(loadoutStr, War.war.getDefaultInventories().getLoadout("default"));
|
||||
}
|
||||
|
||||
// defaultExtraLoadouts
|
||||
String extraLoadoutStr = warConfig.getString("defaultExtraLoadouts");
|
||||
String[] extraLoadoutsSplit = extraLoadoutStr.split(",");
|
||||
|
||||
for (String nameStr : extraLoadoutsSplit) {
|
||||
if (nameStr != null && !nameStr.equals("")) {
|
||||
War.war.getDefaultInventories().addLoadout(nameStr, new HashMap<Integer, ItemStack>());
|
||||
}
|
||||
}
|
||||
|
||||
for (String extraName : extraLoadoutsSplit) {
|
||||
if (extraName != null && !extraName.equals("")) {
|
||||
String loadoutString = warConfig.getString(extraName + "Loadout");
|
||||
HashMap<Integer, ItemStack> loadout = War.war.getDefaultInventories().getLoadout(extraName);
|
||||
LoadoutTxtMapper.fromStringToLoadout(loadoutString, loadout);
|
||||
}
|
||||
}
|
||||
|
||||
// maxZones
|
||||
if (warConfig.keyExists("maxZones")) {
|
||||
War.war.getWarConfig().put(WarConfig.MAXZONES, warConfig.getInt("maxZones"));
|
||||
}
|
||||
|
||||
// defaultLifePool
|
||||
if (warConfig.keyExists("defaultLifePool")) {
|
||||
War.war.getTeamDefaultConfig().put(TeamConfig.LIFEPOOL, warConfig.getInt("defaultLifePool"));
|
||||
}
|
||||
|
||||
// defaultMonumentHeal
|
||||
if (warConfig.keyExists("defaultMonumentHeal")) {
|
||||
War.war.getWarzoneDefaultConfig().put(WarzoneConfig.MONUMENTHEAL, warConfig.getInt("defaultMonumentHeal"));
|
||||
}
|
||||
|
||||
// defaultFriendlyFire
|
||||
if (warConfig.keyExists("defaultFriendlyFire")) {
|
||||
War.war.getWarzoneDefaultConfig().put(WarzoneConfig.FRIENDLYFIRE, warConfig.getBoolean("defaultFriendlyFire"));
|
||||
}
|
||||
|
||||
// defaultAutoAssignOnly
|
||||
if (warConfig.keyExists("defaultAutoAssignOnly")) {
|
||||
War.war.getWarzoneDefaultConfig().put(WarzoneConfig.AUTOASSIGN, warConfig.getBoolean("defaultAutoAssignOnly"));
|
||||
}
|
||||
|
||||
// defaultFlagPointsOnly
|
||||
if (warConfig.keyExists("defaultFlagPointsOnly")) {
|
||||
War.war.getTeamDefaultConfig().put(TeamConfig.FLAGPOINTSONLY, warConfig.getBoolean("defaultFlagPointsOnly"));
|
||||
}
|
||||
|
||||
// defaultFlagMustBeHome
|
||||
if (warConfig.keyExists("defaultFlagMustBeHome")) {
|
||||
War.war.getTeamDefaultConfig().put(TeamConfig.FLAGMUSTBEHOME, warConfig.getBoolean("defaultFlagMustBeHome"));
|
||||
}
|
||||
|
||||
// defaultTeamCap
|
||||
if (warConfig.keyExists("defaultTeamCap")) {
|
||||
War.war.getTeamDefaultConfig().put(TeamConfig.TEAMSIZE, warConfig.getInt("defaultTeamCap"));
|
||||
}
|
||||
|
||||
// defaultScoreCap
|
||||
if (warConfig.keyExists("defaultScoreCap")) {
|
||||
War.war.getTeamDefaultConfig().put(TeamConfig.MAXSCORE, warConfig.getInt("defaultScoreCap"));
|
||||
}
|
||||
|
||||
// defaultRespawnTimer
|
||||
if (warConfig.keyExists("defaultRespawnTimer")) {
|
||||
War.war.getTeamDefaultConfig().put(TeamConfig.RESPAWNTIMER, warConfig.getInt("defaultRespawnTimer"));
|
||||
}
|
||||
|
||||
// pvpInZonesOnly
|
||||
if (warConfig.keyExists("pvpInZonesOnly")) {
|
||||
War.war.getWarConfig().put(WarConfig.PVPINZONESONLY, warConfig.getBoolean("pvpInZonesOnly"));
|
||||
}
|
||||
|
||||
// defaultBlockHeads
|
||||
if (warConfig.keyExists("defaultBlockHeads")) {
|
||||
War.war.getWarzoneDefaultConfig().put(WarzoneConfig.BLOCKHEADS, warConfig.getBoolean("defaultBlockHeads"));
|
||||
}
|
||||
|
||||
// buildInZonesOnly
|
||||
if (warConfig.keyExists("buildInZonesOnly")) {
|
||||
War.war.getWarConfig().put(WarConfig.BUILDINZONESONLY, warConfig.getBoolean("buildInZonesOnly"));
|
||||
}
|
||||
|
||||
// disablePVPMessage
|
||||
if (warConfig.keyExists("disablePvpMessage")) {
|
||||
War.war.getWarConfig().put(WarConfig.DISABLEPVPMESSAGE, warConfig.getBoolean("disablePvpMessage"));
|
||||
}
|
||||
|
||||
// disableBuildMessage
|
||||
if (warConfig.keyExists("disableBuildMessage")) {
|
||||
War.war.getWarConfig().put(WarConfig.DISABLEBUILDMESSAGE, warConfig.getBoolean("disableBuildMessage"));
|
||||
}
|
||||
|
||||
// tntInZonesOnly
|
||||
if (warConfig.keyExists("tntInZonesOnly")) {
|
||||
War.war.getWarConfig().put(WarConfig.TNTINZONESONLY, warConfig.getBoolean("tntInZonesOnly"));
|
||||
}
|
||||
|
||||
// defaultSpawnStyle
|
||||
String spawnStyle = warConfig.getString("defaultspawnStyle");
|
||||
if (spawnStyle != null && !spawnStyle.equals("")) {
|
||||
War.war.getTeamDefaultConfig().put(TeamConfig.SPAWNSTYLE, TeamSpawnStyle.getStyleFromString(spawnStyle));
|
||||
}
|
||||
|
||||
// defaultFlagReturn
|
||||
String flagReturn = warConfig.getString("defaultFlagReturn");
|
||||
if (flagReturn != null && !flagReturn.equals("")) {
|
||||
War.war.getTeamDefaultConfig().put(TeamConfig.FLAGRETURN, FlagReturn.getFromString(flagReturn));
|
||||
}
|
||||
|
||||
// defaultReward
|
||||
String defaultRewardStr = warConfig.getString("defaultReward");
|
||||
if (defaultRewardStr != null && !defaultRewardStr.equals("")) {
|
||||
LoadoutTxtMapper.fromStringToLoadout(defaultRewardStr, War.war.getDefaultInventories().getReward());
|
||||
}
|
||||
|
||||
// defaultUnbreakableZoneBlocks
|
||||
if (warConfig.keyExists("defaultUnbreakableZoneBlocks")) {
|
||||
War.war.getWarzoneDefaultConfig().put(WarzoneConfig.UNBREAKABLE, warConfig.getBoolean("defaultUnbreakableZoneBlocks"));
|
||||
}
|
||||
|
||||
// defaultNoCreatures
|
||||
if (warConfig.keyExists("defaultNoCreatures")) {
|
||||
War.war.getWarzoneDefaultConfig().put(WarzoneConfig.NOCREATURES, warConfig.getBoolean("defaultNoCreatures"));
|
||||
}
|
||||
|
||||
// defaultGlassWalls
|
||||
if (warConfig.keyExists("defaultGlassWalls")) {
|
||||
War.war.getWarzoneDefaultConfig().put(WarzoneConfig.GLASSWALLS, warConfig.getBoolean("defaultGlassWalls"));
|
||||
}
|
||||
|
||||
// defaultPvpInZone
|
||||
if (warConfig.keyExists("defaultPvpInZone")) {
|
||||
War.war.getWarzoneDefaultConfig().put(WarzoneConfig.PVPINZONE, warConfig.getBoolean("defaultPvpInZone"));
|
||||
}
|
||||
|
||||
// defaultInstaBreak
|
||||
if (warConfig.keyExists("defaultInstaBreak")) {
|
||||
War.war.getWarzoneDefaultConfig().put(WarzoneConfig.INSTABREAK, warConfig.getBoolean("defaultInstaBreak"));
|
||||
}
|
||||
|
||||
// defaultNoDrops
|
||||
if (warConfig.keyExists("defaultNoDrops")) {
|
||||
War.war.getWarzoneDefaultConfig().put(WarzoneConfig.NODROPS, warConfig.getBoolean("defaultNoDrops"));
|
||||
}
|
||||
|
||||
// defaultNoHunger
|
||||
if (warConfig.keyExists("defaultNoHunger")) {
|
||||
War.war.getTeamDefaultConfig().put(TeamConfig.NOHUNGER, warConfig.getBoolean("defaultNoHunger"));
|
||||
}
|
||||
|
||||
// defaultSaturation
|
||||
if (warConfig.keyExists("defaultSaturation")) {
|
||||
War.war.getTeamDefaultConfig().put(TeamConfig.SATURATION, warConfig.getInt("defaultSaturation"));
|
||||
}
|
||||
|
||||
// defaultMinPlayers
|
||||
if (warConfig.keyExists("defaultMinPlayers")) {
|
||||
War.war.getWarzoneDefaultConfig().put(WarzoneConfig.MINPLAYERS, warConfig.getInt("defaultMinPlayers"));
|
||||
}
|
||||
|
||||
// defaultMinTeams
|
||||
if (warConfig.keyExists("defaultMinTeams")) {
|
||||
War.war.getWarzoneDefaultConfig().put(WarzoneConfig.MINTEAMS, warConfig.getInt("defaultMinTeams"));
|
||||
}
|
||||
|
||||
// defaultResetOnEmpty
|
||||
if (warConfig.keyExists("defaultResetOnEmpty")) {
|
||||
War.war.getWarzoneDefaultConfig().put(WarzoneConfig.RESETONEMPTY, warConfig.getBoolean("defaultResetOnEmpty"));
|
||||
}
|
||||
|
||||
// defaultResetOnLoad
|
||||
if (warConfig.keyExists("defaultResetOnLoad")) {
|
||||
War.war.getWarzoneDefaultConfig().put(WarzoneConfig.RESETONLOAD, warConfig.getBoolean("defaultResetOnLoad"));
|
||||
}
|
||||
|
||||
// defaultResetOnUnload
|
||||
if (warConfig.keyExists("defaultResetOnUnload")) {
|
||||
War.war.getWarzoneDefaultConfig().put(WarzoneConfig.RESETONUNLOAD, warConfig.getBoolean("defaultResetOnUnload"));
|
||||
}
|
||||
|
||||
// warhub
|
||||
String hubStr = warConfig.getString("warhub");
|
||||
if (hubStr != null && !hubStr.equals("")) {
|
||||
RestoreWarhubJob restoreWarhub = new RestoreWarhubJob(hubStr);
|
||||
if (War.war.getServer().getScheduler().scheduleSyncDelayedTask(War.war, restoreWarhub) == -1) {
|
||||
War.war.log("Failed to schedule warhub-restore job. War hub was not loaded.", Level.WARNING);
|
||||
}
|
||||
}
|
||||
|
||||
warConfig.close();
|
||||
}
|
||||
|
||||
public static void save() {
|
||||
// PropertiesFile warConfig = new PropertiesFile(War.war.getDataFolder().getPath() + "/war.txt");
|
||||
// String warzonesStr = "";
|
||||
|
||||
War.war.log("Saving War with WarTxtMapper", Level.SEVERE);
|
||||
|
||||
// // warzones
|
||||
// for (Warzone zone : War.war.getWarzones()) {
|
||||
// warzonesStr += zone.getName() + ",";
|
||||
// }
|
||||
// warConfig.setString("warzones", warzonesStr);
|
||||
//
|
||||
// // zone makers: default is none and it means everyone can use /setzone
|
||||
// String makersStr = ""; // everyone
|
||||
// for (String name : War.war.getZoneMakerNames()) {
|
||||
// makersStr += name + ",";
|
||||
// }
|
||||
// warConfig.setString("zoneMakers", makersStr);
|
||||
//
|
||||
// // whitelisted commands during a game
|
||||
// String commandWhitelistStr = ""; // everyone
|
||||
// for (String command : War.war.getCommandWhitelist()) {
|
||||
// commandWhitelistStr += command + ",";
|
||||
// }
|
||||
// warConfig.setString("commandWhitelist", commandWhitelistStr);
|
||||
//
|
||||
// // defaultLoadout
|
||||
// HashMap<Integer, ItemStack> items = War.war.getDefaultInventories().getLoadouts().get("default");
|
||||
// warConfig.setString("defaultLoadout", LoadoutTxtMapper.fromLoadoutToString(items));
|
||||
//
|
||||
// // defaultExtraLoadouts
|
||||
// String extraLoadoutsStr = "";
|
||||
// for (String name : War.war.getDefaultInventories().getLoadouts().keySet()) {
|
||||
// if (!name.equals("default")) {
|
||||
// extraLoadoutsStr += name + ",";
|
||||
//
|
||||
// HashMap<Integer, ItemStack> loadout = War.war.getDefaultInventories().getLoadouts().get(name);
|
||||
// warConfig.setString(name + "Loadout", LoadoutTxtMapper.fromLoadoutToString(loadout));
|
||||
// }
|
||||
// }
|
||||
// warConfig.setString("defaultExtraLoadouts", extraLoadoutsStr);
|
||||
//
|
||||
// // maxZones
|
||||
// warConfig.setInt("maxZones", War.war.getWarConfig().getInt(WarConfig.MAXZONES));
|
||||
//
|
||||
// // defaultLifepool
|
||||
// warConfig.setInt("defaultLifePool", War.war.getDefaultLifepool());
|
||||
//
|
||||
// // defaultMonumentHeal
|
||||
// warConfig.setInt("defaultMonumentHeal", War.war.getDefaultMonumentHeal());
|
||||
//
|
||||
// // defaultFriendlyFire
|
||||
// warConfig.setBoolean("defaultFriendlyFire", War.war.isDefaultFriendlyFire());
|
||||
//
|
||||
// // defaultAutoAssignOnly
|
||||
// warConfig.setBoolean("defaultAutoAssignOnly", War.war.isDefaultAutoAssignOnly());
|
||||
//
|
||||
// // defaultFlagPointsOnly
|
||||
// warConfig.setBoolean("defaultFlagPointsOnly", War.war.isDefaultFlagPointsOnly());
|
||||
//
|
||||
// // defaultFlagMustBeHome
|
||||
// warConfig.setBoolean("defaultFlagMustBeHome", War.war.isDefaultFlagMustBeHome());
|
||||
//
|
||||
// // defaultTeamCap
|
||||
// warConfig.setInt("defaultTeamCap", War.war.getDefaultTeamCap());
|
||||
//
|
||||
// // defaultScoreCap
|
||||
// warConfig.setInt("defaultScoreCap", War.war.getDefaultScoreCap());
|
||||
//
|
||||
// // defaultRespawnTimer
|
||||
// warConfig.setInt("defaultRespawnTimer", War.war.getDefaultRespawnTimer());
|
||||
//
|
||||
// // pvpInZonesOnly
|
||||
// warConfig.setBoolean("pvpInZonesOnly", War.war.getWarConfig().getBoolean(WarConfig.PVPINZONESONLY));
|
||||
//
|
||||
// // defaultBlockHeads
|
||||
// warConfig.setBoolean("defaultBlockHeads", War.war.isDefaultBlockHeads());
|
||||
//
|
||||
// // buildInZonesOnly
|
||||
// warConfig.setBoolean("buildInZonesOnly", War.war.getWarConfig().getBoolean(WarConfig.BUILDINZONESONLY));
|
||||
//
|
||||
// // disablePVPMessage
|
||||
// warConfig.setBoolean("disablePvpMessage", War.war.getWarConfig().getBoolean(WarConfig.DISABLEPVPMESSAGE));
|
||||
//
|
||||
// // disableBuildMessage
|
||||
// warConfig.setBoolean("disableBuildMessage", War.war.getWarConfig().getBoolean(WarConfig.DISABLEBUILDMESSAGE));
|
||||
//
|
||||
// // tntInZonesOnly
|
||||
// warConfig.setBoolean("tntInZonesOnly", War.war.getWarConfig().getBoolean(WarConfig.TNTINZONESONLY));
|
||||
//
|
||||
// // spawnStyle
|
||||
// warConfig.setString("spawnStyle", War.war.getDefaultSpawnStyle().toString());
|
||||
//
|
||||
// // flagReturn
|
||||
// warConfig.setString("flagReturn", War.war.getDefaultFlagReturn().toString());
|
||||
//
|
||||
// // defaultReward
|
||||
// String defaultRewardStr = "";
|
||||
// HashMap<Integer, ItemStack> rewardItems = War.war.getDefaultInventories().getReward();
|
||||
// for (Integer slot : rewardItems.keySet()) {
|
||||
// ItemStack item = items.get(slot);
|
||||
// if (item != null) {
|
||||
// defaultRewardStr += item.getTypeId() + "," + item.getAmount() + "," + slot + ";";
|
||||
// }
|
||||
// }
|
||||
// warConfig.setString("defaultReward", defaultRewardStr);
|
||||
//
|
||||
// // defaultUnbreakableZoneBlocks
|
||||
// warConfig.setBoolean("defaultUnbreakableZoneBlocks", War.war.isDefaultUnbreakableZoneBlocks());
|
||||
//
|
||||
// // defaultNoCreatures
|
||||
// warConfig.setBoolean("defaultNoCreatures", War.war.isDefaultNoCreatures());
|
||||
//
|
||||
// // defaultGlassWalls
|
||||
// warConfig.setBoolean("defaultGlassWalls", War.war.isDefaultGlassWalls());
|
||||
//
|
||||
// // defaultPvpInZone
|
||||
// warConfig.setBoolean("defaultPvpInZone", War.war.isDefaultPvpInZone());
|
||||
//
|
||||
// // defaultInstaBreak
|
||||
// warConfig.setBoolean("defaultInstaBreak", War.war.isDefaultInstaBreak());
|
||||
//
|
||||
// // defaultNoDrops
|
||||
// warConfig.setBoolean("defaultNoDrops", War.war.isDefaultNoDrops());
|
||||
//
|
||||
// // defaultNoHunger
|
||||
// warConfig.setBoolean("defaultNoHunger", War.war.isDefaultNoHunger());
|
||||
//
|
||||
// // defaultSaturation
|
||||
// warConfig.setInt("defaultSaturation", War.war.getDefaultSaturation());
|
||||
//
|
||||
// // defaultMinPlayers
|
||||
// warConfig.setInt("defaultMinPlayers", War.war.getDefaultMinPlayers());
|
||||
//
|
||||
// // defaultMinTeams
|
||||
// warConfig.setInt("defaultMinTeams", War.war.getDefaultMinTeams());
|
||||
//
|
||||
// // defaultResetOnEmpty
|
||||
// warConfig.setBoolean("defaultResetOnEmpty", War.war.isDefaultResetOnEmpty());
|
||||
//
|
||||
// // defaultResetOnLoad
|
||||
// warConfig.setBoolean("defaultResetOnLoad", War.war.isDefaultResetOnLoad());
|
||||
//
|
||||
// // defaultResetOnUnload
|
||||
// warConfig.setBoolean("defaultResetOnUnload", War.war.isDefaultResetOnUnload());
|
||||
//
|
||||
// // warhub
|
||||
// String hubStr = "";
|
||||
// WarHub hub = War.war.getWarHub();
|
||||
// if (hub != null) {
|
||||
// String orientationStr = "";
|
||||
// switch (hub.getOrientation()) {
|
||||
// case SOUTH:
|
||||
// orientationStr = "south";
|
||||
// break;
|
||||
// case EAST:
|
||||
// orientationStr = "east";
|
||||
// break;
|
||||
// case NORTH:
|
||||
// orientationStr = "north";
|
||||
// break;
|
||||
// case WEST:
|
||||
// default:
|
||||
// orientationStr = "west";
|
||||
// break;
|
||||
// }
|
||||
// hubStr = hub.getLocation().getBlockX() + "," + hub.getLocation().getBlockY() + "," + hub.getLocation().getBlockZ() + ","
|
||||
// + hub.getLocation().getWorld().getName() + "," + orientationStr;
|
||||
// VolumeMapper.save(hub.getVolume(), "");
|
||||
// }
|
||||
// warConfig.setString("warhub", hubStr);
|
||||
//
|
||||
// warConfig.save();
|
||||
// warConfig.close();
|
||||
}
|
||||
}
|
|
@ -1,18 +1,5 @@
|
|||
package com.tommytony.war.mapper;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
|
||||
import com.tommytony.war.War;
|
||||
import com.tommytony.war.Warzone;
|
||||
import com.tommytony.war.config.KillstreakReward;
|
||||
|
@ -21,6 +8,20 @@ import com.tommytony.war.job.RestoreYmlWarhubJob;
|
|||
import com.tommytony.war.job.RestoreYmlWarzonesJob;
|
||||
import com.tommytony.war.structure.WarHub;
|
||||
import com.tommytony.war.utility.Direction;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.logging.Level;
|
||||
|
||||
public class WarYmlMapper {
|
||||
|
||||
|
@ -32,9 +33,8 @@ public class WarYmlMapper {
|
|||
|
||||
boolean newWar = false;
|
||||
if (warTxtFile.exists() && !warYmlFile.exists()) {
|
||||
// Load both War and warzones (with delay) in old format, save War to new format immediatly
|
||||
WarTxtMapper.load(true);
|
||||
// Warzones are getting loaded by TxtMapper launched job. That job will in turn save the Warzones to their new format.
|
||||
// dropped nimitz compatibility with the MC 1.13 update
|
||||
War.war.log("Failed to load War config file from older version - backwards compatibility was dropped with MC 1.13. Please delete war.txt to continue.", Level.WARNING);
|
||||
return;
|
||||
} else if (!warTxtFile.exists() && !warYmlFile.exists()) {
|
||||
// Save defaults to disk
|
||||
|
@ -57,9 +57,14 @@ public class WarYmlMapper {
|
|||
List<String> makers = warRootSection.getStringList("war.info.zonemakers");
|
||||
War.war.getZoneMakerNames().clear();
|
||||
for (String makerName : makers) {
|
||||
if (makerName != null && !makerName.equals("")) {
|
||||
War.war.getZoneMakerNames().add(makerName);
|
||||
OfflinePlayer player;
|
||||
try {
|
||||
UUID id = UUID.fromString(makerName);
|
||||
player = Bukkit.getOfflinePlayer(id);
|
||||
} catch (IllegalArgumentException iae) {
|
||||
player = Bukkit.getOfflinePlayer(makerName);
|
||||
}
|
||||
War.war.getZoneMakerNames().add(player);
|
||||
}
|
||||
|
||||
// command whitelist
|
||||
|
@ -149,7 +154,11 @@ public class WarYmlMapper {
|
|||
warInfoSection.set("warzones", warzones);
|
||||
|
||||
// zone makers
|
||||
warInfoSection.set("zonemakers", War.war.getZoneMakerNames());
|
||||
List<String> zonemakers = new ArrayList<>();
|
||||
for (OfflinePlayer zonemaker : War.war.getZoneMakerNames()) {
|
||||
zonemakers.add(zonemaker.getUniqueId().toString());
|
||||
}
|
||||
warInfoSection.set("zonemakers", zonemakers);
|
||||
|
||||
// whitelisted commands during a game
|
||||
warInfoSection.set("commandwhitelist", War.war.getCommandWhitelist());
|
||||
|
@ -191,7 +200,7 @@ public class WarYmlMapper {
|
|||
hubConfigSection.set("materials.light", War.war.getWarhubMaterials().getLightBlock());
|
||||
|
||||
try {
|
||||
VolumeMapper.save(hub.getVolume(), "");
|
||||
VolumeMapper.saveSimpleVolume(hub.getVolume());
|
||||
} catch (SQLException e) {
|
||||
// who really even cares
|
||||
War.war.getLogger().log(Level.WARNING, "Failed to save warhub volume blocks", e);
|
||||
|
|
|
@ -1,657 +0,0 @@
|
|||
package com.tommytony.war.mapper;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.sql.SQLException;
|
||||
import java.util.HashMap;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
|
||||
import com.tommytony.war.Team;
|
||||
import com.tommytony.war.War;
|
||||
import com.tommytony.war.Warzone;
|
||||
import com.tommytony.war.config.FlagReturn;
|
||||
import com.tommytony.war.config.TeamConfig;
|
||||
import com.tommytony.war.config.TeamKind;
|
||||
import com.tommytony.war.config.TeamSpawnStyle;
|
||||
import com.tommytony.war.config.WarzoneConfig;
|
||||
import com.tommytony.war.structure.Monument;
|
||||
import com.tommytony.war.structure.ZoneLobby;
|
||||
import com.tommytony.war.utility.Direction;
|
||||
import com.tommytony.war.volume.Volume;
|
||||
import com.tommytony.war.volume.ZoneVolume;
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author tommytony
|
||||
*
|
||||
*/
|
||||
public class WarzoneTxtMapper {
|
||||
|
||||
public static Warzone load(String name, boolean createNewVolume) {
|
||||
// war.getLogger().info("Loading warzone " + name + " config and blocks...");
|
||||
PropertiesFile warzoneConfig = new PropertiesFile(War.war.getDataFolder().getPath() + "/warzone-" + name + ".txt");
|
||||
try {
|
||||
warzoneConfig.load();
|
||||
} catch (IOException e) {
|
||||
War.war.getLogger().info("Failed to load warzone-" + name + ".txt file.");
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
// world
|
||||
String worldStr = warzoneConfig.getProperty("world");
|
||||
World world = null;
|
||||
if (worldStr == null || worldStr.equals("")) {
|
||||
world = War.war.getServer().getWorlds().get(0); // default to first world
|
||||
} else {
|
||||
world = War.war.getServer().getWorld(worldStr);
|
||||
}
|
||||
|
||||
if (world == null) {
|
||||
War.war.log("Failed to restore warzone " + name + ". The specified world (name: " + worldStr + ") does not exist!", Level.WARNING);
|
||||
} else {
|
||||
// Create the zone
|
||||
Warzone warzone = new Warzone(world, name);
|
||||
|
||||
// Create file if needed
|
||||
if (!warzoneConfig.containsKey("name")) {
|
||||
WarzoneTxtMapper.save(warzone, false);
|
||||
War.war.getLogger().info("Warzone " + name + " config file created.");
|
||||
try {
|
||||
warzoneConfig.load();
|
||||
} catch (IOException e) {
|
||||
// war.getLogger().info("Failed to reload warzone-" + name + ".txt file after creating it.");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
// teleport
|
||||
String teleportStr = warzoneConfig.getString("teleport");
|
||||
if (teleportStr != null && !teleportStr.equals("")) {
|
||||
String[] teleportSplit = teleportStr.split(",");
|
||||
int teleX = Integer.parseInt(teleportSplit[0]);
|
||||
int teleY = Integer.parseInt(teleportSplit[1]);
|
||||
int teleZ = Integer.parseInt(teleportSplit[2]);
|
||||
int yaw = Integer.parseInt(teleportSplit[3]);
|
||||
warzone.setTeleport(new Location(world, teleX, teleY, teleZ, yaw, 0));
|
||||
}
|
||||
|
||||
// ff
|
||||
if (warzoneConfig.containsKey("friendlyFire")) {
|
||||
warzone.getWarzoneConfig().put(WarzoneConfig.FRIENDLYFIRE, warzoneConfig.getBoolean("friendlyFire"));
|
||||
}
|
||||
|
||||
// loadout
|
||||
warzone.getDefaultInventories().clearLoadouts();
|
||||
|
||||
String loadoutStr = warzoneConfig.getString("loadout");
|
||||
if (loadoutStr != null && !loadoutStr.equals("")) {
|
||||
warzone.getDefaultInventories().setLoadout("default", new HashMap<Integer, ItemStack>());
|
||||
LoadoutTxtMapper.fromStringToLoadout(loadoutStr, warzone.getDefaultInventories().getLoadout("default"));
|
||||
}
|
||||
|
||||
// extraLoadouts
|
||||
String extraLoadoutStr = warzoneConfig.getString("extraLoadouts");
|
||||
String[] extraLoadoutsSplit = extraLoadoutStr.split(",");
|
||||
|
||||
for (String nameStr : extraLoadoutsSplit) {
|
||||
if (nameStr != null && !nameStr.equals("")) {
|
||||
warzone.getDefaultInventories().setLoadout(nameStr, new HashMap<Integer, ItemStack>());
|
||||
}
|
||||
}
|
||||
|
||||
for (String extraName : extraLoadoutsSplit) {
|
||||
if (extraName != null && !extraName.equals("")) {
|
||||
String loadoutString = warzoneConfig.getString(extraName + "Loadout");
|
||||
HashMap<Integer, ItemStack> loadout = warzone.getDefaultInventories().getLoadout(extraName);
|
||||
LoadoutTxtMapper.fromStringToLoadout(loadoutString, loadout);
|
||||
}
|
||||
}
|
||||
|
||||
// authors
|
||||
if (warzoneConfig.containsKey("author") && !warzoneConfig.getString("author").equals("")) {
|
||||
for(String authorStr : warzoneConfig.getString("author").split(",")) {
|
||||
if (!authorStr.equals("")) {
|
||||
warzone.addAuthor(authorStr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// life pool (always set after teams, so the teams' remaining lives get initialized properly by this setter)
|
||||
if (warzoneConfig.containsKey("lifePool")) {
|
||||
warzone.getTeamDefaultConfig().put(TeamConfig.LIFEPOOL, warzoneConfig.getInt("lifePool"));
|
||||
}
|
||||
|
||||
// monument heal
|
||||
if (warzoneConfig.containsKey("monumentHeal")) {
|
||||
warzone.getWarzoneConfig().put(WarzoneConfig.MONUMENTHEAL, warzoneConfig.getInt("monumentHeal"));
|
||||
}
|
||||
|
||||
// autoAssignOnly
|
||||
if (warzoneConfig.containsKey("autoAssignOnly")) {
|
||||
warzone.getWarzoneConfig().put(WarzoneConfig.AUTOASSIGN, warzoneConfig.getBoolean("autoAssignOnly"));
|
||||
}
|
||||
|
||||
// flagPointsOnly
|
||||
if (warzoneConfig.containsKey("flagPointsOnly")) {
|
||||
warzone.getTeamDefaultConfig().put(TeamConfig.FLAGPOINTSONLY, warzoneConfig.getBoolean("flagPointsOnly"));
|
||||
}
|
||||
|
||||
// flagMustBeHome
|
||||
if (warzoneConfig.containsKey("flagMustBeHome")) {
|
||||
warzone.getTeamDefaultConfig().put(TeamConfig.FLAGMUSTBEHOME, warzoneConfig.getBoolean("flagMustBeHome"));
|
||||
}
|
||||
|
||||
// team cap
|
||||
if (warzoneConfig.containsKey("teamCap")) {
|
||||
warzone.getTeamDefaultConfig().put(TeamConfig.TEAMSIZE, warzoneConfig.getInt("teamCap"));
|
||||
}
|
||||
|
||||
// score cap
|
||||
if (warzoneConfig.containsKey("scoreCap")) {
|
||||
warzone.getTeamDefaultConfig().put(TeamConfig.MAXSCORE, warzoneConfig.getInt("scoreCap"));
|
||||
}
|
||||
|
||||
// respawn timer
|
||||
if (warzoneConfig.containsKey("respawnTimer")) {
|
||||
warzone.getTeamDefaultConfig().put(TeamConfig.RESPAWNTIMER, warzoneConfig.getInt("respawnTimer"));
|
||||
}
|
||||
|
||||
// blockHeads
|
||||
if (warzoneConfig.containsKey("blockHeads")) {
|
||||
warzone.getWarzoneConfig().put(WarzoneConfig.BLOCKHEADS, warzoneConfig.getBoolean("blockHeads"));
|
||||
}
|
||||
|
||||
// spawnStyle
|
||||
String spawnStyle = warzoneConfig.getString("spawnStyle");
|
||||
if (spawnStyle != null && !spawnStyle.equals("")) {
|
||||
warzone.getTeamDefaultConfig().put(TeamConfig.SPAWNSTYLE, TeamSpawnStyle.getStyleFromString(spawnStyle));
|
||||
}
|
||||
|
||||
// flagReturn
|
||||
String flagReturn = warzoneConfig.getString("flagReturn");
|
||||
if (flagReturn != null && !flagReturn.equals("")) {
|
||||
warzone.getTeamDefaultConfig().put(TeamConfig.FLAGRETURN, FlagReturn.getFromString(flagReturn));
|
||||
}
|
||||
|
||||
// reward
|
||||
String rewardStr = warzoneConfig.getString("reward");
|
||||
if (rewardStr != null && !rewardStr.equals("")) {
|
||||
HashMap<Integer, ItemStack> reward = new HashMap<Integer, ItemStack>();
|
||||
LoadoutTxtMapper.fromStringToLoadout(rewardStr, reward);
|
||||
warzone.getDefaultInventories().setReward(reward);
|
||||
}
|
||||
|
||||
// unbreakableZoneBlocks
|
||||
if (warzoneConfig.containsKey("unbreakableZoneBlocks")) {
|
||||
warzone.getWarzoneConfig().put(WarzoneConfig.UNBREAKABLE, warzoneConfig.getBoolean("unbreakableZoneBlocks"));
|
||||
}
|
||||
|
||||
// disabled
|
||||
if (warzoneConfig.containsKey("disabled")) {
|
||||
warzone.getWarzoneConfig().put(WarzoneConfig.DISABLED, warzoneConfig.getBoolean("disabled"));
|
||||
}
|
||||
|
||||
// noCreatures
|
||||
if (warzoneConfig.containsKey("noCreatures")) {
|
||||
warzone.getWarzoneConfig().put(WarzoneConfig.NOCREATURES, warzoneConfig.getBoolean("noCreatures"));
|
||||
}
|
||||
|
||||
// glassWalls
|
||||
if (warzoneConfig.containsKey("glassWalls")) {
|
||||
warzone.getWarzoneConfig().put(WarzoneConfig.GLASSWALLS, warzoneConfig.getBoolean("glassWalls"));
|
||||
}
|
||||
|
||||
// pvpInZone
|
||||
if (warzoneConfig.containsKey("pvpInZone")) {
|
||||
warzone.getWarzoneConfig().put(WarzoneConfig.PVPINZONE, warzoneConfig.getBoolean("pvpInZone"));
|
||||
}
|
||||
|
||||
// instaBreak
|
||||
if (warzoneConfig.containsKey("instaBreak")) {
|
||||
warzone.getWarzoneConfig().put(WarzoneConfig.INSTABREAK, warzoneConfig.getBoolean("instaBreak"));
|
||||
}
|
||||
|
||||
// noDrops
|
||||
if (warzoneConfig.containsKey("noDrops")) {
|
||||
warzone.getWarzoneConfig().put(WarzoneConfig.NODROPS, warzoneConfig.getBoolean("noDrops"));
|
||||
}
|
||||
|
||||
// noHunger
|
||||
if (warzoneConfig.containsKey("noHunger")) {
|
||||
warzone.getTeamDefaultConfig().put(TeamConfig.NOHUNGER, warzoneConfig.getBoolean("noHunger"));
|
||||
}
|
||||
|
||||
// saturation
|
||||
if (warzoneConfig.containsKey("saturation")) {
|
||||
warzone.getTeamDefaultConfig().put(TeamConfig.SATURATION, warzoneConfig.getInt("saturation"));
|
||||
}
|
||||
|
||||
// minPlayers
|
||||
if (warzoneConfig.containsKey("minPlayers")) {
|
||||
warzone.getWarzoneConfig().put(WarzoneConfig.MINPLAYERS, warzoneConfig.getInt("minPlayers"));
|
||||
}
|
||||
|
||||
// minTeams
|
||||
if (warzoneConfig.containsKey("minTeams")) {
|
||||
warzone.getWarzoneConfig().put(WarzoneConfig.MINTEAMS, warzoneConfig.getInt("minTeams"));
|
||||
}
|
||||
|
||||
// resetOnEmpty
|
||||
if (warzoneConfig.containsKey("resetOnEmpty")) {
|
||||
warzone.getWarzoneConfig().put(WarzoneConfig.RESETONEMPTY, warzoneConfig.getBoolean("resetOnEmpty"));
|
||||
}
|
||||
|
||||
// resetOnLoad
|
||||
if (warzoneConfig.containsKey("resetOnLoad")) {
|
||||
warzone.getWarzoneConfig().put(WarzoneConfig.RESETONLOAD, warzoneConfig.getBoolean("resetOnLoad"));
|
||||
}
|
||||
|
||||
// resetOnUnload
|
||||
if (warzoneConfig.containsKey("resetOnUnload")) {
|
||||
warzone.getWarzoneConfig().put(WarzoneConfig.RESETONUNLOAD, warzoneConfig.getBoolean("resetOnUnload"));
|
||||
}
|
||||
|
||||
// rallyPoint
|
||||
String rallyPointStr = warzoneConfig.getString("rallyPoint");
|
||||
if (rallyPointStr != null && !rallyPointStr.equals("")) {
|
||||
String[] rallyPointStrSplit = rallyPointStr.split(",");
|
||||
|
||||
int rpX = Integer.parseInt(rallyPointStrSplit[0]);
|
||||
int rpY = Integer.parseInt(rallyPointStrSplit[1]);
|
||||
int rpZ = Integer.parseInt(rallyPointStrSplit[2]);
|
||||
Location rallyPoint = new Location(world, rpX, rpY, rpZ);
|
||||
warzone.setRallyPoint(rallyPoint);
|
||||
}
|
||||
|
||||
// monuments
|
||||
String monumentsStr = warzoneConfig.getString("monuments");
|
||||
if (monumentsStr != null && !monumentsStr.equals("")) {
|
||||
String[] monumentsSplit = monumentsStr.split(";");
|
||||
warzone.getMonuments().clear();
|
||||
for (String monumentStr : monumentsSplit) {
|
||||
if (monumentStr != null && !monumentStr.equals("")) {
|
||||
String[] monumentStrSplit = monumentStr.split(",");
|
||||
int monumentX = Integer.parseInt(monumentStrSplit[1]);
|
||||
int monumentY = Integer.parseInt(monumentStrSplit[2]);
|
||||
int monumentZ = Integer.parseInt(monumentStrSplit[3]);
|
||||
Monument monument = new Monument(monumentStrSplit[0], warzone, new Location(world, monumentX, monumentY, monumentZ));
|
||||
warzone.getMonuments().add(monument);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// teams
|
||||
String teamsStr = warzoneConfig.getString("teams");
|
||||
if (teamsStr != null && !teamsStr.equals("")) {
|
||||
String[] teamsSplit = teamsStr.split(";");
|
||||
warzone.getTeams().clear();
|
||||
for (String teamStr : teamsSplit) {
|
||||
if (teamStr != null && !teamStr.equals("")) {
|
||||
String[] teamStrSplit = teamStr.split(",");
|
||||
int teamX = Integer.parseInt(teamStrSplit[1]);
|
||||
int teamY = Integer.parseInt(teamStrSplit[2]);
|
||||
int teamZ = Integer.parseInt(teamStrSplit[3]);
|
||||
Location teamLocation = new Location(world, teamX, teamY, teamZ);
|
||||
if (teamStrSplit.length > 4) {
|
||||
int yaw = Integer.parseInt(teamStrSplit[4]);
|
||||
teamLocation.setYaw(yaw);
|
||||
}
|
||||
File original = new File(War.war.getDataFolder().getPath() + "/dat/warzone-" + name + "/volume-" + teamStrSplit[0] + ".dat");
|
||||
File modified = new File(War.war.getDataFolder().getPath() + "/dat/warzone-" + name + "/volume-" + teamStrSplit[0] + "0.dat");
|
||||
try {
|
||||
original.renameTo(modified);
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
|
||||
Team team = new Team(teamStrSplit[0], TeamKind.teamKindFromString(teamStrSplit[0]), Arrays.asList(teamLocation), warzone);
|
||||
team.setRemainingLives(warzone.getTeamDefaultConfig().resolveInt(TeamConfig.LIFEPOOL));
|
||||
warzone.getTeams().add(team);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// teamFlags
|
||||
String teamFlagsStr = warzoneConfig.getString("teamFlags");
|
||||
if (teamFlagsStr != null && !teamFlagsStr.equals("")) {
|
||||
String[] teamFlagsSplit = teamFlagsStr.split(";");
|
||||
for (String teamFlagStr : teamFlagsSplit) {
|
||||
if (teamFlagStr != null && !teamFlagStr.equals("")) {
|
||||
String[] teamFlagStrSplit = teamFlagStr.split(",");
|
||||
Team team = warzone.getTeamByKind(TeamKind.teamKindFromString(teamFlagStrSplit[0]));
|
||||
if (team != null) {
|
||||
int teamFlagX = Integer.parseInt(teamFlagStrSplit[1]);
|
||||
int teamFlagY = Integer.parseInt(teamFlagStrSplit[2]);
|
||||
int teamFlagZ = Integer.parseInt(teamFlagStrSplit[3]);
|
||||
Location teamFlagLocation = new Location(world, teamFlagX, teamFlagY, teamFlagZ);
|
||||
if (teamFlagStrSplit.length > 4) {
|
||||
int yaw = Integer.parseInt(teamFlagStrSplit[4]);
|
||||
teamFlagLocation.setYaw(yaw);
|
||||
}
|
||||
team.setTeamFlag(teamFlagLocation); // this may screw things up
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// lobby
|
||||
String lobbyStr = warzoneConfig.getString("lobby");
|
||||
|
||||
warzoneConfig.close();
|
||||
|
||||
if (createNewVolume) {
|
||||
ZoneVolume zoneVolume = new ZoneVolume(warzone.getName(), world, warzone); // VolumeMapper.loadZoneVolume(warzone.getName(), warzone.getName(), war, warzone.getWorld(), warzone);
|
||||
warzone.setVolume(zoneVolume);
|
||||
}
|
||||
|
||||
// monument blocks
|
||||
for (Monument monument : warzone.getMonuments()) {
|
||||
try {
|
||||
monument.setVolume(VolumeMapper.loadVolume(monument.getName(), warzone.getName(), world));
|
||||
} catch (SQLException e) {
|
||||
War.war.getLogger().log(Level.WARNING, "Failed to load some ambiguous old volume", e);
|
||||
}
|
||||
}
|
||||
|
||||
// team spawn blocks
|
||||
for (Team team : warzone.getTeams()) {
|
||||
for (Location spawnLocation : team.getTeamSpawns()) {
|
||||
try {
|
||||
team.setSpawnVolume(spawnLocation, VolumeMapper.loadVolume(team.getName() + "0", warzone.getName(), world));
|
||||
} catch (SQLException e) {
|
||||
War.war.getLogger().log(Level.WARNING, "Failed to load some ambiguous old volume", e);
|
||||
}
|
||||
}
|
||||
if (team.getTeamFlag() != null) {
|
||||
try {
|
||||
team.setFlagVolume(VolumeMapper.loadVolume(team.getName() + "flag", warzone.getName(), world));
|
||||
} catch (SQLException e) {
|
||||
War.war.getLogger().log(Level.WARNING, "Failed to load some ambiguous old volume", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// lobby
|
||||
BlockFace lobbyFace = null;
|
||||
if (lobbyStr != null && !lobbyStr.equals("")) {
|
||||
String[] lobbyStrSplit = lobbyStr.split(",");
|
||||
if (lobbyStrSplit.length > 0) {
|
||||
// lobby orientation
|
||||
if (lobbyStrSplit[0].equals("south")) {
|
||||
lobbyFace = Direction.SOUTH();
|
||||
} else if (lobbyStrSplit[0].equals("east")) {
|
||||
lobbyFace = Direction.EAST();
|
||||
} else if (lobbyStrSplit[0].equals("north")) {
|
||||
lobbyFace = Direction.NORTH();
|
||||
} else if (lobbyStrSplit[0].equals("west")) {
|
||||
lobbyFace = Direction.WEST();
|
||||
}
|
||||
|
||||
// lobby world
|
||||
World lobbyWorld = world; // by default, warzone world
|
||||
if (lobbyStrSplit.length > 1) {
|
||||
World strWorld = War.war.getServer().getWorld(lobbyStrSplit[1]);
|
||||
if (strWorld != null) {
|
||||
lobbyWorld = strWorld;
|
||||
}
|
||||
}
|
||||
|
||||
// create the lobby
|
||||
Volume lobbyVolume = null;
|
||||
try {
|
||||
lobbyVolume = VolumeMapper.loadVolume("lobby", warzone.getName(), lobbyWorld);
|
||||
} catch (SQLException e) {
|
||||
// if the zone is this old is there any reason the lobby should be nimitz format
|
||||
War.war.getLogger().log(Level.WARNING, "Failed to load lobby for a really old warzone", e);
|
||||
}
|
||||
ZoneLobby lobby = new ZoneLobby(warzone, lobbyFace, lobbyVolume);
|
||||
warzone.setLobby(lobby);
|
||||
}
|
||||
}
|
||||
|
||||
return warzone;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void save(Warzone warzone, boolean saveAllBlocks) {
|
||||
|
||||
War.war.log("Saving War with WarzoneTxtMapper", Level.SEVERE);
|
||||
// (new File(War.war.getDataFolder().getPath() + "/dat/warzone-" + warzone.getName())).mkdir();
|
||||
// PropertiesFile warzoneConfig = new PropertiesFile(War.war.getDataFolder().getPath() + "/warzone-" + warzone.getName() + ".txt");
|
||||
// // war.getLogger().info("Saving warzone " + warzone.getName() + "...");
|
||||
//
|
||||
// // name
|
||||
// warzoneConfig.setString("name", warzone.getName());
|
||||
//
|
||||
// // world
|
||||
// warzoneConfig.setString("world", warzone.getWorld().getName()); // default for now
|
||||
//
|
||||
// // teleport
|
||||
// String teleportStr = "";
|
||||
// Location tele = warzone.getTeleport();
|
||||
// if (tele != null) {
|
||||
// int intYaw = 0;
|
||||
// if (tele.getYaw() >= 0) {
|
||||
// intYaw = (int) (tele.getYaw() % 360);
|
||||
// } else {
|
||||
// intYaw = (int) (360 + (tele.getYaw() % 360));
|
||||
// }
|
||||
// teleportStr = tele.getBlockX() + "," + tele.getBlockY() + "," + tele.getBlockZ() + "," + intYaw;
|
||||
// }
|
||||
// warzoneConfig.setString("teleport", teleportStr);
|
||||
//
|
||||
// // teams
|
||||
// String teamsStr = "";
|
||||
// List<Team> teams = warzone.getTeams();
|
||||
// for (Team team : teams) {
|
||||
// Location spawn = team.getTeamSpawn();
|
||||
// int intYaw = 0;
|
||||
// if (spawn.getYaw() >= 0) {
|
||||
// intYaw = (int) (spawn.getYaw() % 360);
|
||||
// } else {
|
||||
// intYaw = (int) (360 + (spawn.getYaw() % 360));
|
||||
// }
|
||||
// teamsStr += team.getName() + "," + spawn.getBlockX() + "," + spawn.getBlockY() + "," + spawn.getBlockZ() + "," + intYaw + ";";
|
||||
// }
|
||||
// warzoneConfig.setString("teams", teamsStr);
|
||||
//
|
||||
// // team flags
|
||||
// String teamFlagsStr = "";;
|
||||
// for (Team team : teams) {
|
||||
// if (team.getFlagVolume() != null) {
|
||||
// Location flag = team.getTeamFlag();
|
||||
// int intYaw = 0;
|
||||
// if (flag.getYaw() >= 0) {
|
||||
// intYaw = (int) (flag.getYaw() % 360);
|
||||
// } else {
|
||||
// intYaw = (int) (360 + (flag.getYaw() % 360));
|
||||
// }
|
||||
// teamFlagsStr += team.getName() + "," + flag.getBlockX() + "," + flag.getBlockY() + "," + flag.getBlockZ() + "," + intYaw + ";";
|
||||
// }
|
||||
// }
|
||||
// warzoneConfig.setString("teamFlags", teamFlagsStr);
|
||||
//
|
||||
// // ff
|
||||
// warzoneConfig.setBoolean("friendlyFire", warzone.getFriendlyFire());
|
||||
//
|
||||
// // loadout
|
||||
// HashMap<Integer, ItemStack> items = warzone.getDefaultInventories().getLoadouts().get("default");
|
||||
// warzoneConfig.setString("loadout", LoadoutTxtMapper.fromLoadoutToString(items));
|
||||
//
|
||||
// // defaultExtraLoadouts
|
||||
// String extraLoadoutsStr = "";
|
||||
// for (String name : warzone.getDefaultInventories().getLoadouts().keySet()) {
|
||||
// if (!name.equals("default")) {
|
||||
// extraLoadoutsStr += name + ",";
|
||||
//
|
||||
// HashMap<Integer, ItemStack> loadout = warzone.getDefaultInventories().getLoadouts().get(name);
|
||||
// warzoneConfig.setString(name + "Loadout", LoadoutTxtMapper.fromLoadoutToString(loadout));
|
||||
// }
|
||||
// }
|
||||
// warzoneConfig.setString("extraLoadouts", extraLoadoutsStr);
|
||||
//
|
||||
// // authors
|
||||
// warzoneConfig.setString("author", warzone.getAuthorsString());
|
||||
//
|
||||
// // life pool
|
||||
// warzoneConfig.setInt("lifePool", warzone.getLifePool());
|
||||
//
|
||||
// // monument heal
|
||||
// warzoneConfig.setInt("monumentHeal", warzone.getMonumentHeal());
|
||||
//
|
||||
// // autoAssignOnly
|
||||
// warzoneConfig.setBoolean("autoAssignOnly", warzone.isAutoAssignOnly());
|
||||
//
|
||||
// // flagPointsOnly
|
||||
// warzoneConfig.setBoolean("flagPointsOnly", warzone.isFlagPointsOnly());
|
||||
//
|
||||
// // flagMustBeHome
|
||||
// warzoneConfig.setBoolean("flagMustBeHome", warzone.isFlagMustBeHome());
|
||||
//
|
||||
// // team cap
|
||||
// warzoneConfig.setInt("teamCap", warzone.getTeamCap());
|
||||
//
|
||||
// // score cap
|
||||
// warzoneConfig.setInt("scoreCap", warzone.getScoreCap());
|
||||
//
|
||||
// // respawn timer
|
||||
// warzoneConfig.setInt("respawnTimer", warzone.getRespawnTimer());
|
||||
//
|
||||
// // blockHeads
|
||||
// warzoneConfig.setBoolean("blockHeads", warzone.isBlockHeads());
|
||||
//
|
||||
// // spawnStyle
|
||||
// warzoneConfig.setString("spawnStyle", warzone.getSpawnStyle().toString());
|
||||
//
|
||||
// // flagReturn
|
||||
// warzoneConfig.setString("flagReturn", warzone.getFlagReturn().toString());
|
||||
//
|
||||
// // reward
|
||||
// HashMap<Integer, ItemStack> rewardItems = warzone.getDefaultInventories().getReward();
|
||||
// warzoneConfig.setString("reward", LoadoutTxtMapper.fromLoadoutToString(rewardItems));
|
||||
//
|
||||
// // unbreakableZoneBlocks
|
||||
// warzoneConfig.setBoolean("unbreakableZoneBlocks", warzone.isUnbreakableZoneBlocks());
|
||||
//
|
||||
// // disabled
|
||||
// warzoneConfig.setBoolean("disabled", warzone.isDisabled());
|
||||
//
|
||||
// // noCreatures
|
||||
// warzoneConfig.setBoolean("noCreatures", warzone.isNoCreatures());
|
||||
//
|
||||
// // glassWalls
|
||||
// warzoneConfig.setBoolean("glassWalls", warzone.isGlassWalls());
|
||||
//
|
||||
// // pvpInZone
|
||||
// warzoneConfig.setBoolean("pvpInZone", warzone.isPvpInZone());
|
||||
//
|
||||
// // instaBreak
|
||||
// warzoneConfig.setBoolean("instaBreak", warzone.isInstaBreak());
|
||||
//
|
||||
// // noDrops
|
||||
// warzoneConfig.setBoolean("noDrops", warzone.isNoDrops());
|
||||
//
|
||||
// // noHunger
|
||||
// warzoneConfig.setBoolean("noHunger", warzone.isNoHunger());
|
||||
//
|
||||
// // saturation
|
||||
// warzoneConfig.setInt("saturation", warzone.getSaturation());
|
||||
//
|
||||
// // minPlayers
|
||||
// warzoneConfig.setInt("minPlayers", warzone.getMinPlayers());
|
||||
//
|
||||
// // minTeams
|
||||
// warzoneConfig.setInt("minTeams", warzone.getMinTeams());
|
||||
//
|
||||
// // resetOnEmpty
|
||||
// warzoneConfig.setBoolean("resetOnEmpty", warzone.isResetOnEmpty());
|
||||
//
|
||||
// // resetOnLoad
|
||||
// warzoneConfig.setBoolean("resetOnLoad", warzone.isResetOnLoad());
|
||||
//
|
||||
// // resetOnUnload
|
||||
// warzoneConfig.setBoolean("resetOnUnload", warzone.isResetOnUnload());
|
||||
//
|
||||
// // rallyPoint
|
||||
// String rpStr = "";
|
||||
// Location rp = warzone.getRallyPoint();
|
||||
// if (rp != null) {
|
||||
// rpStr = rp.getBlockX() + "," + rp.getBlockY() + "," + rp.getBlockZ();
|
||||
// }
|
||||
// warzoneConfig.setString("rallyPoint", rpStr);
|
||||
//
|
||||
// // defaultDropLootOnDeath
|
||||
// // warzoneConfig.setBoolean("dropLootOnDeath", warzone.isDropLootOnDeath());
|
||||
//
|
||||
// // monuments
|
||||
// String monumentsStr = "";
|
||||
// List<Monument> monuments = warzone.getMonuments();
|
||||
// for (Monument monument : monuments) {
|
||||
// Location monumentLoc = monument.getLocation();
|
||||
// monumentsStr += monument.getName() + "," + monumentLoc.getBlockX() + "," + monumentLoc.getBlockY() + "," + monumentLoc.getBlockZ() + ";";
|
||||
// }
|
||||
// warzoneConfig.setString("monuments", monumentsStr);
|
||||
//
|
||||
// // lobby
|
||||
// String lobbyStr = "";
|
||||
// if (warzone.getLobby() != null) {
|
||||
// if (Direction.SOUTH() == warzone.getLobby().getWall()) {
|
||||
// lobbyStr = "south";
|
||||
// } else if (Direction.EAST() == warzone.getLobby().getWall()) {
|
||||
// lobbyStr = "east";
|
||||
// } else if (Direction.NORTH() == warzone.getLobby().getWall()) {
|
||||
// lobbyStr = "north";
|
||||
// } else if (Direction.WEST() == warzone.getLobby().getWall()) {
|
||||
// lobbyStr = "west";
|
||||
// }
|
||||
// }
|
||||
// warzoneConfig.setString("lobby", lobbyStr + "," + warzone.getLobby().getVolume().getWorld().getName());
|
||||
//
|
||||
// warzoneConfig.save();
|
||||
// warzoneConfig.close();
|
||||
//
|
||||
// // monument blocks
|
||||
// for (Monument monument : monuments) {
|
||||
// VolumeMapper.save(monument.getVolume(), warzone.getName());
|
||||
// }
|
||||
//
|
||||
// // team spawn & flag blocks
|
||||
// for (Team team : teams) {
|
||||
// VolumeMapper.save(team.getSpawnVolume(), warzone.getName());
|
||||
// if (team.getFlagVolume() != null) {
|
||||
// VolumeMapper.save(team.getFlagVolume(), warzone.getName());
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// if (warzone.getLobby() != null) {
|
||||
// VolumeMapper.save(warzone.getLobby().getVolume(), warzone.getName());
|
||||
// }
|
||||
}
|
||||
|
||||
public static void delete(String name) {
|
||||
File zoneFolder = new File(War.war.getDataFolder().getPath() + "/dat/warzone-" + name);
|
||||
File[] files = zoneFolder.listFiles();
|
||||
for (File file : files) {
|
||||
boolean deletedData = file.delete();
|
||||
if (!deletedData) {
|
||||
War.war.log("Failed to delete file " + file.getName(), Level.WARNING);
|
||||
}
|
||||
}
|
||||
boolean deletedData = zoneFolder.delete();
|
||||
if (!deletedData) {
|
||||
War.war.log("Failed to delete folder " + zoneFolder.getName(), Level.WARNING);
|
||||
}
|
||||
File zoneFile = new File(War.war.getDataFolder().getPath() + "/warzone-" + name + ".txt");
|
||||
deletedData = zoneFile.delete();
|
||||
if (!deletedData) {
|
||||
War.war.log("Failed to delete file " + zoneFile.getName(), Level.WARNING);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,5 +1,21 @@
|
|||
package com.tommytony.war.mapper;
|
||||
|
||||
import com.tommytony.war.Team;
|
||||
import com.tommytony.war.War;
|
||||
import com.tommytony.war.Warzone;
|
||||
import com.tommytony.war.config.TeamConfig;
|
||||
import com.tommytony.war.config.TeamKind;
|
||||
import com.tommytony.war.config.WarzoneConfig;
|
||||
import com.tommytony.war.structure.*;
|
||||
import com.tommytony.war.utility.Direction;
|
||||
import com.tommytony.war.volume.Volume;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.sql.Connection;
|
||||
|
@ -10,40 +26,17 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import com.tommytony.war.Team;
|
||||
import com.tommytony.war.War;
|
||||
import com.tommytony.war.Warzone;
|
||||
import com.tommytony.war.config.TeamConfig;
|
||||
import com.tommytony.war.config.TeamKind;
|
||||
import com.tommytony.war.structure.Bomb;
|
||||
import com.tommytony.war.structure.Cake;
|
||||
import com.tommytony.war.structure.Monument;
|
||||
import com.tommytony.war.structure.ZoneLobby;
|
||||
import com.tommytony.war.utility.Direction;
|
||||
import com.tommytony.war.volume.Volume;
|
||||
import com.tommytony.war.volume.ZoneVolume;
|
||||
|
||||
public class WarzoneYmlMapper {
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public static Warzone load(String name) { // removed createNewVolume, as it did nothing
|
||||
File warzoneTxtFile = new File(War.war.getDataFolder().getPath() + "/warzone-" + name + ".txt");
|
||||
File warzoneYmlFile = new File(War.war.getDataFolder().getPath() + "/warzone-" + name + ".yml");
|
||||
|
||||
// Convert from TXT to YML if needed
|
||||
if (warzoneTxtFile.exists() && !warzoneYmlFile.exists()) {
|
||||
// Since we're converting, WarTxtMapper didn't load the warzones.
|
||||
// We need to load the old-text-format-Warzone into memory.
|
||||
Warzone zoneToConvert = WarzoneTxtMapper.load(name, false);
|
||||
WarzoneYmlMapper.save(zoneToConvert);
|
||||
War.war.log("Converted warzone-" + name + ".txt to warzone-" + name + ".yml", Level.INFO);
|
||||
// dropped nimitz compatibility with the MC 1.13 update
|
||||
War.war.log("Failed to load Warzone " + name + " - backwards compatibility was dropped with MC 1.13. Please delete this zone to continue.", Level.WARNING);
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!warzoneYmlFile.exists()) {
|
||||
|
@ -145,7 +138,33 @@ public class WarzoneYmlMapper {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// capture points
|
||||
if (warzoneRootSection.contains(zoneInfoPrefix + "capturepoint")) {
|
||||
List<String> cpNames = warzoneRootSection.getStringList(zoneInfoPrefix + "capturepoint.names");
|
||||
for (String cpName : cpNames) {
|
||||
if (cpName != null && !cpName.equals("")) {
|
||||
String cpPrefix = zoneInfoPrefix + "capturepoint." + cpName + ".";
|
||||
if (!warzoneRootSection.contains(cpPrefix + "x")) {
|
||||
// try lowercase instead
|
||||
cpPrefix = zoneInfoPrefix + "capturepoint." + cpName.toLowerCase() + ".";
|
||||
}
|
||||
int cpX = warzoneRootSection.getInt(cpPrefix + "x");
|
||||
int cpY = warzoneRootSection.getInt(cpPrefix + "y");
|
||||
int cpZ = warzoneRootSection.getInt(cpPrefix + "z");
|
||||
float cpYaw = (float) warzoneRootSection.getDouble(cpPrefix + "yaw");
|
||||
TeamKind controller = null;
|
||||
int strength = 0;
|
||||
if (warzoneRootSection.contains(cpPrefix + "controller")) {
|
||||
controller = TeamKind.teamKindFromString(warzoneRootSection.getString(cpPrefix + "controller"));
|
||||
strength = warzone.getWarzoneConfig().getInt(WarzoneConfig.CAPTUREPOINTTIME);
|
||||
}
|
||||
CapturePoint cp = new CapturePoint(cpName, new Location(world, cpX, cpY, cpZ, cpYaw, 0), controller, strength, warzone);
|
||||
warzone.getCapturePoints().add(cp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// bombs
|
||||
if (warzoneRootSection.contains(zoneInfoPrefix + "bomb")) {
|
||||
List<String> bombNames = warzoneRootSection.getStringList(zoneInfoPrefix + "bomb.names");
|
||||
|
@ -283,7 +302,7 @@ public class WarzoneYmlMapper {
|
|||
}
|
||||
Connection connection = null;
|
||||
try {
|
||||
connection = ZoneVolumeMapper.getZoneConnection(warzone.getVolume(), warzone.getName(), warzone.getWorld());
|
||||
connection = ZoneVolumeMapper.getZoneConnection(warzone.getVolume(), warzone.getName());
|
||||
} catch (SQLException e) {
|
||||
War.war.getLogger().log(Level.WARNING, "Failed to load warzone structures volume", e);
|
||||
}
|
||||
|
@ -295,7 +314,16 @@ public class WarzoneYmlMapper {
|
|||
War.war.getLogger().log(Level.WARNING, "Failed to load warzone structures volume", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// capture point blocks
|
||||
for (CapturePoint cp : warzone.getCapturePoints()) {
|
||||
try {
|
||||
cp.setVolume(warzone.loadStructure("cp-" + cp.getName(), connection));
|
||||
} catch (SQLException e) {
|
||||
War.war.getLogger().log(Level.WARNING, "Failed to load warzone structures volume", e);
|
||||
}
|
||||
}
|
||||
|
||||
// bomb blocks
|
||||
for (Bomb bomb : warzone.getBombs()) {
|
||||
try {
|
||||
|
@ -352,50 +380,18 @@ public class WarzoneYmlMapper {
|
|||
if (warzoneRootSection.isItemStack(lobbyPrefix + "materials.floor")) {
|
||||
warzone.getLobbyMaterials().setFloorBlock(
|
||||
warzoneRootSection.getItemStack(lobbyPrefix + "materials.floor"));
|
||||
} else {
|
||||
ConfigurationSection floorMaterialSection = warzoneRootSection
|
||||
.getConfigurationSection(lobbyPrefix + "materials.floor");
|
||||
if (floorMaterialSection != null) {
|
||||
warzone.getLobbyMaterials().setFloorBlock(
|
||||
new ItemStack(floorMaterialSection.getInt("id"), 1,
|
||||
(short) floorMaterialSection.getInt("data")));
|
||||
}
|
||||
}
|
||||
if (warzoneRootSection.isItemStack(lobbyPrefix + "materials.outline")) {
|
||||
warzone.getLobbyMaterials().setOutlineBlock(
|
||||
warzoneRootSection.getItemStack(lobbyPrefix + "materials.outline"));
|
||||
} else {
|
||||
ConfigurationSection floorMaterialSection = warzoneRootSection
|
||||
.getConfigurationSection(lobbyPrefix + "materials.outline");
|
||||
if (floorMaterialSection != null) {
|
||||
warzone.getLobbyMaterials().setOutlineBlock(
|
||||
new ItemStack(floorMaterialSection.getInt("id"), 1,
|
||||
(short) floorMaterialSection.getInt("data")));
|
||||
}
|
||||
}
|
||||
if (warzoneRootSection.isItemStack(lobbyPrefix + "materials.gate")) {
|
||||
warzone.getLobbyMaterials().setGateBlock(
|
||||
warzoneRootSection.getItemStack(lobbyPrefix + "materials.gate"));
|
||||
} else {
|
||||
ConfigurationSection floorMaterialSection = warzoneRootSection
|
||||
.getConfigurationSection(lobbyPrefix + "materials.gate");
|
||||
if (floorMaterialSection != null) {
|
||||
warzone.getLobbyMaterials().setGateBlock(
|
||||
new ItemStack(floorMaterialSection.getInt("id"), 1,
|
||||
(short) floorMaterialSection.getInt("data")));
|
||||
}
|
||||
}
|
||||
if (warzoneRootSection.isItemStack(lobbyPrefix + "materials.light")) {
|
||||
warzone.getLobbyMaterials().setLightBlock(
|
||||
warzoneRootSection.getItemStack(lobbyPrefix + "materials.light"));
|
||||
} else {
|
||||
ConfigurationSection floorMaterialSection = warzoneRootSection
|
||||
.getConfigurationSection(lobbyPrefix + "materials.light");
|
||||
if (floorMaterialSection != null) {
|
||||
warzone.getLobbyMaterials().setLightBlock(
|
||||
new ItemStack(floorMaterialSection.getInt("id"), 1,
|
||||
(short) floorMaterialSection.getInt("data")));
|
||||
}
|
||||
}
|
||||
|
||||
// lobby world
|
||||
|
@ -416,38 +412,14 @@ public class WarzoneYmlMapper {
|
|||
if (warzoneRootSection.isItemStack(zoneInfoPrefix + "materials.main")) {
|
||||
warzone.getWarzoneMaterials().setMainBlock(
|
||||
warzoneRootSection.getItemStack(zoneInfoPrefix + "materials.main"));
|
||||
} else {
|
||||
ConfigurationSection floorMaterialSection = warzoneRootSection
|
||||
.getConfigurationSection(zoneInfoPrefix + "materials.main");
|
||||
if (floorMaterialSection != null) {
|
||||
warzone.getWarzoneMaterials().setMainBlock(
|
||||
new ItemStack(floorMaterialSection.getInt("id"), 1,
|
||||
(short) floorMaterialSection.getInt("data")));
|
||||
}
|
||||
}
|
||||
if (warzoneRootSection.isItemStack(zoneInfoPrefix + "materials.stand")) {
|
||||
warzone.getWarzoneMaterials().setStandBlock(
|
||||
warzoneRootSection.getItemStack(zoneInfoPrefix + "materials.stand"));
|
||||
} else {
|
||||
ConfigurationSection floorMaterialSection = warzoneRootSection
|
||||
.getConfigurationSection(zoneInfoPrefix + "materials.stand");
|
||||
if (floorMaterialSection != null) {
|
||||
warzone.getWarzoneMaterials().setStandBlock(
|
||||
new ItemStack(floorMaterialSection.getInt("id"), 1,
|
||||
(short) floorMaterialSection.getInt("data")));
|
||||
}
|
||||
}
|
||||
if (warzoneRootSection.isItemStack(zoneInfoPrefix + "materials.light")) {
|
||||
warzone.getWarzoneMaterials().setLightBlock(
|
||||
warzoneRootSection.getItemStack(zoneInfoPrefix + "materials.light"));
|
||||
} else {
|
||||
ConfigurationSection floorMaterialSection = warzoneRootSection
|
||||
.getConfigurationSection(zoneInfoPrefix + "materials.light");
|
||||
if (floorMaterialSection != null) {
|
||||
warzone.getWarzoneMaterials().setLightBlock(
|
||||
new ItemStack(floorMaterialSection.getInt("id"), 1,
|
||||
(short) floorMaterialSection.getInt("data")));
|
||||
}
|
||||
}
|
||||
try {
|
||||
connection.close();
|
||||
|
@ -546,19 +518,42 @@ public class WarzoneYmlMapper {
|
|||
monumentSection.set("yaw", toIntYaw(monument.getLocation().getYaw()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// capture points
|
||||
if (warzone.getCapturePoints().size() > 0) {
|
||||
ConfigurationSection cpsSection = warzoneInfoSection.createSection("capturepoint");
|
||||
|
||||
List<String> cpNames = new ArrayList<String>();
|
||||
for (CapturePoint cp : warzone.getCapturePoints()) {
|
||||
cpNames.add(cp.getName());
|
||||
}
|
||||
cpsSection.set("names", cpNames);
|
||||
|
||||
for (CapturePoint cp : warzone.getCapturePoints()) {
|
||||
|
||||
ConfigurationSection cpSection = cpsSection.createSection(cp.getName());
|
||||
cpSection.set("x", cp.getLocation().getBlockX());
|
||||
cpSection.set("y", cp.getLocation().getBlockY());
|
||||
cpSection.set("z", cp.getLocation().getBlockZ());
|
||||
cpSection.set("yaw", cp.getLocation().getYaw());
|
||||
if (cp.getDefaultController() != null) {
|
||||
cpSection.set("controller", cp.getDefaultController().name());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// bombs
|
||||
if (warzone.getBombs().size() > 0) {
|
||||
ConfigurationSection bombsSection = warzoneInfoSection.createSection("bomb");
|
||||
|
||||
|
||||
List<String> bombNames = new ArrayList<String>();
|
||||
for (Bomb bomb : warzone.getBombs()) {
|
||||
bombNames.add(bomb.getName());
|
||||
}
|
||||
bombsSection.set("names", bombNames);
|
||||
|
||||
|
||||
for (Bomb bomb : warzone.getBombs()) {
|
||||
|
||||
|
||||
ConfigurationSection bombSection = bombsSection.createSection(bomb.getName());
|
||||
bombSection.set("x", bomb.getLocation().getBlockX());
|
||||
bombSection.set("y", bomb.getLocation().getBlockY());
|
||||
|
@ -566,7 +561,7 @@ public class WarzoneYmlMapper {
|
|||
bombSection.set("yaw", toIntYaw(bomb.getLocation().getYaw()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// cakes
|
||||
if (warzone.getCakes().size() > 0) {
|
||||
ConfigurationSection cakesSection = warzoneInfoSection.createSection("cake");
|
||||
|
@ -661,7 +656,7 @@ public class WarzoneYmlMapper {
|
|||
}
|
||||
Connection connection = null;
|
||||
try {
|
||||
connection = ZoneVolumeMapper.getZoneConnection(warzone.getVolume(), warzone.getName(), warzone.getWorld());
|
||||
connection = ZoneVolumeMapper.getZoneConnection(warzone.getVolume(), warzone.getName());
|
||||
} catch (SQLException e) {
|
||||
War.war.getLogger().log(Level.WARNING, "Failed to load warzone structures volume", e);
|
||||
}
|
||||
|
@ -673,7 +668,16 @@ public class WarzoneYmlMapper {
|
|||
War.war.getLogger().log(Level.WARNING, "Failed to save warzone structures volume", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// capture point blocks
|
||||
for (CapturePoint cp : warzone.getCapturePoints()) {
|
||||
try {
|
||||
ZoneVolumeMapper.saveStructure(cp.getVolume(), connection);
|
||||
} catch (SQLException e) {
|
||||
War.war.getLogger().log(Level.WARNING, "Failed to save warzone structures volume", e);
|
||||
}
|
||||
}
|
||||
|
||||
// bomb blocks
|
||||
for (Bomb bomb : warzone.getBombs()) {
|
||||
try {
|
||||
|
|
|
@ -1,42 +1,19 @@
|
|||
package com.tommytony.war.mapper;
|
||||
|
||||
import java.io.File;
|
||||
import java.sql.Connection;
|
||||
import java.sql.DriverManager;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Note;
|
||||
import org.bukkit.Note.Tone;
|
||||
import org.bukkit.SkullType;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.block.CommandBlock;
|
||||
import org.bukkit.block.CreatureSpawner;
|
||||
import org.bukkit.block.Jukebox;
|
||||
import org.bukkit.block.NoteBlock;
|
||||
import org.bukkit.block.Sign;
|
||||
import org.bukkit.block.Skull;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.inventory.InventoryHolder;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import com.tommytony.war.War;
|
||||
import com.tommytony.war.volume.Volume;
|
||||
import com.tommytony.war.volume.ZoneVolume;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.World;
|
||||
|
||||
import java.io.File;
|
||||
import java.sql.Connection;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
|
||||
/**
|
||||
* Loads and saves zone blocks to SQLite3 database.
|
||||
|
@ -44,245 +21,84 @@ import com.tommytony.war.volume.ZoneVolume;
|
|||
* @author cmastudios
|
||||
* @since 1.8
|
||||
*/
|
||||
public class ZoneVolumeMapper {
|
||||
|
||||
public static final int DATABASE_VERSION = 2;
|
||||
public class ZoneVolumeMapper extends VolumeMapper {
|
||||
|
||||
/**
|
||||
* Get a connection to the warzone database, converting blocks if not found.
|
||||
* @param volume zone volume to load
|
||||
* @param zoneName warzone to load
|
||||
* @param world world containing this warzone
|
||||
* @return an open connection to the sqlite file
|
||||
* @throws SQLException
|
||||
*/
|
||||
public static Connection getZoneConnection(ZoneVolume volume, String zoneName, World world) throws SQLException {
|
||||
public static Connection getZoneConnection(ZoneVolume volume, String zoneName) throws SQLException {
|
||||
File databaseFile = new File(War.war.getDataFolder(), String.format("/dat/warzone-%s/volume-%s.sl3", zoneName, volume.getName()));
|
||||
if (!databaseFile.exists()) {
|
||||
// Convert warzone to nimitz file format.
|
||||
PreNimitzZoneVolumeMapper.load(volume, zoneName, world, false);
|
||||
ZoneVolumeMapper.save(volume, zoneName);
|
||||
War.war.log("Warzone " + zoneName + " converted to nimitz format!", Level.INFO);
|
||||
// dropped nimitz compatibility with the MC 1.13 update
|
||||
War.war.log("Warzone " + zoneName + " not found - creating new file. Will not attempt converting legacy War version formats.", Level.WARNING);
|
||||
}
|
||||
Connection databaseConnection = DriverManager.getConnection("jdbc:sqlite:" + databaseFile.getPath());
|
||||
Statement stmt = databaseConnection.createStatement();
|
||||
ResultSet versionQuery = stmt.executeQuery("PRAGMA user_version");
|
||||
int version = versionQuery.getInt("user_version");
|
||||
versionQuery.close();
|
||||
if (version > DATABASE_VERSION) {
|
||||
stmt.close();
|
||||
databaseConnection.close();
|
||||
|
||||
// Can't load this too-recent format
|
||||
throw new IllegalStateException(String.format("Unsupported zone format (was already converted to version: %d, current format: %d)", version, DATABASE_VERSION));
|
||||
} else if (version < DATABASE_VERSION) {
|
||||
stmt.close();
|
||||
|
||||
// We need to migrate to newest schema
|
||||
switch (version) {
|
||||
// Run some update SQL for each old version
|
||||
case 1:
|
||||
// Run update from 1 to 2
|
||||
updateFromVersionOneToTwo(zoneName, databaseConnection);
|
||||
|
||||
// How to continue this pattern: (@tommytony multiple in one shouldn't be needed, just don't put a break in the switch)
|
||||
// case 2:
|
||||
// // Run update from 2 to 3
|
||||
// updateFromVersionTwoToTree(zoneName, databaseConnection);
|
||||
}
|
||||
|
||||
Connection databaseConnection = getConnection(databaseFile);
|
||||
int version = checkConvert(databaseConnection);
|
||||
switch (version) {
|
||||
case 0: // new file
|
||||
break;
|
||||
case 1:
|
||||
case 2:
|
||||
War.war.log(zoneName + " cannot be migrated from War 1.9 due to breaking MC1.13 changes - please resave.", Level.WARNING);
|
||||
convertSchema2_3(databaseConnection, "", false);
|
||||
for (String prefix : getStructures(databaseConnection)) {
|
||||
convertSchema2_3(databaseConnection, prefix, false);
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
break;
|
||||
default:
|
||||
throw new IllegalStateException(String.format("Unsupported volume format (was already converted to version: %d, current format: %d)", version, DATABASE_VERSION));
|
||||
}
|
||||
return databaseConnection;
|
||||
}
|
||||
|
||||
private static List<String> getStructures(Connection databaseConnection) throws SQLException {
|
||||
List<String> structures = new ArrayList<>();
|
||||
Statement stmt = databaseConnection.createStatement();
|
||||
ResultSet q = stmt.executeQuery("SELECT name FROM sqlite_master WHERE type='table'");
|
||||
while (q.next()) {
|
||||
String name = q.getString("name");
|
||||
if (name.contains("structure") && name.contains("corners")) {
|
||||
structures.add(name.replace("corners", ""));
|
||||
}
|
||||
}
|
||||
q.close();
|
||||
stmt.close();
|
||||
return structures;
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads the given volume
|
||||
*
|
||||
* @param databaseConnection Open connection to zone database
|
||||
* @param volume Volume to load
|
||||
* @param world The world the zone is located
|
||||
* @param onlyLoadCorners Should only the corners be loaded
|
||||
* @param start Starting position to load blocks at
|
||||
* @param total Amount of blocks to read
|
||||
* @return Changed blocks
|
||||
* @throws SQLException Error communicating with SQLite3 database
|
||||
*/
|
||||
public static int load(Connection databaseConnection, ZoneVolume volume, World world, boolean onlyLoadCorners, int start, int total, boolean[][][] changes) throws SQLException {
|
||||
Validate.isTrue(!databaseConnection.isClosed());
|
||||
Statement stmt = databaseConnection.createStatement();
|
||||
ResultSet cornerQuery = stmt.executeQuery("SELECT * FROM corners");
|
||||
cornerQuery.next();
|
||||
final Block corner1 = world.getBlockAt(cornerQuery.getInt("x"), cornerQuery.getInt("y"), cornerQuery.getInt("z"));
|
||||
cornerQuery.next();
|
||||
final Block corner2 = world.getBlockAt(cornerQuery.getInt("x"), cornerQuery.getInt("y"), cornerQuery.getInt("z"));
|
||||
cornerQuery.close();
|
||||
volume.setCornerOne(corner1);
|
||||
volume.setCornerTwo(corner2);
|
||||
if (onlyLoadCorners) {
|
||||
stmt.close();
|
||||
return 0;
|
||||
}
|
||||
int minX = volume.getMinX(), minY = volume.getMinY(), minZ = volume.getMinZ();
|
||||
int changed = 0;
|
||||
ResultSet query = stmt.executeQuery("SELECT * FROM blocks ORDER BY rowid LIMIT " + start + ", " + total);
|
||||
while (query.next()) {
|
||||
int x = query.getInt("x"), y = query.getInt("y"), z = query.getInt("z");
|
||||
changed++;
|
||||
Block relative = corner1.getRelative(x, y, z);
|
||||
int xi = relative.getX() - minX, yi = relative.getY() - minY, zi = relative.getZ() - minZ;
|
||||
if (changes != null) {
|
||||
changes[xi][yi][zi] = true;
|
||||
}
|
||||
BlockState modify = relative.getState();
|
||||
ItemStack data = new ItemStack(Material.valueOf(query.getString("type")), 0, query.getShort("data"));
|
||||
if (modify.getType() != data.getType() || !modify.getData().equals(data.getData())) {
|
||||
// Update the type & data if it has changed
|
||||
modify.setType(data.getType());
|
||||
modify.setData(data.getData());
|
||||
modify.update(true, false); // No-physics update, preventing the need for deferring blocks
|
||||
modify = corner1.getRelative(x, y, z).getState(); // Grab a new instance
|
||||
}
|
||||
if (query.getString("metadata") == null || query.getString("metadata").isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
if (modify instanceof Sign) {
|
||||
final String[] lines = query.getString("metadata").split("\n");
|
||||
for (int i = 0; i < lines.length; i++) {
|
||||
((Sign) modify).setLine(i, lines[i]);
|
||||
}
|
||||
modify.update(true, false);
|
||||
}
|
||||
|
||||
// Containers
|
||||
if (modify instanceof InventoryHolder) {
|
||||
YamlConfiguration config = new YamlConfiguration();
|
||||
config.loadFromString(query.getString("metadata"));
|
||||
((InventoryHolder) modify).getInventory().clear();
|
||||
for (Object obj : config.getList("items")) {
|
||||
if (obj instanceof ItemStack) {
|
||||
((InventoryHolder) modify).getInventory().addItem((ItemStack) obj);
|
||||
}
|
||||
}
|
||||
modify.update(true, false);
|
||||
}
|
||||
|
||||
// Notes
|
||||
if (modify instanceof NoteBlock) {
|
||||
String[] split = query.getString("metadata").split("\n");
|
||||
Note note = new Note(Integer.parseInt(split[1]), Tone.valueOf(split[0]), Boolean.parseBoolean(split[2]));
|
||||
((NoteBlock) modify).setNote(note);
|
||||
modify.update(true, false);
|
||||
}
|
||||
|
||||
// Records
|
||||
if (modify instanceof Jukebox) {
|
||||
((Jukebox) modify).setPlaying(Material.valueOf(query.getString("metadata")));
|
||||
modify.update(true, false);
|
||||
}
|
||||
|
||||
// Skulls
|
||||
if (modify instanceof Skull) {
|
||||
String[] opts = query.getString("metadata").split("\n");
|
||||
((Skull) modify).setOwner(opts[0]);
|
||||
((Skull) modify).setSkullType(SkullType.valueOf(opts[1]));
|
||||
((Skull) modify).setRotation(BlockFace.valueOf(opts[2]));
|
||||
modify.update(true, false);
|
||||
}
|
||||
|
||||
// Command blocks
|
||||
if (modify instanceof CommandBlock) {
|
||||
final String[] commandArray = query.getString("metadata").split("\n");
|
||||
((CommandBlock) modify).setName(commandArray[0]);
|
||||
((CommandBlock) modify).setCommand(commandArray[1]);
|
||||
modify.update(true, false);
|
||||
}
|
||||
|
||||
// Creature spawner
|
||||
if (modify instanceof CreatureSpawner) {
|
||||
((CreatureSpawner) modify).setSpawnedType(EntityType.valueOf(query.getString("metadata")));
|
||||
modify.update(true, false);
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
War.war.getLogger().log(Level.WARNING, "Exception loading some tile data. x:" + x + " y:" + y + " z:" + z + " type:" + modify.getType().toString() + " data:" + modify.getData().toString(), ex);
|
||||
}
|
||||
}
|
||||
query.close();
|
||||
stmt.close();
|
||||
return changed;
|
||||
public static int reloadZoneBlocks(Connection databaseConnection, ZoneVolume volume, int start, int total, boolean[][][] changes) throws SQLException {
|
||||
return loadBlocks(databaseConnection, volume, start, total, changes, false, "");
|
||||
}
|
||||
|
||||
|
||||
public static int saveStructure(Volume volume, Connection databaseConnection) throws SQLException {
|
||||
Statement stmt = databaseConnection.createStatement();
|
||||
stmt.executeUpdate("PRAGMA user_version = " + DATABASE_VERSION);
|
||||
// Storing zonemaker-inputted name could result in injection or undesirable behavior.
|
||||
String prefix = String.format("structure_%d", volume.getName().hashCode() & Integer.MAX_VALUE);
|
||||
stmt.executeUpdate("CREATE TABLE IF NOT EXISTS " + prefix +
|
||||
"_blocks (x BIGINT, y BIGINT, z BIGINT, type TEXT, data SMALLINT)");
|
||||
stmt.executeUpdate("CREATE TABLE IF NOT EXISTS " + prefix +
|
||||
"_corners (pos INTEGER PRIMARY KEY NOT NULL UNIQUE, x INTEGER NOT NULL, y INTEGER NOT NULL, z INTEGER NOT NULL)");
|
||||
stmt.executeUpdate("DELETE FROM " + prefix + "_blocks");
|
||||
stmt.executeUpdate("DELETE FROM " + prefix + "_corners");
|
||||
stmt.close();
|
||||
PreparedStatement cornerStmt = databaseConnection
|
||||
.prepareStatement("INSERT INTO " + prefix + "_corners SELECT 1 AS pos, ? AS x, ? AS y, ? AS z UNION SELECT 2, ?, ?, ?");
|
||||
cornerStmt.setInt(1, volume.getCornerOne().getBlockX());
|
||||
cornerStmt.setInt(2, volume.getCornerOne().getBlockY());
|
||||
cornerStmt.setInt(3, volume.getCornerOne().getBlockZ());
|
||||
cornerStmt.setInt(4, volume.getCornerTwo().getBlockX());
|
||||
cornerStmt.setInt(5, volume.getCornerTwo().getBlockY());
|
||||
cornerStmt.setInt(6, volume.getCornerTwo().getBlockZ());
|
||||
cornerStmt.executeUpdate();
|
||||
cornerStmt.close();
|
||||
PreparedStatement dataStmt = databaseConnection
|
||||
.prepareStatement("INSERT INTO " + prefix + "_blocks VALUES (?, ?, ?, ?, ?)");
|
||||
databaseConnection.setAutoCommit(false);
|
||||
final int batchSize = 1000;
|
||||
int changed = 0;
|
||||
for (BlockState block : volume.getBlocks()) {
|
||||
final Location relLoc = ZoneVolumeMapper.rebase(
|
||||
volume.getCornerOne(), block.getLocation());
|
||||
dataStmt.setInt(1, relLoc.getBlockX());
|
||||
dataStmt.setInt(2, relLoc.getBlockY());
|
||||
dataStmt.setInt(3, relLoc.getBlockZ());
|
||||
dataStmt.setString(4, block.getType().toString());
|
||||
dataStmt.setShort(5, block.getData().toItemStack().getDurability());
|
||||
dataStmt.addBatch();
|
||||
if (++changed % batchSize == 0) {
|
||||
dataStmt.executeBatch();
|
||||
}
|
||||
}
|
||||
dataStmt.executeBatch(); // insert remaining records
|
||||
databaseConnection.commit();
|
||||
databaseConnection.setAutoCommit(true);
|
||||
dataStmt.close();
|
||||
return changed;
|
||||
String prefix = String.format("structure_%d_", volume.getName().hashCode() & Integer.MAX_VALUE);
|
||||
saveCorners(databaseConnection, volume, prefix);
|
||||
return saveBlocks(databaseConnection, volume, prefix);
|
||||
}
|
||||
|
||||
public static void loadStructure(Volume volume, Connection databaseConnection) throws SQLException {
|
||||
String prefix = String.format("structure_%d", volume.getName().hashCode() & Integer.MAX_VALUE);
|
||||
String prefix = String.format("structure_%d_", volume.getName().hashCode() & Integer.MAX_VALUE);
|
||||
World world = volume.getWorld();
|
||||
Statement stmt = databaseConnection.createStatement();
|
||||
ResultSet cornerQuery = stmt.executeQuery("SELECT * FROM " + prefix + "_corners");
|
||||
cornerQuery.next();
|
||||
final Block corner1 = world.getBlockAt(cornerQuery.getInt("x"), cornerQuery.getInt("y"), cornerQuery.getInt("z"));
|
||||
cornerQuery.next();
|
||||
final Block corner2 = world.getBlockAt(cornerQuery.getInt("x"), cornerQuery.getInt("y"), cornerQuery.getInt("z"));
|
||||
cornerQuery.close();
|
||||
volume.setCornerOne(corner1);
|
||||
volume.setCornerTwo(corner2);
|
||||
volume.getBlocks().clear();
|
||||
ResultSet query = stmt.executeQuery("SELECT * FROM " + prefix + "_blocks");
|
||||
while (query.next()) {
|
||||
int x = query.getInt("x"), y = query.getInt("y"), z = query.getInt("z");
|
||||
BlockState modify = corner1.getRelative(x, y, z).getState();
|
||||
ItemStack data = new ItemStack(Material.valueOf(query.getString("type")), 0, query.getShort("data"));
|
||||
modify.setType(data.getType());
|
||||
modify.setData(data.getData());
|
||||
volume.getBlocks().add(modify);
|
||||
}
|
||||
query.close();
|
||||
stmt.close();
|
||||
Validate.notNull(world, String.format("Cannot find the warzone for %s", prefix));
|
||||
loadCorners(databaseConnection, volume, world, prefix);
|
||||
loadBlocks(databaseConnection, volume, 0, 0, null, true, prefix);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -293,8 +109,7 @@ public class ZoneVolumeMapper {
|
|||
* @throws SQLException
|
||||
*/
|
||||
public static int getTotalSavedBlocks(ZoneVolume volume, String zoneName) throws SQLException {
|
||||
File databaseFile = new File(War.war.getDataFolder(), String.format("/dat/warzone-%s/volume-%s.sl3", zoneName, volume.getName()));
|
||||
Connection databaseConnection = DriverManager.getConnection("jdbc:sqlite:" + databaseFile.getPath());
|
||||
Connection databaseConnection = getZoneConnection(volume, zoneName);
|
||||
Statement stmt = databaseConnection.createStatement();
|
||||
ResultSet sizeQuery = stmt.executeQuery("SELECT COUNT(*) AS total FROM blocks");
|
||||
int size = sizeQuery.getInt("total");
|
||||
|
@ -312,133 +127,18 @@ public class ZoneVolumeMapper {
|
|||
* @return amount of changed blocks
|
||||
* @throws SQLException
|
||||
*/
|
||||
public static int save(Volume volume, String zoneName) throws SQLException {
|
||||
long startTime = System.currentTimeMillis();
|
||||
int changed = 0;
|
||||
public static int saveZoneBlocksAndEntities(ZoneVolume volume, String zoneName) throws SQLException {
|
||||
File warzoneDir = new File(War.war.getDataFolder().getPath() + "/dat/warzone-" + zoneName);
|
||||
if (!warzoneDir.exists() && !warzoneDir.mkdirs()) {
|
||||
throw new RuntimeException("Failed to create warzone data directory");
|
||||
}
|
||||
File databaseFile = new File(War.war.getDataFolder(), String.format("/dat/warzone-%s/volume-%s.sl3", zoneName, volume.getName()));
|
||||
Connection databaseConnection = DriverManager.getConnection("jdbc:sqlite:" + databaseFile.getPath());
|
||||
Statement stmt = databaseConnection.createStatement();
|
||||
stmt.executeUpdate("PRAGMA user_version = " + DATABASE_VERSION);
|
||||
stmt.executeUpdate("CREATE TABLE IF NOT EXISTS blocks (x BIGINT, y BIGINT, z BIGINT, type TEXT, data SMALLINT, metadata BLOB)");
|
||||
stmt.executeUpdate("CREATE TABLE IF NOT EXISTS corners (pos INTEGER PRIMARY KEY NOT NULL UNIQUE, x INTEGER NOT NULL, y INTEGER NOT NULL, z INTEGER NOT NULL)");
|
||||
stmt.executeUpdate("DELETE FROM blocks");
|
||||
stmt.executeUpdate("DELETE FROM corners");
|
||||
stmt.close();
|
||||
PreparedStatement cornerStmt = databaseConnection.prepareStatement("INSERT INTO corners SELECT 1 AS pos, ? AS x, ? AS y, ? AS z UNION SELECT 2, ?, ?, ?");
|
||||
cornerStmt.setInt(1, volume.getCornerOne().getBlockX());
|
||||
cornerStmt.setInt(2, volume.getCornerOne().getBlockY());
|
||||
cornerStmt.setInt(3, volume.getCornerOne().getBlockZ());
|
||||
cornerStmt.setInt(4, volume.getCornerTwo().getBlockX());
|
||||
cornerStmt.setInt(5, volume.getCornerTwo().getBlockY());
|
||||
cornerStmt.setInt(6, volume.getCornerTwo().getBlockZ());
|
||||
cornerStmt.executeUpdate();
|
||||
cornerStmt.close();
|
||||
PreparedStatement dataStmt = databaseConnection.prepareStatement("INSERT INTO blocks (x, y, z, type, data, metadata) VALUES (?, ?, ?, ?, ?, ?)");
|
||||
databaseConnection.setAutoCommit(false);
|
||||
final int batchSize = 10000;
|
||||
for (int i = 0, x = volume.getMinX(); i < volume.getSizeX(); i++, x++) {
|
||||
for (int j = 0, y = volume.getMinY(); j < volume.getSizeY(); j++, y++) {
|
||||
for (int k = 0, z = volume.getMinZ(); k < volume.getSizeZ(); k++, z++) {
|
||||
// Make sure we are using zone volume-relative coords
|
||||
final Block block = volume.getWorld().getBlockAt(x, y, z);
|
||||
if (block.getType() == Material.AIR) {
|
||||
continue; // Do not save air blocks to the file anymore.
|
||||
}
|
||||
final BlockState state = block.getState();
|
||||
dataStmt.setInt(1, block.getX() - volume.getCornerOne().getBlockX());
|
||||
dataStmt.setInt(2, block.getY() - volume.getCornerOne().getBlockY());
|
||||
dataStmt.setInt(3, block.getZ() - volume.getCornerOne().getBlockZ());
|
||||
dataStmt.setString(4, block.getType().name());
|
||||
dataStmt.setShort(5, state.getData().toItemStack().getDurability());
|
||||
if (state instanceof Sign) {
|
||||
final String signText = StringUtils.join(((Sign) block.getState()).getLines(), "\n");
|
||||
dataStmt.setString(6, signText);
|
||||
} else if (state instanceof InventoryHolder) {
|
||||
List<ItemStack> items = Arrays.asList(((InventoryHolder) block.getState()).getInventory().getContents());
|
||||
YamlConfiguration config = new YamlConfiguration();
|
||||
// Serialize to config, then store config in database
|
||||
config.set("items", items);
|
||||
dataStmt.setString(6, config.saveToString());
|
||||
} else if (state instanceof NoteBlock) {
|
||||
Note note = ((NoteBlock) block.getState()).getNote();
|
||||
dataStmt.setString(6, note.getTone().toString() + '\n' + note.getOctave() + '\n' + note.isSharped());
|
||||
} else if (state instanceof Jukebox) {
|
||||
dataStmt.setString(6, ((Jukebox) block.getState()).getPlaying().toString());
|
||||
} else if (state instanceof Skull) {
|
||||
dataStmt.setString(6, String.format("%s\n%s\n%s",
|
||||
((Skull) block.getState()).getOwner(),
|
||||
((Skull) block.getState()).getSkullType().toString(),
|
||||
((Skull) block.getState()).getRotation().toString()));
|
||||
} else if (state instanceof CommandBlock) {
|
||||
dataStmt.setString(6, ((CommandBlock) block.getState()).getName()
|
||||
+ "\n" + ((CommandBlock) block.getState()).getCommand());
|
||||
} else if (state instanceof CreatureSpawner) {
|
||||
dataStmt.setString(6, ((CreatureSpawner) block.getState()).getSpawnedType().toString());
|
||||
}
|
||||
|
||||
dataStmt.addBatch();
|
||||
|
||||
if (++changed % batchSize == 0) {
|
||||
dataStmt.executeBatch();
|
||||
if ((System.currentTimeMillis() - startTime) >= 5000L) {
|
||||
String seconds = new DecimalFormat("#0.00").format((double) (System.currentTimeMillis() - startTime) / 1000.0D);
|
||||
War.war.getLogger().log(Level.FINE, "Still saving warzone {0} , {1} seconds elapsed.", new Object[] {zoneName, seconds});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
dataStmt.executeBatch(); // insert remaining records
|
||||
databaseConnection.commit();
|
||||
dataStmt.close();
|
||||
Connection databaseConnection = getZoneConnection(volume, zoneName);
|
||||
int changed = 0;
|
||||
saveCorners(databaseConnection, volume, "");
|
||||
saveBlocks(databaseConnection, volume, "");
|
||||
saveEntities(databaseConnection, volume);
|
||||
databaseConnection.close();
|
||||
String seconds = new DecimalFormat("#0.00").format((double) (System.currentTimeMillis() - startTime) / 1000.0D);
|
||||
War.war.getLogger().log(Level.INFO, "Saved warzone {0} in {1} seconds.", new Object[] {zoneName, seconds});
|
||||
return changed;
|
||||
}
|
||||
|
||||
public static Location rebase(final Location base, final Location exact) {
|
||||
return new Location(base.getWorld(),
|
||||
exact.getBlockX() - base.getBlockX(),
|
||||
exact.getBlockY() - base.getBlockY(),
|
||||
exact.getBlockZ() - base.getBlockZ());
|
||||
}
|
||||
|
||||
private static void updateFromVersionOneToTwo(String zoneName, Connection connection) throws SQLException {
|
||||
War.war.log("Migrating warzone " + zoneName + " from v1 to v2 of schema...", Level.INFO);
|
||||
|
||||
// We want to do this in a transaction
|
||||
connection.setAutoCommit(false);
|
||||
|
||||
Statement stmt = connection.createStatement();
|
||||
|
||||
// We want to combine all extra columns into a single metadata BLOB one. To delete some columns we need to drop the table so we use a temp one.
|
||||
stmt.executeUpdate("CREATE TEMPORARY TABLE blocks_backup(x BIGINT, y BIGINT, z BIGINT, type TEXT, data SMALLINT, sign TEXT, container BLOB, note INT, record TEXT, skull TEXT, command TEXT, mobid TEXT)");
|
||||
stmt.executeUpdate("INSERT INTO blocks_backup SELECT x, y, z, type, data, sign, container, note, record, skull, command, mobid FROM blocks");
|
||||
stmt.executeUpdate("DROP TABLE blocks");
|
||||
stmt.executeUpdate("CREATE TABLE blocks(x BIGINT, y BIGINT, z BIGINT, type TEXT, data SMALLINT, metadata BLOB)");
|
||||
stmt.executeUpdate("INSERT INTO blocks SELECT x, y, z, type, data, coalesce(container, sign, note, record, skull, command, mobid) FROM blocks_backup");
|
||||
stmt.executeUpdate("DROP TABLE blocks_backup");
|
||||
stmt.executeUpdate("PRAGMA user_version = 2");
|
||||
stmt.close();
|
||||
|
||||
// Commit transaction
|
||||
connection.commit();
|
||||
|
||||
connection.setAutoCommit(true);
|
||||
|
||||
War.war.log("Warzone " + zoneName + " converted! Compacting database...", Level.INFO);
|
||||
|
||||
// Pack the database otherwise we won't get any space savings.
|
||||
// This rebuilds the database completely and takes some time.
|
||||
stmt = connection.createStatement();
|
||||
stmt.execute("VACUUM");
|
||||
stmt.close();
|
||||
|
||||
War.war.log("Migration of warzone " + zoneName + " to v2 of schema finished.", Level.INFO);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,20 +0,0 @@
|
|||
package com.tommytony.war.spout;
|
||||
|
||||
public class PlayerMessage {
|
||||
|
||||
private final String message;
|
||||
private final long sendTime;
|
||||
|
||||
public PlayerMessage(String message) {
|
||||
this.message = message;
|
||||
this.sendTime = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public long getSendTime() {
|
||||
return sendTime;
|
||||
}
|
||||
}
|
|
@ -1,404 +0,0 @@
|
|||
package com.tommytony.war.spout;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.getspout.spoutapi.SpoutManager;
|
||||
import org.getspout.spoutapi.gui.Color;
|
||||
import org.getspout.spoutapi.gui.GenericGradient;
|
||||
import org.getspout.spoutapi.gui.GenericLabel;
|
||||
import org.getspout.spoutapi.gui.WidgetAnchor;
|
||||
import org.getspout.spoutapi.player.SpoutPlayer;
|
||||
|
||||
|
||||
import com.tommytony.war.Team;
|
||||
import com.tommytony.war.War;
|
||||
import com.tommytony.war.Warzone;
|
||||
import com.tommytony.war.config.TeamConfig;
|
||||
import com.tommytony.war.config.TeamKind;
|
||||
|
||||
public class SpoutDisplayer {
|
||||
|
||||
private static int LINE_HEIGHT = 5;
|
||||
private static int LINE_HEIGHT_WITH_MARGIN = 8;
|
||||
|
||||
Map<String, List<PlayerMessage>> playerMessages = new HashMap<String, List<PlayerMessage>>();
|
||||
|
||||
public void msg(SpoutPlayer sp, String message) {
|
||||
if (!playerMessages.containsKey(sp.getName())) {
|
||||
playerMessages.put(sp.getName(), new ArrayList<PlayerMessage>());
|
||||
}
|
||||
List<PlayerMessage> messages = playerMessages.get(sp.getName());
|
||||
messages.add(new PlayerMessage(message));
|
||||
|
||||
// prevent huge stack of messages, 5 max
|
||||
if (messages.size() > 5) {
|
||||
// remove first
|
||||
messages.remove(0);
|
||||
}
|
||||
|
||||
List<Integer> statsOffset = new ArrayList<Integer>();
|
||||
List<GenericLabel> lines = getStatsLines(Warzone.getZoneByPlayerName(sp.getName()), statsOffset);
|
||||
|
||||
drawMessages(sp.getName(), lines, statsOffset);
|
||||
}
|
||||
|
||||
public void fadeOutOldMessages() {
|
||||
for (String playerName : playerMessages.keySet()) {
|
||||
List<PlayerMessage> messages = playerMessages.get(playerName);
|
||||
List<PlayerMessage> toRemove = new ArrayList<PlayerMessage>();
|
||||
|
||||
for (PlayerMessage message : messages) {
|
||||
if (System.currentTimeMillis() - message.getSendTime() > 15000) {
|
||||
|
||||
toRemove.add(message);
|
||||
}
|
||||
}
|
||||
|
||||
for (PlayerMessage removing : toRemove) {
|
||||
messages.remove(removing);
|
||||
}
|
||||
|
||||
if (toRemove.size() > 0) {
|
||||
List<Integer> statsOffset = new ArrayList<Integer>();
|
||||
List<GenericLabel> lines = getStatsLines(Warzone.getZoneByPlayerName(playerName), statsOffset);
|
||||
drawMessages(playerName, lines, statsOffset);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void remove(String playerName) {
|
||||
Player player = War.war.getServer().getPlayer(playerName);
|
||||
if (player != null && playerMessages.containsKey(playerName)) {
|
||||
clear(SpoutManager.getPlayer(player));
|
||||
playerMessages.remove(playerName);
|
||||
}
|
||||
}
|
||||
|
||||
private void clear(SpoutPlayer player) {
|
||||
player.getMainScreen().removeWidgets(War.war);
|
||||
}
|
||||
|
||||
public void clearAll() {
|
||||
List<String> namesToRemove = new ArrayList<String>();
|
||||
for (String name : playerMessages.keySet()) {
|
||||
Player player = War.war.getServer().getPlayer(name);
|
||||
if (player != null && playerMessages.containsKey(name)) {
|
||||
clear(SpoutManager.getPlayer(player));
|
||||
}
|
||||
|
||||
namesToRemove.add(name);
|
||||
}
|
||||
|
||||
for (String toRemove : namesToRemove) {
|
||||
playerMessages.remove(toRemove);
|
||||
}
|
||||
}
|
||||
|
||||
public static String cleanForNotification(String toNotify) {
|
||||
if (toNotify.length() > 26) {
|
||||
return toNotify.substring(0, 25);
|
||||
}
|
||||
|
||||
return toNotify;
|
||||
}
|
||||
|
||||
public void updateStats(Warzone zone) {
|
||||
List<Integer> statsOffset = new ArrayList<Integer>();
|
||||
List<GenericLabel> statsLines = getStatsLines(zone, statsOffset);
|
||||
for (Team t : zone.getTeams()) {
|
||||
for (Player p : t.getPlayers()) {
|
||||
SpoutPlayer sp = SpoutManager.getPlayer(p);
|
||||
if (sp.isSpoutCraftEnabled()) {
|
||||
drawMessages(sp.getName(), statsLines, statsOffset);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void updateStats(Player player) {
|
||||
SpoutPlayer sp = SpoutManager.getPlayer(player);
|
||||
if (sp.isSpoutCraftEnabled()) {
|
||||
List<Integer> statsOffset = new ArrayList<Integer>();
|
||||
Warzone zone = Warzone.getZoneByPlayerName(player.getName());
|
||||
List<GenericLabel> statsLines = getStatsLines(zone, statsOffset);
|
||||
drawMessages(sp.getName(), statsLines, statsOffset);
|
||||
}
|
||||
}
|
||||
|
||||
private static List<GenericLabel> getStatsLines(Warzone zone, List<Integer> offset) {
|
||||
List<GenericLabel> lines = new ArrayList<GenericLabel>();
|
||||
offset.add(0);
|
||||
offset.add(0);
|
||||
|
||||
if (zone != null) {
|
||||
offset.clear();
|
||||
|
||||
List<GenericLabel> teamlines = new ArrayList<GenericLabel>();
|
||||
List<GenericLabel> playerlines = new ArrayList<GenericLabel>();
|
||||
List<GenericLabel> scorelines = new ArrayList<GenericLabel>();
|
||||
List<GenericLabel> lifelines = new ArrayList<GenericLabel>();
|
||||
int teamMax = 0, scoreMax = 0, lifeMax = 0;
|
||||
GenericLabel line;
|
||||
|
||||
GenericLabel teamsHeader = new GenericLabel(ChatColor.GRAY + "War> " + ChatColor.WHITE + zone.getName());
|
||||
int teamsHeaderWidth = GenericLabel.getStringWidth(teamsHeader.getText()) + 1;
|
||||
teamsHeader.setAnchor(WidgetAnchor.TOP_LEFT)
|
||||
.setX(3)
|
||||
.setY(2)
|
||||
.setWidth(teamsHeaderWidth)
|
||||
.setHeight(LINE_HEIGHT);
|
||||
lines.add(teamsHeader);
|
||||
|
||||
// First, we collect all the team names
|
||||
int lineCounter = 1;
|
||||
for (Team t : zone.getTeams()) {
|
||||
// team name
|
||||
String teamStr = t.getName() + " (" + t.getPlayers().size() + "/" + t.getTeamConfig().resolveInt(TeamConfig.TEAMSIZE) + ")";
|
||||
line = new GenericLabel(teamStr);
|
||||
if (t.getPlayers().size() == 0) {
|
||||
line.setTextColor(new Color(100,100,100));
|
||||
}
|
||||
else {
|
||||
line.setText(t.getKind().getColor() + teamStr.replace("(", ChatColor.GRAY + "(" + ChatColor.WHITE).replace(")", ChatColor.GRAY + ")" + ChatColor.WHITE));
|
||||
}
|
||||
line.setAnchor(WidgetAnchor.TOP_LEFT)
|
||||
.setX(3)
|
||||
.setY(4 + lineCounter * LINE_HEIGHT_WITH_MARGIN)
|
||||
.setWidth(GenericLabel.getStringWidth(line.getText()))
|
||||
.setHeight(LINE_HEIGHT);
|
||||
teamlines.add(line);
|
||||
lineCounter++;
|
||||
}
|
||||
|
||||
// We need to find the longest name
|
||||
for (GenericLabel l : teamlines) {
|
||||
if (GenericLabel.getStringWidth(l.getText()) > teamMax) {
|
||||
teamMax = GenericLabel.getStringWidth(l.getText());
|
||||
}
|
||||
if (teamsHeaderWidth > teamMax) {
|
||||
teamMax = teamsHeaderWidth;
|
||||
}
|
||||
}
|
||||
|
||||
// points header
|
||||
GenericLabel pointsHeader = new GenericLabel(ChatColor.GRAY + "score");
|
||||
int pointsHeaderWidth = GenericLabel.getStringWidth(pointsHeader.getText());
|
||||
pointsHeader.setAnchor(WidgetAnchor.TOP_LEFT)
|
||||
.setX(3 + teamMax + 2)
|
||||
.setY(2)
|
||||
.setWidth(pointsHeaderWidth)
|
||||
.setHeight(LINE_HEIGHT);
|
||||
lines.add(pointsHeader);
|
||||
|
||||
|
||||
lineCounter = 1;
|
||||
for (Team t : zone.getTeams()) {
|
||||
// scores
|
||||
line = new GenericLabel(t.getPoints() + "/" + t.getTeamConfig().resolveInt(TeamConfig.MAXSCORE));
|
||||
if (t.getPlayers().size() == 0) line.setTextColor(new Color(100, 100, 100));
|
||||
line.setAnchor(WidgetAnchor.TOP_LEFT)
|
||||
.setX(3 + teamMax + 4)
|
||||
.setY(4 + lineCounter * LINE_HEIGHT_WITH_MARGIN)
|
||||
.setWidth(GenericLabel.getStringWidth(line.getText()))
|
||||
.setHeight(LINE_HEIGHT);
|
||||
scorelines.add(line);
|
||||
lineCounter++;
|
||||
}
|
||||
|
||||
for (GenericLabel l : scorelines) {
|
||||
if (GenericLabel.getStringWidth(l.getText()) > scoreMax) {
|
||||
scoreMax = GenericLabel.getStringWidth(l.getText());
|
||||
}
|
||||
}
|
||||
if (pointsHeaderWidth > scoreMax) {
|
||||
scoreMax = pointsHeaderWidth;
|
||||
}
|
||||
|
||||
// lifepool header
|
||||
GenericLabel livesHeader = new GenericLabel(ChatColor.GRAY + "lives");
|
||||
int livesHeaderWidth = GenericLabel.getStringWidth(livesHeader.getText());
|
||||
livesHeader.setAnchor(WidgetAnchor.TOP_LEFT)
|
||||
.setX(3 + teamMax + 4 + scoreMax + 2)
|
||||
.setY(2)
|
||||
.setWidth(livesHeaderWidth)
|
||||
.setHeight(LINE_HEIGHT);
|
||||
lines.add(livesHeader);
|
||||
|
||||
|
||||
// and finally, lives.
|
||||
lineCounter = 1;
|
||||
for (Team t : zone.getTeams()) {
|
||||
line = new GenericLabel(t.getRemainingLifes() + "/" + t.getTeamConfig().resolveInt(TeamConfig.LIFEPOOL));
|
||||
if (t.getPlayers().size() == 0) line.setTextColor(new Color(100, 100, 100));
|
||||
line.setAnchor(WidgetAnchor.TOP_LEFT)
|
||||
.setX(3 + teamMax + 4 + scoreMax + 4)
|
||||
.setY(4 + lineCounter * LINE_HEIGHT_WITH_MARGIN)
|
||||
.setWidth(GenericLabel.getStringWidth(line.getText()))
|
||||
.setHeight(LINE_HEIGHT);
|
||||
lifelines.add(line);
|
||||
lineCounter++;
|
||||
}
|
||||
|
||||
for (GenericLabel l : lifelines) {
|
||||
if (GenericLabel.getStringWidth(l.getText()) > lifeMax) {
|
||||
lifeMax = GenericLabel.getStringWidth(l.getText());
|
||||
}
|
||||
}
|
||||
if (livesHeaderWidth > lifeMax) {
|
||||
lifeMax = livesHeaderWidth;
|
||||
}
|
||||
|
||||
for (GenericLabel l : teamlines) { lines.add(l); }
|
||||
for (GenericLabel l : playerlines) { lines.add(l); }
|
||||
for (GenericLabel l : scorelines) { lines.add(l); }
|
||||
for (GenericLabel l : lifelines) { lines.add(l); }
|
||||
|
||||
offset.add(3 + teamMax + 1 + scoreMax + 1 + lifeMax + 5);
|
||||
offset.add(4 + lineCounter * LINE_HEIGHT_WITH_MARGIN);
|
||||
|
||||
}
|
||||
return lines;
|
||||
|
||||
}
|
||||
|
||||
private static void drawStats(SpoutPlayer sp, List<GenericLabel> lines) {
|
||||
for (GenericLabel l : lines) {
|
||||
sp.getMainScreen().attachWidget(War.war, l.copy());
|
||||
}
|
||||
}
|
||||
|
||||
private void drawMessages(String playerName, List<GenericLabel> statsLines, List<Integer> statsOffset) {
|
||||
Player bukkitPlayer = War.war.getServer().getPlayer(playerName);
|
||||
if (bukkitPlayer != null) {
|
||||
SpoutPlayer player = SpoutManager.getPlayer(bukkitPlayer);
|
||||
List<PlayerMessage> messages = playerMessages.get(playerName);
|
||||
|
||||
// remove old widgets
|
||||
clear(player);
|
||||
|
||||
// add bg
|
||||
GenericGradient gradient = new GenericGradient();
|
||||
gradient.setAnchor(WidgetAnchor.TOP_LEFT);
|
||||
gradient.setTopColor(new Color(0.0F, 0.0F, 0.0F, 0.4F)); // (order is Red, Green, Blue, Alpha)
|
||||
gradient.setBottomColor(new Color(0.0F, 0.0F, 0.0F, 0.0F));
|
||||
gradient.setHeight(statsOffset.get(1) + 4).setWidth((int)(statsOffset.get(0)));
|
||||
|
||||
player.getMainScreen().attachWidget(War.war, gradient);
|
||||
|
||||
// border in color of team
|
||||
GenericGradient teamGradient = new GenericGradient();
|
||||
teamGradient.setAnchor(WidgetAnchor.TOP_LEFT);
|
||||
|
||||
Team team = Team.getTeamByPlayerName(playerName);
|
||||
|
||||
Color spoutColor = new Color(250.0F, 250.0F, 250.0F, 1.0F);
|
||||
if (team != null) {
|
||||
spoutColor = team.getKind().getSpoutColor();
|
||||
}
|
||||
spoutColor.setAlpha(0.5F);
|
||||
|
||||
teamGradient.setY(2 + LINE_HEIGHT_WITH_MARGIN);
|
||||
teamGradient.setTopColor(spoutColor);
|
||||
teamGradient.setBottomColor(new Color(256, 256, 256, 1.0F));
|
||||
teamGradient.setHeight(2).setWidth((int)(statsOffset.get(0)));
|
||||
|
||||
player.getMainScreen().attachWidget(War.war, teamGradient);
|
||||
|
||||
// update stats panel
|
||||
drawStats(player, statsLines);
|
||||
|
||||
// finally messages
|
||||
if (messages != null && messages.size() > 0) {
|
||||
Warzone zone = Warzone.getZoneByPlayerName(playerName);
|
||||
int verticalOffset = statsOffset.get(1) + 4;
|
||||
|
||||
for (PlayerMessage message : messages) {
|
||||
int horizontalOffset = 2;
|
||||
|
||||
String messageStr = ChatColor.GRAY + ">" + ChatColor.WHITE + " " + message.getMessage();
|
||||
String[] words = messageStr.split(" ");
|
||||
|
||||
for (String word : words) {
|
||||
|
||||
if (horizontalOffset > 160) {
|
||||
horizontalOffset = 2;
|
||||
verticalOffset += LINE_HEIGHT_WITH_MARGIN;
|
||||
}
|
||||
|
||||
word = addMissingColor(word, zone);
|
||||
|
||||
GenericLabel label = new GenericLabel(word);
|
||||
int width = GenericLabel.getStringWidth(word);
|
||||
label.setAnchor(WidgetAnchor.TOP_LEFT);
|
||||
label.setWidth(width);
|
||||
label.setHeight(LINE_HEIGHT);
|
||||
label.setX(horizontalOffset);
|
||||
label.setY(verticalOffset);
|
||||
|
||||
player.getMainScreen().attachWidget(War.war, label);
|
||||
|
||||
horizontalOffset += width + 2;
|
||||
}
|
||||
|
||||
verticalOffset += LINE_HEIGHT_WITH_MARGIN + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static String addMissingColor(String word, Warzone zone) {
|
||||
if (zone != null) {
|
||||
for (Team team : zone.getTeams()) {
|
||||
for (Player player : team.getPlayers()) {
|
||||
if (word.startsWith(player.getName())) {
|
||||
return team.getKind().getColor() + word + ChatColor.WHITE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (TeamKind kind : TeamKind.values()) {
|
||||
if (word.startsWith(kind.toString())) {
|
||||
return kind.getColor() + word + ChatColor.WHITE;
|
||||
}
|
||||
}
|
||||
|
||||
if (word.equals("War>")) {
|
||||
return ChatColor.GRAY + word + ChatColor.WHITE;
|
||||
}
|
||||
|
||||
// white by default
|
||||
return word;
|
||||
}
|
||||
|
||||
// private Color getWordColor(String word, Warzone zone) {
|
||||
// if (zone != null) {
|
||||
// for (Team team : zone.getTeams()) {
|
||||
// for (Player player : team.getPlayers()) {
|
||||
// if (word.startsWith(player.getName())) {
|
||||
// return team.getKind().getSpoutColor();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// for (TeamKind kind : TeamKind.values()) {
|
||||
// if (word.startsWith(kind.toString())) {
|
||||
// return kind.getSpoutColor();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// if (word.equals("War>")) {
|
||||
// return new Color(200,200,200);
|
||||
// }
|
||||
//
|
||||
// // white by default
|
||||
// return new Color(255,255,255);
|
||||
// }
|
||||
}
|
|
@ -97,7 +97,7 @@ public class Cake {
|
|||
current.setType(this.warzone.getWarzoneMaterials().getStandBlock().getType());
|
||||
current.setData(this.warzone.getWarzoneMaterials().getStandBlock().getData());
|
||||
current.update(true);
|
||||
this.warzone.getWorld().getBlockAt(x, y + 1, z).setType(Material.CAKE_BLOCK);
|
||||
this.warzone.getWorld().getBlockAt(x, y + 1, z).setType(Material.CAKE);
|
||||
}
|
||||
|
||||
public boolean isCakeBlock(Location otherLocation) {
|
||||
|
|
|
@ -0,0 +1,194 @@
|
|||
package com.tommytony.war.structure;
|
||||
|
||||
import com.tommytony.war.Warzone;
|
||||
import com.tommytony.war.config.TeamKind;
|
||||
import com.tommytony.war.config.WarzoneConfig;
|
||||
import com.tommytony.war.volume.Volume;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
/**
|
||||
* Capture points
|
||||
*
|
||||
* @author Connor Monahan
|
||||
*/
|
||||
public class CapturePoint {
|
||||
private static int[][][] structure = {
|
||||
{
|
||||
{1, 1, 1},
|
||||
{1, 2, 1},
|
||||
{1, 1, 1}
|
||||
},
|
||||
{
|
||||
{0, 0, 0},
|
||||
{0, 3, 0},
|
||||
{0, 0, 0}
|
||||
},
|
||||
{
|
||||
{0, 0, 0},
|
||||
{0, 3, 0},
|
||||
{0, 0, 0}
|
||||
},
|
||||
{
|
||||
{0, 0, 0},
|
||||
{0, 3, 0},
|
||||
{0, 0, 0}
|
||||
},
|
||||
{
|
||||
{0, 0, 0},
|
||||
{0, 3, 0},
|
||||
{0, 0, 0}
|
||||
}
|
||||
};
|
||||
|
||||
private final String name;
|
||||
private Volume volume;
|
||||
private Location location;
|
||||
private TeamKind controller, defaultController;
|
||||
private int strength, controlTime;
|
||||
private Warzone warzone;
|
||||
|
||||
public CapturePoint(String name, Location location, TeamKind defaultController, int strength, Warzone warzone) {
|
||||
this.name = name;
|
||||
this.defaultController = defaultController;
|
||||
this.controller = defaultController;
|
||||
this.strength = strength;
|
||||
this.controlTime = 0;
|
||||
this.warzone = warzone;
|
||||
this.volume = new Volume("cp-" + name, warzone.getWorld());
|
||||
this.setLocation(location);
|
||||
}
|
||||
|
||||
private Location getOrigin() {
|
||||
return location.clone().subtract(1, 1, 1).getBlock().getLocation();
|
||||
}
|
||||
|
||||
private void updateBlocks() {
|
||||
Validate.notNull(location);
|
||||
// Set origin to back left corner
|
||||
Location origin = this.getOrigin();
|
||||
// Build structure
|
||||
for (int y = 0; y < structure.length; y++) {
|
||||
for (int z = 0; z < structure[0].length; z++) {
|
||||
for (int x = 0; x < structure[0][0].length; x++) {
|
||||
BlockState state = origin.clone().add(x, y, z).getBlock().getState();
|
||||
switch (structure[y][z][x]) {
|
||||
case 0:
|
||||
state.setType(Material.AIR);
|
||||
break;
|
||||
case 1:
|
||||
state.setType(this.warzone.getWarzoneMaterials().getMainBlock().getType());
|
||||
state.setData(this.warzone.getWarzoneMaterials().getMainBlock().getData());
|
||||
break;
|
||||
case 2:
|
||||
state.setType(this.warzone.getWarzoneMaterials().getLightBlock().getType());
|
||||
state.setData(this.warzone.getWarzoneMaterials().getLightBlock().getData());
|
||||
break;
|
||||
case 3:
|
||||
state.setType(this.warzone.getWarzoneMaterials().getStandBlock().getType());
|
||||
state.setData(this.warzone.getWarzoneMaterials().getStandBlock().getData());
|
||||
break;
|
||||
default:
|
||||
throw new IllegalStateException("Invalid structure");
|
||||
}
|
||||
state.update(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Add flag block
|
||||
if (strength > 0 && controller != null) {
|
||||
// Make flag point direction of player when setting the capture point
|
||||
int flagHeight = (int) (strength / (getMaxStrength() / 4.0));
|
||||
Vector dir = new Vector(1 + -Math.round(Math.sin(Math.toRadians(location.getYaw()))), flagHeight,
|
||||
1 + Math.round(Math.cos(Math.toRadians(location.getYaw()))));
|
||||
BlockState state = origin.clone().add(dir).getBlock().getState();
|
||||
state.setType(controller.getMaterial());
|
||||
state.update(true);
|
||||
}
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public Location getLocation() {
|
||||
return location;
|
||||
}
|
||||
|
||||
public void setLocation(Location location) {
|
||||
this.location = new Location(location.getWorld(), location.getBlockX(), location.getBlockY(),
|
||||
location.getBlockZ(), location.getYaw(), 0);
|
||||
this.volume.setCornerOne(this.getOrigin());
|
||||
this.volume.setCornerTwo(this.getOrigin().add(structure[0][0].length, structure.length, structure[0].length));
|
||||
this.volume.saveBlocks();
|
||||
this.updateBlocks();
|
||||
}
|
||||
|
||||
public TeamKind getDefaultController() {
|
||||
return defaultController;
|
||||
}
|
||||
|
||||
public TeamKind getController() {
|
||||
return controller;
|
||||
}
|
||||
|
||||
public void setController(TeamKind controller) {
|
||||
this.controller = controller;
|
||||
if (strength > 0) {
|
||||
this.updateBlocks();
|
||||
}
|
||||
}
|
||||
|
||||
public int getStrength() {
|
||||
return strength;
|
||||
}
|
||||
|
||||
public void setStrength(int strength) {
|
||||
Validate.isTrue(strength <= getMaxStrength());
|
||||
this.strength = strength;
|
||||
this.updateBlocks();
|
||||
}
|
||||
|
||||
public int getControlTime() {
|
||||
return controlTime;
|
||||
}
|
||||
|
||||
public void setControlTime(int controlTime) {
|
||||
this.controlTime = controlTime;
|
||||
}
|
||||
|
||||
public Volume getVolume() {
|
||||
return volume;
|
||||
}
|
||||
|
||||
public void setVolume(Volume volume) {
|
||||
this.volume = volume;
|
||||
}
|
||||
|
||||
public void reset() {
|
||||
this.controller = defaultController;
|
||||
if (this.controller != null) {
|
||||
this.strength = 4;
|
||||
} else {
|
||||
this.strength = 0;
|
||||
}
|
||||
this.updateBlocks();
|
||||
}
|
||||
|
||||
private long lastMessage = 0;
|
||||
public boolean antiChatSpam() {
|
||||
long now = System.currentTimeMillis();
|
||||
if (now - lastMessage > 3000) {
|
||||
lastMessage = now;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public int getMaxStrength() {
|
||||
return warzone.getWarzoneConfig().getInt(WarzoneConfig.CAPTUREPOINTTIME);
|
||||
}
|
||||
}
|
|
@ -1,17 +1,5 @@
|
|||
package com.tommytony.war.structure;
|
||||
|
||||
import java.text.MessageFormat;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.material.Sign;
|
||||
|
||||
import com.tommytony.war.Team;
|
||||
import com.tommytony.war.War;
|
||||
import com.tommytony.war.Warzone;
|
||||
|
@ -19,6 +7,17 @@ import com.tommytony.war.config.TeamConfig;
|
|||
import com.tommytony.war.config.WarzoneConfig;
|
||||
import com.tommytony.war.utility.Direction;
|
||||
import com.tommytony.war.volume.Volume;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.material.Sign;
|
||||
|
||||
import java.text.MessageFormat;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Level;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -214,7 +213,7 @@ public class WarHub {
|
|||
}
|
||||
|
||||
// War hub sign
|
||||
locationBlock.getRelative(front, 2).setType(Material.SIGN_POST);
|
||||
locationBlock.getRelative(front, 2).setType(Material.SIGN);
|
||||
String[] lines = War.war.getString("sign.warhub").split("\n");
|
||||
org.bukkit.block.Sign locationBlockFront = (org.bukkit.block.Sign) locationBlock.getRelative(front, 2).getState();
|
||||
for (int i = 0; i < 4; i++) {
|
||||
|
@ -236,8 +235,7 @@ public class WarHub {
|
|||
/**
|
||||
* Resets the sign of the given warzone
|
||||
*
|
||||
* @param Warzone
|
||||
* zone
|
||||
* @param zone
|
||||
*/
|
||||
public void resetZoneSign(Warzone zone) {
|
||||
BlockFace left;
|
||||
|
@ -282,8 +280,8 @@ public class WarHub {
|
|||
// add redstone blocks and torches to gate if there are players in it (to highlight active zones)
|
||||
zoneGate.getRelative(BlockFace.UP, 2).getRelative(left).setType(Material.REDSTONE_BLOCK);
|
||||
zoneGate.getRelative(BlockFace.UP, 2).getRelative(left.getOppositeFace()).setType(Material.REDSTONE_BLOCK);
|
||||
zoneGate.getRelative(BlockFace.UP, 2).getRelative(left).getRelative(back, 1).setType(Material.TORCH);
|
||||
zoneGate.getRelative(BlockFace.UP, 2).getRelative(left.getOppositeFace()).getRelative(back, 1).setType(Material.TORCH);
|
||||
zoneGate.getRelative(BlockFace.UP, 2).getRelative(left).getRelative(back, 1).setType(Material.AIR);
|
||||
zoneGate.getRelative(BlockFace.UP, 2).getRelative(left.getOppositeFace()).getRelative(back, 1).setType(Material.AIR);
|
||||
} else {
|
||||
zoneGate.getRelative(BlockFace.UP, 2).getRelative(left).getRelative(back, 1).setType(Material.AIR);
|
||||
zoneGate.getRelative(BlockFace.UP, 2).getRelative(left.getOppositeFace()).getRelative(back, 1).setType(Material.AIR);
|
||||
|
|
|
@ -368,7 +368,7 @@ public class ZoneLobby {
|
|||
|
||||
// set zone sign
|
||||
Block zoneSignBlock = this.lobbyMiddleWallBlock.getBlock().getRelative(this.wall, 4);
|
||||
zoneSignBlock.setType(Material.SIGN_POST);
|
||||
zoneSignBlock.setType(Material.SIGN);
|
||||
org.bukkit.block.Sign block = (org.bukkit.block.Sign) zoneSignBlock.getState();
|
||||
org.bukkit.material.Sign data = (Sign) block.getData();
|
||||
data.setFacingDirection(this.wall);
|
||||
|
@ -552,10 +552,7 @@ public class ZoneLobby {
|
|||
}
|
||||
|
||||
private void setBlock(Block block, TeamKind kind) {
|
||||
BlockState blockState = block.getState();
|
||||
blockState.setType(kind.getBlockHead().getType());
|
||||
blockState.setData(kind.getBlockHead().getData());
|
||||
blockState.update(true);
|
||||
block.setType(kind.getMaterial());
|
||||
}
|
||||
|
||||
private void placeAutoAssignGate() {
|
||||
|
@ -738,7 +735,7 @@ public class ZoneLobby {
|
|||
team.getPoints(),
|
||||
team.getTeamConfig().resolveInt(
|
||||
TeamConfig.MAXSCORE),
|
||||
team.getRemainingLifes(),
|
||||
team.getRemainingLives(),
|
||||
team.getTeamConfig().resolveInt(
|
||||
TeamConfig.LIFEPOOL)).split("\n");
|
||||
}
|
||||
|
@ -776,7 +773,7 @@ public class ZoneLobby {
|
|||
org.bukkit.material.Sign data = (Sign) state.getData();
|
||||
data.setFacingDirection(direction);
|
||||
state.setData(data);
|
||||
for (int i = 0; i < 4; i++) {
|
||||
for (int i = 0; i < lines.length; i++) {
|
||||
state.setLine(i, lines[i]);
|
||||
}
|
||||
state.update(true);
|
||||
|
|
|
@ -29,15 +29,15 @@ public class ZoneWallGuard {
|
|||
public static final Material[] glassifyBlocks = {
|
||||
Material.AIR,
|
||||
Material.WATER,
|
||||
Material.LONG_GRASS,
|
||||
Material.TALL_GRASS,
|
||||
Material.VINE,
|
||||
Material.WATER_LILY,
|
||||
Material.YELLOW_FLOWER,
|
||||
Material.RED_ROSE,
|
||||
Material.LILY_PAD,
|
||||
Material.DANDELION_YELLOW,
|
||||
Material.ROSE_RED,
|
||||
Material.RED_MUSHROOM,
|
||||
Material.BROWN_MUSHROOM,
|
||||
Material.DEAD_BUSH,
|
||||
Material.SUGAR_CANE_BLOCK
|
||||
Material.SUGAR_CANE
|
||||
};
|
||||
|
||||
public ZoneWallGuard(Player player, War war, Warzone warzone, BlockFace wall) {
|
||||
|
|
|
@ -0,0 +1,38 @@
|
|||
package com.tommytony.war.ui;
|
||||
|
||||
import com.tommytony.war.War;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Created by Connor on 7/25/2017.
|
||||
*/
|
||||
public abstract class ChestUI {
|
||||
private Map<ItemStack, Runnable> actions;
|
||||
ChestUI() {
|
||||
actions = new HashMap<ItemStack, Runnable>();
|
||||
}
|
||||
|
||||
protected void addItem(Inventory inv, int slot, ItemStack item, Runnable action) {
|
||||
inv.setItem(slot, item);
|
||||
actions.put(item, action);
|
||||
}
|
||||
|
||||
public abstract void build(Player player, Inventory inv);
|
||||
|
||||
public abstract String getTitle();
|
||||
|
||||
public abstract int getSize();
|
||||
|
||||
boolean processClick(ItemStack clicked, Inventory inventory) {
|
||||
if (actions.containsKey(clicked)) {
|
||||
War.war.getServer().getScheduler().runTask(War.war, actions.get(clicked));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,121 @@
|
|||
package com.tommytony.war.ui;
|
||||
|
||||
import com.tommytony.war.Team;
|
||||
import com.tommytony.war.War;
|
||||
import com.tommytony.war.Warzone;
|
||||
import com.tommytony.war.mapper.LoadoutYmlMapper;
|
||||
import com.tommytony.war.utility.Loadout;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by Connor on 7/29/2017.
|
||||
*/
|
||||
class EditLoadoutListUI extends ChestUI {
|
||||
private final Warzone zone;
|
||||
private final Team team;
|
||||
|
||||
EditLoadoutListUI(Warzone zone) {
|
||||
super();
|
||||
this.zone = zone;
|
||||
this.team = null;
|
||||
}
|
||||
|
||||
EditLoadoutListUI(Team team) {
|
||||
super();
|
||||
this.zone = null;
|
||||
this.team = team;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void build(final Player player, Inventory inv) {
|
||||
List<Loadout> loadouts;
|
||||
if (zone != null) {
|
||||
loadouts = zone.getDefaultInventories().resolveNewLoadouts();
|
||||
} else if (team != null) {
|
||||
loadouts = team.getInventories().resolveNewLoadouts();
|
||||
} else {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
ItemStack item;
|
||||
ItemMeta meta;
|
||||
int i = 0;
|
||||
item = new ItemStack(Material.GOLDEN_SHOVEL, 1);
|
||||
meta = item.getItemMeta();
|
||||
meta.setDisplayName(ChatColor.GREEN + "Create new loadout");
|
||||
item.setItemMeta(meta);
|
||||
this.addItem(inv, i++, item, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
War.war.getUIManager().getPlayerMessage(player, "Type the name for the new loadout (or type cancel):", new StringRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (this.getValue().equalsIgnoreCase("cancel")) {
|
||||
return;
|
||||
}
|
||||
Loadout ldt;
|
||||
if (zone != null) {
|
||||
zone.getDefaultInventories().setLoadout(this.getValue(), new HashMap<Integer, ItemStack>());
|
||||
ldt = zone.getDefaultInventories().getNewLoadout(this.getValue());
|
||||
} else {
|
||||
team.getInventories().setLoadout(this.getValue(), new HashMap<Integer, ItemStack>());
|
||||
ldt = team.getInventories().getNewLoadout(this.getValue());
|
||||
}
|
||||
War.war.getUIManager().assignUI(player, new EditLoadoutUI(ldt, zone, team));
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
List<String> sortedNames = LoadoutYmlMapper.sortNames(Loadout.toLegacyFormat(loadouts));
|
||||
for (String loadoutName : sortedNames) {
|
||||
final Loadout ldt = Loadout.getLoadout(loadouts, loadoutName);
|
||||
if (ldt == null) {
|
||||
War.war.getLogger().warning("Failed to resolve loadout " + loadoutName);
|
||||
continue;
|
||||
}
|
||||
item = new ItemStack(Material.CHEST);
|
||||
meta = item.getItemMeta();
|
||||
meta.setDisplayName(ChatColor.YELLOW + loadoutName);
|
||||
item.setItemMeta(meta);
|
||||
this.addItem(inv, i++, item, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
War.war.getUIManager().assignUI(player, new EditLoadoutUI(ldt, zone, team));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle() {
|
||||
if (zone != null) {
|
||||
return ChatColor.RED + "Warzone \"" + zone.getName() + "\": Loadouts";
|
||||
} else if (team != null) {
|
||||
return ChatColor.BLUE + "Team \"" + team.getName() + "\": Loadouts";
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSize() {
|
||||
int size = 0;
|
||||
if (zone != null) {
|
||||
size = zone.getDefaultInventories().getNewLoadouts().size() + 1;
|
||||
} else if (team != null) {
|
||||
size = team.getInventories().getNewLoadouts().size() + 1;
|
||||
}
|
||||
if (size % 9 == 0) {
|
||||
return size / 9;
|
||||
} else {
|
||||
return size / 9 + 9;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,105 @@
|
|||
package com.tommytony.war.ui;
|
||||
|
||||
import com.tommytony.war.Team;
|
||||
import com.tommytony.war.Warzone;
|
||||
import com.tommytony.war.config.TeamConfigBag;
|
||||
import com.tommytony.war.config.WarzoneConfigBag;
|
||||
import com.tommytony.war.utility.Loadout;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
/**
|
||||
* Created by Connor on 7/29/2017.
|
||||
*/
|
||||
class EditLoadoutUI extends ChestUI {
|
||||
private final Loadout loadout;
|
||||
private final Warzone zone;
|
||||
private final Team team;
|
||||
|
||||
EditLoadoutUI(Loadout ldt, Warzone zone, Team team) {
|
||||
super();
|
||||
this.loadout = ldt;
|
||||
this.zone = zone;
|
||||
this.team = team;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void build(final Player player, final Inventory inv) {
|
||||
HashMap<Integer, ItemStack> lc = loadout.getContents();
|
||||
for (Integer slot : lc.keySet()) {
|
||||
ItemStack item = lc.get(slot);
|
||||
if (item == null || item.getType() == Material.AIR) {
|
||||
continue;
|
||||
}
|
||||
if (slot == 100) {
|
||||
inv.setItem(9 * 4, item.clone());
|
||||
} else if (slot == 101) {
|
||||
inv.setItem(9 * 4 + 1, item.clone());
|
||||
} else if (slot == 102) {
|
||||
inv.setItem(9 * 4 + 2, item.clone());
|
||||
} else if (slot == 103) {
|
||||
inv.setItem(9 * 4 + 3, item.clone());
|
||||
} else {
|
||||
inv.setItem(slot, item.clone());
|
||||
}
|
||||
}
|
||||
ItemStack item = new ItemStack(Material.NETHER_STAR);
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
meta.setDisplayName(ChatColor.GRAY + "Save");
|
||||
item.setItemMeta(meta);
|
||||
this.addItem(inv, getSize() - 2, item, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
HashMap<Integer, ItemStack> nc = new HashMap<Integer, ItemStack>();
|
||||
for (int i = 0; i < 9 * 4 + 4; i++) {
|
||||
int slot = i;
|
||||
if (i >= 9 * 4) {
|
||||
slot = i + 64;
|
||||
}
|
||||
ItemStack item = inv.getItem(i);
|
||||
if (item != null && item.getType() != Material.AIR) {
|
||||
nc.put(slot, item);
|
||||
}
|
||||
}
|
||||
loadout.setContents(nc);
|
||||
if (zone != null) {
|
||||
WarzoneConfigBag.afterUpdate(zone, player, "loadout updated", false);
|
||||
} else if (team != null) {
|
||||
TeamConfigBag.afterUpdate(team, player, "loadout updated", false);
|
||||
}
|
||||
}
|
||||
});
|
||||
item = new ItemStack(Material.TNT);
|
||||
meta = item.getItemMeta();
|
||||
meta.setDisplayName(ChatColor.GRAY + "Delete");
|
||||
item.setItemMeta(meta);
|
||||
this.addItem(inv, getSize() - 1, item, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (zone != null) {
|
||||
zone.getDefaultInventories().removeLoadout(loadout.getName());
|
||||
WarzoneConfigBag.afterUpdate(zone, player, "loadout deleted", false);
|
||||
} else if (team != null) {
|
||||
team.getInventories().removeLoadout(loadout.getName());
|
||||
TeamConfigBag.afterUpdate(team, player, "loadout deleted", false);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle() {
|
||||
return ChatColor.RED + "Updating loadout " + loadout.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSize() {
|
||||
return 9 * 5;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,82 @@
|
|||
package com.tommytony.war.ui;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.tommytony.war.War;
|
||||
import com.tommytony.war.Warzone;
|
||||
import com.tommytony.war.command.ZoneSetter;
|
||||
import com.tommytony.war.utility.Compat;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
/**
|
||||
* Created by Connor on 7/27/2017.
|
||||
*/
|
||||
public class EditOrCreateZoneUI extends ChestUI {
|
||||
@Override
|
||||
public void build(final Player player, Inventory inv) {
|
||||
int i = 0;
|
||||
ItemStack item = new ItemStack(Material.WOODEN_AXE, 1);
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
meta.setDisplayName(ChatColor.BOLD + "" + ChatColor.YELLOW + "Create Warzone");
|
||||
meta.setLore(ImmutableList.of(ChatColor.GRAY + "Click to create a " + ChatColor.AQUA + "Warzone"));
|
||||
item.setItemMeta(meta);
|
||||
this.addItem(inv, i++, item, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (!War.war.getServer().getPluginManager().isPluginEnabled("WorldEdit")) {
|
||||
player.sendTitle("", ChatColor.RED + "This feature requires WorldEdit.", 10, 20, 10);
|
||||
return;
|
||||
}
|
||||
player.getInventory().addItem(new ItemStack(Material.WOODEN_AXE, 1));
|
||||
War.war.getUIManager().getPlayerMessage(player, "Select region for zone using WorldEdit and then type a name:", new StringRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Compat.BlockPair pair = Compat.getWorldEditSelection(player);
|
||||
if (pair != null) {
|
||||
ZoneSetter setter = new ZoneSetter(player, this.getValue());
|
||||
setter.placeCorner1(pair.getBlock1());
|
||||
setter.placeCorner2(pair.getBlock2());
|
||||
} else {
|
||||
War.war.badMsg(player, "Invalid selection. Creation cancelled.");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
for (final Warzone zone : War.war.getEnabledWarzones()) {
|
||||
if (!War.war.isWarAdmin(player) && !zone.isAuthor(player)) {
|
||||
continue;
|
||||
}
|
||||
item = new ItemStack(Material.WRITABLE_BOOK);
|
||||
meta = item.getItemMeta();
|
||||
meta.setDisplayName(ChatColor.YELLOW + "" + ChatColor.BOLD + zone.getName());
|
||||
meta.setLore(ImmutableList.of(ChatColor.GRAY + "Click to edit"));
|
||||
item.setItemMeta(meta);
|
||||
this.addItem(inv, i++, item, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
War.war.getUIManager().assignUI(player, new EditZoneUI(zone));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle() {
|
||||
return ChatColor.RED + "Edit or Create Zones";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSize() {
|
||||
int zones = War.war.getEnabledWarzones().size() + 1;
|
||||
if (zones % 9 == 0) {
|
||||
return zones / 9;
|
||||
} else {
|
||||
return zones / 9 + 9;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,105 @@
|
|||
package com.tommytony.war.ui;
|
||||
|
||||
import com.tommytony.war.Team;
|
||||
import com.tommytony.war.War;
|
||||
import com.tommytony.war.Warzone;
|
||||
import com.tommytony.war.config.TeamConfigBag;
|
||||
import com.tommytony.war.mapper.WarzoneYmlMapper;
|
||||
import com.tommytony.war.volume.Volume;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
/**
|
||||
* Created by Connor on 7/27/2017.
|
||||
*/
|
||||
class EditTeamUI extends ChestUI {
|
||||
private final Team team;
|
||||
|
||||
EditTeamUI(Team team) {
|
||||
super();
|
||||
this.team = team;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void build(final Player player, Inventory inv) {
|
||||
ItemStack item;
|
||||
ItemMeta meta;
|
||||
int i = 0;
|
||||
item = new ItemStack(Material.GOLDEN_SHOVEL, 1);
|
||||
meta = item.getItemMeta();
|
||||
meta.setDisplayName(ChatColor.GREEN + "Add additional spawn");
|
||||
item.setItemMeta(meta);
|
||||
this.addItem(inv, i++, item, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (team.getZone().getVolume().contains(player.getLocation())) {
|
||||
team.addTeamSpawn(player.getLocation());
|
||||
player.sendTitle("", "Additional spawn added", 10, 20, 10);
|
||||
} else {
|
||||
player.sendTitle("", ChatColor.RED + "Can't add a spawn outside of the zone!", 10, 20, 10);
|
||||
}
|
||||
}
|
||||
});
|
||||
item = new ItemStack(Material.CHEST, 1);
|
||||
meta = item.getItemMeta();
|
||||
meta.setDisplayName(ChatColor.YELLOW + "Loadouts");
|
||||
item.setItemMeta(meta);
|
||||
this.addItem(inv, i++, item, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
War.war.getUIManager().assignUI(player, new EditLoadoutListUI(team));
|
||||
}
|
||||
});
|
||||
item = new ItemStack(Material.TNT, 1);
|
||||
meta = item.getItemMeta();
|
||||
meta.setDisplayName(ChatColor.DARK_RED + "" + ChatColor.BOLD + "Delete");
|
||||
item.setItemMeta(meta);
|
||||
this.addItem(inv, getSize() - 1, item, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (team.getFlagVolume() != null) {
|
||||
team.getFlagVolume().resetBlocks();
|
||||
}
|
||||
for (Volume spawnVolume : team.getSpawnVolumes().values()) {
|
||||
spawnVolume.resetBlocks();
|
||||
}
|
||||
final Warzone zone = team.getZone();
|
||||
zone.getTeams().remove(team);
|
||||
if (zone.getLobby() != null) {
|
||||
zone.getLobby().setLocation(zone.getTeleport());
|
||||
zone.getLobby().initialize();
|
||||
}
|
||||
WarzoneYmlMapper.save(zone);
|
||||
War.war.msg(player, "Team " + team.getName() + " removed.");
|
||||
}
|
||||
});
|
||||
item = new ItemStack(Material.SNOWBALL);
|
||||
meta = item.getItemMeta();
|
||||
meta.setDisplayName(ChatColor.GRAY + "" + ChatColor.BOLD + "Restore Defaults");
|
||||
item.setItemMeta(meta);
|
||||
this.addItem(inv, getSize() - 2, item, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
team.getTeamConfig().reset();
|
||||
TeamConfigBag.afterUpdate(team, player, "All options set to defaults in team " + team.getName() + " by " + player.getName(), false);
|
||||
War.war.getUIManager().assignUI(player, new EditTeamUI(team));
|
||||
}
|
||||
});
|
||||
final TeamConfigBag config = team.getTeamConfig();
|
||||
UIConfigHelper.addTeamConfigOptions(this, player, inv, config, team, team.getZone(), i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle() {
|
||||
return ChatColor.RED + "Warzone \"" + team.getZone().getName() + "\": Team \"" + team.getName() + "\"";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSize() {
|
||||
return 9*3;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,85 @@
|
|||
package com.tommytony.war.ui;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.tommytony.war.Team;
|
||||
import com.tommytony.war.War;
|
||||
import com.tommytony.war.Warzone;
|
||||
import com.tommytony.war.config.TeamConfig;
|
||||
import com.tommytony.war.config.TeamKind;
|
||||
import com.tommytony.war.config.WarzoneConfig;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
import java.text.MessageFormat;
|
||||
import java.util.Collections;
|
||||
|
||||
/**
|
||||
* Created by Connor on 7/25/2017.
|
||||
*/
|
||||
public class EditTeamsListUI extends ChestUI {
|
||||
private final Warzone warzone;
|
||||
|
||||
public EditTeamsListUI(Warzone warzone) {
|
||||
super();
|
||||
this.warzone = warzone;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void build(final Player player, Inventory inv) {
|
||||
int i = 0;
|
||||
for (final TeamKind kind : TeamKind.values()) {
|
||||
ItemStack item = kind.getBlockHead();
|
||||
final Team team = warzone.getTeamByKind(kind);
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
if (team == null) {
|
||||
meta.setDisplayName("Create new team");
|
||||
item.setItemMeta(meta);
|
||||
this.addItem(inv, i, item, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (!warzone.getVolume().contains(player.getLocation())) {
|
||||
player.sendTitle("", ChatColor.RED + "Can't add a spawn outside of the zone!", 10, 20, 10);
|
||||
return;
|
||||
}
|
||||
|
||||
Team newTeam = new Team(kind.toString(), kind, Collections.<Location>emptyList(), warzone);
|
||||
newTeam.setRemainingLives(newTeam.getTeamConfig().resolveInt(TeamConfig.LIFEPOOL));
|
||||
warzone.getTeams().add(newTeam);
|
||||
if (warzone.getLobby() != null) {
|
||||
warzone.getLobby().setLocation(warzone.getTeleport());
|
||||
warzone.getLobby().initialize();
|
||||
}
|
||||
newTeam.addTeamSpawn(player.getLocation());
|
||||
player.sendTitle("", "Team " + newTeam.getName() + " created with spawn here.", 10, 20, 10);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
meta.setDisplayName("Edit team " + kind.getColor() + kind.name().toLowerCase());
|
||||
item.setItemMeta(meta);
|
||||
this.addItem(inv, i, item, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
War.war.getUIManager().assignUI(player, new EditTeamUI(team));
|
||||
}
|
||||
});
|
||||
}
|
||||
i++;
|
||||
if (i == 9)
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle() {
|
||||
return ChatColor.RED + "Warzone \"" + warzone.getName() + "\": Teams";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSize() {
|
||||
return 18;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,66 @@
|
|||
package com.tommytony.war.ui;
|
||||
|
||||
import com.tommytony.war.War;
|
||||
import com.tommytony.war.Warzone;
|
||||
import com.tommytony.war.config.WarzoneConfigBag;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
/**
|
||||
* Created by Connor on 7/27/2017.
|
||||
*/
|
||||
public class EditZoneConfigUI extends ChestUI {
|
||||
private final Warzone zone;
|
||||
|
||||
public EditZoneConfigUI(Warzone zone) {
|
||||
super();
|
||||
this.zone = zone;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void build(final Player player, Inventory inv) {
|
||||
ItemStack item;
|
||||
ItemMeta meta;
|
||||
int i = 0;
|
||||
|
||||
i = UIConfigHelper.addWarzoneConfigOptions(this, player, inv, zone.getWarzoneConfig(), zone, i);
|
||||
item = new ItemStack(Material.WHITE_STAINED_GLASS_PANE);
|
||||
meta = item.getItemMeta();
|
||||
meta.setDisplayName(">>>> Team Default Config >>>>");
|
||||
item.setItemMeta(meta);
|
||||
this.addItem(inv, i++, item, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
War.war.getUIManager().assignUI(player, new EditZoneConfigUI(zone));
|
||||
}
|
||||
});
|
||||
UIConfigHelper.addTeamConfigOptions(this, player, inv, zone.getTeamDefaultConfig(), null, zone, i);
|
||||
item = new ItemStack(Material.SNOWBALL);
|
||||
meta = item.getItemMeta();
|
||||
meta.setDisplayName(ChatColor.GRAY + "" + ChatColor.BOLD + "Restore Defaults");
|
||||
item.setItemMeta(meta);
|
||||
this.addItem(inv, getSize() - 1, item, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
zone.getWarzoneConfig().reset();
|
||||
zone.getTeamDefaultConfig().reset();
|
||||
WarzoneConfigBag.afterUpdate(zone, player, "All options set to defaults in warzone " + zone.getName() + " by " + player.getName(), false);
|
||||
War.war.getUIManager().assignUI(player, new EditZoneConfigUI(zone));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle() {
|
||||
return ChatColor.RED + "Warzone \"" + zone.getName() + "\": Config";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSize() {
|
||||
return 9*6;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,103 @@
|
|||
package com.tommytony.war.ui;
|
||||
|
||||
import com.tommytony.war.War;
|
||||
import com.tommytony.war.Warzone;
|
||||
import com.tommytony.war.command.DeleteZoneCommand;
|
||||
import com.tommytony.war.command.ResetZoneCommand;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
/**
|
||||
* Created by Connor on 7/27/2017.
|
||||
*/
|
||||
class EditZoneUI extends ChestUI {
|
||||
private final Warzone zone;
|
||||
|
||||
EditZoneUI(Warzone zone) {
|
||||
super();
|
||||
this.zone = zone;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void build(final Player player, Inventory inv) {
|
||||
ItemStack item;
|
||||
ItemMeta meta;
|
||||
item = new ItemStack(Material.CHEST);
|
||||
meta = item.getItemMeta();
|
||||
meta.setDisplayName(ChatColor.YELLOW + "Options");
|
||||
item.setItemMeta(meta);
|
||||
this.addItem(inv, 0, item, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
War.war.getUIManager().assignUI(player, new EditZoneConfigUI(zone));
|
||||
}
|
||||
});
|
||||
item = new ItemStack(Material.CHEST);
|
||||
meta = item.getItemMeta();
|
||||
meta.setDisplayName(ChatColor.YELLOW + "Teams");
|
||||
item.setItemMeta(meta);
|
||||
this.addItem(inv, 1, item, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
War.war.getUIManager().assignUI(player, new EditTeamsListUI(zone));
|
||||
}
|
||||
});
|
||||
item = new ItemStack(Material.CHEST);
|
||||
meta = item.getItemMeta();
|
||||
meta.setDisplayName(ChatColor.YELLOW + "Loadouts");
|
||||
item.setItemMeta(meta);
|
||||
this.addItem(inv, 2, item, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
War.war.getUIManager().assignUI(player, new EditLoadoutListUI(zone));
|
||||
}
|
||||
});
|
||||
item = new ItemStack(Material.CHEST);
|
||||
meta = item.getItemMeta();
|
||||
meta.setDisplayName(ChatColor.YELLOW + "Structures");
|
||||
item.setItemMeta(meta);
|
||||
item = new ItemStack(Material.NETHER_STAR);
|
||||
meta = item.getItemMeta();
|
||||
meta.setDisplayName(ChatColor.GRAY + "Reset Blocks");
|
||||
item.setItemMeta(meta);
|
||||
this.addItem(inv, 7, item, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
ResetZoneCommand.forceResetZone(zone, player);
|
||||
}
|
||||
});
|
||||
item = new ItemStack(Material.TNT);
|
||||
meta = item.getItemMeta();
|
||||
meta.setDisplayName(ChatColor.DARK_RED + "" + ChatColor.BOLD + "Delete");
|
||||
item.setItemMeta(meta);
|
||||
this.addItem(inv, 8, item, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
War.war.getUIManager().getPlayerMessage(player, "Delete zone: are you sure? Type \"" + zone.getName() + "\" to confirm:", new StringRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (this.getValue().equalsIgnoreCase(zone.getName())) {
|
||||
DeleteZoneCommand.forceDeleteZone(zone, player);
|
||||
} else {
|
||||
War.war.badMsg(player, "Delete aborted.");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle() {
|
||||
return ChatColor.RED + "Editing Warzone \"" + zone.getName() + "\"";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSize() {
|
||||
return 9;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,91 @@
|
|||
package com.tommytony.war.ui;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.tommytony.war.Team;
|
||||
import com.tommytony.war.War;
|
||||
import com.tommytony.war.Warzone;
|
||||
import com.tommytony.war.config.TeamConfig;
|
||||
import com.tommytony.war.config.TeamKind;
|
||||
import com.tommytony.war.config.WarzoneConfig;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
import java.text.MessageFormat;
|
||||
|
||||
/**
|
||||
* Created by Connor on 7/25/2017.
|
||||
*/
|
||||
public class JoinTeamUI extends ChestUI {
|
||||
private final Warzone warzone;
|
||||
|
||||
public JoinTeamUI(Warzone warzone) {
|
||||
super();
|
||||
this.warzone = warzone;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void build(final Player player, Inventory inv) {
|
||||
UIFormatter formatter = new UIFormatter(warzone.getTeams().size());
|
||||
for (final TeamKind kind : TeamKind.values()) {
|
||||
ItemStack item = kind.getBlockHead();
|
||||
Team team = warzone.getTeamByKind(kind);
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
if (team != null) {
|
||||
meta.setDisplayName(kind.getColor() + "Team " + kind.getCapsName());
|
||||
meta.setLore(ImmutableList.of(MessageFormat.format(ChatColor.GRAY + "{0}/{1} players", team.getPlayers().size(), team.getTeamConfig().resolveInt(TeamConfig.TEAMSIZE)),
|
||||
MessageFormat.format(ChatColor.GRAY + "{0}/{1} pts", team.getPoints(), team.getTeamConfig().resolveInt(TeamConfig.MAXSCORE)),
|
||||
MessageFormat.format(ChatColor.GRAY + "{0} lives left", team.getRemainingLives()),
|
||||
ChatColor.DARK_GRAY + "Click to join team"));
|
||||
|
||||
item.setItemMeta(meta);
|
||||
this.addItem(inv, formatter.next(), item, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (warzone.getWarzoneConfig().getBoolean(WarzoneConfig.DISABLED)) {
|
||||
War.war.badMsg(player, "join.disabled");
|
||||
} else if (warzone.isReinitializing()) {
|
||||
War.war.badMsg(player, "join.disabled");
|
||||
} else if (warzone.getWarzoneConfig().getBoolean(WarzoneConfig.AUTOASSIGN)) {
|
||||
War.war.badMsg(player, "join.aarequired");
|
||||
} else if (!warzone.getWarzoneConfig().getBoolean(WarzoneConfig.JOINMIDBATTLE) && warzone.isEnoughPlayers()) {
|
||||
War.war.badMsg(player, "join.progress");
|
||||
} else {
|
||||
Team team = warzone.getTeamByKind(kind);
|
||||
if (team == null) {
|
||||
War.war.badMsg(player, "join.team404");
|
||||
} else if (!War.war.canPlayWar(player, team)) {
|
||||
War.war.badMsg(player, "join.permission.single");
|
||||
} else if (team.isFull()) {
|
||||
War.war.badMsg(player, "join.full.single", team.getName());
|
||||
} else {
|
||||
Team previousTeam = Team.getTeamByPlayerName(player.getName());
|
||||
if (previousTeam != null) {
|
||||
if (previousTeam == team) {
|
||||
War.war.badMsg(player, "join.selfteam");
|
||||
return;
|
||||
}
|
||||
previousTeam.removePlayer(player);
|
||||
previousTeam.resetSign();
|
||||
}
|
||||
warzone.assign(player, team);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle() {
|
||||
return ChatColor.RED + "Warzone \"" + warzone.getName() + "\": Teams";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSize() {
|
||||
return 18;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,68 @@
|
|||
package com.tommytony.war.ui;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.tommytony.war.War;
|
||||
import com.tommytony.war.Warzone;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
import java.text.MessageFormat;
|
||||
|
||||
/**
|
||||
* Created by Connor on 7/25/2017.
|
||||
*/
|
||||
public class JoinZoneUI extends ChestUI {
|
||||
|
||||
@Override
|
||||
public void build(final Player player, Inventory inv) {
|
||||
ItemStack item = new ItemStack(Material.TNT, 1);
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
meta.setDisplayName(ChatColor.RED + "" + ChatColor.BOLD + "Warhub");
|
||||
meta.setLore(ImmutableList.of(ChatColor.GRAY + "Teleports you to the " + ChatColor.RED + "Warhub" + ChatColor.GRAY + " lobby",
|
||||
ChatColor.DARK_GRAY + "Warzone doors located here"));
|
||||
item.setItemMeta(meta);
|
||||
int i = 0;
|
||||
if (War.war.getWarHub() != null) {
|
||||
this.addItem(inv, i++, item, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
player.teleport(War.war.getWarHub().getLocation());
|
||||
}
|
||||
});
|
||||
}
|
||||
for (final Warzone zone : War.war.getEnabledWarzones()) {
|
||||
item = new ItemStack(Material.ENDER_PEARL);
|
||||
meta = item.getItemMeta();
|
||||
meta.setDisplayName(ChatColor.YELLOW + "" + ChatColor.BOLD + zone.getName());
|
||||
meta.setLore(ImmutableList.of(MessageFormat.format(ChatColor.GRAY + "{0}/{1} players", zone.getPlayerCount(), zone.getMaxPlayers()),
|
||||
MessageFormat.format(ChatColor.GRAY + "{0} teams", zone.getTeams().size()),
|
||||
ChatColor.DARK_GRAY + "Click to teleport"));
|
||||
item.setItemMeta(meta);
|
||||
this.addItem(inv, i++, item, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
War.war.getUIManager().assignUI(player, new JoinTeamUI(zone));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle() {
|
||||
return ChatColor.RED + "Pick a Warzone";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSize() {
|
||||
int zones = War.war.getEnabledWarzones().size() + 1;
|
||||
if (zones % 9 == 0) {
|
||||
return zones / 9;
|
||||
} else {
|
||||
return zones / 9 + 9;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
package com.tommytony.war.ui;
|
||||
|
||||
/**
|
||||
* Created by Connor on 7/27/2017.
|
||||
*/
|
||||
public abstract class StringRunnable implements Runnable {
|
||||
private String value;
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,338 @@
|
|||
package com.tommytony.war.ui;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.tommytony.war.Team;
|
||||
import com.tommytony.war.War;
|
||||
import com.tommytony.war.Warzone;
|
||||
import com.tommytony.war.config.*;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.DyeColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.bukkit.material.Dye;
|
||||
|
||||
/**
|
||||
* Created by Connor on 7/28/2017.
|
||||
*/
|
||||
public class UIConfigHelper {
|
||||
static int addTeamConfigOptions(final ChestUI ui, final Player player, Inventory inv, final TeamConfigBag config, final Team team, final Warzone warzone, int i) {
|
||||
ItemStack item;
|
||||
ItemMeta meta;
|
||||
for (final TeamConfig option : TeamConfig.values()) {
|
||||
if (option.getTitle() == null) {
|
||||
continue;
|
||||
}
|
||||
String inheritance = "";
|
||||
if (!config.contains(option) && warzone != null) {
|
||||
if (warzone.getTeamDefaultConfig().contains(option)) {
|
||||
inheritance = ChatColor.DARK_GRAY + "Inherited from warzone config defaults";
|
||||
} else {
|
||||
inheritance = ChatColor.DARK_GRAY + "Inherited from War config defaults";
|
||||
}
|
||||
}
|
||||
String name = ChatColor.RESET + "" + ChatColor.YELLOW + option.getTitle();
|
||||
String status = ChatColor.GRAY + "Currently: ";
|
||||
String[] desc = option.getDescription().split("\n");
|
||||
for (int j = 0; j < desc.length; j++) {
|
||||
desc[j] = ChatColor.RESET + "" + ChatColor.GRAY + desc[j];
|
||||
}
|
||||
if (option.getConfigType() == Boolean.class) {
|
||||
status += config.resolveBoolean(option) ? ChatColor.GREEN + "true" : ChatColor.DARK_GRAY + "false";
|
||||
item = new ItemStack(config.resolveBoolean(option) ? Material.LIME_DYE : Material.GRAY_DYE, 1);
|
||||
meta = item.getItemMeta();
|
||||
meta.setDisplayName(name);
|
||||
meta.setLore(new ImmutableList.Builder<String>().add(desc).add(status).add(inheritance).build());
|
||||
item.setItemMeta(meta);
|
||||
ui.addItem(inv, i++, item, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
config.put(option, !config.resolveBoolean(option));
|
||||
onTeamConfigUpdate(player, option, config, team, warzone);
|
||||
}
|
||||
});
|
||||
} else if (option.getConfigType() == Integer.class || option.getConfigType() == Double.class || option.getConfigType() == String.class) {
|
||||
status += ChatColor.LIGHT_PURPLE + config.resolveValue(option).toString();
|
||||
item = new ItemStack(Material.PURPLE_DYE, 1);
|
||||
meta = item.getItemMeta();
|
||||
meta.setDisplayName(name);
|
||||
meta.setLore(new ImmutableList.Builder<String>().add(desc).add(status).add(inheritance).build());
|
||||
item.setItemMeta(meta);
|
||||
ui.addItem(inv, i++, item, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
War.war.getUIManager().getPlayerMessage(player, "Type a new value for option " + option.name().toLowerCase() + ": ", new StringRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (option.getConfigType() == Integer.class) {
|
||||
config.put(option, Integer.parseInt(this.getValue()));
|
||||
} else if (option.getConfigType() == Double.class) {
|
||||
config.put(option, Double.parseDouble(this.getValue()));
|
||||
} else {
|
||||
config.put(option, this.getValue());
|
||||
}
|
||||
onTeamConfigUpdate(player, option, config, team, warzone);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
} else if (option.getConfigType() == FlagReturn.class) {
|
||||
status += ChatColor.YELLOW + config.resolveValue(option).toString();
|
||||
item = new ItemStack(Material.PINK_DYE, 1);
|
||||
meta = item.getItemMeta();
|
||||
meta.setDisplayName(name);
|
||||
meta.setLore(new ImmutableList.Builder<String>().add(desc).add(status).add(inheritance).build());
|
||||
item.setItemMeta(meta);
|
||||
ui.addItem(inv, i++, item, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
FlagReturn next = FlagReturn.BOTH;
|
||||
FlagReturn[] values = FlagReturn.values();
|
||||
for (int i1 = 0; i1 < values.length; i1++) {
|
||||
FlagReturn flagReturn = values[i1];
|
||||
if (flagReturn == config.resolveFlagReturn() && i1 != values.length - 1) {
|
||||
next = values[i1 + 1];
|
||||
break;
|
||||
}
|
||||
}
|
||||
config.put(option, next);
|
||||
onTeamConfigUpdate(player, option, config, team, warzone);
|
||||
}
|
||||
});
|
||||
} else if (option.getConfigType() == TeamSpawnStyle.class) {
|
||||
status += ChatColor.YELLOW + config.resolveValue(option).toString();
|
||||
item = new ItemStack(Material.PINK_DYE, 1);
|
||||
meta = item.getItemMeta();
|
||||
meta.setDisplayName(name);
|
||||
meta.setLore(new ImmutableList.Builder<String>().add(desc).add(status).add(inheritance).build());
|
||||
item.setItemMeta(meta);
|
||||
ui.addItem(inv, i++, item, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
TeamSpawnStyle next = TeamSpawnStyle.INVISIBLE;
|
||||
TeamSpawnStyle[] values = TeamSpawnStyle.values();
|
||||
for (int i1 = 0; i1 < values.length; i1++) {
|
||||
TeamSpawnStyle tss = values[i1];
|
||||
if (tss == config.resolveSpawnStyle() && i1 != values.length - 1) {
|
||||
next = values[i1 + 1];
|
||||
break;
|
||||
}
|
||||
}
|
||||
config.put(option, next);
|
||||
onTeamConfigUpdate(player, option, config, team, warzone);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
status += ChatColor.RED + config.resolveValue(option).toString();
|
||||
item = new ItemStack(Material.COMPASS, 1);
|
||||
meta = item.getItemMeta();
|
||||
meta.setDisplayName(name);
|
||||
meta.setLore(new ImmutableList.Builder<String>().add(desc).add(status).add(inheritance).build());
|
||||
item.setItemMeta(meta);
|
||||
ui.addItem(inv, i++, item, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
private static void onTeamConfigUpdate(Player player, TeamConfig option, TeamConfigBag config, Team team, Warzone warzone) {
|
||||
if (team != null) {
|
||||
TeamConfigBag.afterUpdate(team, player, option.name() + " set to " + config.resolveValue(option).toString(), false);
|
||||
War.war.getUIManager().assignUI(player, new EditTeamUI(team));
|
||||
} else if (warzone != null) {
|
||||
WarzoneConfigBag.afterUpdate(warzone, player, option.name() + " set to " + config.resolveValue(option).toString(), false);
|
||||
War.war.getUIManager().assignUI(player, new EditZoneConfigUI(warzone));
|
||||
} else {
|
||||
WarConfigBag.afterUpdate(player, option.name() + " set to " + config.resolveValue(option).toString(), false);
|
||||
War.war.getUIManager().assignUI(player, new WarAdminUI());
|
||||
}
|
||||
}
|
||||
|
||||
static int addWarzoneConfigOptions(final ChestUI ui, final Player player, Inventory inv, final WarzoneConfigBag config, final Warzone warzone, int i) {
|
||||
ItemStack item;
|
||||
ItemMeta meta;
|
||||
for (final WarzoneConfig option : WarzoneConfig.values()) {
|
||||
if (option.getTitle() == null) {
|
||||
continue;
|
||||
}
|
||||
String inheritance = "";
|
||||
if (!config.contains(option)) {
|
||||
inheritance = ChatColor.DARK_GRAY + "Inherited from War config defaults";
|
||||
}
|
||||
|
||||
String name = ChatColor.RESET + "" + ChatColor.YELLOW + option.getTitle();
|
||||
String status = ChatColor.GRAY + "Currently: ";
|
||||
String[] desc = option.getDescription().split("\n");
|
||||
for (int j = 0; j < desc.length; j++) {
|
||||
desc[j] = ChatColor.RESET + "" + ChatColor.GRAY + desc[j];
|
||||
}
|
||||
if (option.getConfigType() == Boolean.class) {
|
||||
status += config.getBoolean(option) ? ChatColor.GREEN + "true" : ChatColor.DARK_GRAY + "false";
|
||||
item = new ItemStack(config.getBoolean(option) ? Material.LIME_DYE : Material.GRAY_DYE, 1);
|
||||
meta = item.getItemMeta();
|
||||
meta.setDisplayName(name);
|
||||
meta.setLore(new ImmutableList.Builder<String>().add(desc).add(status).add(inheritance).build());
|
||||
item.setItemMeta(meta);
|
||||
ui.addItem(inv, i++, item, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
config.put(option, !config.getBoolean(option));
|
||||
onWarzoneConfigUpdate(player, option, config, warzone);
|
||||
}
|
||||
});
|
||||
} else if (option.getConfigType() == Integer.class || option.getConfigType() == Double.class || option.getConfigType() == String.class) {
|
||||
status += ChatColor.LIGHT_PURPLE + config.getValue(option).toString();
|
||||
item = new ItemStack(Material.PURPLE_DYE, 1);
|
||||
meta = item.getItemMeta();
|
||||
meta.setDisplayName(name);
|
||||
meta.setLore(new ImmutableList.Builder<String>().add(desc).add(status).add(inheritance).build());
|
||||
item.setItemMeta(meta);
|
||||
ui.addItem(inv, i++, item, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
War.war.getUIManager().getPlayerMessage(player, "Type a new value for option " + option.name().toLowerCase() + ": ", new StringRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (option.getConfigType() == Integer.class) {
|
||||
config.put(option, Integer.parseInt(this.getValue()));
|
||||
} else if (option.getConfigType() == Double.class) {
|
||||
config.put(option, Double.parseDouble(this.getValue()));
|
||||
} else {
|
||||
config.put(option, this.getValue());
|
||||
}
|
||||
onWarzoneConfigUpdate(player, option, config, warzone);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
} else if (option.getConfigType() == ScoreboardType.class) {
|
||||
status += ChatColor.YELLOW + config.getValue(option).toString();
|
||||
item = new ItemStack(Material.PINK_DYE, 1);
|
||||
meta = item.getItemMeta();
|
||||
meta.setDisplayName(name);
|
||||
meta.setLore(new ImmutableList.Builder<String>().add(desc).add(status).add(inheritance).build());
|
||||
item.setItemMeta(meta);
|
||||
ui.addItem(inv, i++, item, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
ScoreboardType next = ScoreboardType.NONE;
|
||||
ScoreboardType[] values = ScoreboardType.values();
|
||||
for (int i1 = 0; i1 < values.length; i1++) {
|
||||
ScoreboardType st = values[i1];
|
||||
if (st == config.getScoreboardType(option) && i1 != values.length - 1) {
|
||||
next = values[i1 + 1];
|
||||
break;
|
||||
}
|
||||
}
|
||||
config.put(option, next);
|
||||
onWarzoneConfigUpdate(player, option, config, warzone);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
status += ChatColor.RED + config.getValue(option).toString();
|
||||
item = new ItemStack(Material.COMPASS, 1);
|
||||
meta = item.getItemMeta();
|
||||
meta.setDisplayName(name);
|
||||
meta.setLore(new ImmutableList.Builder<String>().add(desc).add(status).add(inheritance).build());
|
||||
item.setItemMeta(meta);
|
||||
ui.addItem(inv, i++, item, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
private static void onWarzoneConfigUpdate(Player player, WarzoneConfig option, WarzoneConfigBag config, Warzone warzone) {
|
||||
if (warzone != null) {
|
||||
WarzoneConfigBag.afterUpdate(warzone, player, option.name() + " set to " + config.getValue(option).toString(), false);
|
||||
War.war.getUIManager().assignUI(player, new EditZoneConfigUI(warzone));
|
||||
} else {
|
||||
WarConfigBag.afterUpdate(player, option.name() + " set to " + config.getValue(option).toString(), false);
|
||||
War.war.getUIManager().assignUI(player, new WarAdminUI());
|
||||
}
|
||||
}
|
||||
|
||||
static int addWarConfigOptions(final ChestUI ui, final Player player, Inventory inv, final WarConfigBag config, int i) {
|
||||
ItemStack item;
|
||||
ItemMeta meta;
|
||||
for (final WarConfig option : WarConfig.values()) {
|
||||
if (option.getTitle() == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
String name = ChatColor.RESET + "" + ChatColor.YELLOW + option.getTitle();
|
||||
String status = ChatColor.GRAY + "Currently: ";
|
||||
String[] desc = option.getDescription().split("\n");
|
||||
for (int j = 0; j < desc.length; j++) {
|
||||
desc[j] = ChatColor.RESET + "" + ChatColor.GRAY + desc[j];
|
||||
}
|
||||
if (option.getConfigType() == Boolean.class) {
|
||||
status += config.getBoolean(option) ? ChatColor.GREEN + "true" : ChatColor.DARK_GRAY + "false";
|
||||
item = new ItemStack(config.getBoolean(option) ? Material.LIME_DYE : Material.GRAY_DYE, 1);
|
||||
meta = item.getItemMeta();
|
||||
meta.setDisplayName(name);
|
||||
meta.setLore(new ImmutableList.Builder<String>().add(desc).add(status).build());
|
||||
item.setItemMeta(meta);
|
||||
ui.addItem(inv, i++, item, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
config.put(option, !config.getBoolean(option));
|
||||
onWarConfigUpdate(player, option, config);
|
||||
}
|
||||
});
|
||||
} else if (option.getConfigType() == Integer.class || option.getConfigType() == Double.class || option.getConfigType() == String.class) {
|
||||
status += ChatColor.LIGHT_PURPLE + config.getValue(option).toString();
|
||||
item = new ItemStack(Material.PURPLE_DYE, 1);
|
||||
meta = item.getItemMeta();
|
||||
meta.setDisplayName(name);
|
||||
meta.setLore(new ImmutableList.Builder<String>().add(desc).add(status).build());
|
||||
item.setItemMeta(meta);
|
||||
ui.addItem(inv, i++, item, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
War.war.getUIManager().getPlayerMessage(player, "Type a new value for option " + option.name().toLowerCase() + ": ", new StringRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (option.getConfigType() == Integer.class) {
|
||||
config.put(option, Integer.parseInt(this.getValue()));
|
||||
} else if (option.getConfigType() == Double.class) {
|
||||
config.put(option, Double.parseDouble(this.getValue()));
|
||||
} else {
|
||||
config.put(option, this.getValue());
|
||||
}
|
||||
onWarConfigUpdate(player, option, config);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
} else {
|
||||
status += ChatColor.RED + config.getValue(option).toString();
|
||||
item = new ItemStack(Material.COMPASS, 1);
|
||||
meta = item.getItemMeta();
|
||||
meta.setDisplayName(name);
|
||||
meta.setLore(new ImmutableList.Builder<String>().add(desc).add(status).build());
|
||||
item.setItemMeta(meta);
|
||||
ui.addItem(inv, i++, item, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
private static void onWarConfigUpdate(Player player, WarConfig option, WarConfigBag config) {
|
||||
WarConfigBag.afterUpdate(player, option.name() + " set to " + config.getValue(option).toString(), false);
|
||||
War.war.getUIManager().assignUI(player, new WarAdminUI());
|
||||
}
|
||||
}
|
|
@ -0,0 +1,70 @@
|
|||
package com.tommytony.war.ui;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by Connor on 7/27/2017.
|
||||
*/
|
||||
public class UIFormatter {
|
||||
private int i;
|
||||
private List<Integer> pattern;
|
||||
|
||||
UIFormatter(int slots) {
|
||||
this.i = 0;
|
||||
this.pattern = new ArrayList<Integer>();
|
||||
int row = 0;
|
||||
while (slots > 9) {
|
||||
List<Integer> pattern = Arrays.asList(0, 1, 2, 3, 4, 5, 6, 7, 8);
|
||||
for (int i = 0; i < pattern.size(); i++) {
|
||||
pattern.set(i, pattern.get(i) + row * 9);
|
||||
}
|
||||
this.pattern.addAll(pattern);
|
||||
row++;
|
||||
}
|
||||
List<Integer> pattern;
|
||||
switch (slots) {
|
||||
case 0:
|
||||
pattern = Arrays.asList(0);
|
||||
break;
|
||||
case 1:
|
||||
pattern = Arrays.asList(4);
|
||||
break;
|
||||
case 2:
|
||||
pattern = Arrays.asList(2, 6);
|
||||
break;
|
||||
case 3:
|
||||
pattern = Arrays.asList(1, 4, 7);
|
||||
break;
|
||||
case 4:
|
||||
pattern = Arrays.asList(1, 3, 5, 7);
|
||||
break;
|
||||
case 5:
|
||||
pattern = Arrays.asList(0, 2, 4, 6, 8);
|
||||
break;
|
||||
case 6:
|
||||
pattern = Arrays.asList(1, 2, 3, 5, 6, 7);
|
||||
break;
|
||||
case 7:
|
||||
pattern = Arrays.asList(1, 2, 3, 4, 5, 6, 7);
|
||||
break;
|
||||
case 8:
|
||||
pattern = Arrays.asList(0, 1, 2, 3, 5, 6, 7, 8);
|
||||
break;
|
||||
case 9:
|
||||
pattern = Arrays.asList(0, 1, 2, 3, 4, 5, 6, 7, 8);
|
||||
break;
|
||||
default:
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
for (int i = 0; i < pattern.size(); i++) {
|
||||
pattern.set(i, pattern.get(i) + row * 9);
|
||||
}
|
||||
this.pattern.addAll(pattern);
|
||||
}
|
||||
|
||||
int next() {
|
||||
return this.pattern.get(i++);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,108 @@
|
|||
package com.tommytony.war.ui;
|
||||
|
||||
import com.tommytony.war.War;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Created by Connor on 7/25/2017.
|
||||
*/
|
||||
public class UIManager implements Listener {
|
||||
private final War plugin;
|
||||
private Map<Player, ChestUI> uiMap;
|
||||
private Map<Player, StringRunnable> messageMap;
|
||||
|
||||
public UIManager(War plugin) {
|
||||
this.plugin = plugin;
|
||||
this.uiMap = new HashMap<Player, ChestUI>();
|
||||
this.messageMap = new HashMap<Player, StringRunnable>();
|
||||
}
|
||||
|
||||
public void assignUI(Player player, ChestUI ui) {
|
||||
Inventory inv = Bukkit.getServer().createInventory(null, ui.getSize(), ui.getTitle());
|
||||
ui.build(player, inv);
|
||||
uiMap.put(player, ui);
|
||||
player.closeInventory();
|
||||
player.openInventory(inv);
|
||||
}
|
||||
|
||||
public void getPlayerMessage(Player player, String prompt, StringRunnable action) {
|
||||
messageMap.put(player, action);
|
||||
for (int i = 0; i < 10; i++) {
|
||||
player.sendMessage("");
|
||||
}
|
||||
player.sendMessage("CHAT DISABLED WHILE WAITING FOR RESPONSE");
|
||||
for (int i = 0; i < 8; i++) {
|
||||
player.sendMessage("|");
|
||||
}
|
||||
player.sendMessage(prompt);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onInventoryClick(InventoryClickEvent event) {
|
||||
Player player = (Player) event.getWhoClicked();
|
||||
ItemStack clicked = event.getCurrentItem();
|
||||
Inventory inventory = event.getInventory();
|
||||
|
||||
if (uiMap.containsKey(player)) {
|
||||
ChestUI ui = uiMap.get(player);
|
||||
if (inventory.getName().equals(ui.getTitle())) {
|
||||
if (ui.processClick(clicked, inventory)) {
|
||||
event.setCancelled(true);
|
||||
player.closeInventory();
|
||||
uiMap.remove(player);
|
||||
}
|
||||
} else {
|
||||
uiMap.remove(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerInteract(PlayerInteractEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
ItemStack item = event.getItem();
|
||||
if (item != null && item.getType() == Material.TNT
|
||||
&& (item.getDurability() == 7 ||
|
||||
(item.hasItemMeta() && item.getItemMeta().hasDisplayName()
|
||||
&& item.getItemMeta().getDisplayName().contains("War")))) {
|
||||
event.setCancelled(true);
|
||||
this.assignUI(player, new WarUI());
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onChat(AsyncPlayerChatEvent event) {
|
||||
if (messageMap.containsKey(event.getPlayer())) {
|
||||
event.setCancelled(true);
|
||||
StringRunnable exe = messageMap.remove(event.getPlayer());
|
||||
exe.setValue(event.getMessage());
|
||||
War.war.getServer().getScheduler().runTask(War.war, exe);
|
||||
return;
|
||||
}
|
||||
for (Player p : messageMap.keySet()) {
|
||||
if (event.getRecipients().contains(p)) {
|
||||
event.getRecipients().remove(p);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerLeave(PlayerQuitEvent event) {
|
||||
this.uiMap.remove(event.getPlayer());
|
||||
this.messageMap.remove(event.getPlayer());
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
package com.tommytony.war.ui;
|
||||
|
||||
import com.tommytony.war.War;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
/**
|
||||
* Created by Connor on 7/27/2017.
|
||||
*/
|
||||
public class WarAdminUI extends ChestUI {
|
||||
@Override
|
||||
public void build(final Player player, Inventory inv) {
|
||||
ItemStack item;
|
||||
ItemMeta meta;
|
||||
int i = 0;
|
||||
|
||||
i = UIConfigHelper.addWarConfigOptions(this, player, inv, War.war.getWarConfig(), i);
|
||||
item = new ItemStack(Material.WHITE_STAINED_GLASS_PANE);
|
||||
meta = item.getItemMeta();
|
||||
meta.setDisplayName(">>>> Warzone Default Config >>>>");
|
||||
item.setItemMeta(meta);
|
||||
this.addItem(inv, i++, item, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
War.war.getUIManager().assignUI(player, new WarAdminUI());
|
||||
}
|
||||
});
|
||||
i = UIConfigHelper.addWarzoneConfigOptions(this, player, inv, War.war.getWarzoneDefaultConfig(), null, i);
|
||||
item = new ItemStack(Material.WHITE_STAINED_GLASS_PANE);
|
||||
meta = item.getItemMeta();
|
||||
meta.setDisplayName(">>>> Team Default Config >>>>");
|
||||
item.setItemMeta(meta);
|
||||
this.addItem(inv, i++, item, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
War.war.getUIManager().assignUI(player, new WarAdminUI());
|
||||
}
|
||||
});
|
||||
UIConfigHelper.addTeamConfigOptions(this, player, inv, War.war.getTeamDefaultConfig(), null, null, i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle() {
|
||||
return ChatColor.DARK_RED + "" + ChatColor.BOLD + "War Admin Panel";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSize() {
|
||||
return 9 * 7;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,87 @@
|
|||
package com.tommytony.war.ui;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.tommytony.war.War;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
/**
|
||||
* Created by Connor on 7/26/2017.
|
||||
*/
|
||||
public class WarUI extends ChestUI {
|
||||
@Override
|
||||
public void build(final Player player, Inventory inv) {
|
||||
Runnable joinZoneAction = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
War.war.getUIManager().assignUI(player, new JoinZoneUI());
|
||||
}
|
||||
};
|
||||
Runnable createZoneAction = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
War.war.getUIManager().assignUI(player, new EditOrCreateZoneUI());
|
||||
}
|
||||
};
|
||||
Runnable warAdminAction = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
War.war.getUIManager().assignUI(player, new WarAdminUI());
|
||||
}
|
||||
};
|
||||
|
||||
if (War.war.isWarAdmin(player)) {
|
||||
this.addItem(inv, 2, getWarAdminItem(), warAdminAction);
|
||||
this.addItem(inv, 4, getCreateWarzoneItem(), createZoneAction);
|
||||
this.addItem(inv, 6, getJoinWarzoneItem(), joinZoneAction);
|
||||
} else if (War.war.isZoneMaker(player)) {
|
||||
this.addItem(inv, 2, getCreateWarzoneItem(), createZoneAction);
|
||||
this.addItem(inv, 6, getJoinWarzoneItem(), joinZoneAction);
|
||||
} else {
|
||||
this.addItem(inv, 4, getJoinWarzoneItem(), joinZoneAction);
|
||||
}
|
||||
}
|
||||
|
||||
private ItemStack getCreateWarzoneItem() {
|
||||
ItemStack item = new ItemStack(Material.WOODEN_AXE, 1);
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
meta.setDisplayName(ChatColor.YELLOW + "" + ChatColor.BOLD + "Create Warzone");
|
||||
meta.setLore(ImmutableList.of(ChatColor.GRAY + "Click to create, or edit a " + ChatColor.AQUA + "Warzone" + ChatColor.GRAY + "."));
|
||||
item.setItemMeta(meta);
|
||||
return item;
|
||||
}
|
||||
|
||||
private ItemStack getJoinWarzoneItem() {
|
||||
ItemStack item = new ItemStack(Material.IRON_SWORD, 1);
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
meta.setDisplayName(ChatColor.RED + "" + ChatColor.BOLD + "Join Warzone");
|
||||
meta.setLore(ImmutableList.of(ChatColor.GRAY + "Click to access " + ChatColor.AQUA + "Warzones" + ChatColor.GRAY + ".",
|
||||
ChatColor.DARK_GRAY + "Play in PVP areas, with multiple gamemodes here."));
|
||||
item.setItemMeta(meta);
|
||||
return item;
|
||||
}
|
||||
|
||||
private ItemStack getWarAdminItem() {
|
||||
ItemStack item = new ItemStack(Material.ENDER_EYE, 1);
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
meta.setDisplayName(ChatColor.DARK_RED + "" + ChatColor.BOLD + "Manage War");
|
||||
meta.setLore(ImmutableList.of(ChatColor.GRAY + "Click to display " + ChatColor.DARK_RED + "Admin" + ChatColor.GRAY + " access panel",
|
||||
ChatColor.GRAY + "Includes: " + ChatColor.DARK_GRAY + "Permissions, managing warzones, configs, etc."));
|
||||
item.setItemMeta(meta);
|
||||
return item;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle() {
|
||||
return ChatColor.RED + "War";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSize() {
|
||||
return 9;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,69 @@
|
|||
package com.tommytony.war.utility;
|
||||
|
||||
import com.sk89q.worldedit.IncompleteRegionException;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
||||
import com.sk89q.worldedit.bukkit.BukkitPlayer;
|
||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
import com.tommytony.war.War;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.Damageable;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
/**
|
||||
* Simple fixes to account for removed Bukkit functionality
|
||||
*/
|
||||
public class Compat {
|
||||
public static ItemStack createDamagedIS(Material mat, int amount, int damage) {
|
||||
ItemStack is = new ItemStack(mat, amount);
|
||||
ItemMeta meta = is.getItemMeta();
|
||||
((Damageable) meta).setDamage(damage); // hope this works
|
||||
is.setItemMeta(meta);
|
||||
return is;
|
||||
}
|
||||
|
||||
public static class BlockPair {
|
||||
final Block block1;
|
||||
final Block block2;
|
||||
|
||||
BlockPair(Block block1, Block block2) {
|
||||
this.block1 = block1;
|
||||
this.block2 = block2;
|
||||
}
|
||||
|
||||
public Block getBlock1() {
|
||||
return block1;
|
||||
}
|
||||
|
||||
public Block getBlock2() {
|
||||
return block2;
|
||||
}
|
||||
}
|
||||
|
||||
public static BlockPair getWorldEditSelection(Player player) {
|
||||
if (!War.war.getServer().getPluginManager().isPluginEnabled("WorldEdit")) {
|
||||
return null;
|
||||
}
|
||||
BukkitPlayer wp = BukkitAdapter.adapt(player);
|
||||
LocalSession session = WorldEdit.getInstance().getSessionManager().get(wp);
|
||||
try {
|
||||
Region selection = session.getSelection(wp.getWorld());
|
||||
if (selection instanceof CuboidRegion) {
|
||||
return new BlockPair(
|
||||
player.getWorld().getBlockAt(selection.getMinimumPoint().getBlockX(), selection.getMinimumPoint().getBlockY(), selection.getMinimumPoint().getBlockZ()),
|
||||
player.getWorld().getBlockAt(selection.getMaximumPoint().getBlockX(), selection.getMaximumPoint().getBlockY(), selection.getMaximumPoint().getBlockZ())
|
||||
);
|
||||
}
|
||||
return null;
|
||||
} catch (IncompleteRegionException e) {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -6,8 +6,9 @@ import org.bukkit.entity.Player;
|
|||
import org.bukkit.potion.PotionEffect;
|
||||
|
||||
public class PotionEffectHelper {
|
||||
|
||||
public static void restorePotionEffects(Player player, Collection<PotionEffect> potionEffects) {
|
||||
|
||||
public static void restorePotionEffects(Player player,
|
||||
Collection<PotionEffect> potionEffects) {
|
||||
clearPotionEffects(player);
|
||||
for (PotionEffect effect : potionEffects) {
|
||||
player.addPotionEffect(effect, true);
|
||||
|
@ -15,9 +16,8 @@ public class PotionEffectHelper {
|
|||
}
|
||||
|
||||
public static void clearPotionEffects(Player player) {
|
||||
for(PotionEffect effect : player.getActivePotionEffects())
|
||||
{
|
||||
player.addPotionEffect(new PotionEffect(effect.getType(), 0, 0), true);
|
||||
for (PotionEffect effect : player.getActivePotionEffects()) {
|
||||
player.removePotionEffect(effect.getType());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -261,63 +261,6 @@ public class Volume {
|
|||
}
|
||||
}
|
||||
|
||||
public void replaceMaterial(Material original, Material replacement) {
|
||||
Validate.isTrue(this.hasTwoCorners(), "Incomplete volume");
|
||||
for (int x = this.getMinX(); x <= this.getMaxX(); x++) {
|
||||
for (int y = this.getMinY(); y <= this.getMaxY(); y++) {
|
||||
for (int z = this.getMinZ(); z <= this.getMaxZ(); z++) {
|
||||
if (this.getWorld().getBlockAt(x, y, z).getType() == original) {
|
||||
this.getWorld().getBlockAt(x, y, z).setType(replacement);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void replaceMaterials(Material[] materials, Material replacement) {
|
||||
for (Material mat: materials) {
|
||||
this.replaceMaterial(mat, replacement);
|
||||
}
|
||||
}
|
||||
|
||||
public void clearBlocksThatDontFloat() {
|
||||
Validate.isTrue(this.hasTwoCorners(), "Incomplete volume");
|
||||
for (int x = this.getMinX(); x <= this.getMaxX(); x++) {
|
||||
for (int y = this.getMinY(); y <= this.getMaxY(); y++) {
|
||||
for (int z = this.getMinZ(); z <= this.getMaxZ(); z++) {
|
||||
switch (this.getWorld().getBlockAt(x, y, z).getType()) {
|
||||
case SIGN_POST:
|
||||
case WALL_SIGN:
|
||||
case IRON_DOOR:
|
||||
case WOOD_DOOR:
|
||||
case LADDER:
|
||||
case YELLOW_FLOWER:
|
||||
case RED_ROSE:
|
||||
case RED_MUSHROOM:
|
||||
case BROWN_MUSHROOM:
|
||||
case SAPLING:
|
||||
case TORCH:
|
||||
case RAILS:
|
||||
case STONE_BUTTON:
|
||||
case STONE_PLATE:
|
||||
case WOOD_PLATE:
|
||||
case LEVER:
|
||||
case REDSTONE:
|
||||
case REDSTONE_TORCH_ON:
|
||||
case REDSTONE_TORCH_OFF:
|
||||
case CACTUS:
|
||||
case SNOW:
|
||||
case ICE:
|
||||
this.getWorld().getBlockAt(x, y, z)
|
||||
.setType(Material.AIR);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void finalize() {
|
||||
this.blocks.clear();
|
||||
|
|
|
@ -1,13 +1,5 @@
|
|||
package com.tommytony.war.volume;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
|
||||
import com.tommytony.war.Team;
|
||||
import com.tommytony.war.War;
|
||||
import com.tommytony.war.Warzone;
|
||||
|
@ -15,6 +7,13 @@ import com.tommytony.war.config.WarConfig;
|
|||
import com.tommytony.war.job.PartialZoneResetJob;
|
||||
import com.tommytony.war.mapper.ZoneVolumeMapper;
|
||||
import com.tommytony.war.structure.Monument;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
import java.util.logging.Level;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -36,7 +35,7 @@ public class ZoneVolume extends Volume {
|
|||
// Save blocks directly to disk (i.e. don't put everything in memory)
|
||||
int saved = 0;
|
||||
try {
|
||||
saved = ZoneVolumeMapper.save(this, this.zone.getName());
|
||||
saved = ZoneVolumeMapper.saveZoneBlocksAndEntities(this, this.zone.getName());
|
||||
} catch (SQLException ex) {
|
||||
War.war.log("Failed to save warzone " + zone.getName() + ": " + ex.getMessage(), Level.WARNING);
|
||||
ex.printStackTrace();
|
||||
|
@ -51,8 +50,8 @@ public class ZoneVolume extends Volume {
|
|||
}
|
||||
|
||||
public void loadCorners() throws SQLException {
|
||||
Connection conn = ZoneVolumeMapper.getZoneConnection(this, this.zone.getName(), this.getWorld());
|
||||
ZoneVolumeMapper.load(conn, this, this.getWorld(), true, 0, 0, null);
|
||||
Connection conn = ZoneVolumeMapper.getZoneConnection(this, this.zone.getName());
|
||||
ZoneVolumeMapper.loadCorners(conn, this, this.getWorld(), "");
|
||||
this.isSaved = true;
|
||||
}
|
||||
|
||||
|
@ -60,8 +59,8 @@ public class ZoneVolume extends Volume {
|
|||
public void resetBlocks() {
|
||||
// Load blocks directly from disk and onto the map (i.e. no more in-memory warzone blocks)
|
||||
try {
|
||||
Connection conn = ZoneVolumeMapper.getZoneConnection(this, this.zone.getName(), this.getWorld());
|
||||
ZoneVolumeMapper.load(conn, this, this.getWorld(), false, 0, Integer.MAX_VALUE, null);
|
||||
Connection conn = ZoneVolumeMapper.getZoneConnection(this, this.zone.getName());
|
||||
ZoneVolumeMapper.reloadZoneBlocks(conn, this, 0, Integer.MAX_VALUE, null);
|
||||
} catch (SQLException ex) {
|
||||
War.war.log("Failed to load warzone " + zone.getName() + ": " + ex.getMessage(), Level.WARNING);
|
||||
ex.printStackTrace();
|
||||
|
@ -82,7 +81,18 @@ public class ZoneVolume extends Volume {
|
|||
* @throws SQLException
|
||||
*/
|
||||
public int resetSection(Connection conn, int start, int total, boolean[][][] changes) throws SQLException {
|
||||
return ZoneVolumeMapper.load(conn, this, this.getWorld(), false, start, total, changes);
|
||||
return ZoneVolumeMapper.reloadZoneBlocks(conn, this, start, total, changes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reload all saved entities in the warzone. Consists of paintings, item frames, etc.
|
||||
*
|
||||
* @param connection Open connection to warzone database file.
|
||||
* @return Changed entity count.
|
||||
* @throws SQLException SQLite error
|
||||
*/
|
||||
public int resetEntities(Connection connection) throws SQLException {
|
||||
return ZoneVolumeMapper.loadEntities(connection, this);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -102,7 +112,7 @@ public class ZoneVolume extends Volume {
|
|||
public void resetBlocksAsJob() {
|
||||
try {
|
||||
PartialZoneResetJob job = new PartialZoneResetJob(zone, War.war.getWarConfig().getInt(WarConfig.RESETSPEED));
|
||||
War.war.getServer().getScheduler().runTask(War.war, job);
|
||||
job.runTask(War.war);
|
||||
} catch (SQLException e) {
|
||||
War.war.getLogger().log(Level.WARNING, "Failed to reset warzone - cannot get count of saved blocks", e);
|
||||
}
|
||||
|
|
|
@ -9,6 +9,10 @@ build.denied.zone.place = You cannot place blocks in this warzone.
|
|||
build.denied.zone.type = You cannot modify this type of block.
|
||||
command.console = You can't do this if you are not in game.
|
||||
command.disabled = You can only use War commands (e.g. /leave) while playing.
|
||||
command.tp.init = Please wait for {0} seconds before teleportation. Movement or damage will cancel the timer.
|
||||
command.tp.moved = Teleportation cancelled due to movement.
|
||||
command.tp.damaged = Teleportation cancelled due to damage.
|
||||
command.tp.success = You have been teleported. Thanks for your patience.
|
||||
drop.bomb.broadcast = {0} dropped the {1} bomb!
|
||||
drop.bomb.disabled = You can't drop items while stealing bomb. What are you doing?! Run for your enemy's spawn!
|
||||
drop.cake.broadcast = {0} dropped the {1} cake!
|
||||
|
@ -87,6 +91,11 @@ zone.battle.resetprogress = Reset progress: {0}%, {1} seconds...
|
|||
zone.battle.resetcomplete = Warzone reset in {0} seconds. A new battle begins.
|
||||
zone.bomb.broadcast = {0} blew up team {1}''s spawn. Team {2} scores one point.
|
||||
zone.cake.broadcast = {0} captured cake {1}. Team {2} scores one point and gets a full lifepool.
|
||||
zone.capturepoint.addpoint = Team {0} gained one point for maintaining control of capture point {1}.
|
||||
zone.capturepoint.lose = Team {0} has lost control of capture point {1}.
|
||||
zone.capturepoint.contest = Capture point {0} is being contested by {1}!
|
||||
zone.capturepoint.capture = Team {0} has captured point {1}, gaining 1 extra point.
|
||||
zone.capturepoint.fortify = Team {0} is gaining control of point {1}!
|
||||
zone.flagcapture.broadcast = {0} captured team {1}''s flag. Team {2} scores one point.
|
||||
zone.flagreturn.deadlock = You can't capture the enemy flag until your team's flag is returned.
|
||||
zone.flagreturn.flag = You have to capture the enemy flag at your team's flag.
|
||||
|
@ -104,6 +113,7 @@ zone.score.board404 = This warzone has not enabled a scoreboard.
|
|||
zone.score.empty = You can't score until at least one player joins another team.
|
||||
zone.spawn.minplayers = You can''t leave spawn until there''s a minimum of {0} player(s) on at least {1} team(s).
|
||||
zone.spawn.timer = You can''t leave spawn for {0} second(s) after respawning!
|
||||
zone.spawn.timer.title = Respawn in {0} second(s)...
|
||||
zone.steal.bomb.broadcast = {0} has bomb {1}.
|
||||
zone.steal.bomb.notice = You have bomb {0}. Reach another team''s spawn to score. Don''t get touched by anyone or you''ll blow up!
|
||||
zone.steal.bomb.prevent = Prevent {0} from reaching your spawn with the bomb!
|
||||
|
|
|
@ -0,0 +1,133 @@
|
|||
# Generated by ResourceBundle Editor (http://eclipse-rbe.sourceforge.net)
|
||||
build.denied.location = Ma T8dr Tbny Hna
|
||||
build.denied.outside = Bs T8dr Tbny Gwa WarZones
|
||||
build.denied.teamblock = Ymknk F86 Ast3mal Blockat Fre8k l2lt8a6 Almouments
|
||||
build.denied.zone.break = Blockat Warzone Ma Ttksr
|
||||
build.denied.zone.multteam = A9ln 3ndk {0} Block
|
||||
build.denied.zone.outside = Ma T8dr Tksr 3shan Ant Ma Tl3b
|
||||
build.denied.zone.place = Ma T8dr T76 Blockat Fe WarZone
|
||||
build.denied.zone.type = Ma T8dr T3dl 3la H4a Al No3
|
||||
command.console = Ma T8dr Tswe H4a 3shank Mo Fe Al Game
|
||||
command.disabled = Ma T8dr Tktb Alla (/Leave) w Ant Tl3b
|
||||
command.tp.init = Alrja2 Ant9'ar {0} Thwany 8bl Ant8al. A4a Mshet Aw 9'rbk A7d By36l Ant8al.
|
||||
command.tp.moved = Al Ant8al M36l 3shank Tmshy.
|
||||
command.tp.damaged = Al Ant8al M36l 3shan Al 9'rb
|
||||
command.tp.success = L8d Tm N8lk. Shkrn l 9brk
|
||||
drop.bomb.broadcast = \u200e{0}\u200e 6a7t, \u200e{1}\u200e Al 8nblh!
|
||||
drop.bomb.disabled = Ma T8dr Trmy Shy w Ant Ma54 8nblh. Wsh 8a3d Tswe?! Ahrb l Spawn Al3do!
|
||||
drop.cake.broadcast = {0} 6a7t , {1} Al Cake!
|
||||
drop.cake.disabled = Ma T8dr Trmy Shy w Ant Ma54 Al Cake. Wsh 8a3d Tswe?! Ahrb!
|
||||
drop.flag.broadcast = {0} 6a7 , {1} Al 3lm!
|
||||
drop.flag.disabled = Ma T8dr Trmy Items w Ant Ma54 Al 3lm. Wsh 8a3d Tswe?! Ahrb!
|
||||
drop.item.border = ant mat8dr trmy items fe alzone
|
||||
drop.item.disabled = Ma T8dr Trmy H4a Fe WarZone.
|
||||
drop.item.spawn = Ant Ma T8dr Trmy w Ant Fe Spawn.
|
||||
drop.team = Ant Ma T8dr Trmy {0} Blocks.
|
||||
drop.wand = Ant Rmet Al Zone {0} Al 39a
|
||||
join.aarequired = Al Warzone Y6lb Mnk D5ol Tl8a2y l Fre8\nAlrja2 Ad5l Ay Bwabh
|
||||
join.broadcast = {0} D5l Team {1}
|
||||
join.disabled = H4a Al WarZone M36l
|
||||
join.full.all = Kl Al Teams Full
|
||||
join.full.single = Fre8 {0} H4a Full.
|
||||
join.inventorystored = .Al Inventory 78k Fe Al M5zn 7ta T6l3 /War Leave.
|
||||
join.permission.all = Ma 3ndk 9la7yat l Ay Teams Fe H4e WarZone.
|
||||
join.permission.single = Ma 3ndk 9la7yat Td5l Team {0}
|
||||
join.progress = Ma T8dr Td5l Al7rb Bd2t Fe H4e Zone.
|
||||
join.selfteam = mat8dr td5l alteam 78k
|
||||
join.team404 = alteam 3'er mojod jrb aktb/ teams tshof 8a2mh alteams
|
||||
leave.broadcast = {0} 6l3 mn alzone.
|
||||
leave.inventoryrestore = 78ybtk tm astrja3ha
|
||||
pvp.death.drown = {0} 3'r8
|
||||
pvp.death.explosion = {0} tfjr
|
||||
pvp.death.fall = {0}s86 wmat fj2h
|
||||
pvp.death.fire = \u200e{0}\u200e a7tr8 llshwa2
|
||||
pvp.death.other = {0} mat
|
||||
pvp.ff.disabled = hjomk fashl! hdfk m3k fe alfre8
|
||||
pvp.ff.enabled = alnyran al9de8h msh3'lh! alrja2 la to24e fre8k
|
||||
pvp.kill.adjectives = ;;al8wy;al8atl;b5er;d8e8;alw7shy;6a8h
|
||||
pvp.kill.bomb = \u200e{0}\u200eada ela \u200e{1}\u200e tfjer!
|
||||
pvp.kill.format = {0}'s{1}{2}{3}{4}
|
||||
pvp.kill.self = {0} ant7r
|
||||
pvp.kill.verbs = An8tl;An8tl;An8tl;Antha;Abed;8tl;Ams7;Abed
|
||||
pvp.kill.weapon.aim = Hdf
|
||||
pvp.kill.weapon.bow = 8os
|
||||
pvp.kill.weapon.hand = Yd
|
||||
pvp.outside.permission = Mat8dr Thajm Ala3ben 5arj Alwarzones.
|
||||
pvp.self.notplaying = Lazm Tkon Tl3b 3shan Thjm
|
||||
pvp.self.respawn = Mat8dr Thjm W Ant Trsbn
|
||||
pvp.self.spawn = Ma t8dr Thjm W Ant Fe Spawn
|
||||
pvp.target.notplaying = Hdfk Ma Yl3b Fe Alwarzone
|
||||
pvp.target.otherzone = Hdfk Y3b Fe Warzone Thany.
|
||||
pvp.target.respawn = Hdfk 7alya Yrsbn!
|
||||
pvp.target.spawn = Hdfk Fe Alspawn!
|
||||
sign.lobby.autoassign = Warzone\u00a0\n{0}\u00a0\nD5ol Tl8a2y -\u00a0\nAssign Gate.
|
||||
sign.lobby.pick = Warzone\u00a0\n{0}\u00a0\n\u00a0
|
||||
sign.lobby.warhub = \n\n\nTo War hub\n
|
||||
sign.team.limited = Fre8 \u200e{0}\u200e\n\u200e{1}\u200e/\u200e{2}\u200e La3ben\n\u200e{3}\u200e/\u200e{4}\u200e N8a6\n\u200e{5}\u200e 7yah
|
||||
sign.team.unlimited = fre8 {0}\u00a0\n{1}/{2} la3ben\n{3}/{4} n8a6\n7yah la nha2yh
|
||||
sign.warhub = War hub\u00a0\n(/warhub)\u00a0\na5tar al3bh
|
||||
sign.warzone = Warzone\u00a0\n{0}\u00a0\n{1}/{2} la3ben\n{3} afr8h
|
||||
team.chat.enable = Chat Al Fre8 Msh3'l. Byst8bl Rsayl Team 78k Bs.
|
||||
team.chat.disable = Chat Al Fre8 M36l
|
||||
use.anvil = mat8dr tst3ml anvil fe h4a alwarzone!
|
||||
use.enchant = ma t8dr tst3ml 6awlh alt6wer fe h4a alwarzone!
|
||||
use.ender = mat8dr tst3ml enderchst w ant tl3b fe warzone!
|
||||
use.item.spawn = mat8dr tst3ml items w ant fe spawn
|
||||
use.xpkillmeter = h4a al xpkillmeter ymkn a5tyar tsh3'elh
|
||||
wand.toofar = hdf alblockh b3ed jda.
|
||||
war.notadmin = mat8dr tswe h4a e4a ant mo admin fe war (permission war.admin).
|
||||
war.notzm = mat8dr tswe h4a e4a ant mo warzone maker ( permssion war.zonemaker).
|
||||
war.prefix = War>
|
||||
war.title = War
|
||||
warhub.none = mafyh warhub fe h4a alserver. jrb /zone aw /zone.
|
||||
warhub.permission = ma3ndk 9la7yh al2nt8al ela war hub.
|
||||
warhub.teleport = ahla bk fe WarHub. a5tr l3btk
|
||||
zone.airstrike = {0} d3a fy 9'rbh jwyh !
|
||||
zone.battle.end = alm3krh antht. fre8 {0} 5sr: {1} mat w lm ykn 7yah trkt lhm
|
||||
zone.battle.newscores = n8a6 jdedh - {0}
|
||||
zone.battle.next = al7rb antht . a3adh alwarzone {0} ...
|
||||
zone.battle.reset = stbda alm3rh aljdedh 8rabn. a3adh alwarzone...
|
||||
zone.battle.resetprogress = al23adh fe t8dm: {0}%,{1}thwany...
|
||||
zone.battle.resetcomplete = Al WarZone Bt3ed B3d {0} Thwany. Mbarat Gdedh Btbd2.
|
||||
zone.bomb.broadcast = \u200e{0}\u200e fjr bdayh fre8 {1}. fre8 {2} n86h wa7dh.
|
||||
zone.cake.broadcast = \u200e{0}\u200e cake astwlt \u200e{1}\u200e. fre8 \u200e{2}\u200e n86h wa7dh w 7yah jdedh
|
||||
zone.flagcapture.broadcast = \u200e{0}\u200e fjr bdayh fre8 {1}. fre8 {2} n86h wa7dh.
|
||||
zone.flagreturn.deadlock = mat8dr tstwle 3lm al3do 7ta ytm arja3 3lm fre8k
|
||||
zone.flagreturn.flag = yjb an tstwle 3la 3lm 3dok ela 3lm fre8k.
|
||||
zone.flagreturn.spawn = yjb 3lek an tstwle 3la 3lm 3dok ela bdayh fre8k
|
||||
zone.leavenotice = ast3ml /war leave 3shan t6l3 mn alzone
|
||||
zone.lifepool.empty = 7yat alfre8 \u200e{0}\u200e 5l9t . moth w7dh w y5sron al7rb
|
||||
zone.loadout.equip = mjhz \u200e{0}\u200e loadout ( tsll lld5ol )
|
||||
zone.loadout.reenter = mat8dr t3'er alloadout b3d 5rojk mn albdayh.
|
||||
zone.monument.badblock = yjb 3lek alt8a6 al monument m3 block al9of 78 fre8k\n54 wa7d mn bdayh fre8k
|
||||
zone.monument.capture = Monument {0} tm alt8a6ha mn alfre8 {1}.
|
||||
zone.monument.lose = fre8 \u200e{0}\u200e f8d alsy6rh 3la monument {1}
|
||||
zone.monument.voodoo = ant tr89 tr9'e al monument''s voodoo. ant ksbt {0} 8lob!
|
||||
zone.noteamnotice = mat8dr tkon da5l alwarzone bdon fre8.
|
||||
zone.score.board404 = alwarzone mo mf3l alscoreboard.
|
||||
zone.score.empty = ant mat8dr ta54 score 7ta yd5l a7d alfre8 althany.
|
||||
zone.spawn.minplayers = mat8dr ttrk alspawn 7ta hna al7d al2dna mn {0} ala3ben ma y8l 3n {1} fre8.
|
||||
zone.spawn.timer = mat8dr ttrk alspawn 7ta {0} thanyh b3d alrespawn!
|
||||
zone.steal.bomb.broadcast = {0} ldeh 8nblh {1}.
|
||||
zone.steal.bomb.notice = ldyk 8nblh {0}. t9l ela spawn alfre8 althany lln8a6 . la tnlms mn a7d wla ant btnfjr!
|
||||
zone.steal.bomb.prevent = mn3 {0} mn alw9wl ela alspawn 78k m3 al8nblh!
|
||||
zone.steal.cake.broadcast = {0} ldyh cake {1}.
|
||||
zone.steal.cake.notice = ldyk cake {0}.aw9l lfre8k lln8a6 wtjded 7yatk.
|
||||
zone.steal.cake.prevent = mn3 {0} mn alw9l ela alspawn m3 alcake!
|
||||
zone.steal.flag.broadcast = {0} sr8 3lm fre8 {1}.
|
||||
zone.steal.flag.empty = mat8dr tsr8 3lm alfre8 {0} l2n mafy a7d da5l alfre8.
|
||||
zone.steal.flag.notice = ldyk 3lm alfre8 {0} . aw9l llspawn fre8k aw al3lm 3shan tlt86h!
|
||||
zone.steal.flag.prevent = mn3 {0} mn alw9l ela spawn alfre8 {1} aw al3lm
|
||||
zone.stealextra.bomb = ant t8dr bs tsr8 8nblh w7dh fe w8t wa7d!
|
||||
zone.stealextra.cake = ant t8dr bs tsr8 cake wa7d fe w8t wa7d!
|
||||
zone.stealextra.flag = ant bs t8dr tsr8 3lm wa7d fe w8t wa7d!
|
||||
zone.stealextra.other = ant bs t8dr tsr8 shy wa7d fe w8t wa7d!
|
||||
zone.teaminfo.format = {0}: {1} n8a6, {2}\\{3} 7yah mtb8yh. {4}
|
||||
zone.teaminfo.none = La Shy2
|
||||
zone.teaminfo.prefix = Al2fr8h:
|
||||
zone.teleport = Ahln Bk Fe WarZone {0}.
|
||||
zone.warp.permission = Ma 3ndk 9la7yat L Ant8al l WarZone
|
||||
zone.zone404 = WarZone Mo Mwgodh.
|
||||
zone.zoneinfo.format = {0}: {1} Afr8h, {2} L3ebh
|
||||
zone.zoneinfo.prefix = Warzones:
|
||||
zone.zoneinfo.teleport = Ast3ml /Zone <Asm-Zone> 3shan Tro7 l WarZone
|
|
@ -0,0 +1,19 @@
|
|||
# Generated by ResourceBundle Editor (http://eclipse-rbe.sourceforge.net)
|
||||
build.denied.location = Zde nem\u016f\u017ee\u0161 stav\u011bt.
|
||||
build.denied.outside = M\u016f\u017ee\u0161 stav\u011bt pouze v bitevn\u00edch z\u00f3n\u00e1ch.
|
||||
build.denied.teamblock = M\u016f\u017ee\u0161 pou\u017e\u00edvat pouze bloky tv\u00e9ho t\u00fdmu k zabr\u00e1n\u00ed monument\u016f.
|
||||
build.denied.zone.break = Bloky v bitevn\u00ed z\u00f3n\u011b jsou nezni\u010diteln\u00e9!
|
||||
build.denied.zone.multteam = Blok {0} u\u017e m\u00e1\u0161.
|
||||
build.denied.zone.outside = Nem\u016f\u017ee\u0161 zni\u010dit bitevn\u00ed z\u00f3nu,ve kter\u00e9 nehraje\u0161.
|
||||
build.denied.zone.place = Nem\u016f\u017ee\u0161 pokl\u00e1dat bloky v t\u00e9to bitevn\u00ed z\u00f3n\u011b.
|
||||
build.denied.zone.type = Nem\u016f\u017ee\u0161 upravovat tento typ blok\u016f!
|
||||
command.console = Toto nem\u016f\u017ee\u0161 pokud nejsi ve h\u0159e.
|
||||
command.disabled = M\u016f\u017ee\u0161 pou\u017e\u00edvat pouze War p\u0159\u00edkazy (nap\u0159. /leave) kdy\u017e hraje\u0161.
|
||||
drop.bomb.broadcast = {0} ztratil {1} bombu!
|
||||
drop.bomb.disabled = Nem\u016f\u017ee\u0161 pokl\u00e1dat p\u0159edm\u011bty kdy\u017e krade\u0161 bombu! Co d\u011bl\u00e1\u0161?! B\u011b\u017e na nep\u0159\u00e1telsk\u00fd spawn!
|
||||
drop.cake.broadcast = {0} ztratil {1} dort!
|
||||
drop.cake.disabled = Nem\u016f\u017ee\u0161 pokl\u00e1dat p\u0159edm\u011bty kdy\u017e krade\u0161 dort! Co d\u011bl\u00e1\u0161?! B\u011b\u017e!
|
||||
drop.flag.broadcast = {0} ztratil {1} vlajku!
|
||||
drop.flag.disabled = Nem\u016f\u017ee\u0161 pokl\u00e1dat p\u0159edm\u011bty kdy\u017e krade\u0161 vlajku. Co d\u011bl\u00e1\u0161?! B\u011b\u017e!
|
||||
drop.item.border = Nem\u016f\u017ee\u0161 pokl\u00e1dat p\u0159edm\u011bty bl\u00edzko hranice z\u00f3ny.
|
||||
drop.item.disabled = Nem\u016f\u017ee\u0161 pokl\u00e1dat p\u0159edm\u011bty v t\u00e9to bitevn\u00ed z\u00f3n\u011b.
|
|
@ -0,0 +1,133 @@
|
|||
# Generated by ResourceBundle Editor (http://eclipse-rbe.sourceforge.net)
|
||||
build.denied.location = Du kan ikke bygge her.
|
||||
build.denied.outside = Du kan kun bygge inde i krigszoner.
|
||||
build.denied.teamblock = Du kan kun bruge dit holds blokke til at overtage monumenter.
|
||||
build.denied.zone.break = Blokkenede i denne krigszone er ubrydelige!
|
||||
build.denied.zone.multteam = You har allerede en {0} blok.
|
||||
build.denied.zone.outside = Du kan ikke \u00f8del\u00e6gge en krigszone du ikke spiller i.
|
||||
build.denied.zone.place = Du kan ikke placere bloks i denne krigszone.
|
||||
build.denied.zone.type = Du kan ikke \u00e6ndre denne type blok.
|
||||
command.console = Du kan ikke g\u00f8re dette hvis du ikke er inde i et spil.
|
||||
command.disabled = Du kan kun bruge War kommandoer (f.eks. /leave) n\u00e5r du spiller.
|
||||
command.tp.init = V\u00e6r venlig at vente {0} sekunder f\u00f8r teleportation. Bev\u00e6gelse eller skade vil afbryde timeren.
|
||||
command.tp.moved = Teleportation afbrudt pga. bev\u00e6gelse.
|
||||
command.tp.damaged = Teleportation afbrudt pga. skade.
|
||||
command.tp.success = Du er blevet teleporteret. Tak for din t\u00e5lmodighed.
|
||||
drop.bomb.broadcast = {0} tabte den {1} bombe!
|
||||
drop.bomb.disabled = Du kan ikke smide ting n\u00e5r du er ved at stj\u00e6le en bombe. Hvad laver du?! L\u00f8b mod din fjendes spawn!
|
||||
drop.cake.broadcast = {0} tabte den {1} kage!
|
||||
drop.cake.disabled = Du kan ikke smide ting n\u00e5r du er ved at stj\u00e6le en kage. Hvad laver du?! L\u00f8b!
|
||||
drop.flag.broadcast = {0} tabte den {1} flag!
|
||||
drop.flag.disabled = Du kan ikke smide ting n\u00e5r du er ved at stj\u00e6le et flag. Hvad laver du?! L\u00f8b!
|
||||
drop.item.border = Du kan ikke smide ting n\u00e6r zone gr\u00e6nsen.
|
||||
drop.item.disabled = Du kan ikke smide ting i denne krigszone.
|
||||
drop.item.spawn = Du kan ikke smide ting mens du stadig er i spawn.
|
||||
drop.team = Du kan ikke smide {0} blokke.
|
||||
drop.wand = Du kan tabte zone {0} stav.
|
||||
join.aarequired = Denne krigszone kr\u00e6ver at du automatisk bliver tildelt et hold.\nV\u00e6r venlig og g\u00e5 ind i autotildelings indgangen istedet.
|
||||
join.broadcast = {0} sluttede sig til hold {1}.
|
||||
join.disabled = Denne krigszone er deaktiveret.
|
||||
join.full.all = Alle hold er fulde.
|
||||
join.full.single = Hold {0} er fuld.
|
||||
join.inventorystored = Din beholdning er i et lager indtil du forlader spillet med /war leave.
|
||||
join.permission.all = Du har ikke tilladelse til nogen af de tilg\u00e6ngelige hold i denne krigszone.
|
||||
join.permission.single = Du har ikke tilladelse til at tilslutte dig til team {0}.
|
||||
join.progress = Du kan ikke tilslutte dig en kamp der er i gang i denne zone.
|
||||
join.selfteam = Du kan ikke tilslutte dig dit eget hold.
|
||||
join.team404 = Det hold blev ikke fundet. Pr\u00f8v at bruge /teams for en liste.
|
||||
leave.broadcast = {0} forladte zonen.
|
||||
leave.inventoryrestore = Din beholdning er i gang med at blive genoprettet.
|
||||
pvp.death.drown = {0} druknede.
|
||||
pvp.death.explosion = {0} eksploderede.
|
||||
pvp.death.fall = {0} faldt til en alt for tidlige d\u00f8d.
|
||||
pvp.death.fire = {0} br\u00e6ndte til aske.
|
||||
pvp.death.other = {0} d\u00f8de.
|
||||
pvp.ff.disabled = Dit angreb missede! Dit m\u00e5l er p\u00e5 dit eget hold.
|
||||
pvp.ff.enabled = Egenbeskydning er aktiveret! V\u00e6r venlig ikke at dr\u00e6be dine holdkammerater.
|
||||
pvp.kill.adjectives = ;;m\u00e6gtige;d\u00f8dbringende;kvalitets;pr\u00e6cise;brutale;kraftfulde
|
||||
pvp.kill.bomb = {0} fik {1} til at springe i luften!
|
||||
pvp.kill.format = {0}s {1} {2} {3} {4}
|
||||
pvp.kill.self = {0} begik selvmord
|
||||
pvp.kill.verbs = dr\u00e6bte;aflivede;dr\u00e6bte;f\u00e6rdigjorde;tilintetgjorde,myrdede;udslettede;udryddede
|
||||
pvp.kill.weapon.aim = sigt
|
||||
pvp.kill.weapon.bow = bue
|
||||
pvp.kill.weapon.hand = h\u00e5nd
|
||||
pvp.outside.permission = Du kan ikke angribe spillere udenfor kriszoner.
|
||||
pvp.self.notplaying = Du bliver n\u00f8d til at spille inde i krigszonen for at kunne angribe.
|
||||
pvp.self.respawn = Du kan ikke angribe spillere mens du genopst\u00e5r!
|
||||
pvp.self.spawn = Du kan ikke angribe mens du stadig er i spawn!
|
||||
pvp.target.notplaying = Dit m\u00e5l spiller ikke i krigszonen.
|
||||
pvp.target.otherzone = Dit m\u00e5l spiller i en anden krigszone.
|
||||
pvp.target.respawn = Dit m\u00e5l er i gang med at genopst\u00e5!
|
||||
pvp.target.spawn = Dit m\u00e5l er stadig i spawn!
|
||||
sign.lobby.autoassign = Krigszone\n{0}\nG\u00e5 ind i til-\ndelingsporten.
|
||||
sign.lobby.pick = Krigszone\n{0}\n\nV\u00e6lg dit hold.
|
||||
sign.lobby.warhub = \nTil War samlingspunkt\n
|
||||
sign.team.limited = Hold {0}\n{1}/{2} spillere\n{3}/{4} pts\n{5} liv tilbage
|
||||
sign.team.unlimited = Hold {0}\n{1}/{2} spillere\n{3}/{4} pts\nuendelig liv
|
||||
sign.warhub = War samlingspunkt\n(/warhub)\nV\u00e6lg din\nkamp!
|
||||
sign.warzone = Krigszone\n{0}\n{1}/{2} spillere\n{3} hold
|
||||
team.chat.enable = Hold chat sl\u00e5et til. Dine normale chat beskeder vil kun blive modtaget af folk fra dit hold.
|
||||
team.chat.disable = Hold chat sl\u00e5et fra.
|
||||
use.anvil = Du kan ikke bruge ambolte i denne krigszone!
|
||||
use.enchant = Du kan ikke bruge fortrylleses borde i denne krigszone!
|
||||
use.ender = Du kan ikke bruge ender kister n\u00e5r du spiller i en krigszone!
|
||||
use.item.spawn = Du kan ikke bruge ting mens du stadig er i spawn.
|
||||
use.xpkillmeter = Dette skyldes, at xpkillmetereret punktet er aktiveret.
|
||||
wand.toofar = Din valgte blok er for langt v\u00e6k.
|
||||
war.notadmin = Du kan g\u00f8re dette hvis du ikke er en War admin (permission war.admin).
|
||||
war.notzm = Du kan ikke g\u00f8re dette hvis du ikke er en krigszone bygger (permission war.zonemaker).
|
||||
war.prefix = War>
|
||||
war.title = War
|
||||
warhub.none = Intet war samlingssted p\u00e5 denne War server. Pr\u00f8v /zones og /zone.
|
||||
warhub.permission = Du har ikke tilladelse til at teleportere til War samlingstedet.
|
||||
warhub.teleport = Velkommen til War samlingsstedet. V\u00e6lg din kamp!
|
||||
zone.airstrike = {0} kaldte ind et luftangreb!
|
||||
zone.battle.end = Kampen er ovre. Hold {0} tabte: {1} d\u00f8de og der var ikke flere live tilbage i deres livs p\u00f8l.
|
||||
zone.battle.newscores = Nye scorer - {0}
|
||||
zone.battle.next = Kampen blev afbrudt. Nulstiller krigszone {0}...
|
||||
zone.battle.reset = En ny kamp vil begynde snart. Nulstiller krigszone...
|
||||
zone.battle.resetprogress = Nulstillings fremskridt: {0}%, {1} sekunder...
|
||||
zone.battle.resetcomplete = Krigszone nulstillet p\u00e5 {0} sekunder. En ny kamp begynder.
|
||||
zone.bomb.broadcast = {0} spr\u00e6ngte hold {1}s spawn i luften. Hold {2} scorer \u00e9t point.
|
||||
zone.cake.broadcast = {0} erobrede kage {1}. Hold {2} scorer \u00e9t point og f\u00e5r en fuld livs p\u00f8l.
|
||||
zone.flagcapture.broadcast = {0} erobrede hold {1}s flag. Hold {2} scorer \u00e9t point.
|
||||
zone.flagreturn.deadlock = Du kan ikke erobre fjendens flag f\u00f8r dit eget flag er returneret.
|
||||
zone.flagreturn.flag = Du bliver n\u00f8d til at erobre fjendes flag p\u00e5 dit holds flag.
|
||||
zone.flagreturn.spawn = Du bliver n\u00f8d til at erobre fjendes flag p\u00e5 dit holds spawn.
|
||||
zone.leavenotice = Brug /war leave til at forlade zonen.
|
||||
zone.lifepool.empty = Hold {0}s livs p\u00f8l et tom. \u00c9t til d\u00f8dsfald og de taber kampen!
|
||||
zone.loadout.equip = Rustet med {0} udstyret (snig for at skifte).
|
||||
zone.loadout.reenter = Kan ikke \u00e6ndre udstyr efter at have forladt spawn.
|
||||
zone.monument.badblock = Du bliver n\u00f8d til at erobre et monument med en blok af dit holds uld farve. F\u00e5 en fra dit holds spawn.
|
||||
zone.monument.capture = Monument {0} blev erobret af hold {1}.
|
||||
zone.monument.lose = Hold {0} tabte kontrollen af monument {1}.
|
||||
zone.monument.voodoo = Din dans tilfredsstiller monuments voodoo. Du f\u00e5r {0} hjerte(r)!
|
||||
zone.noteamnotice = Du kan ikke v\u00e6re inde i en krigszone uden et hold.
|
||||
zone.score.board404 = Denne krigszone har ikke en resultattavle.
|
||||
zone.score.empty = Du kan ikke score indtil mindst \u00e9n spiller tilslutter sig et andet hold.
|
||||
zone.spawn.minplayers = Du kan ikke forlade spawn indtil der er et minimum af {0} spiller(e) p\u00e5 mindst {1} hold.
|
||||
zone.spawn.timer = Du kan ikke forlade spawn for {0} sekund(er) efter genopstandelse!
|
||||
zone.steal.bomb.broadcast = {0} har bombe {1}.
|
||||
zone.steal.bomb.notice = Du har bombe {0}. N\u00e5 et andet holds spawn for at score. Lad v\u00e6re med at r\u00f8re andre ellers eksplodere du!
|
||||
zone.steal.bomb.prevent = Forhindre {0} i at n\u00e5 dit spawn med bomben!
|
||||
zone.steal.cake.broadcast = {0} har kage {1}.
|
||||
zone.steal.cake.notice = You har kage {0}. N\u00e5 dit holds spawn for at score og genopfylde din livs p\u00f8l.
|
||||
zone.steal.cake.prevent = Forhindre {0} i at n\u00e5 sit spawn med kagen!
|
||||
zone.steal.flag.broadcast = {0} stjal hold {1}s flag.
|
||||
zone.steal.flag.empty = Du kan ikke stj\u00e6le hold {0}s flag siden ingen spillere er p\u00e5 det hold.
|
||||
zone.steal.flag.notice = Du har hold {0}s flag. N\u00e5 dit holds spawn eller flag for at erobre det!
|
||||
zone.steal.flag.prevent = Forhindre {0} i at n\u00e5 hold{1}s spawn eller flag.
|
||||
zone.stealextra.bomb = Du kan kun stj\u00e6le \u00e9n bombe af gangen!
|
||||
zone.stealextra.cake = Du kan kun stj\u00e6le \u00e9n kage af gangen!
|
||||
zone.stealextra.flag = Du kan kun stj\u00e6le \u00e9t flag af gangen!
|
||||
zone.stealextra.other = Du kan kun stj\u00e6le \u00e9n ting af gangen!
|
||||
zone.teaminfo.format = {0}: {1} point, {2}/{3} liv tilbage. {4}
|
||||
zone.teaminfo.none = intet
|
||||
zone.teaminfo.prefix = Hold:
|
||||
zone.teleport = Velkommen til krigszone {0}.
|
||||
zone.warp.permission = Du har ikke tilladelse til at teleportere til krigszonen.
|
||||
zone.zone404 = Krigszonen blev ikke fundet.
|
||||
zone.zoneinfo.format = {0}: {1} hold, {2} spillere
|
||||
zone.zoneinfo.prefix = Krigszoner:
|
||||
zone.zoneinfo.teleport = Brug /zone <zone-navn> for at teleportere til en krigszone.
|
|
@ -1,14 +1,18 @@
|
|||
# Generated by ResourceBundle Editor (http://eclipse-rbe.sourceforge.net)
|
||||
build.denied.location = Du kannst hier nicht bauen.
|
||||
build.denied.outside = Du kannst nur inerhalb einer Warzone bauen.
|
||||
build.denied.teamblock = Du kannst nur dein Team-Block nehmen, um ein Monument einzunehmen.
|
||||
build.denied.outside = Du kannst nur innerhalb einer Warzone Arena bauen.
|
||||
build.denied.teamblock = Du kannst nur dein Team-Block nehmen, um ein Monument zu \u00fcbernehmen.
|
||||
build.denied.zone.break = Die Bl\u00f6cke in dieser Warzone sind unzerst\u00f6rbar.
|
||||
build.denied.zone.multteam = Du hast schon einen {0} Block.
|
||||
build.denied.zone.outside = Du kannst nichts in einer Warzone zerst\u00f6ren,wenn du dich nicht in ihr befindest.
|
||||
build.denied.zone.outside = Du kannst nichts in einer Warzone zerst\u00f6ren, wenn du dich nicht in ihr befindest.
|
||||
build.denied.zone.place = Du kannst in dieser Warzone keine Bl\u00f6cke setzen.
|
||||
build.denied.zone.type = Du kannst keine Bl\u00f6cke dieses Typs zerst\u00f6ren.
|
||||
command.console = Dieser Command ist leider nicht von der Konsole aus nutzbar
|
||||
command.disabled = Du kannst nur War Kommandos (Z.Bsp. /leave) ausf\u00fchren, w\u00e4hrend du spielst!
|
||||
command.disabled = Du kannst nur War Kommandos (bsp /leave) ausf\u00fchren, w\u00e4hrend du spielst!
|
||||
command.tp.init = Bitte warte {0} Sekunden. Schaden oder Bewegung bricht die Teleportierung ab.
|
||||
command.tp.moved = Teleportation wegen Bewegung abgebrochen.
|
||||
command.tp.damaged = Bewegung wegen Schaden abgebrochen
|
||||
command.tp.success = Du wirst teleportiert. Vielen Dank f\u00fcr deine Geduld.
|
||||
drop.bomb.broadcast = {0} hat die {1} Bombe fallen gelassen.
|
||||
drop.bomb.disabled = Du kannst keine Items droppen w\u00e4hrend du die Bombe stielst.\nWas machst du?! Renne zu dem Spawn von deinen Feinden!
|
||||
drop.cake.broadcast = {0} hat den {1} Kuchen fallen gelassen.
|
||||
|
|
|
@ -1,14 +1,18 @@
|
|||
# Generated by ResourceBundle Editor (http://eclipse-rbe.sourceforge.net)
|
||||
build.denied.location = No puedes construir aqui!
|
||||
build.denied.outside = Solo puedes contruir en la arena.
|
||||
build.denied.location = No puedes construir aqui.
|
||||
build.denied.outside = Solo puedes construir dentro de las arenas.
|
||||
build.denied.teamblock = Solo puedes usar los bloques de tu equipo para capturar los monumentos!
|
||||
build.denied.zone.break = Estos bloques tienen las propiedades de la Bedrock!
|
||||
build.denied.zone.multteam = Tienes {0} bloques
|
||||
build.denied.zone.break = No puedes romper bloques en esta arena.
|
||||
build.denied.zone.multteam = Ya tienes {0} bloques
|
||||
build.denied.zone.outside = No puedes destruir arenas en las que no estas jugando.
|
||||
build.denied.zone.place = No puedes modificar estos bloques!
|
||||
build.denied.zone.place = No puedes poner bloques dentro de esta arena.
|
||||
build.denied.zone.type = No puedes modificar estos bloques!
|
||||
command.console = No puedes usar este comando si no estas en partida.
|
||||
command.disabled = Solo puedes usar comandos de guerra si estas jugando (Ej: /leave).
|
||||
command.tp.init = Por favor espera {0} segundos antes de la teletransportaci\u00f3n. Cualquier movimiento o da\u00f1o cancelar\u00e1 la cuenta atr\u00e1s
|
||||
command.tp.moved = Teletransportaci\u00f3n cancelada debido a que te has movido.
|
||||
command.tp.damaged = Teletransportaci\u00f3n cancelada debido a que has sido atacado.
|
||||
command.tp.success = Te has teletransportado. Gracias por tu paciencia.
|
||||
drop.bomb.broadcast = {0} ha soltado la {1} bomba!
|
||||
drop.bomb.disabled = No puedes tirar objetos mientras tienes la bomba!
|
||||
drop.cake.broadcast = {0} ha soltado la {1} tarta!
|
||||
|
@ -73,12 +77,12 @@ use.xpkillmeter = La opcion xpkillmeter esta habilitado.
|
|||
wand.toofar = Tu bloque objetivo esta muy lejos.
|
||||
war.notadmin = No puedes hacer esto si no eres un War Admin (permiso: war.admin).
|
||||
war.notzm = No puedes hacer esto si no eres un editor de la zona de batalla (permiso: war.zonemaker).
|
||||
war.prefix = PvP>
|
||||
war.title = PvP
|
||||
warhub.none = No hay war central en este servidor War. Fijate las zonas con /zones o /zone.
|
||||
warhub.permission = No tienes permisos para teletransportarte para el War central.
|
||||
warhub.teleport = Bienvenido a la War central. Elige tu batalla!
|
||||
zone.airstrike = {0} fue llamada en un ataque aereo!
|
||||
war.prefix = Guerra>
|
||||
war.title = Guerra
|
||||
warhub.none = No hay un War Hub en este servidor War. Fijate las zonas con /zones o /zone.
|
||||
warhub.permission = No tienes permisos para teletransportarte hacia el War Hub..
|
||||
warhub.teleport = Bienvenido al War Hub. Elige tu batalla!
|
||||
zone.airstrike = {0} ha llamado un ataque aereo!
|
||||
zone.battle.end = La batalla se ha acabado. El equipo {0} perdio: {1} murio y no quedan mas vidas restantes en su equipo.
|
||||
zone.battle.newscores = Nuevas puntuaciones - {0}
|
||||
zone.battle.next = La batalla ha sido interrumpida. Reiniciando zona de batalla {0}.
|
||||
|
|
|
@ -0,0 +1,133 @@
|
|||
# Generated by ResourceBundle Editor (http://eclipse-rbe.sourceforge.net)
|
||||
build.denied.location = Sa ei saa ehitada siin.
|
||||
build.denied.outside = Sa saad ehitada ainult s\u00f5jatsooni sees.
|
||||
build.denied.teamblock = Sa saad kasutada ainult oma tiimi plokke, et p\u00fc\u00fcda monumente.
|
||||
build.denied.zone.break = Plokid selles s\u00f5jatsoonis on purunematud!
|
||||
build.denied.zone.multteam = Sul juba on {0} plokk.
|
||||
build.denied.zone.outside = Sa ei saa l\u00f5hkuda s\u00f5jatsoonis kuna sa ei m\u00e4ngi selles.
|
||||
build.denied.zone.place = Sa ei saa asetada plokke selles s\u00f5jatsoonis.
|
||||
build.denied.zone.type = Sa ei saa muuta seda t\u00fc\u00fcpi plokki.
|
||||
command.console = Sa ei saa teha seda kui sa pole m\u00e4ngus.
|
||||
command.disabled = Sa saad kasutada ainult War k\u00e4sklusi (Nt /leave) kui sa m\u00e4ngid.
|
||||
command.tp.init = Palun oota {0} sekundit ennem teleporteerumist. Liikumine v\u00f5i kahjustuse saamine peatab taimeri.
|
||||
command.tp.moved = Teleporteertumine peatati liikumise t\u00f5ttu.
|
||||
command.tp.damaged = Teleporteerumine peatati kahjustuse saamise t\u00f5ttu.
|
||||
command.tp.success = Sa oled teleporteeritud. T\u00e4nan sinu kannatlikkuse eest.
|
||||
drop.bomb.broadcast = {0} kukutas {1} pommi!
|
||||
drop.bomb.disabled = Sa ei saa kukutada esemeid kui sa varastasid pommi. Mida sa teed?! Jookse oma vastase baasi!
|
||||
drop.cake.broadcast = {0} kukutas {1} koogi!
|
||||
drop.cake.disabled = Sa ei saa kukutada esemeid kui varastasid koogi. Mida sa teed?! Jookse!
|
||||
drop.flag.broadcast = {0} kukutas {1} lipu!
|
||||
drop.flag.disabled = Sa ei saa kukutada esemeid kui varastasid lipu. Mida sa teed?! Jookse!
|
||||
drop.item.border = Sa ei saa kukutada esemeid tsooni piiri l\u00e4hedal.
|
||||
drop.item.disabled = Sa ei saa kukutada esemeid selles s\u00f5jatsoonis.
|
||||
drop.item.spawn = Sa ei saa kukutada esemeid kui sa oled veel alguspunktis.
|
||||
drop.team = Sa ei saa kukutada {0} plokki.
|
||||
drop.wand = Sa kukutasid tsooni {0} v\u00f5lukepi.
|
||||
join.aarequired = See s\u00f5jatsoon n\u00f5uab, et sind saadetaks automaatselt meeskonda.\nPalun sisene automaatse suunaja v\u00e4ravasse.
|
||||
join.broadcast = {0} liitus tiimiga {1}.
|
||||
join.disabled = See s\u00f5jatsoon on keelatud.
|
||||
join.full.all = K\u00f5ik tiimid on t\u00e4is.
|
||||
join.full.single = Tiim {0} on t\u00e4is.
|
||||
join.inventorystored = Sinu seljakott s\u00e4ilitati kuni sa lahkud /war leave.
|
||||
join.permission.all = Sul ei ole \u00f5iguseid \u00fchelegi saadaval olevale tiimile selles s\u00f5jatsoonis.
|
||||
join.permission.single = Sul ei ole \u00f5igusi, et liituda {0} tiimiga.
|
||||
join.progress = Sa ei saa liituda kui s\u00f5da on pooleli.
|
||||
join.selfteam = Sa ei saa liituda oma enda tiimiga.
|
||||
join.team404 = Seda tiimi ei leitud. Proovi kasutada /teams ,et saada kogu nimekiri.
|
||||
leave.broadcast = {0} lahkus tsoonist.
|
||||
leave.inventoryrestore = Sinu seljakott taastati.
|
||||
pvp.death.drown = {0} uppus
|
||||
pvp.death.explosion = {0} plahvatas
|
||||
pvp.death.fall = {0} kukkus surnuks
|
||||
pvp.death.fire = {0} p\u00f5les \u00e4ra
|
||||
pvp.death.other = {0} suri
|
||||
pvp.ff.disabled = Sinu r\u00fcnnak kadus! Sihtm\u00e4rk on sinu tiimis.
|
||||
pvp.ff.enabled = S\u00f5bra tapmine on lubatud! Palun, \u00e4ra tapa oma tiimi liikmeid.
|
||||
pvp.kill.adjectives = ;;v\u00e4gev;surmav;korras;t\u00e4pne;j\u00f5hker;v\u00f5imas
|
||||
pvp.kill.bomb = {0} tegi {1} plahvatuse.
|
||||
pvp.kill.format = {0} {1} {2} {3} {4}
|
||||
pvp.kill.self = {0} tegi enesetapu
|
||||
pvp.kill.verbs = tapetud;tapetud;tapetud;l\u00f5petatud;h\u00e4vitatud;m\u00f5rvatud;h\u00e4vitatud;h\u00e4vitatud
|
||||
pvp.kill.weapon.aim = siht
|
||||
pvp.kill.weapon.bow = vibu
|
||||
pvp.kill.weapon.hand = k\u00e4si
|
||||
pvp.outside.permission = Sa ei saa r\u00fcnnata m\u00e4ngijaid v\u00e4ljaspool s\u00f5jatsooni.
|
||||
pvp.self.notplaying = Sa pead m\u00e4ngima s\u00f5jatsoonisl, et r\u00fcnnata.
|
||||
pvp.self.respawn = Sa ei saa r\u00fcnnata taass\u00fcndides!
|
||||
pvp.self.spawn = Sa ei saa r\u00fcnnata kui oled endiselt alguspunktis!
|
||||
pvp.target.notplaying = Sinu vastane ei m\u00e4ngi s\u00f5jatsoonis.
|
||||
pvp.target.otherzone = Sinu vastane m\u00e4ngib teises s\u00f5jatsoonis.
|
||||
pvp.target.respawn = Sinu vastane taass\u00fcnnib hetkel!
|
||||
pvp.target.spawn = Sinu vastane on endiselt alguspunktis!
|
||||
sign.lobby.autoassign = S\u00f5jatsoon\n{0}\nSisene autom.\nv\u00e4ravasse
|
||||
sign.lobby.pick = S\u00f5jatsoon\n{0}\n\nVali tiim
|
||||
sign.lobby.warhub = \nWar alguspunkt\n
|
||||
sign.team.limited = Tiim {0}\n{1}/{2} m\u00e4ngijat\n{3}/{4} punkti\n{5} elu j\u00e4rel
|
||||
sign.team.unlimited = Tiim {0}\n{1}/{2} m\u00e4ngijat\n{3}/{4} punkti\nL\u00f5pmatult elusi
|
||||
sign.warhub = War alguspunkt\n(warhub)\nVali enda\ns\u00f5da!
|
||||
sign.warzone = S\u00f5jatsoon\n{0}\n{1}/{2} m\u00e4ngijat\n{3} tiimi
|
||||
team.chat.enable = Tiimi jutukas l\u00fclitati sisse. Sinu regulaarsed jutuka s\u00f5numeid n\u00e4eb ainult sinu tiim.
|
||||
team.chat.disable = Tiimi jutukas l\u00fclitati v\u00e4lja.
|
||||
use.anvil = Sa ei saa kasutada alaseid sellel s\u00f5jatsoonil!
|
||||
use.enchant = Sa ei saa kasutada loitsumislauda sellel s\u00f5jatsoonil!
|
||||
use.ender = Sa ei saa kasutada m\u00e4ngimise ajal l\u00f5pukirstu s\u00f5jatsoonis!
|
||||
use.item.spawn = Sa ei saa kasutada esemeid kui oled alguspunktis.
|
||||
use.xpkillmeter = See on seet\u00f5ttu, et kogemustasemete surmaindikaatori valik on lubatud.
|
||||
wand.toofar = Sinu vastase plokk on liiga kaugel.
|
||||
war.notadmin = Sa ei saa teha seda kui sa ei ole War administraator (\u00f5igus war.admin).
|
||||
war.notzm = Sa ei saa teha seda kui sa ei ole s\u00f5jatsooni tegija (\u00f5igus war.zonemaker)
|
||||
war.prefix = War>
|
||||
war.title = War
|
||||
warhub.none = Puuduvad War alguspunktid serveris. Proovi /zones ja /zone.
|
||||
warhub.permission = Sul puuduvad \u00f5igused teleporteerumiseks War alguspuntki.
|
||||
warhub.teleport = Tere tulemast War alguspunkti. Vali enda tiim!
|
||||
zone.airstrike = {0} kutsus \u00f5hur\u00fcnnaku!
|
||||
zone.battle.end = S\u00f5da on l\u00e4bi. Tiim {0} kaotas: {1} suri ja tema tiimil polnud enam elusi.
|
||||
zone.battle.newscores = Uued skoorid - {0}
|
||||
zone.battle.next = S\u00f5da on katkestatud. Taastatakse s\u00f5jatsoon {0}...
|
||||
zone.battle.reset = Uus s\u00f5da algab varsti. Taastatakse s\u00f5jatsooni...
|
||||
zone.battle.resetprogress = Taastamine k\u00e4ib: {0}%, {1} sekundit...
|
||||
zone.battle.resetcomplete = Warzone l\u00e4hestatakse {0} sekundi p\u00e4rast. Uus v\u00f5itlus algab.
|
||||
zone.bomb.broadcast = {0} lasi \u00f5hku tiimi {1} alguspunkti. Tiim {2} sai juurde \u00fche punkti.
|
||||
zone.cake.broadcast = {0} varastas koogi {1}. Tiim {2} sai endale juurde \u00fche punkti ning nende k\u00f5ik elud taastati.
|
||||
zone.flagcapture.broadcast = {0} varastas tiimi {1} lipu. Tiim {2} sai juurde \u00fche punkti.
|
||||
zone.flagreturn.deadlock = Sa ei saa varastada vastase lippu ennem kui sinu tiimi lipp on tagastatud.
|
||||
zone.flagreturn.flag = Sa pead tooma vastaste lipu oma lipu juurde.
|
||||
zone.flagreturn.spawn = Sa pead tooma vastaste lipu oma alguskoha juurde.
|
||||
zone.leavenotice = Kasuta /war leave ,et lahkuda tsoonist.
|
||||
zone.lifepool.empty = Tiimi {0} elud on t\u00fchjad. 1 lisa surm ja nad kaotavad s\u00f5ja!
|
||||
zone.loadout.equip = K\u00e4tte v\u00f5etud {0} v\u00e4ljalaadimine (hiili, et vahetada).
|
||||
zone.loadout.reenter = V\u00e4ljalaadimist ei saa vahetada p\u00e4rast alguskohast v\u00e4ljumist.
|
||||
zone.monument.badblock = Sa pead hankima kuju oma meeskonna v\u00e4rvi villaga
|
||||
zone.monument.capture = Monument {0} varastati tiimi {1} poolt.
|
||||
zone.monument.lose = Tiim {0} kaotas kontrolli monumendis {1}.
|
||||
zone.monument.voodoo = Sinu tants rahuldab kuju voodoo'd. Sa said {0} s\u00fcdant!
|
||||
zone.noteamnotice = Sa ei saa olla s\u00f5jatsooni sees kui sa ei ole \u00fcheski tiimis.
|
||||
zone.score.board404 = Selles s\u00f5jatsoonis ei ole lubatud skooritabel.
|
||||
zone.score.empty = Sa ei saa punkte kuni teise tiimi liitub m\u00f5ni m\u00e4ngija.
|
||||
zone.spawn.minplayers = Sa ei saa lahkuda spawnist kuni on saavutatud miinumum arv {0} m\u00e4ngija(id) {1} tiimis(des)
|
||||
zone.spawn.timer = Sa ei saa lahkuda spawnist {0} sekundit peale taass\u00fcndimist.
|
||||
zone.steal.bomb.broadcast = {0} omab pommi {1}.
|
||||
zone.steal.bomb.notice = Sul on pomm {0}. Proovi minna vastase tiimi alguspunkti. \u00c4ra puutu kedagi v\u00f5i sa plahvatad!
|
||||
zone.steal.bomb.prevent = V\u00e4ldi {0} sattumist pommiga sinu tiimi alguspunkti.
|
||||
zone.steal.cake.broadcast = {0} omab kooki {1}.
|
||||
zone.steal.cake.notice = Sul on kook {0}. Mine oma tiimi alguspunkti, et saada \u00fcks punkt ja taastada oma elud.
|
||||
zone.steal.cake.prevent = Vaata, et {0} ei j\u00f5uaks enda alguspunkti koogiga!
|
||||
zone.steal.flag.broadcast = {0} varastas tiimi {1} lipu.
|
||||
zone.steal.flag.empty = Sa ei saa varastada tiimi {0} lippu kuni pole \u00fchtegi m\u00e4ngijat selles tiimis.
|
||||
zone.steal.flag.notice = Sul on tiimi {0} lipp. Mine oma tiimi alguspunkti v\u00f5i lipu varastamis punkti.
|
||||
zone.steal.flag.prevent = Vaata, et {0} ei j\u00f5uaks meeskonna {1} alguspunkti v\u00f5i lipuni.
|
||||
zone.stealextra.bomb = Sa saad varastada ainult \u00fche pommi korraga!
|
||||
zone.stealextra.cake = Sa saad varastada ainult \u00fche koogi korraga!
|
||||
zone.stealextra.flag = Sa saad varastada ainult \u00fche lipu korraga!
|
||||
zone.stealextra.other = Sa saad varastada ainult \u00fche asja korraga!
|
||||
zone.teaminfo.format = {0}: {1} punktid, {2}/{3} elu j\u00e4rgi. {4}
|
||||
zone.teaminfo.none = puudub
|
||||
zone.teaminfo.prefix = Tiimid:
|
||||
zone.teleport = Tere tulemast s\u00f5jatsooni {0}.
|
||||
zone.warp.permission = Sul ei ole \u00f5igusi, et teleporteeruda s\u00f5jatsooni.
|
||||
zone.zone404 = S\u00f5jatsooni ei leitud.
|
||||
zone.zoneinfo.format = {0}: {1} tiimid, {2} m\u00e4ngijad
|
||||
zone.zoneinfo.prefix = S\u00f5jatsoonid:
|
||||
zone.zoneinfo.teleport = Kasuta /zone <tsooni-nimi> ,et teleporteeruda s\u00f5jatsooni.
|
|
@ -0,0 +1,133 @@
|
|||
# Generated by ResourceBundle Editor (http://eclipse-rbe.sourceforge.net)
|
||||
build.denied.location = Et voi rakentaa t\u00e4h\u00e4n.
|
||||
build.denied.outside = Voit rakentaa vain Sotatantereen sis\u00e4ll\u00e4.
|
||||
build.denied.teamblock = Voit k\u00e4ytt\u00e4\u00e4 vain joukkueesi kuutioita monumentin valloittamiseen.
|
||||
build.denied.zone.break = T\u00e4m\u00e4n Sotatantereen kuutiot ovat tuhoutumattomia.
|
||||
build.denied.zone.multteam = Sinulla on jo {0} kuutio.
|
||||
build.denied.zone.outside = Et voi tuhota Sotatannerta, jos et pelaa siin\u00e4.
|
||||
build.denied.zone.place = Et voi asettaa kuutioita t\u00e4ss\u00e4 Sotatantereessa.
|
||||
build.denied.zone.type = Et voi muokata t\u00e4m\u00e4ntyyppisi\u00e4 kuutioita.
|
||||
command.console = Et voi suorittaa t\u00e4t\u00e4 toimintoa ellet ole mukana peliss\u00e4.
|
||||
command.disabled = Voit k\u00e4ytt\u00e4\u00e4 vain War-lis\u00e4osan komentoja (esim. /leave) pelatessasi.
|
||||
command.tp.init = Odota {0} sekuntia ennen siirtoa. Liikkuminen tai vaurioituminen peruvat siirron.
|
||||
command.tp.moved = Teleportaatio peruttu liikkumisen takia.
|
||||
command.tp.damaged = Teleportaatio peruttu vaurioitumisen takia.
|
||||
command.tp.success = Sinut on siirretty. Kiitos k\u00e4rsiv\u00e4llisyydest\u00e4si.
|
||||
drop.bomb.broadcast = {0} menetti {1} pommin!
|
||||
drop.bomb.disabled = Et voi pudottaa tavaroita varastaessasi pommia. Mit\u00e4 ihmett\u00e4 olet tekem\u00e4ss\u00e4?! Juokse vihollisjoukkueen tukikohtaan!
|
||||
drop.cake.broadcast = {0} pudotti {1} kakun!
|
||||
drop.cake.disabled = Et voi pudottaa tavaroita varastaessasi kakkua. Mit\u00e4 ihmett\u00e4 olet tekem\u00e4ss\u00e4?! Juokse!
|
||||
drop.flag.broadcast = {0} pudotti {1} lipun!
|
||||
drop.flag.disabled = Et voi pudottaa tavaroita ry\u00f6st\u00e4ess\u00e4si lippua. Mit\u00e4 ihmett\u00e4 olet tekem\u00e4ss\u00e4?! Juokse!
|
||||
drop.item.border = Et voi pudottaa tavaroita Sotatantereen rajojen l\u00e4heisyydess\u00e4.
|
||||
drop.item.disabled = Et voi pudottaa tavaroita t\u00e4ss\u00e4 Sotatantereessa.
|
||||
drop.item.spawn = Et voi pudottaa tavaroita ollessasi tukikohdassa.
|
||||
drop.team = Et voi pudottaa {0} kuutioita.
|
||||
drop.wand = Pudotit {0} sauvan.
|
||||
join.aarequired = T\u00e4m\u00e4 Sotatanner k\u00e4ytt\u00e4\u00e4 automaattijakajaa. Astu automaattijakajan l\u00e4pi.
|
||||
join.broadcast = {0} liittyi {1} joukkueeseen.
|
||||
join.disabled = T\u00e4m\u00e4 Sotatanner ei ole k\u00e4yt\u00f6ss\u00e4.
|
||||
join.full.all = Kaikki joukkueet ovat t\u00e4ynn\u00e4.
|
||||
join.full.single = {0} joukkue on t\u00e4ynn\u00e4.
|
||||
join.inventorystored = Tavaraluettelosi on varastossa siihen asti kun poistut k\u00e4ytt\u00e4m\u00e4ll\u00e4 /war leave.
|
||||
join.permission.all = Sinulla ei ole valtuuksia mihink\u00e4\u00e4n joukkueeseen t\u00e4ss\u00e4 Sotatantereessa.
|
||||
join.permission.single = Sinulla ei ole valtuuksia liitty\u00e4 joukkueeseen {0}.
|
||||
join.progress = Et voi liitty\u00e4 t\u00e4ll\u00e4 Sotatantereella meneill\u00e4\u00e4n olevaan taisteluun.
|
||||
join.selfteam = Et voi liitty\u00e4 omaan joukkueeseesi.
|
||||
join.team404 = Tuota joukkuetta ei l\u00f6ydetty. Yrit\u00e4 k\u00e4ytt\u00e4\u00e4 /teams komentoa n\u00e4hd\u00e4ksesi listan.
|
||||
leave.broadcast = {0} poistui Sotatantereelta.
|
||||
leave.inventoryrestore = Tavaraluetteloasi palautetaan.
|
||||
pvp.death.drown = {0} hukkui.
|
||||
pvp.death.explosion = {0} r\u00e4j\u00e4hti.
|
||||
pvp.death.fall = {0} putosi ennenaikaiseen kuolemaan.
|
||||
pvp.death.fire = {0} paloi poroksi.
|
||||
pvp.death.other = {0} kuoli.
|
||||
pvp.ff.disabled = Hy\u00f6kk\u00e4yksesi ep\u00e4onnistui! Kohteesi on joukkueessasi.
|
||||
pvp.ff.enabled = Oma tuli on sallittu. \u00c4l\u00e4 satuta joukkuetovereitasi.
|
||||
pvp.kill.adjectives = ;;mahtava;kuolettava;upea;tarkka;brutaali;voimakas
|
||||
pvp.kill.bomb = {1} r\u00e4j\u00e4ytettiin {0} toimesta.
|
||||
pvp.kill.format = {0}''s {1} {2} {3} {4}
|
||||
pvp.kill.self = {0} teki itsemurhan.
|
||||
pvp.kill.verbs = tappoi;tappoi;tappoi;viimeisteli;tuhosi;murhasi;h\u00e4vitti;tuhosi
|
||||
pvp.kill.weapon.aim = nuoli
|
||||
pvp.kill.weapon.bow = jousi
|
||||
pvp.kill.weapon.hand = k\u00e4si
|
||||
pvp.outside.permission = Et voi hy\u00f6k\u00e4t\u00e4 Sotatantereen ulkopuolisia pelaajia vastaan.
|
||||
pvp.self.notplaying = Sinun t\u00e4ytyy olla mukana pelaamassa Sotatantereella hy\u00f6k\u00e4t\u00e4ksesi.
|
||||
pvp.self.respawn = Et voi hy\u00f6k\u00e4t\u00e4 sill\u00e4 aikaa kun olet uudelleensyntym\u00e4ss\u00e4!
|
||||
pvp.self.spawn = Et voi hy\u00f6k\u00e4t\u00e4 ollessasi viel\u00e4 tukikohdassa!
|
||||
pvp.target.notplaying = Kohteesi ei pelaa Sotatantereella.
|
||||
pvp.target.otherzone = Kohteesi pelaa toisella Sotatantereella.
|
||||
pvp.target.respawn = Kohde on juuri uudelleensyntym\u00e4ss\u00e4!
|
||||
pvp.target.spawn = Kohde on viel\u00e4 tukikohdassa!
|
||||
sign.lobby.autoassign = Sotatanner\n{0}\nAstu automaatti-\njakajaan.
|
||||
sign.lobby.pick = Sotanner\n{0}\n\nValitse joukkue.
|
||||
sign.lobby.warhub = \nSotakeskukseen\n\n
|
||||
sign.team.limited = {0} joukkue\n{1}/{2} pelaajaa\n{3}/{4} pistett\u00e4\n{5} el\u00e4m\u00e4\u00e4 j\u00e4ljell\u00e4
|
||||
sign.team.unlimited = {0} joukkue\n{1}/{2} pelaajaa\n{3}/{4} pistett\u00e4\nehtym\u00e4tt\u00f6m\u00e4t el\u00e4m\u00e4t
|
||||
sign.warhub = Sotakeskus\n(/warhub)\nValitse \nottelu!
|
||||
sign.warzone = Sotatanner\n{0}\n{1}/{2} pelaajaa\n{3} joukkuetta
|
||||
team.chat.enable = Joukkueviestittely p\u00e4\u00e4ll\u00e4. Vain joukkueesi saa normaalit viestisi.
|
||||
team.chat.disable = Joukkueviestittely pois p\u00e4\u00e4lt\u00e4.
|
||||
use.anvil = Et voi k\u00e4ytt\u00e4\u00e4 alasimia t\u00e4ll\u00e4 Sotatantereella!
|
||||
use.enchant = Et voi k\u00e4ytt\u00e4\u00e4 lumousp\u00f6yti\u00e4 t\u00e4ll\u00e4 Sotatantereella!
|
||||
use.ender = Et voi k\u00e4ytt\u00e4\u00e4 \u00e4\u00e4riarkkuja pelatessasi Sotatantereella!
|
||||
use.item.spawn = Et voi k\u00e4ytt\u00e4\u00e4 tavaroita ollessasi tukikohdassa.
|
||||
use.xpkillmeter = T\u00e4m\u00e4 johtuu xpkillmeter ominaisuuden p\u00e4\u00e4ll\u00e4 olemisesta.
|
||||
wand.toofar = Kohdekuutio on liian kaukana.
|
||||
war.notadmin = Et voi tehd\u00e4 tuota ellet ole War:in yll\u00e4pit\u00e4j\u00e4 (lupa war.admin).
|
||||
war.notzm = Et voi tehd\u00e4 tuota ellet ole Sotatantereen tekij\u00e4 (lupa war.zonemaker).
|
||||
war.prefix = War>
|
||||
war.title = War
|
||||
warhub.none = T\u00e4ss\u00e4 serveriss\u00e4 ei ole Sotakeskusta. Yrit\u00e4 komentoja /zones ja /zone.
|
||||
warhub.permission = Sinulla ei ole valtuuksia siirty\u00e4 Sotakeskukseen.
|
||||
warhub.teleport = Tervetuloa Sotakeskukseen! Valitse ottelusi!
|
||||
zone.airstrike = {0} kutsui ilmaiskun!
|
||||
zone.battle.end = Taistelu on p\u00e4\u00e4ttynyt. {0} joukkue h\u00e4visi: {1} kuoli ja joukkueella ei ollut en\u00e4\u00e4 j\u00e4ljell\u00e4 el\u00e4mi\u00e4.
|
||||
zone.battle.newscores = Uudet pisteet - {0}
|
||||
zone.battle.next = Taistelu keskeytettiin. Palautetaan Sotatanner {0}...
|
||||
zone.battle.reset = Uusi taistelu alkaa pian. Palautetaan Sotatannerta...
|
||||
zone.battle.resetprogress = Palautusprosessi: {0}%, {1} sekuntia...
|
||||
zone.battle.resetcomplete = Sotatanner palautettu {0} sekunnissa. Uusi taistelu alkaa.
|
||||
zone.bomb.broadcast = {0} r\u00e4j\u00e4ytti {1} joukkueen tukikohdan. {2} joukkue saa yhden pisteen.
|
||||
zone.cake.broadcast = {0} valloitti {1} kakun. {2} joukkue saa yhden pisteen ja t\u00e4ydet el\u00e4m\u00e4t.
|
||||
zone.flagcapture.broadcast = {0} joukkue valloitti {1} joukkueen lipun. {2} joukkue saa yhden pisteen.
|
||||
zone.flagreturn.deadlock = Et voi vallata vihollisen lippua ennen kuin oman joukkueesi lippu on palautettu.
|
||||
zone.flagreturn.flag = Sinun t\u00e4ytyy vallata vihollisen lippu joukkueesi lipun luona.
|
||||
zone.flagreturn.spawn = Sinun t\u00e4ytyy vallata vihollisen lippu joukkueesi tukikohdassa.
|
||||
zone.leavenotice = K\u00e4yt\u00e4 komentoa /war leave poistuaksesi Sotatantereelta.
|
||||
zone.lifepool.empty = {0} joukkueen el\u00e4m\u00e4t ovat ehtyneet. Viel\u00e4 yksi kuolema ja he h\u00e4vi\u00e4v\u00e4t ottelun!
|
||||
zone.loadout.equip = {0} varustus otettu k\u00e4ytt\u00f6\u00f6n (paina shift vaihtaaksesi).
|
||||
zone.loadout.reenter = Et voi vaihtaa varustusta poistuttuasi tukikohdasta.
|
||||
zone.monument.badblock = Voit vallata monumentin joukkueesi v\u00e4risell\u00e4 villakuutiolla. Hae yksi joukkueesi tukikohdasta.
|
||||
zone.monument.capture = {0} monumentti on valloitettu {1} joukkueen toimesta.
|
||||
zone.monument.lose = {0} joukkue menetti {1} monumentin hallinnan.
|
||||
zone.monument.voodoo = Tanssisi miellytt\u00e4\u00e4 monumentin henke\u00e4. Saat {0} syd\u00e4nt\u00e4!
|
||||
zone.noteamnotice = Et voi olla Sotatantereen sis\u00e4ll\u00e4 ilman joukkuetta.
|
||||
zone.score.board404 = T\u00e4ss\u00e4 Sotatantereessa ei ole k\u00e4yt\u00f6ss\u00e4 pistetaulukkoa.
|
||||
zone.score.empty = Et saa pistett\u00e4 ennen kuin v\u00e4hint\u00e4\u00e4n yksi pelaaja liittyy toiseen joukkueeseen.
|
||||
zone.spawn.minplayers = Et voi poistua tukikohdasta ennen kuin v\u00e4hint\u00e4\u00e4n {0} pelaaja(a) on v\u00e4hint\u00e4\u00e4n {1} joukkueessa.
|
||||
zone.spawn.timer = Et voi poistua tukikohdasta {0} sekuntiin uudelleensyntymisen j\u00e4lkeen.
|
||||
zone.steal.bomb.broadcast = Pelaajalla {0} on {1} pommi.
|
||||
zone.steal.bomb.notice = Sinulla on {0} pommi. P\u00e4\u00e4se toisen joukkueen tukikohtaan saadaksesi pisteen. \u00c4l\u00e4 osu kehenk\u00e4\u00e4n tai muuten r\u00e4j\u00e4hd\u00e4t!
|
||||
zone.steal.bomb.prevent = Est\u00e4 pelaajaa {0} p\u00e4\u00e4sem\u00e4st\u00e4 tukikohtaanne pommin kanssa!
|
||||
zone.steal.cake.broadcast = Pelaajalla {0} on {1} kakku.
|
||||
zone.steal.cake.notice = Sinulla on {0} kakku. P\u00e4\u00e4se joukkueesi tukikohtaan saadaksesi pisteen ja t\u00e4ydent\u00e4\u00e4ksesi el\u00e4mi\u00e4nne.
|
||||
zone.steal.cake.prevent = Est\u00e4 pelaajaa {0} p\u00e4\u00e4sem\u00e4st\u00e4 heid\u00e4n tukikohtaansa kakun kanssa!
|
||||
zone.steal.flag.broadcast = {0} ry\u00f6sti {1} joukkueen lipun.
|
||||
zone.steal.flag.empty = Et voi ry\u00f6st\u00e4\u00e4 {0} joukkueen lippua, sill\u00e4 siin\u00e4 joukkueessa ei ole yht\u00e4\u00e4n pelaajaa.
|
||||
zone.steal.flag.notice = Sinulla on {0} joukkueen lippu. P\u00e4\u00e4se joukkueesi tukikohtaan tai lipulle valloittaaksesi sen!
|
||||
zone.steal.flag.prevent = Est\u00e4 pelaajaa {0} p\u00e4\u00e4sem\u00e4st\u00e4 {1} joukkueen tukikohtaan tai lipulle.
|
||||
zone.stealextra.bomb = Voit ry\u00f6st\u00e4\u00e4 vain yhden pommin kerrallaan!
|
||||
zone.stealextra.cake = Voit ry\u00f6st\u00e4\u00e4 vain yhden kakun kerrallaan!
|
||||
zone.stealextra.flag = Voit ry\u00f6st\u00e4\u00e4 vain yhden lipun kerrallaan!
|
||||
zone.stealextra.other = Voit ry\u00f6st\u00e4\u00e4 vain yhden asian kerrallaan!
|
||||
zone.teaminfo.format = {0}: {1} pistett\u00e4, {2}/{3} el\u00e4m\u00e4\u00e4 j\u00e4ljell\u00e4. {4}
|
||||
zone.teaminfo.none = ei yht\u00e4\u00e4n
|
||||
zone.teaminfo.prefix = Joukkueet:
|
||||
zone.teleport = Tervetuloa {0} Sotatantereelle.
|
||||
zone.warp.permission = Sinulla ei ole valtuuksia siirty\u00e4 Sotatantereelle.
|
||||
zone.zone404 = Sotatannerta ei l\u00f6ydetty.
|
||||
zone.zoneinfo.format = {0}: {1} joukkuetta, {2} pelaajaa
|
||||
zone.zoneinfo.prefix = Sotatantereet:
|
||||
zone.zoneinfo.teleport = K\u00e4yt\u00e4 komentoa /zone <sotatantereen-nimi> siirty\u00e4ksesi Sotatantereelle.
|
|
@ -1,72 +1,76 @@
|
|||
# Generated by ResourceBundle Editor (http://eclipse-rbe.sourceforge.net)
|
||||
build.denied.location = Vous ne pouvez pas construire ici.
|
||||
build.denied.outside = Vous pouvez construire uniquement dans les zones de combat.
|
||||
build.denied.teamblock = Vous devez utiliser les blocs de l'\u00e9quipe pour vous emparer des monuments.
|
||||
build.denied.zone.break = Vous ne pouvez pas casser de bloc !
|
||||
build.denied.outside = Vous ne pouvez construire qu'\u00e0 l'int\u00e9rieur de la WarZone
|
||||
build.denied.teamblock = Vous pouvez seulement utiliser les blocs de votre team pour prendre un monument.
|
||||
build.denied.zone.break = Les blocs de la zone sont incassables !
|
||||
build.denied.zone.multteam = Vous avez d\u00e9j\u00e0 le bloc {0}.
|
||||
build.denied.zone.outside = Vous ne pouvez pas d\u00e9truire le terrain si vous n'\u00eates pas dans la partie.
|
||||
build.denied.zone.place = Vous ne pouvez pas placer de bloc ici.
|
||||
build.denied.zone.outside = Impossible de d\u00e9truire les blocs d'une zone sans jouer.
|
||||
build.denied.zone.place = Vous ne pouvez pas placer de bloc dans cette zone.
|
||||
build.denied.zone.type = Vous ne pouvez pas modifier ce type de bloc.
|
||||
command.console = Vous ne pouvez pas effectuer cette action si vous n'\u00eates pas dans une partie.
|
||||
command.disabled = Vous ne pouvez utiliser que les commandes de combat quand vous jouez.
|
||||
command.console = Vous ne pouvez pas effectuer cette action si vous n''\u00eates pas dans la partie.
|
||||
command.disabled = Vous pouvez seulement utiliser les commandes de War en jeu (ex: /war leave)
|
||||
command.tp.init = Attendez {0} seconde(s) pour \u00eatre t\u00e9l\u00e9porter. Ne bougez pas.
|
||||
command.tp.moved = T\u00e9l\u00e9portation annul\u00e9 \u00e0 cause de mouvement.
|
||||
command.tp.damaged = T\u00e9l\u00e9portation annul\u00e9e. Vous recevez des coups !
|
||||
command.tp.success = Vous avez \u00e9t\u00e9 t\u00e9l\u00e9port\u00e9. Merci pour votre patience.
|
||||
drop.bomb.broadcast = {0} a perdu la bombe {1} !
|
||||
drop.bomb.disabled = Vous ne pouvez pas jeter des objets quand vous avez la bombe, Que faites vous ?!... Foncez au Spawn de l'ennemi !
|
||||
drop.bomb.disabled = Vous ne pouvez pas jeter d'objet quand vous avez la bombe ! Atteignez rapidement la base ennemie !
|
||||
drop.cake.broadcast = {0} a perdu le g\u00e2teau {1} !
|
||||
drop.cake.disabled = Vous ne pouvez pas jeter des objets tout en volant un g\u00e2teau. Que faites vous ?! Courez !
|
||||
drop.cake.disabled = Vous ne pouvez pas jeter d'objet quand vous avez le g\u00e2teau ! Atteignez vite votre base !
|
||||
drop.flag.broadcast = {0} a perdu le drapeau {1} !
|
||||
drop.flag.disabled = Vous ne pouvez pas jeter d'objets quand vous avez le drapeau. Que faites vous ?! Courez !
|
||||
drop.item.border = Vous ne pouvez pas jeter d'objets pr\u00e8s des fronti\u00e8res de la zone.
|
||||
drop.item.disabled = Vous ne pouvez rien jeter sur ce champs de bataille. Soyez \u00e9colo !
|
||||
drop.item.spawn = Vous ne pouvez pas jeter d'objets en \u00e9tant \u00e0 votre base.
|
||||
drop.team = Vous ne pouvez pas jeter de blocs {0}.
|
||||
drop.flag.disabled = Vous ne pouvez pas lancer d'objet quand vous avez le drapeau ! Atteignez vite votre base !
|
||||
drop.item.border = Vous ne pouvez pas lancer d'objet pr\u00e8s des limites de la zone.
|
||||
drop.item.disabled = Vous ne pouvez rien jeter sur le champ de bataille.
|
||||
drop.item.spawn = Vous ne pouvez pas jeter d'objet lorsque vous \u00eates \u00e0 votre base.
|
||||
drop.team = Vous ne pouvez pas jeter les blocs de l'\u00e9quipe {0}.
|
||||
drop.wand = Vous jetez l''outil de zone {0}.
|
||||
join.aarequired = Vous serez automatiquement int\u00e9gr\u00e9 \u00e0 une \u00e9quipe en passant le portail.
|
||||
join.broadcast = {0} a rejoint l''\u00e9quipe {1}.
|
||||
join.disabled = Cette ar\u00e8ne est d\u00e9sactiv\u00e9e.
|
||||
join.full.all = Toutes les \u00e9quipes sont au complet.
|
||||
join.full.all = Tous les \u00e9quipes sont pleine.
|
||||
join.full.single = Il n'y a plus de place dans l''\u00e9quipe {0}.
|
||||
join.inventorystored = Votre inventaire est conserv\u00e9 jusqu'\u00e0 ce que vous quittiez le champs de bataille (via '/war leave').
|
||||
join.permission.all = Vous n'avez pas les permissions suffisantes pour rejoindre une \u00e9quipe.
|
||||
join.permission.single = Vous n''avez pas la permission de rejoindre l''\u00e9quipe {0}.
|
||||
join.progress = Les combats ont d\u00e9j\u00e0 d\u00e9marr\u00e9, vous ne pouvez pas rejoindre cette ar\u00e8ne.
|
||||
join.progress = Impossible de rejoindre une zone en jeu.
|
||||
join.selfteam = Vous ne pouvez pas rejoindre votre propre \u00e9quipe.
|
||||
join.team404 = Cette \u00e9quipe n'existe pas. Utilisez '/teams' pour obtenir la liste des \u00e9quipes existantes.
|
||||
leave.broadcast = {0} a quitt\u00e9 la bataille.
|
||||
leave.inventoryrestore = Votre inventaire vient d'\u00eatre restaur\u00e9.
|
||||
pvp.death.drown = {0} ne sait pas nager, et vient de se noyer !
|
||||
pvp.death.explosion = Boom ! {0} vient d''exploser !
|
||||
pvp.death.fall = {0} s''est cass\u00e9 le doigt de pied en tombant... Et il en est mort !
|
||||
pvp.death.fire = {0} vient de p\u00e9rir dans les flammes... Paix \u00e0 son \u00e2me !
|
||||
pvp.death.drown = {0} vient de se noyer.
|
||||
pvp.death.explosion = {0} vient d''exploser !
|
||||
pvp.death.fall = {0} est mort en tombant.
|
||||
pvp.death.fire = {0} vient de p\u00e9rir dans les flammes.
|
||||
pvp.death.other = {0} est mort !
|
||||
pvp.ff.disabled = Rat\u00e9 ! Il est dans ton \u00e9quipe celui-l\u00e0 !
|
||||
pvp.ff.enabled = Tir ami activ\u00e9 ! Faites attention quand vous tapez ;)
|
||||
pvp.ff.disabled = Il est dans ton \u00e9quipe celui-l\u00e0 !
|
||||
pvp.ff.enabled = PvP entre \u00e9quipe activ\u00e9, attention !
|
||||
pvp.kill.adjectives = ;;puissant;mortel;bien;pr\u00e9cis;brutal;puissant
|
||||
pvp.kill.bomb = Bien jou\u00e9 {0} ! Le souffle de l''explosion a tu\u00e9 {1} !
|
||||
pvp.kill.bomb = Bien jou\u00e9 {0} ! L'explostion a tu\u00e9 {1} !
|
||||
pvp.kill.format = {1} {2} de {0} {3} {4}
|
||||
pvp.kill.self = {0} s''est suicid\u00e9 !
|
||||
pvp.kill.verbs = tu\u00e9;tu\u00e9;tu\u00e9;termin\u00e9;an\u00e9anti;assassin\u00e9;effac\u00e9;extermin\u00e9
|
||||
pvp.kill.weapon.aim = cible
|
||||
pvp.kill.weapon.bow = arc
|
||||
pvp.kill.weapon.hand = main
|
||||
pvp.outside.permission = Vous ne pouvez pas attaquer les joueurs en dehors de l'ar\u00e8ne.
|
||||
pvp.self.notplaying = Vous devez rejoindre l'ar\u00e8ne pour attaquer. Allez, viens, on est bien !
|
||||
pvp.self.respawn = Attendez qu'il soit pr\u00eat pour attaquer !
|
||||
pvp.self.spawn = Vous ne pouvez pas attaquer depuis votre base.
|
||||
pvp.outside.permission = Impossible d''attaquer les joueurs en dehors de la zone.
|
||||
pvp.self.notplaying = Vous devez rejoindre l'ar\u00e8ne pour attaquer.
|
||||
pvp.self.respawn = Attendez qu'il r\u00e9apparaisse pour l'attaquer !
|
||||
pvp.self.spawn = Vous ne pouvez pas attaquer depuis votre base !
|
||||
pvp.target.notplaying = Votre cible est en dehors de l'ar\u00e8ne.
|
||||
pvp.target.otherzone = Votre cible est dans une autre ar\u00e8ne... Bien tent\u00e9 !
|
||||
pvp.target.otherzone = Votre cible est dans une autre zone...
|
||||
pvp.target.respawn = La cible est actuellement \u00e0 sa base !
|
||||
pvp.target.spawn = La cible est d\u00e9j\u00e0 au point d'apparition !
|
||||
sign.lobby.autoassign = Warzone\n{0}\nEntrez dans un\nportail.
|
||||
sign.lobby.pick = Ar\u00e8ne\n{0}\nChoisissez\nvotre \u00e9quipe
|
||||
sign.lobby.warhub = \nVers la zone de\nchoix d'ar\u00e8ne\n
|
||||
sign.lobby.autoassign = Zone\n{0}\nEntrez dans un\nportail.
|
||||
sign.lobby.pick = Carte\n{0}\nChoisissez\nvotre \u00e9quipe
|
||||
sign.lobby.warhub = \nVers la zone\nwarhub\n
|
||||
sign.team.limited = Equipe {0}\n{1}/{2} joueurs\n{3}/{4} points\n{5} vies
|
||||
sign.team.unlimited = Equipe {0}\n{1}/{2} joueurs\n{3}/{4} points\nVies illimit\u00e9es
|
||||
sign.warhub = War hub\n( /warhub )\nChoisissez votre\nbataille !
|
||||
sign.warzone = Champs de bataille\n{0}\n{1}/{2} joueurs\n{3} \u00e9quipes
|
||||
sign.warhub = Zone \n( /warhub )\nChoisissez votre\nzone !
|
||||
sign.warzone = Zone\n{0}\n{1}/{2} joueurs\n{3} \u00e9quipes
|
||||
team.chat.enable = Chat d'\u00e9quipe activ\u00e9. Seule votre \u00e9quipe pourra lire vos messages.
|
||||
team.chat.disable = Chat d'\u00e9quipe d\u00e9sactiv\u00e9.
|
||||
use.anvil = Vous ne pouvez pas utiliser l'enclume sur ce champs de bataille !
|
||||
use.enchant = Vous ne pouvez pas utiliser la table d'enchantement sur ce champs de bataille !
|
||||
use.anvil = Vous ne pouvez pas utiliser l'enclume sur cette zone.
|
||||
use.enchant = Vous ne pouvez pas utiliser la table d'enchantement sur cette zone.
|
||||
use.ender = Vous ne pouvez pas utiliser les coffres de l'end en pleine bataille !
|
||||
use.item.spawn = Vous ne pouvez pas utiliser d'objet \u00e0 votre base.
|
||||
use.xpkillmeter = L'option 'xpkillmeter' doit \u00eatre activ\u00e9e.
|
||||
|
@ -76,35 +80,40 @@ war.notzm = Vous n'avez pas la permission requise.
|
|||
war.prefix = War >
|
||||
war.title = War
|
||||
warhub.none = Il n'y a pas de "warhub". Utilisez '/zones' et '/zone'.
|
||||
warhub.permission = Vous n'avez pas la permission de vous t\u00e9l\u00e9porter.
|
||||
warhub.teleport = Bienvenue ! Choisissez un champs de bataille.
|
||||
warhub.permission = Vous n'avez pas la permission de vous t\u00e9l\u00e9porter \u00e0 la zone warhub.
|
||||
warhub.teleport = Bienvenue ! Choisissez une zone pour combattre.
|
||||
zone.airstrike = {0} a fait un raid a\u00e9rien !
|
||||
zone.battle.end = La partie est termin\u00e9e ! L''\u00e9quipe {0} a perdu : {1} morts et plus aucune de vie.
|
||||
zone.battle.end = La partie est termin\u00e9e ! L''\u00e9quipe {0} a perdu : L'\u00e9quipe {1} est morte et n'a plus aucune de vie.
|
||||
zone.battle.newscores = Nouveaux scores - {0}
|
||||
zone.battle.next = Le combat a \u00e9t\u00e9 interrompu... Remise \u00e0 z\u00e9ro de la zone {0}...
|
||||
zone.battle.reset = Une nouvelle bataille va bient\u00f4t d\u00e9marrer. Pr\u00e9paration de l'ar\u00e8ne...
|
||||
zone.battle.resetprogress = Progression: {0}%, {1} secondes...
|
||||
zone.battle.resetcomplete = L''ar\u00e8ne va \u00eatre r\u00e9initialis\u00e9e dans {0} secondes. Une nouvelle bataille va commencer !
|
||||
zone.bomb.broadcast = {0} a explos\u00e9 la base de l''\u00e9quipe {1}. L''\u00e9quipe {2} gagne un point.
|
||||
zone.battle.next = Le combat a \u00e9t\u00e9 interrompu... Regen\u00e9ration de la zone {0}...
|
||||
zone.battle.reset = Une nouvelle bataille va bient\u00f4t d\u00e9marrer. Regen de la zone..
|
||||
zone.battle.resetprogress = Progression: {0}%, {1} secondes pass\u00e9...
|
||||
zone.battle.resetcomplete = Carte r\u00e9initialis\u00e9e en {0} secondes. Une nouvelle bataille va commencer !
|
||||
zone.bomb.broadcast = {0} a explos\u00e9 la base de l''\u00e9quipe {1}. L''\u00e9quipe {2} gagne 1 point.
|
||||
zone.cake.broadcast = {0} a ramen\u00e9 le g\u00e2teau {1} \u00e0 sa base. L''\u00e9quipe {2} gagne un point et r\u00e9cup\u00e8re toutes ses vies.
|
||||
zone.flagcapture.broadcast = {0} a ramen\u00e9 le drapeau de l''\u00e9quipe {1} dans son camp ! L''\u00e9quipe {2} gagne un point.
|
||||
zone.capturepoint.addpoint=L''\u00e9quipe {0} gagne 1 point pour prot\u00e9ger du cap {1}.
|
||||
zone.capturepoint.lose=L''\u00e9quipe {0} a perdu le contr\u00f4le du cap {1}.
|
||||
zone.capturepoint.contest=L''\u00e9quipe {1} conteste le cap {0} !
|
||||
zone.capturepoint.capture=L''\u00e9quipe {0} s''est empar\u00e9e du cap {1}, gagnant 1 point.
|
||||
zone.flagcapture.broadcast = {0} a ramen\u00e9 le drapeau de l''\u00e9quipe {1} \u00e0 sa base ! L''\u00e9quipe {2} gagne 1 point.
|
||||
zone.flagreturn.deadlock = Vous ne pouvez pas rapporter un drapeau ennemi alors que votre propre drapeau a \u00e9t\u00e9 vol\u00e9 !
|
||||
zone.flagreturn.flag = Vous devez rapporter le drapeau ennemi \u00e0 votre propre drapeau.
|
||||
zone.flagreturn.flag = Vous devez captuer le drapeau enemie \u00e0 votre drapeau d'\u00e9quipe.
|
||||
zone.flagreturn.spawn = Vous devez rapporter le drapeau ennemi \u00e0 votre base.
|
||||
zone.leavenotice = Utilisez '/war leave' pour quitter le champs de bataille.
|
||||
zone.lifepool.empty = L''\u00e9quipe {0} n''a plus de vie. Encore un d\u00e9c\u00e8s, et elle perd la bataille !
|
||||
zone.loadout.equip = Voici l''\u00e9quipement {0} (accroupissez-vous pour changer).
|
||||
zone.leavenotice = Utilisez '/war leave' pour quitter la zone.
|
||||
zone.lifepool.empty = L''\u00e9quipe {0} n''a plus de vie. Encore une mort, et elle perd la bataille !
|
||||
zone.loadout.equip = Voici votre \u00e9quipement {0} (Utiliser la touche sneak pour changer).
|
||||
zone.loadout.reenter = Vous ne pouvez pas changer votre \u00e9quipement apr\u00e8s avoir quitt\u00e9 votre base.
|
||||
zone.monument.badblock = Vous devez vous emparer d'un monument avec une laine \u00e0 la couleur de votre \u00e9quipe. Obtenez en une \u00e0 votre base.
|
||||
zone.monument.badblock = Vous devez vous emparer d'un monument avec une laine \u00e0 la couleur de votre \u00e9quipe.
|
||||
zone.monument.capture = L''\u00e9quipe {1} s''est empar\u00e9e du monument {0}.
|
||||
zone.monument.lose = L''\u00e9quipe {0} a perdu le contr\u00f4le du monument {1}.
|
||||
zone.monument.voodoo = Votre danse a plu au monument. Vous gagnez {0} coeur(s) !
|
||||
zone.noteamnotice = Vous ne pouvez pas \u00eatre dans l'ar\u00e8ne sans \u00eatre dans une \u00e9quipe.
|
||||
zone.score.board404 = Le tableau des scores n'est pas activ\u00e9 dans cette ar\u00e8ne.
|
||||
zone.monument.voodoo = Votre dance plait au monument voodoo ! Vous gagnez {0} coeur(s) !
|
||||
zone.noteamnotice = Vous ne pouvez pas \u00eatre dans la zone sans \u00eatre dans une \u00e9quipe.
|
||||
zone.score.board404 = Le tableau des scores n'est pas activ\u00e9 dans cette zone.
|
||||
zone.score.empty = Vous ne pourrez pas marquer de point tant qu'aucun joueur n'aura rejoint une autre \u00e9quipe.
|
||||
zone.spawn.minplayers = Vous ne pouvez pas quitter votre base s''il n''y a pas au moins {0} joueurs dans au moins {1} \u00e9quipes.
|
||||
zone.spawn.timer = Vous ne pouvez pas quitter votre base pendant {0} apr\u00e8s votre apparition.
|
||||
zone.steal.bomb.broadcast = {0} s''est empar\u00e9 de la bombe {1}.
|
||||
zone.spawn.timer = Vous devez attendre {0} secondes pour quitter votre base !
|
||||
zone.spawn.timer.title=Attendez {0} secondes...
|
||||
zone.steal.bomb.broadcast = {0} s''est empar\u00e9 de la bombe {1} !
|
||||
zone.steal.bomb.notice = Vous avez la bombe {0}. Atteignez la base d''une \u00e9quipe ennemie pour gagner des points. Si vous vous faites toucher, vous exploserez !
|
||||
zone.steal.bomb.prevent = Emp\u00eachez {0} d''atteindre votre base avec la bombe !
|
||||
zone.steal.cake.broadcast = {0} a vol\u00e9 le g\u00e2teau {1}.
|
||||
|
@ -112,8 +121,8 @@ zone.steal.cake.notice = Vous avez le g\u00e2teau {0}. Atteignez votre base pour
|
|||
zone.steal.cake.prevent = Emp\u00eachez {0} d''atteindre sa base avec le g\u00e2teau !
|
||||
zone.steal.flag.broadcast = {0} a vol\u00e9 le drapeau de l''\u00e9quipe {1} !
|
||||
zone.steal.flag.empty = Vous ne pouvez pas voler le drapeau de l''\u00e9quipe {0} si aucun joueur n''a rejoint cette \u00e9quipe.
|
||||
zone.steal.flag.notice = Vous avez le drapeau de l''\u00e9quipe {0}. Atteigez votre base ou votre propre drapeau, et vite !
|
||||
zone.steal.flag.prevent = Emp\u00eachez {0} d''atteindre la base ou le drapeau de l''\u00e9quipe {1} !
|
||||
zone.steal.flag.notice = Vous avez le drapeau de l''\u00e9quipe {0}. Atteignez vite votre base !
|
||||
zone.steal.flag.prevent = Emp\u00eachez {0} d''atteindre la base de l''\u00e9quipe {1} !
|
||||
zone.stealextra.bomb = Vous ne pouvez voler qu'une seule bombe \u00e0 la fois !
|
||||
zone.stealextra.cake = Vous ne pouvez voler qu'un seul g\u00e2teau \u00e0 la fois !
|
||||
zone.stealextra.flag = Vous ne pouvez voler qu'un seul drapeau \u00e0 la fois !
|
||||
|
@ -121,9 +130,9 @@ zone.stealextra.other = Vous ne pouvez voler qu'une seule chose \u00e0 la fois !
|
|||
zone.teaminfo.format = {0} : {1} points, {2}/{3} vies restantes. {4}
|
||||
zone.teaminfo.none = aucun(e)
|
||||
zone.teaminfo.prefix = Equipes :
|
||||
zone.teleport = Bienvenue sur le champs de bataille {0} !
|
||||
zone.warp.permission = Vous n'avez pas la permission de vous t\u00e9l\u00e9porter \u00e0 cette ar\u00e8ne.
|
||||
zone.zone404 = Ar\u00e8ne non trouv\u00e9e.
|
||||
zone.teleport = Bienvenue sur la zone {0} !
|
||||
zone.warp.permission = Vous n'avez pas la permission de vous t\u00e9l\u00e9porter \u00e0 cette zone.
|
||||
zone.zone404 = Zone non trouv\u00e9e.
|
||||
zone.zoneinfo.format = {0} : {1} \u00e9quipes, {2} joueurs
|
||||
zone.zoneinfo.prefix = Liste des ar\u00e8nes :
|
||||
zone.zoneinfo.prefix = Liste des zones:
|
||||
zone.zoneinfo.teleport = Utilisez '/zone <nom de la zone>' pour vous y t\u00e9l\u00e9porter.
|
||||
|
|
|
@ -0,0 +1,65 @@
|
|||
# Generated by ResourceBundle Editor (http://eclipse-rbe.sourceforge.net)
|
||||
build.denied.location = Do kinst hjir net bouwe.
|
||||
build.denied.outside = Do kinst allinnich yn oarlochsgebieten bouwe.
|
||||
build.denied.teamblock = Do kinst allinnich de blokken fan dyn tiim br\u00fbke om monuminten te feroverjen.
|
||||
build.denied.zone.break = Do blokken dy't yn dit oarlochsgebiet boud binne, binne unbrekber!
|
||||
build.denied.zone.multteam = Do hast al in {0} blok.
|
||||
build.denied.zone.outside = Do kinst in oarlochsgebiet w\u00ear'tsto net yn spilest net ferneatigje.
|
||||
build.denied.zone.place = Do kinst gjin blokken pleatsen yn dit oarlochsgebiet.
|
||||
build.denied.zone.type = Do kinst blokken fan dit type net oanpasse.
|
||||
command.console = Do kinst dit net dwaan at'sto net yn-spiel bist.
|
||||
command.disabled = Do kinst allinnich Oarlochkommando's (lykas /leave) br\u00fbke at'sto oan it spilen bist.
|
||||
drop.bomb.broadcast = {0} hat de {1} bom fallen litten!
|
||||
drop.bomb.disabled = Do kinst gjin foarwerpen fallen litten at'sto de bom oan it stelle bist. Wat dochsto?! Rin nei de spawn fan dyn fij\u00e2n!
|
||||
drop.cake.broadcast = {0} hat de {1} cake fallen listen!
|
||||
drop.cake.disabled = Do kinst gjin foarwerpen fallen litten at'sto de cake oan it stelle bist. Wat dochsto?! Rin!
|
||||
drop.flag.broadcast = {0} hat de {1} flagge fallen litten!
|
||||
drop.flag.disabled = Do kinst gjin foarwerpen fallen litten at'sto de flag oan it stelle bist. Wat dochsto?! Rin!
|
||||
drop.item.border = Do kinst gjin foarwerpen fallen litten yn 'e buert fan de s\u00f4negrins.
|
||||
drop.item.disabled = Do kinst gjin foarwerpen fallen litten yn dit oarlochsgebiet.
|
||||
drop.item.spawn = Do kinst gjin foarwerpen fallen litten at'sto noch yn 'e spawn bist.
|
||||
drop.team = Do kinst gjin {0} blokken fallen litten.
|
||||
drop.wand = Do hast de s\u00f4ne {0} st\u00eaf fallen litten.
|
||||
join.aarequired = Dit oarlochsgebiet ferplichtet dy om automatysk tawiisd te wurden oan in tiim. Gean asjebleaft nei de auto-tawiispoarte.
|
||||
join.broadcast = {0} wie taheakke oan tiim {1}
|
||||
join.disabled = Dit oarlochsgebiet is \u00fatskeakele.
|
||||
join.full.all = Alle tiims binne fol.
|
||||
join.full.single = Tiim {0} is fol.
|
||||
join.inventorystored = Dyn ynventaris stiet yn 'e opslach oant datsto fuort geast mei /war leave.
|
||||
join.permission.all = Do hast gjin tastimming foar elts fan 'e beskikbere tiims yn dit oarlochsgebiet.
|
||||
join.permission.single = Do hast gjin tastimming om dysels ta te heakje oan team {0}.
|
||||
join.progress = Do kinst dysels net taheakje oan in dwaande striid yn dizze s\u00f4ne.
|
||||
join.selfteam = Do kinst dysels net taheakje oan dyn eigen tiim.
|
||||
join.team404 = It team waard net f\u00fbn. Probearje /teams te br\u00fbken foar in list.
|
||||
leave.broadcast = {0} hat de s\u00f4ne ferlitten.
|
||||
leave.inventoryrestore = Dyn ynventaris wurdt wer ynoarder.
|
||||
pvp.death.drown = {0} fersopen
|
||||
pvp.death.explosion = {0} eksplodearre
|
||||
pvp.death.fall = {0} is betiid dea gongen troch in fal
|
||||
pvp.death.fire = {0} wie knapperich opbaarnd
|
||||
pvp.death.other = {0} is dea gongen
|
||||
pvp.ff.disabled = Dyn oanfal miste! Dyn wyt is yn dyn tiim.
|
||||
pvp.ff.enabled = Freonlike fjoer stiet oan! Alsjebleaft, blessearje dyn tiimgenoaten net.
|
||||
pvp.kill.adjectives = ;;machtich;deadlik;fijn;presys;br\u00fat;kr\u00eaftich
|
||||
pvp.kill.bomb = {0} hat {1} opblaasd!
|
||||
pvp.kill.format = {0}''s {1} {2} {3} {4}
|
||||
pvp.kill.self = {0} hat selsmoard plege
|
||||
pvp.kill.weapon.aim = rjochtsje
|
||||
pvp.kill.weapon.bow = b\u00f4ge
|
||||
pvp.kill.weapon.hand = h\u00e2n
|
||||
pvp.outside.permission = Do kinst gjin spilers oanfalle b\u00fbten de oarlochsgebieten.
|
||||
pvp.self.notplaying = Do moatst yn it oarlochsgebiet w\u00eaze asto aanfalle wolst.
|
||||
pvp.self.respawn = Do kinst net oanfalle asto oan it respawnen bist!
|
||||
pvp.self.spawn = Do kinst net oanfalle asto noch yn 'e spawn bist!
|
||||
pvp.target.notplaying = Dyn wyt spilet net yn it oarlochsgebiet.
|
||||
pvp.target.otherzone = Dyn wyt spilet yn in oar oarlochsgebiet.
|
||||
pvp.target.respawn = It wyt is dwaande mei respawnen!
|
||||
pvp.target.spawn = Dyn wyt is noch hyltyd yn 'e spawn.
|
||||
sign.lobby.autoassign = Oarlochsgebiet\n{0}\nGean nei auto-\ntawiispoarte.
|
||||
sign.lobby.pick = Oarlochsgebiet\n{0} \n \nIn tiim \u00fatkieze.
|
||||
sign.lobby.warhub = \nNei Oarlochshub\n\n
|
||||
sign.team.limited = Tiim {0}\n{1}/{2} spilers\n{3}/{4} pnt\n{5} libbens oer
|
||||
sign.team.unlimited = Tiim {0}\n{1}/{2} spilers\n{3}/{4} pnt\nlibbens unbeheind
|
||||
sign.warhub = Oarlochshub\n(/warhub)\nKies dyn\nstriid!
|
||||
sign.warzone = Oarlochsgebiet\n{0}\n{1}/{2} spilers\n{3} tiims
|
||||
use.anvil = Do kinst gjin ambylden br\u00fbke yn dit oarlochsgebiet!
|
|
@ -0,0 +1,3 @@
|
|||
# Generated by ResourceBundle Editor (http://eclipse-rbe.sourceforge.net)
|
||||
build.denied.location = \u05d0\u05e1\u05d5\u05e8 \u05dc\u05d1\u05e0\u05d5\u05ea \u05db\u05d0\u05df
|
||||
build.denied.outside = \u05d0\u05e4\u05e9\u05e8 \u05dc\u05d1\u05e0\u05d5\u05ea \u05e8\u05e7 \u05d1\u05ea\u05d5\u05da \u05d0\u05d6\u05d5\u05e8\u05d9 \u05de\u05dc\u05d7\u05de\u05d4
|
|
@ -1,10 +1,133 @@
|
|||
# Generated by ResourceBundle Editor (http://eclipse-rbe.sourceforge.net)
|
||||
build.denied.location = Itt nem \u00e9p\u00edthetsz.
|
||||
build.denied.outside = Csak a j\u00e1t\u00e9kteren bel\u00fcl \u00e9p\u00edthetsz.
|
||||
build.denied.teamblock = Csak arra haszn\u00e1lhatod a csapatod blokkjait, hogy elfoglald a szobrokat.
|
||||
build.denied.zone.break = Ez egy t\u00f6rhetelen blokk!
|
||||
build.denied.zone.multteam = Neked m\u00e1r van {0} blokkod.
|
||||
build.denied.zone.outside = Nem t\u00f6rhetsz blokkokat az ar\u00e9n\u00e1ban, ha nem j\u00e1tszol
|
||||
build.denied.zone.place = Nem rakhatsz le blokkokat ebben az ar\u00e9n\u00e1ban.
|
||||
build.denied.zone.type = Nem m\u00f3dos\u00edthatod a blokk t\u00edpus\u00e1t.
|
||||
command.console = Ezt nem csin\u00e1lhatod, ha nem j\u00e1tszol.
|
||||
command.disabled = Csak a War parancsait haszn\u00e1lhatod, amikor j\u00e1tszol. (pl.: /leave)
|
||||
command.tp.init = V\u00e1rj {0} m\u00e1sodpercet a teleport\u00e1l\u00e1sig. Ha mozogsz, vagy sebz\u0151dsz, az megszak\u00edtja a teleport\u00e1l\u00e1st.
|
||||
command.tp.moved = Nem tudt\u00e1l teleport\u00e1l\u00f3dni, mert mozogt\u00e1l.
|
||||
command.tp.damaged = Nem tudt\u00e1l teleport\u00e1l\u00f3dni, mert sebz\u0151dt\u00e9l.
|
||||
command.tp.success = Elteleport\u00e1l\u00f3dt\u00e1l. K\u00f6sz\u00f6nj\u00fck a t\u00fcrelmet.
|
||||
drop.bomb.broadcast = {0} eldobta a(z) {1} bomb\u00e1t!
|
||||
drop.bomb.disabled = Nem dobhatsz el t\u00e1rgyakat, amikor n\u00e1lad van a bomba. Mit csin\u00e1lsz?! Fuss az ellens\u00e9ged spawnj\u00e1ra!
|
||||
drop.cake.broadcast = {0} eldobta a(z) {1} tort\u00e1t!
|
||||
drop.cake.disabled = Nem dobhatsz el t\u00e1rgyakat, amikor n\u00e1lad van a torta. Mit csin\u00e1lsz?! Fuss!
|
||||
drop.flag.broadcast = {0} eldobta a(z) {1} csapat z\u00e1szl\u00f3j\u00e1t.
|
||||
drop.flag.disabled = Nem dobhatod el a z\u00e1szl\u00f3t. Mit csin\u00e1lsz?! Fuss!
|
||||
drop.item.border = Nem dobhatsz el t\u00e1rgyakat az ar\u00e9na fal\u00e1nak k\u00f6zel\u00e9ben.
|
||||
drop.item.disabled = Nem dobhatsz el t\u00e1rgyakat az ar\u00e9n\u00e1ban.
|
||||
drop.item.spawn = Nem dobhatsz el t\u00e1rgyakat, am\u00edg a spawnon vagy.
|
||||
drop.team = Nem dobhatsz el {0} blokkot.
|
||||
drop.wand = Eldobtad a(z) {0} ar\u00e9na kijel\u00f6l\u0151 eszk\u00f6z\u00e9t.
|
||||
join.aarequired = Ez az ar\u00e9na megk\u00f6veteli az aut\u00f3matikus eloszt\u00e1st.\nL\u00e9pj be az eloszt\u00f3 kapun.
|
||||
join.broadcast = {0} csatlakozott a(z) {1} csapatba.
|
||||
join.disabled = Ez az ar\u00e9na le van tiltva.
|
||||
join.full.all = A csapatok tele vannak.
|
||||
join.inventorystored = Az eszk\u00f6zt\u00e1rad vissza\u00e1ll, ha kil\u00e9psz a /warp leave paranccsal.
|
||||
join.permission.single = Nincs jogod, hogy csatlakozz a(z) {0} csapathoz.
|
||||
join.full.all = A \u00f6sszes csapat tele van.
|
||||
join.full.single = A(z) {0} csapat tele van.
|
||||
join.inventorystored = Az eszk\u00f6zt\u00e1rad vissza\u00e1ll, ha kil\u00e9psz a /war leave, vagy a /leave paranccsal.
|
||||
join.permission.all = Egyik csapatban sem lehetsz, mivel nincs enged\u00e9lyed hozz\u00e1.
|
||||
join.permission.single = Nincs jogod ahhoz, hogy csatlakozz a(z) {0} csapathoz.
|
||||
join.progress = nem csatlakozhatsz, am\u00edg a jelenlegi j\u00e1t\u00e9k be nem fejez\u0151dik.
|
||||
join.selfteam = Nem csatlakozhatsz a saj\u00e1t csapatodba.
|
||||
join.team404 = Nincs ilyen csapat. Pr\u00f3b\u00e1ld ki a /teams parancsot.
|
||||
leave.broadcast = {0} kil\u00e9pett az ar\u00e9n\u00e1b\u00f3l.
|
||||
leave.inventoryrestore = Az eszk\u00f6zt\u00e1rad vissza\u00e1llt.
|
||||
pvp.death.drown = {0} megfulladt
|
||||
pvp.death.explosion = {0} felrobbant
|
||||
pvp.death.fall = {0} kiesett az ar\u00e9n\u00e1b\u00f3l
|
||||
pvp.death.fire = {0} porr\u00e1 \u00e9gett
|
||||
pvp.death.other = {0} meghalt
|
||||
pvp.ff.disabled = Rossz helyre c\u00e9lozt\u00e1l! A csapat t\u00e1rsadat tal\u00e1ltad el.
|
||||
pvp.ff.enabled = A Friendly fire be van kapcsolva. Ne s\u00e9rtsd meg a csapatt\u00e1rsaidat.
|
||||
pvp.kill.adjectives = ;;hatalmas;hal\u00e1los;v\u00e9gs\u0151;pontos;brut\u00e1lis;er\u0151teljes
|
||||
pvp.kill.bomb = {0} felrobbantotta {1}-t
|
||||
pvp.kill.format = {0} {1} {2} {3} {4}
|
||||
pvp.kill.self = {0} \u00f6ngyilkoss\u00e1gban meghalt
|
||||
pvp.kill.verbs = meg\u00f6lte;meg\u00f6lte;meg\u00f6lte;kiv\u00e9gezte;megsemmis\u00edtette;meggyilkolta;els\u00f6p\u00f6rte;kiirtotta
|
||||
pvp.kill.weapon.aim = ny\u00edlvessz\u0151
|
||||
pvp.kill.weapon.bow = \u00edj
|
||||
pvp.kill.weapon.hand = k\u00e9z
|
||||
pvp.outside.permission = Nem \u00fctheded meg azt, aki nem j\u00e1tszik.
|
||||
pvp.self.notplaying = J\u00e1tszanod kell ahhoz, hogy megt\u00e1madhass valakit.
|
||||
pvp.self.respawn = Nem t\u00e1madhatod meg azt, aki most \u00e9led \u00fajra.
|
||||
pvp.self.spawn = Nem t\u00e1madhatsz, am\u00edg a spawnon \u00e1llsz.
|
||||
pvp.target.notplaying = Az, akit meg akarsz \u00f6lni, nem j\u00e1tszik.
|
||||
pvp.target.otherzone = Az, akit meg akarsz \u00f6lni, egy m\u00e1sik ar\u00e9n\u00e1ban j\u00e1tszik,
|
||||
pvp.target.respawn = Az, akit meg akarsz \u00f6lni, jelenleg \u00fajra\u00e9led!
|
||||
pvp.target.spawn = Az, akit meg akarsz \u00f6lni a kezd\u0151 ponton van!
|
||||
sign.lobby.autoassign = Warzone\n{0}\nL\u00e9pj be az\neloszt\u00f3n.
|
||||
sign.lobby.pick = Warzone\n{0}\nV\u00e1lassz\ncsapatot.
|
||||
sign.lobby.warhub = \nA WarHub-ba\u00a0\n\n
|
||||
sign.team.limited = {0} csapat\n{1}/{2} j\u00e1t\u00e9kos\n{3}/{4} pont\n{5} \u00e9let h\u00e1tra
|
||||
sign.team.unlimited = {0} csapat\n{1}/{2} j\u00e1t\u00e9kos\n{3}/{4} pont\nv\u00e9gtelen \u00e9let
|
||||
sign.warhub = War hub\n(/warhub)\nV\u00e1lassz\nar\u00e9n\u00e1t!
|
||||
sign.warzone = Warzone\n{0}\n{1}/{2} j\u00e1t\u00e9kos\n{3} csapat
|
||||
team.chat.enable = A csapat besz\u00e9lget\u00e9s bekapcsolva. Az \u00fczeneteket, amit k\u00fcldesz, csak a csapatt\u00e1rsaid l\u00e1tj\u00e1k.
|
||||
team.chat.disable = A csapat besz\u00e9lget\u00e9s kikapcsolva.
|
||||
use.anvil = Nem haszn\u00e1lhatsz \u00fcll\u0151t, mik\u00f6zben j\u00e1tszol!
|
||||
use.enchant = Nem haszn\u00e1lhatsz enchant asztalt, mik\u00f6zben j\u00e1tszol!
|
||||
use.ender = Nem haszn\u00e1lhatsz v\u00e9gzetl\u00e1d\u00e1t, mik\u00f6zben j\u00e1tszol!
|
||||
use.item.spawn = Nem haszn\u00e1lhatsz t\u00e1rgyakat, am\u00edg a spawnon vagy
|
||||
use.xpkillmeter = Ez az\u00e9rt van, mert az xpkillmeter be\u00e1ll\u00edt\u00e1s be van kapcsolva.
|
||||
wand.toofar = A megc\u00e9lzott blokk t\u00fal messze van.
|
||||
war.notadmin = Ezt nem csin\u00e1lhatod, ha nem vagy War admin (jog: war.admin)
|
||||
war.notzm = Ezt nem csin\u00e1lhatod, ha nem vagy Z.M. (jog: war.zonemaker)
|
||||
war.prefix = War>
|
||||
war.title = War
|
||||
warhub.none = Nincs warhub a szerveren. Pr\u00f3b\u00e1ld: /zones \u00e9s a /zone parancsot.
|
||||
warhub.permission = Nincs jogod, hogy a Warhubba teleport\u00e1lj.
|
||||
warhub.teleport = \u00dcdv a Warhubban. V\u00e1lassz ar\u00e9n\u00e1t!
|
||||
zone.airstrike = {0} egy l\u00e9git\u00e1mad\u00e1st h\u00edvott!
|
||||
zone.battle.end = A j\u00e1t\u00e9knak v\u00e9ge. A(z) {0} csapat vesztett: {1} meghalt, \u00e9s nem volt t\u00f6bb \u00e9lete a csapatnak.
|
||||
zone.battle.newscores = \u00daj pontok - {0}
|
||||
zone.battle.next = A j\u00e1t\u00e9k megszakadt. Ar\u00e9na \u00fajra\u00e9p\u00edt\u00e9se {0}...
|
||||
zone.battle.reset = Hamarosan \u00faj j\u00e1t\u00e9k kezd\u0151dik. Ar\u00e9na \u00fajra\u00e9p\u00edt\u00e9se...
|
||||
zone.battle.resetprogress = \u00dajra\u00e9p\u00edt\u00e9s folyamatban: {0}%, {1} m\u00e1sodperc alatt...
|
||||
zone.battle.resetcomplete = Az ar\u00e9na \u00fajra\u00e9p\u00fcl {0} m\u00e1sodperc m\u00falva. \u00daj csata kezd\u0151dik.
|
||||
zone.bomb.broadcast = {0} felrobbantotta a(z) {1} csapat spawnj\u00e1t. A(z) {2} csapat pontja 1 pont.
|
||||
zone.cake.broadcast = {0} elfoglalta a(z) {1} tort\u00e1t. A(z) {2} csapat \u00f6sszes tagj\u00e1nak felt\u00f6lt\u0151d\u00f6tt az \u00e9lete.
|
||||
zone.flagcapture.broadcast = {0} megszerezte a(z) {1} csapat z\u00e1szl\u00f3j\u00e1t. A(z) {2} csapatnak 1 pontja van.
|
||||
zone.flagreturn.deadlock = Nem teheted le a z\u00e1szl\u00f3t, am\u00edg a csapatod z\u00e1szl\u00f3ja nincs a hely\u00e9n.
|
||||
zone.flagreturn.flag = El kell vinned az ellens\u00e9g z\u00e1szl\u00f3j\u00e1t a csapatod z\u00e1szl\u00f3j\u00e1hoz.
|
||||
zone.flagreturn.spawn = El kell vinned az ellens\u00e9g z\u00e1szl\u00f3j\u00e1t a csapatod indul\u00f3hely\u00e9hez.
|
||||
zone.leavenotice = /war leave vagy /leave a kil\u00e9p\u00e9shez.
|
||||
zone.lifepool.empty = A(z) {0} csapatnak nincs t\u00f6bb \u00e9lete. M\u00e9g egy hal\u00e1l \u00e9s elvesztik a j\u00e1t\u00e9kot.
|
||||
zone.loadout.equip = Lek\u00e9rted a(z) {0} csomagot (guggolj a v\u00e1lt\u00e1shoz).
|
||||
zone.loadout.reenter = Nem tudod v\u00e1ltoztatni a csomagot, miut\u00e1n kiment\u00e9l a kezd\u0151 helyr\u0151l.
|
||||
zone.monument.badblock = A szobrokat a csapatod blokkj\u00e1val kell elfoglalnod. Szerezz egyet a csapatod kezd\u0151 pontj\u00e1r\u00f3l.
|
||||
zone.monument.capture = A(z) {0} szobrot elfoglalta a(z) {1} csapat.
|
||||
zone.monument.lose = A(z) {0} csapat elvesz\u00edtette az uralmat a(z) {1} szobor felett.
|
||||
zone.monument.voodoo = A t\u00e1ncod tetszik a szobor szellem\u00e9nek. Szerezt\u00e9l {0} \u00e9letet!
|
||||
zone.noteamnotice = Nem lehetsz egy ar\u00e9n\u00e1ban csapat n\u00e9lk\u00fcl.
|
||||
zone.score.board404 = Enn\u00e9l az ar\u00e9n\u00e1n\u00e1l nem enged\u00e9lyezt\u00e9k az eredm\u00e9nyjelz\u0151t.
|
||||
zone.score.empty = Nem kaphatsz pontot, am\u00edg egy j\u00e1t\u00e9kos be nem sz\u00e1ll egy m\u00e1sik csapatba.
|
||||
zone.spawn.minplayers = Nem hagyhatod el a kezd\u0151 helyet, am\u00edg nem lesz minimum {0} j\u00e1t\u00e9kos {1} csapatban.
|
||||
zone.spawn.timer = Nem hagyhatod el a spawn {0} m\u00e1sodpercig, az \u00fajra \u00e9led\u00e9s ut\u00e1n!
|
||||
zone.steal.bomb.broadcast = {0} megszerezte a(z) {1} bomb\u00e1t.
|
||||
zone.steal.bomb.notice = Megszerezted a(z) {0} bomb\u00e1t. Menj a m\u00e1sik csapat kezd\u0151 hely\u00e9hez. Vigy\u00e1zz, hogy ne \u00e9rintkezz senkivel, vagy felrobbansz!
|
||||
zone.steal.bomb.prevent = Akad\u00e1lyozd meg, hogy {0} el\u00e9rje a kezd\u0151 helyedet a bomb\u00e1val.
|
||||
zone.steal.cake.broadcast = {0} megszerezte a(z) {1} tort\u00e1t.
|
||||
zone.steal.cake.notice = Megszerezted a(z) {0} tort\u00e1t. Menj a csapatod kezd\u0151 hely\u00e9hez, hogy pontot kapj \u00e9s felt\u00f6lt\u0151dj\u00f6n az \u00e9leted.
|
||||
zone.steal.cake.prevent = Akad\u00e1lyozd meg, hogy {0} el\u00e9rje a kezd\u0151hely\u00e9t a tort\u00e1val!
|
||||
zone.steal.flag.broadcast = {0} megszerezte a(z) {1} csapat z\u00e1szl\u00f3j\u00e1t.
|
||||
zone.steal.flag.empty = Nem foglalhatod el a(z) {0} csapat z\u00e1szl\u00f3j\u00e1t, mert nincs senki a csapatban.
|
||||
zone.steal.flag.notice = Megszerezted a(z) {0} csapat z\u00e1szl\u00f3j\u00e1t. Fuss a spawnodra, vagy a z\u00e1szl\u00f3dhoz, hogy a csapatod megkapja a pontot \u00e9rte.
|
||||
zone.steal.flag.prevent = Akad\u00e1lyozd meg, hogy {0} el\u00e9rje a(z) {1} csapat z\u00e1szl\u00f3j\u00e1t.
|
||||
zone.stealextra.bomb = Egyszerre csak egy bomb\u00e1t lophatsz!
|
||||
zone.stealextra.cake = Egyszerre csak egy tort\u00e1t lophatsz!
|
||||
zone.stealextra.flag = Egyszerre csak egy z\u00e1szl\u00f3t lophatsz!
|
||||
zone.stealextra.other = Egyszerre csak egy dolgot lophatsz!
|
||||
zone.teaminfo.format = {0}: {1} pont, {2}/{3} \u00e9let van h\u00e1tra. {4}
|
||||
zone.teaminfo.none = semmi
|
||||
zone.teaminfo.prefix = Csapatok:
|
||||
zone.teleport = \u00dcdv a(z) {0} ar\u00e9n\u00e1ban.
|
||||
zone.warp.permission = Nincs enged\u00e9lyed, hogy ebbe az ar\u00e9n\u00e1ba teleport\u00e1lj.
|
||||
zone.zone404 = Nincs ilyen ar\u00e9na.
|
||||
zone.zoneinfo.format = {0}:\n{1} csapat\n{2} j\u00e1t\u00e9kos
|
||||
zone.zoneinfo.prefix = Ar\u00e9n\u00e1k:
|
||||
zone.zoneinfo.teleport = Haszn\u00e1ld a /zone <ar\u00e9na-neve> parancsot, hogy bel\u00e9pj egy ar\u00e9n\u00e1ba.
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue