Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b16266e22a | ||
|
|
2c886dc33b | ||
|
|
db9c60cf35 | ||
|
|
a34b36daec | ||
|
|
41a35e99fd | ||
|
|
8e12dad247 | ||
|
|
72afa1e5cc | ||
|
|
9904553325 | ||
|
|
ad069ab32f |
@@ -98,5 +98,5 @@ build.dependsOn publishToMavenLocal
|
|||||||
|
|
||||||
group = 'com.willfp'
|
group = 'com.willfp'
|
||||||
archivesBaseName = project.name
|
archivesBaseName = project.name
|
||||||
version = '1.0.5'
|
version = '1.1.2'
|
||||||
java.sourceCompatibility = JavaVersion.VERSION_1_8
|
java.sourceCompatibility = JavaVersion.VERSION_1_8
|
||||||
@@ -3,6 +3,7 @@ package com.willfp.eco.util;
|
|||||||
import lombok.experimental.UtilityClass;
|
import lombok.experimental.UtilityClass;
|
||||||
|
|
||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.TreeMap;
|
import java.util.TreeMap;
|
||||||
import java.util.concurrent.ThreadLocalRandom;
|
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.
|
* Generate random integer in range.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -202,9 +202,8 @@ public abstract class AbstractEcoPlugin extends JavaPlugin {
|
|||||||
public final void onEnable() {
|
public final void onEnable() {
|
||||||
super.onLoad();
|
super.onLoad();
|
||||||
|
|
||||||
this.getLog().info("==========================================");
|
this.getLog().info("");
|
||||||
this.getLog().info("Loading " + this.color + this.pluginName);
|
this.getLog().info("Loading " + this.color + this.pluginName);
|
||||||
this.getLog().info("==========================================");
|
|
||||||
|
|
||||||
this.getEventManager().registerListener(new ArrowDataListener(this));
|
this.getEventManager().registerListener(new ArrowDataListener(this));
|
||||||
this.getEventManager().registerListener(new NaturalExpGainListeners());
|
this.getEventManager().registerListener(new NaturalExpGainListeners());
|
||||||
@@ -237,8 +236,8 @@ public abstract class AbstractEcoPlugin extends JavaPlugin {
|
|||||||
integrationLoader.load();
|
integrationLoader.load();
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
|
||||||
this.getLog().info("Loaded integrations: " + String.join(", ", this.getLoadedIntegrations()));
|
this.getLog().info("Loaded integrations: " + String.join(", ", this.getLoadedIntegrations()));
|
||||||
this.getLog().info("");
|
|
||||||
|
|
||||||
Prerequisite.update();
|
Prerequisite.update();
|
||||||
|
|
||||||
@@ -265,6 +264,8 @@ public abstract class AbstractEcoPlugin extends JavaPlugin {
|
|||||||
this.updatableClasses.forEach(clazz -> this.getConfigHandler().registerUpdatableClass(clazz));
|
this.updatableClasses.forEach(clazz -> this.getConfigHandler().registerUpdatableClass(clazz));
|
||||||
|
|
||||||
this.enable();
|
this.enable();
|
||||||
|
|
||||||
|
this.getLog().info("");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -321,7 +322,7 @@ public abstract class AbstractEcoPlugin extends JavaPlugin {
|
|||||||
|
|
||||||
this.reload();
|
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() {
|
public final void reload() {
|
||||||
this.getConfigHandler().callUpdate();
|
this.getConfigHandler().callUpdate();
|
||||||
|
this.getConfigHandler().callUpdate(); // Call twice to fix issues
|
||||||
this.getScheduler().cancelAll();
|
this.getScheduler().cancelAll();
|
||||||
new FastCollatedDropQueue.CollatedRunnable(this);
|
new FastCollatedDropQueue.CollatedRunnable(this);
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import com.comphenix.protocol.events.PacketContainer;
|
|||||||
import com.comphenix.protocol.events.PacketEvent;
|
import com.comphenix.protocol.events.PacketEvent;
|
||||||
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
|
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
@@ -61,7 +62,8 @@ public abstract class AbstractPacketAdapter extends PacketAdapter {
|
|||||||
*
|
*
|
||||||
* @param packet The packet.
|
* @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
|
// Empty rather than abstract as implementations don't need both
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -70,7 +72,8 @@ public abstract class AbstractPacketAdapter extends PacketAdapter {
|
|||||||
*
|
*
|
||||||
* @param packet The packet.
|
* @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
|
// Empty rather than abstract as implementations don't need both
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -89,7 +92,7 @@ public abstract class AbstractPacketAdapter extends PacketAdapter {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
onReceive(event.getPacket());
|
onReceive(event.getPacket(), event.getPlayer());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -107,7 +110,7 @@ public abstract class AbstractPacketAdapter extends PacketAdapter {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
onSend(event.getPacket());
|
onSend(event.getPacket(), event.getPlayer());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user