mirror of
https://github.com/darksaid98/Builders-Utilities.git
synced 2026-12-03 06:28:53 +00:00
update
update
This commit is contained in:
1 parent
009927e4f4
commit
04883a7da2
3 files changed
+25
-25
No files matched your search
@@ -36,13 +36,14 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class Main extends JavaPlugin implements Listener {
|
public class Main extends JavaPlugin implements Listener {
|
||||||
|
public static Main main;
|
||||||
public static NmsManager nmsManager;
|
public static NmsManager nmsManager;
|
||||||
public static List<String> ironTrapdoorNames;
|
public static List<String> ironTrapdoorNames;
|
||||||
public static List<String> slabNames;
|
public static List<String> slabNames;
|
||||||
public static List<String> terracottaNames;
|
public static List<String> terracottaNames;
|
||||||
public static Main main;
|
|
||||||
|
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
|
main = this;
|
||||||
nmsManager = new NmsManager();
|
nmsManager = new NmsManager();
|
||||||
|
|
||||||
PluginManager pm = getServer().getPluginManager();
|
PluginManager pm = getServer().getPluginManager();
|
||||||
@@ -52,8 +53,6 @@ public class Main extends JavaPlugin implements Listener {
|
|||||||
slabNames = new ArrayList<>();
|
slabNames = new ArrayList<>();
|
||||||
terracottaNames = new ArrayList<>();
|
terracottaNames = new ArrayList<>();
|
||||||
|
|
||||||
main = this;
|
|
||||||
|
|
||||||
this.saveDefaultConfig();
|
this.saveDefaultConfig();
|
||||||
new NoClipManager(this);
|
new NoClipManager(this);
|
||||||
|
|
||||||
@@ -133,6 +132,9 @@ public class Main extends JavaPlugin implements Listener {
|
|||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR)
|
@EventHandler(priority = EventPriority.MONITOR)
|
||||||
public void onDragonEggTP(PlayerInteractEvent e) {
|
public void onDragonEggTP(PlayerInteractEvent e) {
|
||||||
|
if (e.isCancelled()){
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (e.getAction().equals(Action.RIGHT_CLICK_BLOCK) && e.getClickedBlock().getType().equals(Material.DRAGON_EGG) && this.getConfig().getBoolean("prevent-dragon-egg-teleport")) {
|
if (e.getAction().equals(Action.RIGHT_CLICK_BLOCK) && e.getClickedBlock().getType().equals(Material.DRAGON_EGG) && this.getConfig().getBoolean("prevent-dragon-egg-teleport")) {
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
}
|
}
|
||||||
@@ -142,6 +144,9 @@ public class Main extends JavaPlugin implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.MONITOR)
|
@EventHandler(priority = EventPriority.MONITOR)
|
||||||
public void onBlockBreak(PlayerInteractEvent e)
|
public void onBlockBreak(PlayerInteractEvent e)
|
||||||
{
|
{
|
||||||
|
if (e.isCancelled()){
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (slabNames.contains(e.getPlayer().getName())){
|
if (slabNames.contains(e.getPlayer().getName())){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -240,6 +245,9 @@ public class Main extends JavaPlugin implements Listener {
|
|||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerInteract(PlayerInteractEvent e) {
|
public void onPlayerInteract(PlayerInteractEvent e) {
|
||||||
|
if (e.isCancelled()){
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (this.getConfig().getBoolean("disable-soil-trample")) {
|
if (this.getConfig().getBoolean("disable-soil-trample")) {
|
||||||
if (e.getAction() == Action.PHYSICAL) {
|
if (e.getAction() == Action.PHYSICAL) {
|
||||||
Block block = e.getClickedBlock();
|
Block block = e.getClickedBlock();
|
||||||
@@ -286,6 +294,9 @@ public class Main extends JavaPlugin implements Listener {
|
|||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onTeleport(PlayerTeleportEvent event) {
|
public void onTeleport(PlayerTeleportEvent event) {
|
||||||
|
if (event.isCancelled()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (event.getCause() == null) {
|
if (event.getCause() == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -299,19 +310,19 @@ public class Main extends JavaPlugin implements Listener {
|
|||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
@EventHandler(priority = EventPriority.MONITOR)
|
@EventHandler(priority = EventPriority.MONITOR)
|
||||||
public void GlazedTerracottaInteract(final PlayerInteractEvent e) {
|
public void GlazedTerracottaInteract(final PlayerInteractEvent e) {
|
||||||
if (!Main.nmsManager.isAtLeastVersion(1, 12 ,0)){
|
if (e.isCancelled()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!e.getHand().equals(EquipmentSlot.HAND)) {
|
if (!Main.nmsManager.isAtLeastVersion(1, 12 ,0)){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!terracottaNames.contains(e.getPlayer().getName())) {
|
if (!terracottaNames.contains(e.getPlayer().getName())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (e.isCancelled()) {
|
if (!e.getAction().equals(Action.RIGHT_CLICK_BLOCK)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!e.getAction().equals(Action.RIGHT_CLICK_BLOCK)) {
|
if (!e.getHand().equals(EquipmentSlot.HAND)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!e.getClickedBlock().getType().name().contains("GLAZED")) {
|
if (!e.getClickedBlock().getType().name().contains("GLAZED")) {
|
||||||
@@ -339,15 +350,15 @@ public class Main extends JavaPlugin implements Listener {
|
|||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
@EventHandler(priority = EventPriority.MONITOR)
|
@EventHandler(priority = EventPriority.MONITOR)
|
||||||
public void ironTrapDoorInteract(final PlayerInteractEvent e) {
|
public void ironTrapDoorInteract(final PlayerInteractEvent e) {
|
||||||
|
if (e.isCancelled()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (ironTrapdoorNames.contains(e.getPlayer().getName())) {
|
if (ironTrapdoorNames.contains(e.getPlayer().getName())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!e.getPlayer().getGameMode().equals(GameMode.CREATIVE)) {
|
if (!e.getPlayer().getGameMode().equals(GameMode.CREATIVE)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (e.isCancelled()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!e.getAction().equals(Action.RIGHT_CLICK_BLOCK)) {
|
if (!e.getAction().equals(Action.RIGHT_CLICK_BLOCK)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -362,7 +373,6 @@ public class Main extends JavaPlugin implements Listener {
|
|||||||
if (e.getPlayer().isSneaking()) {
|
if (e.getPlayer().isSneaking()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Bukkit.getScheduler().runTaskLater(this, new Runnable() {
|
Bukkit.getScheduler().runTaskLater(this, new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
|||||||
@@ -13,17 +13,11 @@ public class NmsManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean isVersion(String v) {
|
public boolean isVersion(String v) {
|
||||||
if (version.equalsIgnoreCase(v)) {
|
return version.equalsIgnoreCase(v);
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isVersion(int gameV, int releaseV, int subReleaseV) {
|
public boolean isVersion(int gameV, int releaseV, int subReleaseV) {
|
||||||
if (version.equalsIgnoreCase("v" + gameV + "_" + releaseV + "_R" + subReleaseV)) {
|
return version.equalsIgnoreCase("v" + gameV + "_" + releaseV + "_R" + subReleaseV);
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isAtLeastVersion(int gameV, int releaseV, int subReleaseV) {
|
public boolean isAtLeastVersion(int gameV, int releaseV, int subReleaseV) {
|
||||||
@@ -42,11 +36,7 @@ public class NmsManager {
|
|||||||
} else if (release < releaseV) {
|
} else if (release < releaseV) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
if (subRelease >= subReleaseV) {
|
return subRelease >= subReleaseV;
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
name: BuildersUtilities
|
name: BuildersUtilities
|
||||||
main: com.buildersrefuge.utilities.Main
|
main: com.buildersrefuge.utilities.Main
|
||||||
version: 1.2.7
|
version: 1.2.9
|
||||||
author: Arcaniax
|
author: Arcaniax
|
||||||
commands:
|
commands:
|
||||||
banner:
|
banner:
|
||||||
|
|||||||
Reference in new issue
Block a user