Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-11-03 01:50:07 +01:00
refactor: Move update checker to core
feat: Add permission for tracing
Dieser Commit ist enthalten in:
Ursprung
3d70d9e496
Commit
c55bc8c05f
@ -21,7 +21,7 @@
|
||||
|
||||
package com.sk89q.worldedit.bukkit;
|
||||
|
||||
import com.fastasyncworldedit.bukkit.util.UpdateNotification;
|
||||
import com.fastasyncworldedit.core.util.UpdateNotification;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
|
@ -21,7 +21,7 @@ package com.sk89q.worldedit.bukkit;
|
||||
|
||||
import com.fastasyncworldedit.bukkit.BukkitPermissionAttachmentManager;
|
||||
import com.fastasyncworldedit.bukkit.FaweBukkit;
|
||||
import com.fastasyncworldedit.bukkit.util.UpdateNotification;
|
||||
import com.fastasyncworldedit.core.util.UpdateNotification;
|
||||
import com.fastasyncworldedit.core.Fawe;
|
||||
import com.google.common.base.Joiner;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
@ -1,10 +1,10 @@
|
||||
package com.fastasyncworldedit.bukkit.util;
|
||||
package com.fastasyncworldedit.core.util;
|
||||
|
||||
import com.fastasyncworldedit.core.Fawe;
|
||||
import com.fastasyncworldedit.core.FaweVersion;
|
||||
import com.fastasyncworldedit.core.configuration.Caption;
|
||||
import com.fastasyncworldedit.core.configuration.Settings;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.internal.util.LogManagerCompat;
|
||||
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||
import com.sk89q.worldedit.util.formatting.text.event.ClickEvent;
|
||||
@ -15,9 +15,6 @@ import javax.xml.parsers.DocumentBuilder;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
import java.net.URL;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public class UpdateNotification {
|
||||
|
||||
private static final Logger LOGGER = LogManagerCompat.getLogger();
|
||||
@ -63,14 +60,14 @@ public class UpdateNotification {
|
||||
/**
|
||||
* Trigger an update notification based on captions. Useful to notify server administrators ingame.
|
||||
*
|
||||
* @param player The player to notify.
|
||||
* @param actor The player to notify.
|
||||
*/
|
||||
public static void doUpdateNotification(Player player) {
|
||||
public static void doUpdateNotification(Actor actor) {
|
||||
if (Settings.IMP.ENABLED_COMPONENTS.UPDATE_NOTIFICATIONS) {
|
||||
if (player.hasPermission("fawe.admin") && UpdateNotification.hasUpdate) {
|
||||
if (actor.hasPermission("fawe.admin") && UpdateNotification.hasUpdate) {
|
||||
FaweVersion faweVersion = Fawe.get().getVersion();
|
||||
int versionDifference = Integer.parseInt(UpdateNotification.faweVersion) - faweVersion.build;
|
||||
player.print(Caption.of("fawe.info.update-available", versionDifference, faweVersion.toString(),
|
||||
actor.print(Caption.of("fawe.info.update-available", versionDifference, faweVersion.toString(),
|
||||
faweVersion.getSimpleVersionName() + "-" + UpdateNotification.faweVersion,
|
||||
TextComponent
|
||||
.of("https://www.spigotmc.org/resources/13932/")
|
@ -23,6 +23,7 @@ import com.fastasyncworldedit.core.Fawe;
|
||||
import com.fastasyncworldedit.core.FaweVersion;
|
||||
import com.fastasyncworldedit.core.configuration.Caption;
|
||||
import com.fastasyncworldedit.core.configuration.Settings;
|
||||
import com.fastasyncworldedit.core.util.UpdateNotification;
|
||||
import com.intellectualsites.paster.IncendoPaster;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
@ -98,6 +99,7 @@ public class WorldEditCommands {
|
||||
}
|
||||
|
||||
actor.printInfo(TextComponent.of("Wiki: https://github.com/IntellectualSites/FastAsyncWorldEdit-Documentation/wiki"));
|
||||
UpdateNotification.doUpdateNotification(actor);
|
||||
//FAWE end
|
||||
|
||||
PlatformManager pm = we.getPlatformManager();
|
||||
@ -187,6 +189,7 @@ public class WorldEditCommands {
|
||||
name = "trace",
|
||||
desc = "Toggles trace hook"
|
||||
)
|
||||
@CommandPermissions(value = "worldedit.trace", queued = false)
|
||||
void trace(
|
||||
Actor actor, LocalSession session,
|
||||
@Arg(desc = "The mode to set the trace hook to", def = "")
|
||||
|
@ -36,6 +36,8 @@ public @interface CommandPermissions {
|
||||
*/
|
||||
String[] value() default {};
|
||||
|
||||
//FAWE start
|
||||
boolean queued() default true;
|
||||
//FAWE end
|
||||
|
||||
}
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren