mirror of
https://github.com/TotalFreedomMC/VulnerabilityPatcher.git
synced 2024-06-29 01:10:53 +00:00
66 lines
2.2 KiB
Java
66 lines
2.2 KiB
Java
package me.cooljwb.vulnerabilitypatcher.patches;
|
|
|
|
import org.bukkit.Bukkit;
|
|
import org.bukkit.World;
|
|
import org.bukkit.entity.Entity;
|
|
import org.bukkit.event.EventHandler;
|
|
import org.bukkit.event.Listener;
|
|
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
|
import org.bukkit.scheduler.BukkitScheduler;
|
|
import org.bukkit.util.Vector;
|
|
|
|
import java.util.logging.Level;
|
|
import java.util.logging.Logger;
|
|
|
|
/*
|
|
* Copyright 2019 CoolJWB
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
|
|
/**
|
|
* @author CoolJWB
|
|
*/
|
|
|
|
|
|
public class Rouge_Entity extends Patches implements Listener {
|
|
|
|
private Logger log = Logger.getLogger("Minecraft");
|
|
|
|
public Rouge_Entity() {
|
|
runnable();
|
|
}
|
|
|
|
public void runnable() {
|
|
BukkitScheduler scheduler = Bukkit.getServer().getScheduler();
|
|
scheduler.scheduleSyncRepeatingTask(main, new Runnable() {
|
|
@Override
|
|
public void run() {
|
|
for(World world : Bukkit.getWorlds()) {
|
|
if(world.getEntities() != null) {
|
|
for(Entity entity : world.getEntities()) {
|
|
if(entity != null && (entity.getVelocity().getX() > 10.0D || entity.getVelocity().getY() > 10.0D || entity.getVelocity().getZ() > 10.0D || entity.getVelocity().getX() < -6.0D || entity.getVelocity().getY() < -6.0D || entity.getVelocity().getZ() < -6.0D)) {
|
|
if(entity.getName().equals("Firework Rocket"))
|
|
entity.remove();
|
|
|
|
else
|
|
entity.setVelocity(new Vector(0,0,0));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}, 0L, 0);
|
|
}
|
|
}
|