Updated to 1.18.1, and other small things.
This commit is contained in:
parent
30041b6210
commit
dabfb89163
8 changed files with 26 additions and 25 deletions
16
pom.xml
16
pom.xml
|
@ -32,7 +32,7 @@
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
<version>3.9.0-SNAPSHOT</version>
|
<version>3.9.0-SNAPSHOT</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<release>16</release>
|
<release>17</release>
|
||||||
<compilerArgs>
|
<compilerArgs>
|
||||||
<arg>-parameters</arg>
|
<arg>-parameters</arg>
|
||||||
</compilerArgs>
|
</compilerArgs>
|
||||||
|
@ -107,16 +107,10 @@
|
||||||
</repositories>
|
</repositories>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
|
||||||
<groupId>org.bukkit</groupId>
|
|
||||||
<artifactId>craftbukkit</artifactId>
|
|
||||||
<version>1.17.1-R0.1-SNAPSHOT</version>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.spigotmc</groupId>
|
<groupId>org.spigotmc</groupId>
|
||||||
<artifactId>spigot-api</artifactId>
|
<artifactId>spigot-api</artifactId>
|
||||||
<version>1.17.1-R0.1-SNAPSHOT</version>
|
<version>1.18.1-R0.1-SNAPSHOT</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -128,7 +122,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.jetbrains</groupId>
|
<groupId>org.jetbrains</groupId>
|
||||||
<artifactId>annotations</artifactId>
|
<artifactId>annotations</artifactId>
|
||||||
<version>21.0.1</version>
|
<version>22.0.0</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -140,12 +134,12 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.github.cryptomorin</groupId>
|
<groupId>com.github.cryptomorin</groupId>
|
||||||
<artifactId>XSeries</artifactId>
|
<artifactId>XSeries</artifactId>
|
||||||
<version>8.2.0</version>
|
<version>8.6.1</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.github.fierioziy.particlenativeapi</groupId>
|
<groupId>com.github.fierioziy.particlenativeapi</groupId>
|
||||||
<artifactId>ParticleNativeAPI-plugin</artifactId>
|
<artifactId>ParticleNativeAPI-plugin</artifactId>
|
||||||
<version>3.1.0</version>
|
<version>3.2.0</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|
|
@ -31,8 +31,8 @@ public class ShowAPI implements API, Listener {
|
||||||
//This gets called either by #initAPI above or #initAPI in one of the requiring plugins
|
//This gets called either by #initAPI above or #initAPI in one of the requiring plugins
|
||||||
@Override
|
@Override
|
||||||
public void init(Plugin plugin) {
|
public void init(Plugin plugin) {
|
||||||
if (VersionUtil.getVersion() < 9 || VersionUtil.getVersion() > 16) {
|
if (VersionUtil.getVersion() < 9 || VersionUtil.getVersion() > 17) {
|
||||||
logger.severe("Deze API werkt alleen tussen 1.9.x en 1.16.x.");
|
logger.severe("Deze API werkt alleen tussen 1.9.x en 1.17.x.");
|
||||||
disable(plugin);
|
disable(plugin);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@ public enum TriggerType {
|
||||||
FIREWORK(FireworkTrigger.class, 6),
|
FIREWORK(FireworkTrigger.class, 6),
|
||||||
FAKE_FIREWORK(FakeFireworkTrigger.class, 7),
|
FAKE_FIREWORK(FakeFireworkTrigger.class, 7),
|
||||||
SPOT(SpotTrigger.class, 6),
|
SPOT(SpotTrigger.class, 6),
|
||||||
// LASER(LaserTrigger.class, 6),
|
LASER(LaserTrigger.class, 6),
|
||||||
ANIMA(AnimaTrigger.class, 2),
|
ANIMA(AnimaTrigger.class, 2),
|
||||||
PARTICLE(ParticleTrigger.class, 7);
|
PARTICLE(ParticleTrigger.class, 7);
|
||||||
|
|
||||||
|
|
|
@ -13,8 +13,7 @@ public class LaserTrigger extends TriggerTask {
|
||||||
|
|
||||||
//TODO Fix laser for 1.17
|
//TODO Fix laser for 1.17
|
||||||
public LaserTrigger(String[] data) {
|
public LaserTrigger(String[] data) {
|
||||||
//super(TriggerType.LASER, data);
|
super(TriggerType.LASER, data);
|
||||||
super(null, data);
|
|
||||||
|
|
||||||
this.name = data[0];
|
this.name = data[0];
|
||||||
|
|
||||||
|
@ -45,7 +44,8 @@ public class LaserTrigger extends TriggerTask {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void trigger() {
|
public void trigger() {
|
||||||
ShowAPI.Lasers.move(name, newLocation);
|
Bukkit.broadcastMessage("[ShowAPI] De trigger " + name + " is genegeerd, omdat de LASER is disabled.");
|
||||||
|
// ShowAPI.Lasers.move(name, newLocation);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -43,7 +43,8 @@ public class SpotTrigger extends TriggerTask {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void trigger() {
|
public void trigger() {
|
||||||
ShowAPI.Spots.move(name, newLocation);
|
// ShowAPI.Spots.move(name, newLocation);
|
||||||
|
Bukkit.broadcastMessage("[ShowAPI] De trigger " + name + " is genegeerd, omdat de SPOT is disabled.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -5,7 +5,6 @@ import nl.sbdeveloper.showapi.api.ShowCue;
|
||||||
import nl.sbdeveloper.showapi.api.TriggerTask;
|
import nl.sbdeveloper.showapi.api.TriggerTask;
|
||||||
import nl.sbdeveloper.showapi.utils.MainUtil;
|
import nl.sbdeveloper.showapi.utils.MainUtil;
|
||||||
import nl.sbdeveloper.showapi.utils.YamlFile;
|
import nl.sbdeveloper.showapi.utils.YamlFile;
|
||||||
import org.bukkit.craftbukkit.libs.org.apache.commons.io.FilenameUtils;
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
@ -20,7 +19,7 @@ public class DataSaving {
|
||||||
public static void load() {
|
public static void load() {
|
||||||
File showsFolder = new File(ShowAPIPlugin.getInstance().getDataFolder(), "data");
|
File showsFolder = new File(ShowAPIPlugin.getInstance().getDataFolder(), "data");
|
||||||
for (File showFile : showsFolder.listFiles()) {
|
for (File showFile : showsFolder.listFiles()) {
|
||||||
String showID = FilenameUtils.removeExtension(showFile.getName());
|
String showID = removeExtension(showFile.getName());
|
||||||
YamlFile showConfig = new YamlFile("data/" + showID);
|
YamlFile showConfig = new YamlFile("data/" + showID);
|
||||||
files.put(showID, showConfig);
|
files.put(showID, showConfig);
|
||||||
|
|
||||||
|
@ -38,13 +37,20 @@ public class DataSaving {
|
||||||
|
|
||||||
public static void save() {
|
public static void save() {
|
||||||
for (Map.Entry<String, List<ShowCue>> entry : Shows.getShowsMap().entrySet()) {
|
for (Map.Entry<String, List<ShowCue>> entry : Shows.getShowsMap().entrySet()) {
|
||||||
YamlFile file = files.get(entry.getKey());
|
YamlFile file = files.containsKey(entry.getKey()) ? files.get(entry.getKey()) : new YamlFile("data/" + entry.getKey());
|
||||||
for (ShowCue cue : entry.getValue()) {
|
for (ShowCue cue : entry.getValue()) {
|
||||||
file.getFile().set(cue.getCueID().toString() + ".Time", cue.getTime());
|
file.getFile().set(cue.getCueID().toString() + ".Time", cue.getTime());
|
||||||
file.getFile().set(cue.getCueID().toString() + ".Type", cue.getTask().getType().name());
|
file.getFile().set(cue.getCueID().toString() + ".Type", cue.getTask().getType().name());
|
||||||
file.getFile().set(cue.getCueID().toString() + ".Data", cue.getTask().getDataString());
|
file.getFile().set(cue.getCueID().toString() + ".Data", cue.getTask().getDataString());
|
||||||
}
|
}
|
||||||
file.saveFile();
|
file.saveFile();
|
||||||
|
|
||||||
|
if (!files.containsKey(entry.getKey())) files.put(entry.getKey(), file);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static String removeExtension(String fileName) {
|
||||||
|
int lastDot = fileName.lastIndexOf(".");
|
||||||
|
return (lastDot == -1 ? fileName : fileName.substring(0, lastDot));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,8 @@ public class Shows {
|
||||||
|
|
||||||
public static void create(String name) {
|
public static void create(String name) {
|
||||||
showsMap.put(name, new ArrayList<>());
|
showsMap.put(name, new ArrayList<>());
|
||||||
Bukkit.getScheduler().runTaskAsynchronously(ShowAPIPlugin.getInstance(), DataSaving::save);
|
DataSaving.save();
|
||||||
|
// Bukkit.getScheduler().runTaskAsynchronously(ShowAPIPlugin.getInstance(), DataSaving::save);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void delete(String name) {
|
public static void delete(String name) {
|
||||||
|
@ -42,7 +43,8 @@ public class Shows {
|
||||||
public static void addPoint(String name, Long time, TriggerTask data) {
|
public static void addPoint(String name, Long time, TriggerTask data) {
|
||||||
if (!exists(name)) return;
|
if (!exists(name)) return;
|
||||||
getPoints(name).add(new ShowCue(time, data));
|
getPoints(name).add(new ShowCue(time, data));
|
||||||
Bukkit.getScheduler().runTaskAsynchronously(ShowAPIPlugin.getInstance(), DataSaving::save);
|
DataSaving.save();
|
||||||
|
// Bukkit.getScheduler().runTaskAsynchronously(ShowAPIPlugin.getInstance(), DataSaving::save);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void removePoint(String name, ShowCue point) {
|
public static void removePoint(String name, ShowCue point) {
|
||||||
|
|
|
@ -13,8 +13,6 @@ import java.nio.charset.StandardCharsets;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
public class YamlFile {
|
public class YamlFile {
|
||||||
//SBYamlFile file = new SBYamlFile(this, "data");
|
|
||||||
|
|
||||||
private FileConfiguration fileConfiguration;
|
private FileConfiguration fileConfiguration;
|
||||||
private File file;
|
private File file;
|
||||||
private final String name;
|
private final String name;
|
||||||
|
|
Loading…
Add table
Reference in a new issue