Initial. perhaps broken update attempt
This commit is contained in:
parent
6fb1174adf
commit
ef3cf02a23
4
.gitignore
vendored
4
.gitignore
vendored
@ -22,4 +22,6 @@
|
|||||||
/manifest.mf
|
/manifest.mf
|
||||||
|
|
||||||
# Mac filesystem dust
|
# Mac filesystem dust
|
||||||
/.DS_Store
|
/.DS_Store
|
||||||
|
|
||||||
|
*.iml
|
Binary file not shown.
Binary file not shown.
169
pom.xml
169
pom.xml
@ -1,90 +1,83 @@
|
|||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
<modelVersion>4.0.0</modelVersion>
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
<groupId>org.dynmap</groupId>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<artifactId>Dynmap-Factions</artifactId>
|
<groupId>org.dynmap</groupId>
|
||||||
<version>0.91</version>
|
<artifactId>Dynmap-Factions</artifactId>
|
||||||
<properties>
|
<version>0.92</version>
|
||||||
<timestamp>${maven.build.timestamp}</timestamp>
|
<properties>
|
||||||
<maven.build.timestamp.format>yyyyMMddHHmm</maven.build.timestamp.format>
|
<timestamp>${maven.build.timestamp}</timestamp>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<maven.build.timestamp.format>yyyyMMddHHmm</maven.build.timestamp.format>
|
||||||
<BUILD_NUMBER>Dev${timestamp}</BUILD_NUMBER>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
</properties>
|
<BUILD_NUMBER>Dev${timestamp}</BUILD_NUMBER>
|
||||||
|
</properties>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
<resources>
|
<resources>
|
||||||
<resource>
|
<resource>
|
||||||
<directory>src/main/resources</directory>
|
<directory>src/main/resources</directory>
|
||||||
<filtering>true</filtering>
|
<filtering>true</filtering>
|
||||||
<includes>
|
<includes>
|
||||||
<include>*.yml</include>
|
<include>*.yml</include>
|
||||||
<include>*.txt</include>
|
<include>*.txt</include>
|
||||||
</includes>
|
</includes>
|
||||||
</resource>
|
</resource>
|
||||||
<resource>
|
<resource>
|
||||||
<directory>src/main/resources</directory>
|
<directory>src/main/resources</directory>
|
||||||
<filtering>false</filtering>
|
<filtering>false</filtering>
|
||||||
<excludes>
|
<excludes>
|
||||||
<exclude>*.yml</exclude>
|
<exclude>*.yml</exclude>
|
||||||
<exclude>*.txt</exclude>
|
<exclude>*.txt</exclude>
|
||||||
</excludes>
|
</excludes>
|
||||||
</resource>
|
</resource>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
||||||
<plugins>
|
<plugins>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
<version>2.0.2</version>
|
<version>3.8.1</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<source>1.6</source>
|
<source>16</source>
|
||||||
<target>1.6</target>
|
<target>16</target>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
<repositories>
|
<repositories>
|
||||||
<repository>
|
<repository>
|
||||||
<releases>
|
<id>spigotmc-repo</id>
|
||||||
</releases>
|
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
|
||||||
<snapshots>
|
</repository>
|
||||||
</snapshots>
|
<repository>
|
||||||
<id>bukkit-repo</id>
|
<id>dynmap</id>
|
||||||
<url>http://repo.bukkit.org/content/repositories/releases/</url>
|
<url>https://repo.mikeprimm.com/</url>
|
||||||
</repository>
|
</repository>
|
||||||
<repository>
|
</repositories>
|
||||||
<releases>
|
|
||||||
</releases>
|
<dependencies>
|
||||||
<snapshots>
|
<dependency>
|
||||||
</snapshots>
|
<groupId>us.dynmap</groupId>
|
||||||
<id>dynmap-repo</id>
|
<artifactId>dynmap-api</artifactId>
|
||||||
<url>http://repo.mikeprimm.com/</url>
|
<version>3.6-SNAPSHOT</version>
|
||||||
</repository>
|
<scope>provided</scope>
|
||||||
</repositories>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
<dependencies>
|
<groupId>org.spigotmc</groupId>
|
||||||
<dependency>
|
<artifactId>spigot-api</artifactId>
|
||||||
<groupId>org.dynmap</groupId>
|
<version>1.20.6-R0.1-SNAPSHOT</version>
|
||||||
<artifactId>dynmap-api</artifactId>
|
<scope>provided</scope>
|
||||||
<version>1.9</version>
|
</dependency>
|
||||||
</dependency>
|
<dependency>
|
||||||
<dependency>
|
<groupId>com.massivecraft</groupId>
|
||||||
<groupId>org.bukkit</groupId>
|
<artifactId>Factions</artifactId>
|
||||||
<artifactId>bukkit</artifactId>
|
<version>3.3.3</version>
|
||||||
<version>1.7.10-R0.1-SNAPSHOT</version>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.massivecraft</groupId>
|
<groupId>com.massivecraft.massivecore</groupId>
|
||||||
<artifactId>Factions</artifactId>
|
<artifactId>MassiveCore</artifactId>
|
||||||
<version>2.7.1</version>
|
<version>3.3.3</version>
|
||||||
<scope>system</scope>
|
<scope>provided</scope>
|
||||||
<systemPath>${project.basedir}/Factions-2.7.1.jar</systemPath>
|
</dependency>
|
||||||
</dependency>
|
</dependencies>
|
||||||
<dependency>
|
|
||||||
<groupId>com.massivecraft</groupId>
|
|
||||||
<artifactId>MassiveCore</artifactId>
|
|
||||||
<version>2.7.1</version>
|
|
||||||
<scope>system</scope>
|
|
||||||
<systemPath>${project.basedir}/MassiveCore-2.7.1.jar</systemPath>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
</project>
|
</project>
|
@ -1,16 +0,0 @@
|
|||||||
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
|
|
||||||
<id>bin</id>
|
|
||||||
<includeBaseDirectory>false</includeBaseDirectory>
|
|
||||||
<formats>
|
|
||||||
<format>zip</format>
|
|
||||||
</formats>
|
|
||||||
<fileSets>
|
|
||||||
</fileSets>
|
|
||||||
<files>
|
|
||||||
<file>
|
|
||||||
<source>${project.build.directory}/${artifactId}-${version}.jar</source>
|
|
||||||
<outputDirectory>/</outputDirectory>
|
|
||||||
<destName>${artifactId}.jar</destName>
|
|
||||||
</file>
|
|
||||||
</files>
|
|
||||||
</assembly>
|
|
51
src/main/java/org/dynmap/factions/AreaStyle.java
Normal file
51
src/main/java/org/dynmap/factions/AreaStyle.java
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
package org.dynmap.factions;
|
||||||
|
|
||||||
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
|
import org.dynmap.markers.MarkerIcon;
|
||||||
|
|
||||||
|
class AreaStyle {
|
||||||
|
|
||||||
|
final String strokecolor;
|
||||||
|
final double strokeopacity;
|
||||||
|
final int strokeweight;
|
||||||
|
final String fillcolor;
|
||||||
|
final double fillopacity;
|
||||||
|
final String homemarker;
|
||||||
|
MarkerIcon homeicon;
|
||||||
|
final boolean boost;
|
||||||
|
|
||||||
|
AreaStyle(DynmapFactionsPlugin dynmapFactionsPlugin, FileConfiguration cfg, String path, AreaStyle def) {
|
||||||
|
strokecolor = cfg.getString(path + ".strokeColor", def.strokecolor);
|
||||||
|
strokeopacity = cfg.getDouble(path + ".strokeOpacity", def.strokeopacity);
|
||||||
|
strokeweight = cfg.getInt(path + ".strokeWeight", def.strokeweight);
|
||||||
|
fillcolor = cfg.getString(path + ".fillColor", def.fillcolor);
|
||||||
|
fillopacity = cfg.getDouble(path + ".fillOpacity", def.fillopacity);
|
||||||
|
homemarker = cfg.getString(path + ".homeicon", def.homemarker);
|
||||||
|
if (homemarker != null) {
|
||||||
|
homeicon = dynmapFactionsPlugin.markerapi.getMarkerIcon(homemarker);
|
||||||
|
if (homeicon == null) {
|
||||||
|
DynmapFactionsPlugin.severe("Invalid homeicon: " + homemarker);
|
||||||
|
homeicon = dynmapFactionsPlugin.markerapi.getMarkerIcon("blueicon");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
boost = cfg.getBoolean(path + ".boost", def.boost);
|
||||||
|
}
|
||||||
|
|
||||||
|
AreaStyle(DynmapFactionsPlugin dynmapFactionsPlugin, FileConfiguration cfg, String path) {
|
||||||
|
strokecolor = cfg.getString(path + ".strokeColor", "#FF0000");
|
||||||
|
strokeopacity = cfg.getDouble(path + ".strokeOpacity", 0.8);
|
||||||
|
strokeweight = cfg.getInt(path + ".strokeWeight", 3);
|
||||||
|
fillcolor = cfg.getString(path + ".fillColor", "#FF0000");
|
||||||
|
fillopacity = cfg.getDouble(path + ".fillOpacity", 0.35);
|
||||||
|
homemarker = cfg.getString(path + ".homeicon", null);
|
||||||
|
if (homemarker != null) {
|
||||||
|
homeicon = dynmapFactionsPlugin.markerapi.getMarkerIcon(homemarker);
|
||||||
|
if (homeicon == null) {
|
||||||
|
DynmapFactionsPlugin.severe("Invalid homeicon: " + homemarker);
|
||||||
|
homeicon = dynmapFactionsPlugin.markerapi.getMarkerIcon("blueicon");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
boost = cfg.getBoolean(path + ".boost", false);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
10
src/main/java/org/dynmap/factions/Direction.java
Normal file
10
src/main/java/org/dynmap/factions/Direction.java
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
package org.dynmap.factions;
|
||||||
|
|
||||||
|
public enum Direction {
|
||||||
|
|
||||||
|
XPLUS,
|
||||||
|
ZPLUS,
|
||||||
|
XMINUS,
|
||||||
|
ZMINUS
|
||||||
|
|
||||||
|
}
|
File diff suppressed because it is too large
Load Diff
4
src/main/java/org/dynmap/factions/FactionBlock.java
Normal file
4
src/main/java/org/dynmap/factions/FactionBlock.java
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
package org.dynmap.factions;
|
||||||
|
|
||||||
|
public record FactionBlock(int x, int z) {
|
||||||
|
}
|
11
src/main/java/org/dynmap/factions/FactionBlocks.java
Normal file
11
src/main/java/org/dynmap/factions/FactionBlocks.java
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
package org.dynmap.factions;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.LinkedList;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public class FactionBlocks {
|
||||||
|
|
||||||
|
final Map<String, LinkedList<FactionBlock>> blocks = new HashMap<>();
|
||||||
|
|
||||||
|
}
|
26
src/main/java/org/dynmap/factions/FactionsUpdate.java
Normal file
26
src/main/java/org/dynmap/factions/FactionsUpdate.java
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
package org.dynmap.factions;
|
||||||
|
|
||||||
|
public class FactionsUpdate implements Runnable {
|
||||||
|
|
||||||
|
private final DynmapFactionsPlugin dynmapFactionsPlugin;
|
||||||
|
public boolean runonce;
|
||||||
|
|
||||||
|
public FactionsUpdate(DynmapFactionsPlugin dynmapFactionsPlugin) {
|
||||||
|
this.dynmapFactionsPlugin = dynmapFactionsPlugin;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void run() {
|
||||||
|
if (dynmapFactionsPlugin.stop) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
dynmapFactionsPlugin.updateFactions();
|
||||||
|
if (!runonce) {
|
||||||
|
dynmapFactionsPlugin.getServer().getScheduler().scheduleSyncDelayedTask(dynmapFactionsPlugin,
|
||||||
|
this, dynmapFactionsPlugin.updperiod);
|
||||||
|
} else if (dynmapFactionsPlugin.pending == this) {
|
||||||
|
dynmapFactionsPlugin.pending = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -45,6 +45,7 @@ import java.net.Proxy;
|
|||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.net.URLConnection;
|
import java.net.URLConnection;
|
||||||
import java.net.URLEncoder;
|
import java.net.URLEncoder;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
@ -193,16 +194,11 @@ public class MetricsLite {
|
|||||||
* @return true if metrics should be opted out of it
|
* @return true if metrics should be opted out of it
|
||||||
*/
|
*/
|
||||||
public boolean isOptOut() {
|
public boolean isOptOut() {
|
||||||
synchronized(optOutLock) {
|
synchronized (optOutLock) {
|
||||||
try {
|
try {
|
||||||
// Reload the metrics file
|
// Reload the metrics file
|
||||||
configuration.load(getConfigFile());
|
configuration.load(getConfigFile());
|
||||||
} catch (IOException ex) {
|
} catch (IOException | InvalidConfigurationException ex) {
|
||||||
if (debug) {
|
|
||||||
Bukkit.getLogger().log(Level.INFO, "[Metrics] " + ex.getMessage());
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
} catch (InvalidConfigurationException ex) {
|
|
||||||
if (debug) {
|
if (debug) {
|
||||||
Bukkit.getLogger().log(Level.INFO, "[Metrics] " + ex.getMessage());
|
Bukkit.getLogger().log(Level.INFO, "[Metrics] " + ex.getMessage());
|
||||||
}
|
}
|
||||||
@ -378,10 +374,10 @@ public class MetricsLite {
|
|||||||
* </code>
|
* </code>
|
||||||
*
|
*
|
||||||
* @param buffer the stringbuilder to append the data pair onto
|
* @param buffer the stringbuilder to append the data pair onto
|
||||||
* @param key the key value
|
* @param key the key value
|
||||||
* @param value the value
|
* @param value the value
|
||||||
*/
|
*/
|
||||||
private static void encodeDataPair(final StringBuilder buffer, final String key, final String value) throws UnsupportedEncodingException {
|
private static void encodeDataPair(final StringBuilder buffer, final String key, final String value) {
|
||||||
buffer.append('&').append(encode(key)).append('=').append(encode(value));
|
buffer.append('&').append(encode(key)).append('=').append(encode(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -391,8 +387,8 @@ public class MetricsLite {
|
|||||||
* @param text the text to encode
|
* @param text the text to encode
|
||||||
* @return the encoded text, as UTF-8
|
* @return the encoded text, as UTF-8
|
||||||
*/
|
*/
|
||||||
private static String encode(final String text) throws UnsupportedEncodingException {
|
private static String encode(final String text) {
|
||||||
return URLEncoder.encode(text, "UTF-8");
|
return URLEncoder.encode(text, StandardCharsets.UTF_8);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
111
src/main/java/org/dynmap/factions/OurServerListener.java
Normal file
111
src/main/java/org/dynmap/factions/OurServerListener.java
Normal file
@ -0,0 +1,111 @@
|
|||||||
|
package org.dynmap.factions;
|
||||||
|
|
||||||
|
import com.massivecraft.factions.entity.Faction;
|
||||||
|
import com.massivecraft.factions.event.EventFactionsChunksChange;
|
||||||
|
import com.massivecraft.factions.event.EventFactionsCreate;
|
||||||
|
import com.massivecraft.factions.event.EventFactionsDisband;
|
||||||
|
import com.massivecraft.factions.event.EventFactionsMembershipChange;
|
||||||
|
import com.massivecraft.factions.event.EventFactionsNameChange;
|
||||||
|
import com.massivecraft.factions.event.EventFactionsWarpAdd;
|
||||||
|
import com.massivecraft.factions.event.EventFactionsWarpRemove;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.EventPriority;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
|
import org.bukkit.event.server.PluginEnableEvent;
|
||||||
|
import org.bukkit.plugin.Plugin;
|
||||||
|
|
||||||
|
class OurServerListener implements Listener {
|
||||||
|
private final DynmapFactionsPlugin dynmapFactionsPlugin;
|
||||||
|
|
||||||
|
public OurServerListener(DynmapFactionsPlugin dynmapFactionsPlugin) {
|
||||||
|
this.dynmapFactionsPlugin = dynmapFactionsPlugin;
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onPluginEnable(PluginEnableEvent event) {
|
||||||
|
Plugin p = event.getPlugin();
|
||||||
|
String name = p.getDescription().getName();
|
||||||
|
if (name.equals("dynmap") || name.equals("Factions")) {
|
||||||
|
if (dynmapFactionsPlugin.dynmap.isEnabled() && dynmapFactionsPlugin.factions.isEnabled()) {
|
||||||
|
dynmapFactionsPlugin.activate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler(priority = EventPriority.MONITOR)
|
||||||
|
public void onFPlayerJoin(EventFactionsMembershipChange event) {
|
||||||
|
if (event.isCancelled()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (dynmapFactionsPlugin.playersets) {
|
||||||
|
Faction f = event.getNewFaction();
|
||||||
|
dynmapFactionsPlugin.requestUpdatePlayerSet(f.getId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler(priority = EventPriority.MONITOR)
|
||||||
|
public void onFactionCreate(EventFactionsCreate event) {
|
||||||
|
if (event.isCancelled()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (dynmapFactionsPlugin.playersets) {
|
||||||
|
dynmapFactionsPlugin.requestUpdatePlayerSet(event.getFactionId());
|
||||||
|
}
|
||||||
|
requestUpdateFactions();
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler(priority = EventPriority.MONITOR)
|
||||||
|
public void onFactionDisband(EventFactionsDisband event) {
|
||||||
|
if (event.isCancelled()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (dynmapFactionsPlugin.playersets) {
|
||||||
|
Faction f = event.getFaction();
|
||||||
|
dynmapFactionsPlugin.requestUpdatePlayerSet(f.getId());
|
||||||
|
}
|
||||||
|
requestUpdateFactions();
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler(priority = EventPriority.MONITOR)
|
||||||
|
public void onFactionRename(EventFactionsNameChange event) {
|
||||||
|
if (event.isCancelled()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
requestUpdateFactions();
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler(priority = EventPriority.MONITOR)
|
||||||
|
public void onFactionRename(EventFactionsWarpAdd event) {
|
||||||
|
if (event.isCancelled()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
requestUpdateFactions();
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler(priority = EventPriority.MONITOR)
|
||||||
|
public void onFactionRename(EventFactionsWarpRemove event) {
|
||||||
|
if (event.isCancelled()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
requestUpdateFactions();
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler(priority = EventPriority.MONITOR)
|
||||||
|
public void onFactionRename(EventFactionsChunksChange event) {
|
||||||
|
if (event.isCancelled()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
requestUpdateFactions();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void requestUpdateFactions() {
|
||||||
|
if (DynmapFactionsPlugin.instance.pending == null) {
|
||||||
|
FactionsUpdate upd = new FactionsUpdate(DynmapFactionsPlugin.instance);
|
||||||
|
upd.runonce = true;
|
||||||
|
DynmapFactionsPlugin.instance.pending = upd;
|
||||||
|
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(DynmapFactionsPlugin.instance, upd, 20);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
17
src/main/java/org/dynmap/factions/PlayerSetUpdate.java
Normal file
17
src/main/java/org/dynmap/factions/PlayerSetUpdate.java
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
package org.dynmap.factions;
|
||||||
|
|
||||||
|
class PlayerSetUpdate implements Runnable {
|
||||||
|
private final DynmapFactionsPlugin dynmapFactionsPlugin;
|
||||||
|
public final String faction;
|
||||||
|
|
||||||
|
public PlayerSetUpdate(DynmapFactionsPlugin dynmapFactionsPlugin, String fid) {
|
||||||
|
this.dynmapFactionsPlugin = dynmapFactionsPlugin;
|
||||||
|
faction = fid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void run() {
|
||||||
|
if (!dynmapFactionsPlugin.stop) {
|
||||||
|
dynmapFactionsPlugin.updatePlayerSet(faction);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,67 +1,67 @@
|
|||||||
package org.dynmap.factions;
|
package org.dynmap.factions;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* scalable flags primitive - used for keeping track of potentially huge number of tiles
|
* scalable flags primitive - used for keeping track of potentially huge number of tiles
|
||||||
*
|
* <p>
|
||||||
* Represents a flag for each tile, with 2D coordinates based on 0,0 origin. Flags are grouped
|
* Represents a flag for each tile, with 2D coordinates based on 0,0 origin. Flags are grouped
|
||||||
* 64 x 64, represented by an array of 64 longs. Each set is stored in a hashmap, keyed by a long
|
* 64 x 64, represented by an array of 64 longs. Each set is stored in a hashmap, keyed by a long
|
||||||
* computed by ((x/64)<<32)+(y/64).
|
* computed by ((x/64)<<32)+(y/64).
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class TileFlags {
|
public class TileFlags {
|
||||||
private HashMap<Long, long[]> chunkmap = new HashMap<Long, long[]>();
|
private final Map<Long, long[]> chunkMap = new HashMap<>();
|
||||||
private long last_key = Long.MAX_VALUE;
|
private long last_key = Long.MAX_VALUE;
|
||||||
private long[] last_row;
|
private long[] last_row;
|
||||||
|
|
||||||
public TileFlags() {
|
public TileFlags() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean getFlag(int x, int y) {
|
public boolean getFlag(int x, int y) {
|
||||||
long k = (((long)(x >> 6)) << 32) | (0xFFFFFFFFL & (long)(y >> 6));
|
long k = (((long) (x >> 6)) << 32) | (0xFFFFFFFFL & (long) (y >> 6));
|
||||||
long[] row;
|
long[] row;
|
||||||
if(k == last_key) {
|
if (k == last_key) {
|
||||||
row = last_row;
|
row = last_row;
|
||||||
}
|
} else {
|
||||||
else {
|
row = chunkMap.get(k);
|
||||||
row = chunkmap.get(k);
|
last_key = k;
|
||||||
last_key = k;
|
last_row = row;
|
||||||
last_row = row;
|
}
|
||||||
}
|
if (row == null) {
|
||||||
if(row == null)
|
return false;
|
||||||
return false;
|
} else {
|
||||||
else
|
return (row[y & 0x3F] & (1L << (x & 0x3F))) != 0;
|
||||||
return (row[y & 0x3F] & (1L << (x & 0x3F))) != 0;
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setFlag(int x, int y, boolean f) {
|
public void setFlag(int x, int y, boolean f) {
|
||||||
long k = (((long)(x >> 6)) << 32) | (0xFFFFFFFFL & (long)(y >> 6));
|
long k = (((long) (x >> 6)) << 32) | (0xFFFFFFFFL & (long) (y >> 6));
|
||||||
long[] row;
|
long[] row;
|
||||||
if(k == last_key) {
|
if (k == last_key) {
|
||||||
row = last_row;
|
row = last_row;
|
||||||
}
|
} else {
|
||||||
else {
|
row = chunkMap.get(k);
|
||||||
row = chunkmap.get(k);
|
last_key = k;
|
||||||
last_key = k;
|
last_row = row;
|
||||||
last_row = row;
|
}
|
||||||
}
|
if (f) {
|
||||||
if(f) {
|
if (row == null) {
|
||||||
if(row == null) {
|
row = new long[64];
|
||||||
row = new long[64];
|
chunkMap.put(k, row);
|
||||||
chunkmap.put(k, row);
|
last_row = row;
|
||||||
last_row = row;
|
}
|
||||||
}
|
row[y & 0x3F] |= (1L << (x & 0x3F));
|
||||||
row[y & 0x3F] |= (1L << (x & 0x3F));
|
} else {
|
||||||
}
|
if (row != null) {
|
||||||
else {
|
row[y & 0x3F] &= ~(1L << (x & 0x3F));
|
||||||
if(row != null)
|
}
|
||||||
row[y & 0x3F] &= ~(1L << (x & 0x3F));
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
public void clear() {
|
public void clear() {
|
||||||
chunkmap.clear();
|
chunkMap.clear();
|
||||||
last_row = null;
|
last_row = null;
|
||||||
last_key = Long.MAX_VALUE;
|
last_key = Long.MAX_VALUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@ layer:
|
|||||||
layerprio: 2
|
layerprio: 2
|
||||||
# (optional) set minimum zoom level before layer is visible (0 = defalt, always visible)
|
# (optional) set minimum zoom level before layer is visible (0 = defalt, always visible)
|
||||||
minzoom: 0
|
minzoom: 0
|
||||||
|
|
||||||
# Format for popup - substitute values for macros
|
# Format for popup - substitute values for macros
|
||||||
infowindow: '<div class="infowindow"><span style="font-size:120%;">%regionname%</span><br />Flags<br /><span style="font-weight:bold;">%flags%</span></div>'
|
infowindow: '<div class="infowindow"><span style="font-size:120%;">%regionname%</span><br />Flags<br /><span style="font-weight:bold;">%flags%</span></div>'
|
||||||
|
|
||||||
@ -27,15 +27,15 @@ regionstyle:
|
|||||||
fillOpacity: 0.35
|
fillOpacity: 0.35
|
||||||
homeicon: "redflag"
|
homeicon: "redflag"
|
||||||
boost: false
|
boost: false
|
||||||
|
|
||||||
# Optional setting to limit which regions to show, by name - if commented out, all regions are shown
|
# Optional setting to limit which regions to show, by name - if commented out, all regions are shown
|
||||||
# To show all regions on a given world, add 'world:<worldname>' to the list
|
# To show all regions on a given world, add 'world:<worldname>' to the list
|
||||||
visibleregions: [ ]
|
visibleregions: [ ]
|
||||||
|
|
||||||
# Optional setting to hide specific regions, by name
|
# Optional setting to hide specific regions, by name
|
||||||
# To hide all regions on a given world, add 'world:<worldname>' to the list
|
# To hide all regions on a given world, add 'world:<worldname>' to the list
|
||||||
hiddenregions: [ ]
|
hiddenregions: [ ]
|
||||||
|
|
||||||
# Optional per-region overrides for regionstyle (any defined replace those in regionstyle)
|
# Optional per-region overrides for regionstyle (any defined replace those in regionstyle)
|
||||||
custstyle:
|
custstyle:
|
||||||
SafeZone:
|
SafeZone:
|
||||||
|
Loading…
Reference in New Issue
Block a user