Add new disguise option to remove disguises on world change
This commit is contained in:
parent
f777b33917
commit
c145ae5106
@ -86,6 +86,9 @@ MaxHealthDeterminedByEntity: true
|
|||||||
# This disables the Attributes packet, Non-living entities can still disguise as other non-living
|
# This disables the Attributes packet, Non-living entities can still disguise as other non-living
|
||||||
MiscDisguisesForLiving: true
|
MiscDisguisesForLiving: true
|
||||||
|
|
||||||
|
# Turn this to true to have players undisguised when switching worlds
|
||||||
|
UndisguiseOnWorldChange: false
|
||||||
|
|
||||||
# This will help performance, especially with CPU
|
# This will help performance, especially with CPU
|
||||||
# Due to safety reasons, self disguises can never have their packets disabled.
|
# Due to safety reasons, self disguises can never have their packets disabled.
|
||||||
PacketsEnabled:
|
PacketsEnabled:
|
||||||
|
@ -34,6 +34,7 @@ public class DisguiseConfig {
|
|||||||
private static boolean showNameAboveHead;
|
private static boolean showNameAboveHead;
|
||||||
private static boolean showNameAboveHeadAlwaysVisible;
|
private static boolean showNameAboveHeadAlwaysVisible;
|
||||||
private static boolean targetDisguises;
|
private static boolean targetDisguises;
|
||||||
|
private static boolean undisguiseSwitchWorlds;
|
||||||
private static boolean witherSkullEnabled;
|
private static boolean witherSkullEnabled;
|
||||||
|
|
||||||
public static String getDisguiseBlownMessage() {
|
public static String getDisguiseBlownMessage() {
|
||||||
@ -85,6 +86,7 @@ public class DisguiseConfig {
|
|||||||
setMaxClonedDisguises(config.getInt("DisguiseCloneSize"));
|
setMaxClonedDisguises(config.getInt("DisguiseCloneSize"));
|
||||||
setSheepDyeable(config.getBoolean("DyeableSheep"));
|
setSheepDyeable(config.getBoolean("DyeableSheep"));
|
||||||
setWolfDyeable(config.getBoolean("DyeableWolf"));
|
setWolfDyeable(config.getBoolean("DyeableWolf"));
|
||||||
|
setUndisguiseOnWorldChange(config.getBoolean("UndisguiseOnWorldChange"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isAnimationPacketsEnabled() {
|
public static boolean isAnimationPacketsEnabled() {
|
||||||
@ -192,6 +194,10 @@ public class DisguiseConfig {
|
|||||||
return PacketsManager.isHearDisguisesEnabled();
|
return PacketsManager.isHearDisguisesEnabled();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean isUndisguiseOnWorldChange() {
|
||||||
|
return undisguiseSwitchWorlds;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Is the velocity packets sent
|
* Is the velocity packets sent
|
||||||
*/
|
*/
|
||||||
@ -370,6 +376,10 @@ public class DisguiseConfig {
|
|||||||
PacketsManager.setHearDisguisesListener(isSoundsEnabled);
|
PacketsManager.setHearDisguisesListener(isSoundsEnabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void setUndisguiseOnWorldChange(boolean isUndisguise) {
|
||||||
|
undisguiseSwitchWorlds = isUndisguise;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Disable velocity packets being sent for w/e reason. Maybe you want every ounce of performance you can get?
|
* Disable velocity packets being sent for w/e reason. Maybe you want every ounce of performance you can get?
|
||||||
*/
|
*/
|
||||||
|
@ -21,6 +21,7 @@ import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
|||||||
import org.bukkit.event.entity.EntityTargetEvent;
|
import org.bukkit.event.entity.EntityTargetEvent;
|
||||||
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
||||||
import org.bukkit.event.player.PlayerJoinEvent;
|
import org.bukkit.event.player.PlayerJoinEvent;
|
||||||
|
import org.bukkit.event.player.PlayerPortalEvent;
|
||||||
import org.bukkit.event.player.PlayerRespawnEvent;
|
import org.bukkit.event.player.PlayerRespawnEvent;
|
||||||
import org.bukkit.event.vehicle.VehicleEnterEvent;
|
import org.bukkit.event.vehicle.VehicleEnterEvent;
|
||||||
import org.bukkit.event.vehicle.VehicleExitEvent;
|
import org.bukkit.event.vehicle.VehicleExitEvent;
|
||||||
@ -189,8 +190,8 @@ public class DisguiseListener implements Listener {
|
|||||||
p.sendMessage(ChatColor.RED + "Disguised " + (entity instanceof Player ? "" : "the ") + entityName
|
p.sendMessage(ChatColor.RED + "Disguised " + (entity instanceof Player ? "" : "the ") + entityName
|
||||||
+ " as " + disguiseName + "!");
|
+ " as " + disguiseName + "!");
|
||||||
} else {
|
} else {
|
||||||
p.sendMessage(ChatColor.RED + "Failed to disguise " + (entity instanceof Player ? "" : "the ") + entityName
|
p.sendMessage(ChatColor.RED + "Failed to disguise " + (entity instanceof Player ? "" : "the ")
|
||||||
+ " as " + disguiseName + "!");
|
+ entityName + " as " + disguiseName + "!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -248,6 +249,15 @@ public class DisguiseListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onWorldSwitch(PlayerPortalEvent event) {
|
||||||
|
if (DisguiseConfig.isUndisguiseOnWorldChange() && event.getFrom().getWorld() != event.getTo().getWorld()) {
|
||||||
|
for (Disguise disguise : DisguiseAPI.getDisguises(event.getPlayer())) {
|
||||||
|
disguise.removeDisguise();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void setDisguiseClone(final String player, Boolean[] options) {
|
public void setDisguiseClone(final String player, Boolean[] options) {
|
||||||
if (disguiseRunnable.containsKey(player)) {
|
if (disguiseRunnable.containsKey(player)) {
|
||||||
BukkitRunnable run = disguiseRunnable.remove(player);
|
BukkitRunnable run = disguiseRunnable.remove(player);
|
||||||
|
Loading…
Reference in New Issue
Block a user