Compare commits

...

9 Commits
1.0.5 ... 1.1.2

Author SHA1 Message Date
Auxilor
b16266e22a Cleaned up numerals 2021-01-10 20:05:50 +00:00
Auxilor
2c886dc33b Updated to 1.1.2 2021-01-10 18:51:37 +00:00
Auxilor
db9c60cf35 Added fromNumeral method 2021-01-10 18:51:21 +00:00
Auxilor
a34b36daec Updated to 1.1.1 2021-01-08 22:18:17 +00:00
Auxilor
41a35e99fd Call update is now invoked twice 2021-01-08 22:18:00 +00:00
Auxilor
8e12dad247 Added players to packet adapters 2021-01-08 08:02:15 +00:00
Auxilor
72afa1e5cc Updated to 1.1.0 2021-01-08 08:01:21 +00:00
Auxilor
9904553325 Updated to 1.0.6 2021-01-05 14:17:41 +00:00
Auxilor
ad069ab32f Cleaned up loader 2021-01-05 14:17:26 +00:00
4 changed files with 31 additions and 9 deletions

View File

@@ -98,5 +98,5 @@ build.dependsOn publishToMavenLocal
group = 'com.willfp'
archivesBaseName = project.name
version = '1.0.5'
version = '1.1.2'
java.sourceCompatibility = JavaVersion.VERSION_1_8

View File

@@ -3,6 +3,7 @@ package com.willfp.eco.util;
import lombok.experimental.UtilityClass;
import java.text.DecimalFormat;
import java.util.Map;
import java.util.TreeMap;
import java.util.concurrent.ThreadLocalRandom;
@@ -85,6 +86,22 @@ public class NumberUtils {
}
}
/**
* Get number from roman numeral.
*
* @param numeral The numeral to convert.
* @return The number, converted from a roman numeral.
*/
public static int fromNumeral(String numeral) {
if (numeral.isEmpty()) return 0;
for (Map.Entry<Integer, String> entry : NUMERALS.entrySet()) {
if (numeral.startsWith(entry.getValue())) {
return entry.getKey() + fromNumeral(numeral.substring(entry.getValue().length()));
}
}
return 0;
}
/**
* Generate random integer in range.
*

View File

@@ -202,9 +202,8 @@ public abstract class AbstractEcoPlugin extends JavaPlugin {
public final void onEnable() {
super.onLoad();
this.getLog().info("==========================================");
this.getLog().info("");
this.getLog().info("Loading " + this.color + this.pluginName);
this.getLog().info("==========================================");
this.getEventManager().registerListener(new ArrowDataListener(this));
this.getEventManager().registerListener(new NaturalExpGainListeners());
@@ -237,8 +236,8 @@ public abstract class AbstractEcoPlugin extends JavaPlugin {
integrationLoader.load();
}
}));
this.getLog().info("Loaded integrations: " + String.join(", ", this.getLoadedIntegrations()));
this.getLog().info("");
Prerequisite.update();
@@ -265,6 +264,8 @@ public abstract class AbstractEcoPlugin extends JavaPlugin {
this.updatableClasses.forEach(clazz -> this.getConfigHandler().registerUpdatableClass(clazz));
this.enable();
this.getLog().info("");
}
/**
@@ -321,7 +322,7 @@ public abstract class AbstractEcoPlugin extends JavaPlugin {
this.reload();
this.getLog().info("Loaded &a" + this.pluginName);
this.getLog().info("Loaded " + this.color + this.pluginName);
}
/**
@@ -329,6 +330,7 @@ public abstract class AbstractEcoPlugin extends JavaPlugin {
*/
public final void reload() {
this.getConfigHandler().callUpdate();
this.getConfigHandler().callUpdate(); // Call twice to fix issues
this.getScheduler().cancelAll();
new FastCollatedDropQueue.CollatedRunnable(this);

View File

@@ -8,6 +8,7 @@ import com.comphenix.protocol.events.PacketContainer;
import com.comphenix.protocol.events.PacketEvent;
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
import lombok.Getter;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
import java.util.Collections;
@@ -61,7 +62,8 @@ public abstract class AbstractPacketAdapter extends PacketAdapter {
*
* @param packet The packet.
*/
public void onReceive(@NotNull final PacketContainer packet) {
public void onReceive(@NotNull final PacketContainer packet,
@NotNull final Player player) {
// Empty rather than abstract as implementations don't need both
}
@@ -70,7 +72,8 @@ public abstract class AbstractPacketAdapter extends PacketAdapter {
*
* @param packet The packet.
*/
public void onSend(@NotNull final PacketContainer packet) {
public void onSend(@NotNull final PacketContainer packet,
@NotNull final Player player) {
// Empty rather than abstract as implementations don't need both
}
@@ -89,7 +92,7 @@ public abstract class AbstractPacketAdapter extends PacketAdapter {
return;
}
onReceive(event.getPacket());
onReceive(event.getPacket(), event.getPlayer());
}
/**
@@ -107,7 +110,7 @@ public abstract class AbstractPacketAdapter extends PacketAdapter {
return;
}
onSend(event.getPacket());
onSend(event.getPacket(), event.getPlayer());
}
/**