mirror of
https://github.com/ViaVersion/ViaRewind-Legacy-Support.git
synced 2025-01-24 21:21:50 +01:00
slime bouncing
This commit is contained in:
parent
bae0f53730
commit
8aa27a0e23
@ -1,6 +1,7 @@
|
||||
package de.gerrygames.viarewind.legacysupport;
|
||||
|
||||
import de.gerrygames.viarewind.legacysupport.injector.LilyPadFixer;
|
||||
import de.gerrygames.viarewind.legacysupport.listener.BounceListener;
|
||||
import de.gerrygames.viarewind.legacysupport.listener.BrewingListener;
|
||||
import de.gerrygames.viarewind.legacysupport.listener.EnchantingListener;
|
||||
import de.gerrygames.viarewind.legacysupport.listener.SoundListener;
|
||||
@ -29,6 +30,8 @@ public class BukkitPlugin extends JavaPlugin {
|
||||
LilyPadFixer.fix();
|
||||
if (ProtocolRegistry.SERVER_PROTOCOL>47 && config.getBoolean("sound-fix"))
|
||||
Bukkit.getPluginManager().registerEvents(new SoundListener(), this);
|
||||
if (ProtocolRegistry.SERVER_PROTOCOL>5 && config.getBoolean("slime-fix"))
|
||||
Bukkit.getPluginManager().registerEvents(new BounceListener(), this);
|
||||
if (config.getBoolean("versioninfo.active")) new VersionInformer();
|
||||
});
|
||||
}
|
||||
|
@ -0,0 +1,29 @@
|
||||
package de.gerrygames.viarewind.legacysupport.listener;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
import org.bukkit.util.Vector;
|
||||
import us.myles.ViaVersion.api.Via;
|
||||
|
||||
public class BounceListener implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerMove(PlayerMoveEvent e) {
|
||||
if (e.getTo().getY()>=e.getFrom().getY()) return;
|
||||
Player player = e.getPlayer();
|
||||
if (Via.getAPI().getPlayerVersion(player)>5) return;
|
||||
if (Math.floor(e.getTo().getY()) + 0.01 < e.getTo().getY()) return;
|
||||
if (player.isSneaking()) return;
|
||||
Block block = e.getTo().clone().add(0, -0.1, 0).getBlock();
|
||||
if (block.getType()!=Material.SLIME_BLOCK) return;
|
||||
Vector velocity = player.getVelocity();
|
||||
double motY = (e.getTo().getY()-e.getFrom().getY());
|
||||
if (motY>-0.11) return;
|
||||
velocity.setY(-motY * 1.05);
|
||||
player.setVelocity(velocity);
|
||||
}
|
||||
}
|
@ -6,6 +6,8 @@ enchanting-gui-fix: true
|
||||
lily-pad-fix: true
|
||||
#If set to true, this plugin will play sounds for 1.8 and lower that got clientside on 1.9 and higher
|
||||
sound-fix: true
|
||||
#If set to true, this plugin will apply velocity to 1.7 if they fall onto slime blocks
|
||||
slime-fix: true
|
||||
#Inform your players that they are using an outdated minecraft version
|
||||
#max-version specifies the maximum protocol version of players being notified. See http://wiki.vg/Protocol_version_numbers for protocol version numbers
|
||||
#interval can be set to JOIN to notify players when joining the server. If you set it to any integer number it will broadcast the message every x ticks.
|
||||
|
Loading…
Reference in New Issue
Block a user