mirror of
https://github.com/tanyaofei/minecraft-fakeplayer.git
synced 2025-07-14 05:12:23 +08:00
devtools
This commit is contained in:
parent
338663f6eb
commit
554aa9f4d3
@ -5,7 +5,7 @@ import io.github.hello09x.devtools.core.transaction.PluginTranslator;
|
|||||||
import io.github.hello09x.devtools.core.transaction.TranslatorUtils;
|
import io.github.hello09x.devtools.core.transaction.TranslatorUtils;
|
||||||
import io.github.hello09x.devtools.core.utils.EntityUtils;
|
import io.github.hello09x.devtools.core.utils.EntityUtils;
|
||||||
import io.github.hello09x.devtools.core.utils.WorldUtils;
|
import io.github.hello09x.devtools.core.utils.WorldUtils;
|
||||||
import io.github.hello09x.devtools.core.utils.task.Tasks;
|
import io.github.hello09x.devtools.core.utils.task.SchedulerUtils;
|
||||||
import io.github.hello09x.fakeplayer.api.event.FakePlayerSpawnEvent;
|
import io.github.hello09x.fakeplayer.api.event.FakePlayerSpawnEvent;
|
||||||
import io.github.hello09x.fakeplayer.api.spi.Action;
|
import io.github.hello09x.fakeplayer.api.spi.Action;
|
||||||
import io.github.hello09x.fakeplayer.api.spi.NMSBridge;
|
import io.github.hello09x.fakeplayer.api.spi.NMSBridge;
|
||||||
@ -122,7 +122,7 @@ public class FakePlayer {
|
|||||||
var locale = TranslatorUtils.getLocale(creator);
|
var locale = TranslatorUtils.getLocale(creator);
|
||||||
var address = ipGen.next();
|
var address = ipGen.next();
|
||||||
this.player.setMetadata(FakePlayerStatus.METADATA_KEY, new FixedMetadataValue(Main.getInstance(), FakePlayerStatus.SPAWNING));
|
this.player.setMetadata(FakePlayerStatus.METADATA_KEY, new FixedMetadataValue(Main.getInstance(), FakePlayerStatus.SPAWNING));
|
||||||
return Tasks
|
return SchedulerUtils
|
||||||
.runTaskAsynchronously(Main.getInstance(), () -> {
|
.runTaskAsynchronously(Main.getInstance(), () -> {
|
||||||
var event = this.callPreLoginEvent(address);
|
var event = this.callPreLoginEvent(address);
|
||||||
if (event.getLoginResult() != AsyncPlayerPreLoginEvent.Result.ALLOWED) {
|
if (event.getLoginResult() != AsyncPlayerPreLoginEvent.Result.ALLOWED) {
|
||||||
@ -133,7 +133,7 @@ public class FakePlayer {
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.thenComposeAsync(nul -> Tasks.runTask(Main.getInstance(), () -> {
|
.thenComposeAsync(nul -> SchedulerUtils.runTask(Main.getInstance(), () -> {
|
||||||
{
|
{
|
||||||
var event = this.callLoginEvent(address);
|
var event = this.callLoginEvent(address);
|
||||||
if (event.getResult() != PlayerLoginEvent.Result.ALLOWED && config.getPreventKicking().ordinal() < PreventKicking.ON_SPAWNING.ordinal()) {
|
if (event.getResult() != PlayerLoginEvent.Result.ALLOWED && config.getPreventKicking().ordinal() < PreventKicking.ON_SPAWNING.ordinal()) {
|
||||||
|
@ -92,7 +92,7 @@ public class FakeplayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
case ALWAYS -> {
|
case ALWAYS -> {
|
||||||
if (!ComponentUtils.asString(event.reason()).startsWith("[fakeplayer]")) {
|
if (!ComponentUtils.toString(event.reason()).startsWith("[fakeplayer]")) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
log.warning(String.format(
|
log.warning(String.format(
|
||||||
"Canceled kicking fake player '%s' due to your configuration",
|
"Canceled kicking fake player '%s' due to your configuration",
|
||||||
|
@ -23,7 +23,7 @@ public abstract class AbstractInvsee implements Invsee {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
view.setTitle(ComponentUtils.asString(translator.translate(
|
view.setTitle(ComponentUtils.toString(translator.translate(
|
||||||
"fakeplayer.manager.inventory.title",
|
"fakeplayer.manager.inventory.title",
|
||||||
null,
|
null,
|
||||||
Placeholder.component("name", text(owner.getName()))
|
Placeholder.component("name", text(owner.getName()))
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package io.github.hello09x.fakeplayer.core.util;
|
package io.github.hello09x.fakeplayer.core.util;
|
||||||
|
|
||||||
import com.destroystokyo.paper.profile.PlayerProfile;
|
import com.destroystokyo.paper.profile.PlayerProfile;
|
||||||
import io.github.hello09x.devtools.core.utils.task.Tasks;
|
import io.github.hello09x.devtools.core.utils.task.SchedulerUtils;
|
||||||
import org.bukkit.OfflinePlayer;
|
import org.bukkit.OfflinePlayer;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
@ -41,7 +41,7 @@ public class Skins {
|
|||||||
var profile = from.getPlayerProfile();
|
var profile = from.getPlayerProfile();
|
||||||
return CompletableFuture
|
return CompletableFuture
|
||||||
.supplyAsync(profile::complete)
|
.supplyAsync(profile::complete)
|
||||||
.thenComposeAsync(completed -> Tasks.runTask(plugin, () -> {
|
.thenComposeAsync(completed -> SchedulerUtils.runTask(plugin, () -> {
|
||||||
if (!completed) {
|
if (!completed) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user