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();
|
||||
}
|
||||
|
||||
private void startTask() {
|
||||
|
||||
}
|
||||
|
||||
public void unregisterCommands(boolean force) {
|
||||
CommandMap map = ReflectionManager.getCommandMap();
|
||||
Map<String, Command> commands = ReflectionManager.getCommands(map);
|
||||
|
@ -1280,10 +1280,6 @@ public class DisguiseUtilities {
|
||||
file.delete();
|
||||
}
|
||||
|
||||
public static void doDisguiseTick(Disguise disguise) {
|
||||
|
||||
}
|
||||
|
||||
public static void removeSelfDisguise(Disguise disguise) {
|
||||
if (!Bukkit.isPrimaryThread())
|
||||
throw new IllegalStateException("Cannot modify disguises on an async thread");
|
||||
|
@ -582,6 +582,19 @@ public class DisguiseListener implements Listener {
|
||||
}
|
||||
}.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 {
|
||||
// Stupid hack to fix worldswitch invisibility bug
|
||||
// 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());
|
||||
|
||||
disguise.setViewSelfDisguise(false);
|
||||
if (disguise.isSelfDisguiseVisible()) {
|
||||
disguise.setViewSelfDisguise(false);
|
||||
|
||||
Bukkit.getScheduler().runTaskLater(plugin, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
disguise.setViewSelfDisguise(true);
|
||||
}
|
||||
}, 20L); // I wish I could use lambdas here, so badly
|
||||
Bukkit.getScheduler().runTaskLater(plugin, () -> disguise.setViewSelfDisguise(true), 20L);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user