Remove FAWE toggle entirely
This commit is contained in:
parent
9fc56831b6
commit
28d3f0c45d
|
@ -42,7 +42,6 @@ public class Config extends Language {
|
|||
public String MYSQL_USERNAME;
|
||||
public String MYSQL_PASSWORD;
|
||||
public String LANGUAGE;
|
||||
public boolean ENABLE_FAWE;
|
||||
public boolean ENABLE_SSL;
|
||||
public boolean DISABLE_WAL;
|
||||
public boolean HOVER_EVENTS;
|
||||
|
@ -190,7 +189,6 @@ public class Config extends Language {
|
|||
}
|
||||
|
||||
private void readValues() {
|
||||
this.ENABLE_FAWE = this.getBoolean("enable-fawe", false);
|
||||
this.ENABLE_SSL = this.getBoolean("enable-ssl", false);
|
||||
this.DISABLE_WAL = this.getBoolean("disable-wal", false);
|
||||
this.HOVER_EVENTS = this.getBoolean("hover-events", true);
|
||||
|
|
|
@ -5,7 +5,6 @@ import com.sk89q.worldedit.WorldEdit;
|
|||
import com.sk89q.worldedit.event.extent.EditSessionEvent;
|
||||
import com.sk89q.worldedit.util.eventbus.Subscribe;
|
||||
import net.coreprotect.CoreProtect;
|
||||
import net.coreprotect.config.Config;
|
||||
import net.coreprotect.config.ConfigHandler;
|
||||
import net.coreprotect.language.Phrase;
|
||||
import net.coreprotect.language.Selector;
|
||||
|
@ -13,68 +12,88 @@ import net.coreprotect.thread.Scheduler;
|
|||
import net.coreprotect.utility.Chat;
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
public class CoreProtectEditSessionEvent {
|
||||
|
||||
public class CoreProtectEditSessionEvent
|
||||
{
|
||||
private static boolean initialized = false;
|
||||
private static boolean isFAWE = false;
|
||||
private static CoreProtectEditSessionEvent event = new CoreProtectEditSessionEvent();
|
||||
|
||||
public static boolean isInitialized() {
|
||||
public static boolean isInitialized()
|
||||
{
|
||||
return initialized;
|
||||
}
|
||||
|
||||
public static boolean isFAWE() {
|
||||
public static boolean isFAWE()
|
||||
{
|
||||
return isFAWE;
|
||||
}
|
||||
|
||||
public static void register() {
|
||||
if (isInitialized()) {
|
||||
public static void register()
|
||||
{
|
||||
if (isInitialized())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
if (Bukkit.getServer().getPluginManager().getPlugin("FastAsyncWorldEdit") == null || Config.getGlobal().ENABLE_FAWE) {
|
||||
WorldEdit.getInstance().getEventBus().register(new Object() {
|
||||
@Subscribe
|
||||
public void onEditSessionEvent(EditSessionEvent event) {
|
||||
if (event.getActor() != null && event.getStage() == Stage.BEFORE_CHANGE) {
|
||||
event.setExtent(new CoreProtectLogger(event.getActor(), event.getWorld(), event.getExtent()));
|
||||
}
|
||||
try
|
||||
{
|
||||
WorldEdit.getInstance().getEventBus().register(new Object()
|
||||
{
|
||||
@Subscribe
|
||||
public void onEditSessionEvent(EditSessionEvent event)
|
||||
{
|
||||
if (event.getActor() != null && event.getStage() == Stage.BEFORE_CHANGE)
|
||||
{
|
||||
event.setExtent(new CoreProtectLogger(event.getActor(), event.getWorld(), event.getExtent()));
|
||||
}
|
||||
});
|
||||
initialized = true;
|
||||
ConfigHandler.worldeditEnabled = true;
|
||||
isFAWE = (Bukkit.getServer().getPluginManager().getPlugin("FastAsyncWorldEdit") != null);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
}
|
||||
});
|
||||
initialized = true;
|
||||
ConfigHandler.worldeditEnabled = true;
|
||||
isFAWE = (Bukkit.getServer().getPluginManager().getPlugin("FastAsyncWorldEdit") != null);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
// Failed to initialize WorldEdit logging
|
||||
}
|
||||
|
||||
Scheduler.runTask(CoreProtect.getInstance(), () -> {
|
||||
try {
|
||||
if (isInitialized()) {
|
||||
Chat.console(Phrase.build(Phrase.INTEGRATION_SUCCESS, "WorldEdit", Selector.FIRST));
|
||||
} else {
|
||||
Chat.console(Phrase.build(Phrase.INTEGRATION_ERROR, "WorldEdit", Selector.FIRST));
|
||||
Scheduler.runTask(CoreProtect.getInstance(), () ->
|
||||
{
|
||||
try
|
||||
{
|
||||
if (isInitialized())
|
||||
{
|
||||
Chat.console(Phrase.build(Phrase.INTEGRATION_SUCCESS, isFAWE() ? "FastAsyncWorldEdit" : "WorldEdit", Selector.FIRST));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
else
|
||||
{
|
||||
Chat.console(Phrase.build(Phrase.INTEGRATION_ERROR, isFAWE() ? "FastAsyncWorldEdit" : "WorldEdit", Selector.FIRST));
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static void unregister() {
|
||||
if (!isInitialized()) {
|
||||
public static void unregister()
|
||||
{
|
||||
if (!isInitialized())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
try
|
||||
{
|
||||
WorldEdit.getInstance().getEventBus().unregister(event);
|
||||
initialized = false;
|
||||
ConfigHandler.worldeditEnabled = false;
|
||||
Chat.console(Phrase.build(Phrase.INTEGRATION_SUCCESS, "WorldEdit", Selector.SECOND));
|
||||
} catch (Exception e) {
|
||||
Chat.console(Phrase.build(Phrase.INTEGRATION_ERROR, "WorldEdit", Selector.SECOND));
|
||||
Chat.console(Phrase.build(Phrase.INTEGRATION_SUCCESS, isFAWE() ? "FastAsyncWorldEdit" : "WorldEdit", Selector.SECOND));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Chat.console(Phrase.build(Phrase.INTEGRATION_ERROR, isFAWE() ? "FastAsyncWorldEdit" : "WorldEdit", Selector.SECOND));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,7 +22,6 @@ import org.bukkit.inventory.ItemStack;
|
|||
|
||||
public class CoreProtectLogger extends AbstractDelegateExtent
|
||||
{
|
||||
|
||||
private final Actor eventActor;
|
||||
private final World eventWorld;
|
||||
private final Extent eventExtent;
|
||||
|
|
Loading…
Reference in New Issue