Fix being unable to switch worlds while self disguised (paper?), fixes #476
This commit is contained in:
parent
a19b9e4023
commit
f12c1192e1
@ -171,10 +171,6 @@ public class LibsDisguises extends JavaPlugin {
|
|||||||
new MetricsInitalizer();
|
new MetricsInitalizer();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void startTask() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void unregisterCommands(boolean force) {
|
public void unregisterCommands(boolean force) {
|
||||||
CommandMap map = ReflectionManager.getCommandMap();
|
CommandMap map = ReflectionManager.getCommandMap();
|
||||||
Map<String, Command> commands = ReflectionManager.getCommands(map);
|
Map<String, Command> commands = ReflectionManager.getCommands(map);
|
||||||
|
@ -1280,10 +1280,6 @@ public class DisguiseUtilities {
|
|||||||
file.delete();
|
file.delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void doDisguiseTick(Disguise disguise) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void removeSelfDisguise(Disguise disguise) {
|
public static void removeSelfDisguise(Disguise disguise) {
|
||||||
if (!Bukkit.isPrimaryThread())
|
if (!Bukkit.isPrimaryThread())
|
||||||
throw new IllegalStateException("Cannot modify disguises on an async thread");
|
throw new IllegalStateException("Cannot modify disguises on an async thread");
|
||||||
|
@ -582,6 +582,19 @@ public class DisguiseListener implements Listener {
|
|||||||
}
|
}
|
||||||
}.runTaskLater(LibsDisguises.getInstance(), 4);
|
}.runTaskLater(LibsDisguises.getInstance(), 4);
|
||||||
}
|
}
|
||||||
|
} else if (from.getWorld() != to.getWorld()) {
|
||||||
|
// Stupid hack to fix worldswitch invisibility bug & paper packet bug
|
||||||
|
final boolean viewSelfToggled = DisguiseAPI.isViewSelfToggled(event.getPlayer());
|
||||||
|
|
||||||
|
if (viewSelfToggled) {
|
||||||
|
final Disguise disguise = DisguiseAPI.getDisguise(event.getPlayer());
|
||||||
|
|
||||||
|
if (disguise.isSelfDisguiseVisible()) {
|
||||||
|
disguise.setViewSelfDisguise(false);
|
||||||
|
|
||||||
|
Bukkit.getScheduler().runTaskLater(plugin, () -> disguise.setViewSelfDisguise(true), 20L);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -641,20 +654,17 @@ public class DisguiseListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Stupid hack to fix worldswitch invisibility bug
|
// Stupid hack to fix worldswitch invisibility bug & paper packet bug
|
||||||
final boolean viewSelfToggled = DisguiseAPI.isViewSelfToggled(event.getPlayer());
|
final boolean viewSelfToggled = DisguiseAPI.isViewSelfToggled(event.getPlayer());
|
||||||
|
|
||||||
if (viewSelfToggled) {
|
if (viewSelfToggled) {
|
||||||
final Disguise disguise = DisguiseAPI.getDisguise(event.getPlayer());
|
final Disguise disguise = DisguiseAPI.getDisguise(event.getPlayer());
|
||||||
|
|
||||||
|
if (disguise.isSelfDisguiseVisible()) {
|
||||||
disguise.setViewSelfDisguise(false);
|
disguise.setViewSelfDisguise(false);
|
||||||
|
|
||||||
Bukkit.getScheduler().runTaskLater(plugin, new Runnable() {
|
Bukkit.getScheduler().runTaskLater(plugin, () -> disguise.setViewSelfDisguise(true), 20L);
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
disguise.setViewSelfDisguise(true);
|
|
||||||
}
|
}
|
||||||
}, 20L); // I wish I could use lambdas here, so badly
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user