-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1.4, adding a shit ton of features, Bow bomb, ability to disable link…
…s, and some other lag stuff.
- Loading branch information
Showing
12 changed files
with
389 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
src/main/java/me/krymz0n/simpleexploitfixer/listener/ArmorStand.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package me.krymz0n.simpleexploitfixer.listener; | ||
|
||
import me.krymz0n.simpleexploitfixer.Main; | ||
import org.bukkit.Chunk; | ||
import org.bukkit.entity.Entity; | ||
import org.bukkit.entity.EntityType; | ||
import org.bukkit.event.EventHandler; | ||
import org.bukkit.event.Listener; | ||
import org.bukkit.event.world.ChunkLoadEvent; | ||
|
||
import java.util.ArrayList; | ||
|
||
public class ArmorStand implements Listener { | ||
private final Main plugin; | ||
|
||
public ArmorStand(Main plugin) { | ||
this.plugin = plugin; | ||
} | ||
|
||
@EventHandler | ||
public void onChunkLoad(ChunkLoadEvent evt) { | ||
Chunk c = evt.getChunk(); | ||
if (!evt.isNewChunk()) { | ||
ArrayList<Entity> entities = new ArrayList<>(); | ||
for (Entity entity : c.getEntities()) { | ||
if (entity.getType().equals(EntityType.ARMOR_STAND) && (!(entity.getType() == null))) { | ||
entities.add(entity); | ||
for (int i = plugin.getConfig().getInt("MaxArmorStandPerChunk"); i < entities.size(); i++) { | ||
entity.remove(); | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
src/main/java/me/krymz0n/simpleexploitfixer/listener/BowBomb.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package me.krymz0n.simpleexploitfixer.listener; | ||
|
||
import me.krymz0n.simpleexploitfixer.Main; | ||
import org.bukkit.entity.Arrow; | ||
import org.bukkit.event.EventHandler; | ||
import org.bukkit.event.Listener; | ||
import org.bukkit.event.entity.ProjectileLaunchEvent; | ||
|
||
public class BowBomb implements Listener { | ||
private final Main plugin; | ||
|
||
public BowBomb(Main plugin) { | ||
this.plugin = plugin; | ||
} | ||
|
||
@EventHandler | ||
public void onArrow(ProjectileLaunchEvent evt) { | ||
if (plugin.getConfig().getBoolean("PreventBowBombExploit")) { | ||
if (evt.getEntity() instanceof Arrow) { | ||
if (evt.getEntity().getVelocity().lengthSquared() > plugin.getConfig().getInt("MaxBowSquaredVelocity")) { | ||
evt.setCancelled(true); | ||
} | ||
} | ||
} | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
src/main/java/me/krymz0n/simpleexploitfixer/listener/Chat.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package me.krymz0n.simpleexploitfixer.listener; | ||
|
||
import io.papermc.paper.event.player.AsyncChatEvent; | ||
import me.krymz0n.simpleexploitfixer.Main; | ||
import org.bukkit.entity.Player; | ||
import org.bukkit.event.EventHandler; | ||
import org.bukkit.event.Listener; | ||
import org.bukkit.event.player.AsyncPlayerChatEvent; | ||
|
||
import java.util.regex.Matcher; | ||
import java.util.regex.Pattern; | ||
|
||
public class Chat implements Listener { | ||
private static final Pattern httpRegexCheck = | ||
Pattern.compile("(https?://(?:www\\.|(?!www))[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\\.[^\\s]{2,}|www\\.[a-zA-Z0-9]" + | ||
"[a-zA-Z0-9-]+[a-zA-Z0-9]\\.[^\\s]{2,}|https?://(?:www\\.|(?!www))[a-zA-Z0-9]+\\.[^\\s]{2,}|www\\.[a-zA-Z0-9]+\\.[^\\s]{2,})", Pattern.CASE_INSENSITIVE); | ||
private final Main plugin; | ||
|
||
public Chat(Main plugin) { | ||
this.plugin = plugin; | ||
} | ||
|
||
@EventHandler | ||
private void onChat(AsyncPlayerChatEvent evt) { | ||
Player p = evt.getPlayer(); | ||
if (link(evt.getMessage())) { | ||
evt.setCancelled(true); | ||
} | ||
} | ||
|
||
public static boolean link(String s) { | ||
Matcher matcher = httpRegexCheck.matcher(s); | ||
return matcher.find(); | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.