Skip to content

Commit

Permalink
Support 1.16.4 (#5)
Browse files Browse the repository at this point in the history
* Remove metrics

* Refactoring, huge changes to code

* Clean up, refactoring

* Move AreaStyle class to a separate file

* Package rename

* Fix package name

* Fixed OfflinePlayers UUID conversion, updated to 1.16.4
  • Loading branch information
DmitryRendov authored Jan 3, 2021
1 parent 713c5ea commit c686740
Show file tree
Hide file tree
Showing 17 changed files with 421 additions and 1,337 deletions.
12 changes: 6 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>jahan.khan.jdynmapgriefprevention</groupId>
<groupId>jahan.khan</groupId>
<artifactId>JDynmapGriefPrevention</artifactId>
<version>3.3.1-SNAPSHOT</version>
<version>3.6.1</version>
<packaging>jar</packaging>
<name>JDynmapGriefPrevention</name>
<description>JDynmapGriefPrevention.</description>
Expand All @@ -19,19 +19,19 @@
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.15.2-R0.1-SNAPSHOT</version>
<version>1.16.4-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.github.TechFortress</groupId>
<artifactId>GriefPrevention</artifactId>
<version>16.12.0</version>
<version>16.16.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>us.dynmap</groupId>
<artifactId>dynmap-api</artifactId>
<version>3.0-SNAPSHOT</version>
<version>3.0-beta-10</version>
</dependency>
</dependencies>

Expand Down Expand Up @@ -59,7 +59,7 @@
<build>
<defaultGoal>clean package</defaultGoal>
<finalName>${project.name}${project.version}</finalName>
<sourceDirectory>${basedir}/src</sourceDirectory>
<sourceDirectory>${basedir}/src/main/java</sourceDirectory>
<resources>
<resource>
<filtering>true</filtering>
Expand Down
30 changes: 30 additions & 0 deletions src/main/java/jahan/khan/jdynmapgriefprevention/AreaStyle.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package jahan.khan.JDynmapGriefPrevention;

import org.bukkit.configuration.file.FileConfiguration;

class AreaStyle {
final String strokecolor;

final double strokeopacity;
final int strokeweight;
final String fillcolor;
final double fillopacity;
String label;

AreaStyle(FileConfiguration cfg, String path, AreaStyle def) {
this.strokecolor = cfg.getString(path + ".strokeColor", def.strokecolor);
this.strokeopacity = cfg.getDouble(path + ".strokeOpacity", def.strokeopacity);
this.strokeweight = cfg.getInt(path + ".strokeWeight", def.strokeweight);
this.fillcolor = cfg.getString(path + ".fillColor", def.fillcolor);
this.fillopacity = cfg.getDouble(path + ".fillOpacity", def.fillopacity);
this.label = cfg.getString(path + ".label", null);
}

AreaStyle(FileConfiguration cfg) {
this.strokecolor = cfg.getString("regionstyle" + ".strokeColor", "#FF0000");
this.strokeopacity = cfg.getDouble("regionstyle" + ".strokeOpacity", 0.8D);
this.strokeweight = cfg.getInt("regionstyle" + ".strokeWeight", 3);
this.fillcolor = cfg.getString("regionstyle" + ".fillColor", "#FF0000");
this.fillopacity = cfg.getDouble("regionstyle" + ".fillOpacity", 0.35D);
}
}
75 changes: 39 additions & 36 deletions src/main/java/jahan/khan/jdynmapgriefprevention/CSVFile.java
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
package jahan.khan.jdynmapgriefprevention;
package jahan.khan.JDynmapGriefPrevention;

import java.io.FileWriter;
import java.io.IOException;
import java.util.UUID;

import me.ryanhamshire.GriefPrevention.Claim;
import org.bukkit.command.CommandSender;
import me.ryanhamshire.GriefPrevention.Claim;
import jahan.khan.JDynmapGriefPrevention.ClaimInfo;
import static jahan.khan.JDynmapGriefPrevention.JDynmapGriefPrevention.*;


public class CSVFile {
final org.bukkit.plugin.java.JavaPlugin plugin;
private JDynmapGriefPrevention jdgp;
CommandSender sender;
private String claims_filename;
private String stats_filename;
class CSVFile {
private final org.bukkit.plugin.java.JavaPlugin plugin;
private final JDynmapGriefPrevention jdgp;
private final CommandSender sender;
private final String claims_filename;
private final String stats_filename;
final String delim = "|";

public CSVFile(JDynmapGriefPrevention plugin, CommandSender sender) {
Expand All @@ -24,7 +27,7 @@ public CSVFile(JDynmapGriefPrevention plugin, CommandSender sender) {
}

protected void generate() {
this.jdgp.getServer().getScheduler().scheduleAsyncDelayedTask(this.jdgp, new Runnable() {
this.jdgp.getServer().getScheduler().runTaskLaterAsynchronously(this.jdgp, new Runnable() {
public void run() {
try {
FileWriter writer = new FileWriter(CSVFile.this.claims_filename);
Expand All @@ -49,7 +52,7 @@ public void run() {
writer.append("|");
writer.append("OwnerOfflineDays");
writer.append("|");
writer.append("OverLimit (" + JDynmapGriefPrevention.absenceDayLimit + " days)");
writer.append("OverLimit (").append(String.valueOf(JDynmapGriefPrevention.absenceDayLimit)).append(" days)");
writer.append("|");
writer.append("StillUsedByOthers(Trusted)");
writer.append("|");
Expand Down Expand Up @@ -78,14 +81,14 @@ public void run() {

ClaimInfo hci;

for (int i = 0; i < JDynmapGriefPrevention.claimsInfo.size(); i++) {
hci = (ClaimInfo) JDynmapGriefPrevention.claimsInfo.get(i);
for (int i = 0; i < claimsInfo.size(); i++) {
hci = (ClaimInfo) claimsInfo.get(i);
Claim claim = hci.claim;
String owner = hci.owner;
String wname = hci.wname;
Integer ownerdays = Integer.valueOf(hci.ownerdays);
Boolean playerLongAgo = Boolean.valueOf(hci.playerLongAgo);
Boolean claimUsed = Boolean.valueOf(hci.claimUsed);
int ownerdays = hci.ownerdays;
Boolean playerLongAgo = hci.playerLongAgo;
Boolean claimUsed = hci.claimUsed;

UUID uuidowner = hci.ownerUuid;
String uuid;
Expand All @@ -98,14 +101,14 @@ public void run() {
if (claimID == null) {
claimID = "Subclaim";
}
Integer cwidth = Integer.valueOf(hci.cwidth);
Integer cheight = Integer.valueOf(hci.cheight);
Integer csize = Integer.valueOf(hci.csize);
Integer cwidth = hci.cwidth;
Integer cheight = hci.cheight;
Integer csize = hci.csize;
String coords = hci.coords;
String coordx = hci.coordx;
String coordy = hci.coordy;
String coordz = hci.coordz;
Boolean publictrust = Boolean.valueOf(hci.publictrust);
Boolean publictrust = hci.publictrust;
String stringBuilders = hci.stringBuilders;
String stringContainers = hci.stringContainers;
String stringAccessors = hci.stringAccessors;
Expand Down Expand Up @@ -138,7 +141,7 @@ public void run() {
writer.append("|");
writer.append(owner);
writer.append("|");
writer.append(ownerdays.toString());
writer.append(Integer.toString(ownerdays));
writer.append("|");
writer.append(playerLongAgo.toString());
writer.append("|");
Expand All @@ -152,11 +155,11 @@ public void run() {
writer.append("|");
writer.append(publictrust.toString());
writer.append("|");
writer.append("/jdgp tp " + claimID);
writer.append("/jdgp tp ").append(claimID);
writer.append("|");
writer.append("/jdgp tp " + coordx + " " + coordz);
writer.append("/jdgp tp ").append(coordx).append(" ").append(coordz);
writer.append("|");
writer.append("/tppos " + coordx + " " + coordy + " " + coordz);
writer.append("/tppos ").append(coordx).append(" ").append(coordy).append(" ").append(coordz);
writer.append("|");
writer.append(stringBuilders);
writer.append("|");
Expand Down Expand Up @@ -199,37 +202,37 @@ public void run() {
writer.append("|");
writer.append('\n');

writer.append(String.valueOf(CSVFile.this.jdgp.numOwners));
writer.append(String.valueOf(CSVFile.this.jdgp.getNumOwners()));
writer.append("|");
writer.append(String.valueOf(CSVFile.this.jdgp.sz));
writer.append(String.valueOf(CSVFile.this.jdgp.getSz()));
writer.append("|");
writer.append(String.valueOf(CSVFile.this.jdgp.idx - CSVFile.this.jdgp.sz));
writer.append(String.valueOf(CSVFile.this.jdgp.getIdx() - CSVFile.this.jdgp.getSz()));
writer.append("|");
writer.append(String.valueOf(CSVFile.this.jdgp.countused));
writer.append(String.valueOf(CSVFile.this.jdgp.getCountUsed()));
writer.append("|");
writer.append(String.valueOf(CSVFile.this.jdgp.countadmin));
writer.append(String.valueOf(CSVFile.this.jdgp.getCountadmin()));
writer.append("|");
writer.append(String.valueOf(CSVFile.this.jdgp.countnormal));
writer.append(String.valueOf(CSVFile.this.jdgp.getCountNormal()));
writer.append("|");
writer.append(String.valueOf(CSVFile.this.jdgp.countbuilder));
writer.append(String.valueOf(CSVFile.this.jdgp.getCountbuilder()));
writer.append("|");
writer.append(String.valueOf(CSVFile.this.jdgp.countunused));
writer.append(String.valueOf(CSVFile.this.jdgp.getCountUnused()));
writer.append("|");
writer.append(String.valueOf(CSVFile.this.jdgp.numBuilders));
writer.append(String.valueOf(CSVFile.this.jdgp.getNumBuilders()));
writer.append("|");
writer.append(String.valueOf(CSVFile.this.jdgp.numContainers));
writer.append(String.valueOf(CSVFile.this.jdgp.getNumContainers()));
writer.append("|");
writer.append(String.valueOf(CSVFile.this.jdgp.numAccessors));
writer.append(String.valueOf(CSVFile.this.jdgp.getNumAccessors()));
writer.append("|");
writer.append(String.valueOf(CSVFile.this.jdgp.numManagers));
writer.append(String.valueOf(CSVFile.this.jdgp.getNumManagers()));
writer.append("|");
writer.append('\n');

writer.flush();
writer.close();

CSVFile.this.sender
.sendMessage(JDynmapGriefPrevention.jdgpMessages.getString("command.export.success"));
.sendMessage(jdgpMessages.getString("command.export.success"));

} catch (IOException e) {
e.printStackTrace();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package jahan.khan.jdynmapgriefprevention;
package jahan.khan.JDynmapGriefPrevention;

import java.util.UUID;

Expand Down
Loading

0 comments on commit c686740

Please sign in to comment.