mirror of
https://github.com/ViaVersion/ViaRewind-Legacy-Support.git
synced 2025-01-09 19:17:34 +01:00
Rename feature classes to their actual functionality
This commit is contained in:
parent
0c82936698
commit
5f95c9edd1
@ -18,15 +18,15 @@
|
||||
|
||||
package com.viaversion.viarewind.legacysupport;
|
||||
|
||||
import com.viaversion.viarewind.legacysupport.feature.BoundingBoxFixer;
|
||||
import com.viaversion.viarewind.legacysupport.feature.BlockCollisionChanges;
|
||||
import com.viaversion.viarewind.legacysupport.versioninfo.VersionInformer;
|
||||
import com.viaversion.viaversion.api.Via;
|
||||
import com.viaversion.viarewind.legacysupport.feature.AreaEffectCloudListener;
|
||||
import com.viaversion.viarewind.legacysupport.feature.BounceListener;
|
||||
import com.viaversion.viarewind.legacysupport.feature.BrewingListener;
|
||||
import com.viaversion.viarewind.legacysupport.feature.ElytraListener;
|
||||
import com.viaversion.viarewind.legacysupport.feature.EnchantingListener;
|
||||
import com.viaversion.viarewind.legacysupport.feature.SoundListener;
|
||||
import com.viaversion.viarewind.legacysupport.feature.AreaEffectCloudEmulator;
|
||||
import com.viaversion.viarewind.legacysupport.feature.SlimeBounceEmulator;
|
||||
import com.viaversion.viarewind.legacysupport.feature.BrewingInteractionEmulator;
|
||||
import com.viaversion.viarewind.legacysupport.feature.ElytraVelocityEmulator;
|
||||
import com.viaversion.viarewind.legacysupport.feature.EnchantingGuiEmulator;
|
||||
import com.viaversion.viarewind.legacysupport.feature.BlockPlaceSoundEmulator;
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
@ -56,35 +56,36 @@ public class BukkitPlugin extends JavaPlugin {
|
||||
cancel();
|
||||
|
||||
if (serverProtocol.newerThanOrEqualTo(ProtocolVersion.v1_8)) {
|
||||
if (config.getBoolean("enchanting-gui-fix"))
|
||||
Bukkit.getPluginManager().registerEvents(new EnchantingListener(), BukkitPlugin.this);
|
||||
|
||||
if (config.getBoolean("slime-fix"))
|
||||
Bukkit.getPluginManager().registerEvents(new BounceListener(), BukkitPlugin.this);
|
||||
if (config.getBoolean("enchanting-gui-fix")) {
|
||||
Bukkit.getPluginManager().registerEvents(new EnchantingGuiEmulator(), BukkitPlugin.this);
|
||||
}
|
||||
if (config.getBoolean("slime-fix")) {
|
||||
Bukkit.getPluginManager().registerEvents(new SlimeBounceEmulator(), BukkitPlugin.this);
|
||||
}
|
||||
}
|
||||
if (serverProtocol.newerThanOrEqualTo(ProtocolVersion.v1_9)) {
|
||||
if (config.getBoolean("sound-fix"))
|
||||
Bukkit.getPluginManager().registerEvents(new SoundListener(BukkitPlugin.this), BukkitPlugin.this);
|
||||
|
||||
if (config.getBoolean("ladder-fix")) // 15w31a
|
||||
BoundingBoxFixer.fixLadder(getLogger(), serverProtocol);
|
||||
|
||||
if (config.getBoolean("area-effect-cloud-particles")) // 15w32c
|
||||
Bukkit.getPluginManager().registerEvents(new AreaEffectCloudListener(BukkitPlugin.this), BukkitPlugin.this);
|
||||
|
||||
if (config.getBoolean("elytra-fix")) // 15w40b
|
||||
Bukkit.getPluginManager().registerEvents(new ElytraListener(), BukkitPlugin.this);
|
||||
|
||||
if (config.getBoolean("brewing-stand-gui-fix")) // 15w41b
|
||||
Bukkit.getPluginManager().registerEvents(new BrewingListener(), BukkitPlugin.this);
|
||||
|
||||
if (config.getBoolean("lily-pad-fix")) // 15w44b
|
||||
BoundingBoxFixer.fixLilyPad(getLogger(), serverProtocol);
|
||||
if (config.getBoolean("sound-fix")) {
|
||||
Bukkit.getPluginManager().registerEvents(new BlockPlaceSoundEmulator(BukkitPlugin.this), BukkitPlugin.this);
|
||||
}
|
||||
if (config.getBoolean("ladder-fix")) { // 15w31a
|
||||
BlockCollisionChanges.fixLadder(getLogger(), serverProtocol);
|
||||
}
|
||||
if (config.getBoolean("area-effect-cloud-particles")) { // 15w32c
|
||||
Bukkit.getPluginManager().registerEvents(new AreaEffectCloudEmulator(BukkitPlugin.this), BukkitPlugin.this);
|
||||
}
|
||||
if (config.getBoolean("elytra-fix")) { // 15w40b
|
||||
Bukkit.getPluginManager().registerEvents(new ElytraVelocityEmulator(), BukkitPlugin.this);
|
||||
}
|
||||
if (config.getBoolean("brewing-stand-gui-fix")) { // 15w41b
|
||||
Bukkit.getPluginManager().registerEvents(new BrewingInteractionEmulator(), BukkitPlugin.this);
|
||||
}
|
||||
if (config.getBoolean("lily-pad-fix")) { // 15w44b
|
||||
BlockCollisionChanges.fixLilyPad(getLogger(), serverProtocol);
|
||||
}
|
||||
}
|
||||
if (serverProtocol.newerThanOrEqualTo(ProtocolVersion.v1_14_4) && config.getBoolean("carpet-fix")) {
|
||||
BoundingBoxFixer.fixCarpet(getLogger(), serverProtocol);
|
||||
BlockCollisionChanges.fixCarpet(getLogger(), serverProtocol);
|
||||
}
|
||||
|
||||
if (config.getBoolean("versioninfo.active")) {
|
||||
new VersionInformer(BukkitPlugin.this, config);
|
||||
}
|
||||
|
@ -35,10 +35,10 @@ import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public class AreaEffectCloudListener implements Listener {
|
||||
public class AreaEffectCloudEmulator implements Listener {
|
||||
private final ArrayList<AreaEffectCloud> effectClouds = new ArrayList<>();
|
||||
|
||||
public AreaEffectCloudListener(final BukkitPlugin plugin) {
|
||||
public AreaEffectCloudEmulator(final BukkitPlugin plugin) {
|
||||
Bukkit.getScheduler().runTaskTimer(plugin, () -> {
|
||||
final Set<Player> affectedPlayers = Bukkit.getOnlinePlayers().stream().filter(p -> Via.getAPI().getPlayerProtocolVersion(p).newerThanOrEqualTo(ProtocolVersion.v1_8)).collect(Collectors.toSet());
|
||||
effectClouds.removeIf(e -> !e.isValid());
|
@ -30,7 +30,7 @@ import java.util.logging.Logger;
|
||||
import static com.viaversion.viarewind.legacysupport.util.ReflectionUtil.*;
|
||||
import static com.viaversion.viarewind.legacysupport.util.NMSUtil.*;
|
||||
|
||||
public class BoundingBoxFixer {
|
||||
public class BlockCollisionChanges {
|
||||
|
||||
public static void fixLilyPad(final Logger logger, final ProtocolVersion serverVersion) {
|
||||
try {
|
@ -43,7 +43,7 @@ import static com.viaversion.viarewind.legacysupport.util.ReflectionUtil.*;
|
||||
import static com.viaversion.viarewind.legacysupport.util.NMSUtil.*;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public class SoundListener implements Listener {
|
||||
public class BlockPlaceSoundEmulator implements Listener {
|
||||
|
||||
private static boolean isSoundCategory = false;
|
||||
|
||||
@ -55,7 +55,7 @@ public class SoundListener implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
public SoundListener(final BukkitPlugin plugin) {
|
||||
public BlockPlaceSoundEmulator(final BukkitPlugin plugin) {
|
||||
try {
|
||||
Class.forName("org.bukkit.event.entity.EntityPickupItemEvent");
|
||||
|
||||
@ -65,7 +65,7 @@ public class SoundListener implements Listener {
|
||||
public void onItemPickUp(EntityPickupItemEvent e) {
|
||||
if (!(e.getEntity() instanceof Player)) return;
|
||||
|
||||
SoundListener.this.onItemPickUp((Player) e.getEntity());
|
||||
BlockPlaceSoundEmulator.this.onItemPickUp((Player) e.getEntity());
|
||||
}
|
||||
|
||||
}, plugin);
|
||||
@ -74,7 +74,7 @@ public class SoundListener implements Listener {
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onItemPickUp(PlayerPickupItemEvent e) {
|
||||
SoundListener.this.onItemPickUp(e.getPlayer());
|
||||
BlockPlaceSoundEmulator.this.onItemPickUp(e.getPlayer());
|
||||
}
|
||||
|
||||
}, plugin);
|
@ -32,7 +32,7 @@ import org.bukkit.inventory.BrewerInventory;
|
||||
import org.bukkit.inventory.EquipmentSlot;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class BrewingListener implements Listener {
|
||||
public class BrewingInteractionEmulator implements Listener {
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onPlayerInteract(PlayerInteractEvent e) {
|
@ -28,7 +28,7 @@ import org.bukkit.event.player.PlayerMoveEvent;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public class ElytraListener implements Listener {
|
||||
public class ElytraVelocityEmulator implements Listener {
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onPlayerMove(PlayerMoveEvent e) {
|
@ -34,12 +34,12 @@ import org.bukkit.inventory.PlayerInventory;
|
||||
import java.util.Map;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public class EnchantingListener implements Listener {
|
||||
public class EnchantingGuiEmulator implements Listener {
|
||||
|
||||
private final boolean newMaterialNames;
|
||||
private final Material lapisMaterial;
|
||||
|
||||
public EnchantingListener() {
|
||||
public EnchantingGuiEmulator() {
|
||||
newMaterialNames = Material.getMaterial("LAPIS_LAZULI") != null;
|
||||
|
||||
if (newMaterialNames) {
|
@ -29,7 +29,7 @@ import org.bukkit.event.player.PlayerMoveEvent;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
@SuppressWarnings({"unchecked", "DataFlowIssue"})
|
||||
public class BounceListener implements Listener {
|
||||
public class SlimeBounceEmulator implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerMove(PlayerMoveEvent e) {
|
Loading…
Reference in New Issue
Block a user