PhysicListener : suppression des chutes du sable gravier enclume
ajouts des libs dans le Git
This commit is contained in:
parent
9c6ed91c02
commit
aadfde75f5
@ -1,9 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
|
||||
<classpathentry kind="lib" path="/home/florian/Documents/Libs/Minecraft/Plugin/Spigot/1.10.2/spigot-1.10.2.jar"/>
|
||||
<classpathentry kind="lib" path="/home/florian/Documents/Libs/Minecraft/Plugin/Vault/Vault.jar"/>
|
||||
<classpathentry kind="lib" path="/home/florian/Documents/Libs/Minecraft/Plugin/Jobs Reborn/3.5.6/Jobs3.5.6.jar"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
@ -1,17 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>Menoria</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
1
Menoria/bin/.gitignore
vendored
1
Menoria/bin/.gitignore
vendored
@ -1 +0,0 @@
|
||||
/net/
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Menoria/lib/Jobs3.6.3Experimental.jar
Normal file
BIN
Menoria/lib/Jobs3.6.3Experimental.jar
Normal file
Binary file not shown.
BIN
Menoria/lib/Vault.jar
Normal file
BIN
Menoria/lib/Vault.jar
Normal file
Binary file not shown.
BIN
Menoria/lib/spigot-1.10.2.jar
Normal file
BIN
Menoria/lib/spigot-1.10.2.jar
Normal file
Binary file not shown.
@ -0,0 +1,54 @@
|
||||
package net.DeltaWings.Nemoria.Listeners;
|
||||
|
||||
/**
|
||||
* Created by Floflo on 22/10/2016.
|
||||
*/
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
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.block.BlockPhysicsEvent;
|
||||
import org.bukkit.event.entity.EntityChangeBlockEvent;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
public class PhysicListener implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void blockFallEvent(BlockPhysicsEvent event) {
|
||||
Block block = event.getBlock();
|
||||
if (!check(block)) {
|
||||
return;
|
||||
}
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void blockPlaceEvent(EntityChangeBlockEvent event) {
|
||||
Block block = event.getBlock();
|
||||
if (!check(block)) {
|
||||
return;
|
||||
}
|
||||
event.setCancelled(true);
|
||||
for (Player player : Bukkit.getServer().getOnlinePlayers()) {
|
||||
Location loc = block.getLocation();
|
||||
double y = loc.getY();
|
||||
y -= 1.0D;
|
||||
loc.setY(y);
|
||||
|
||||
player.sendBlockChange(loc, 0, (byte)0);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean check(Block block) {
|
||||
return (checkBlock(block));
|
||||
}
|
||||
|
||||
private boolean checkBlock(Block block)
|
||||
{
|
||||
Material type = block.getType();
|
||||
return (type == Material.GRAVEL) || (type == Material.SAND || (type == Material.ANVIL));
|
||||
}
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
package net.DeltaWings.Nemoria;
|
||||
|
||||
import net.DeltaWings.Nemoria.Listeners.PhysicListener;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.plugin.RegisteredServiceProvider;
|
||||
@ -34,6 +35,7 @@ public class Main extends JavaPlugin implements Listener{
|
||||
getCommand("PlayerInfos").setExecutor(new PlayerInfos());
|
||||
getCommand("SetTP").setExecutor(new SetTP());
|
||||
getCommand("DelTP").setExecutor(new DelTP());
|
||||
getServer().getPluginManager().registerEvents(new PhysicListener(), this);
|
||||
saveDefaultConfig();
|
||||
//plugin enabled
|
||||
System.out.println("[Menoria]Plugin enabled");
|
||||
|
Loading…
x
Reference in New Issue
Block a user