Merge branch 'master' of https://github.com/CivClassic/SimpleAdminHacks into anti-fast-break-fix
This commit is contained in:
commit
3264c5b124
5 files changed
+76
-26
No files matched your search
-8
@@ -20,7 +20,6 @@ public class GameFeaturesConfig extends SimpleHackConfig {
|
||||
private boolean enderChestUse;
|
||||
private boolean shulkerBoxUse;
|
||||
private boolean totemPowers;
|
||||
private boolean elytraUse;
|
||||
private boolean chorusFruitUse;
|
||||
|
||||
private boolean weepingAngel;
|
||||
@@ -69,9 +68,6 @@ public class GameFeaturesConfig extends SimpleHackConfig {
|
||||
this.totemPowers = config.getBoolean("totemPower", false);
|
||||
if (!this.totemPowers) plugin().log(" Undeath via totems is disabled");
|
||||
|
||||
this.elytraUse = config.getBoolean("elytraUse", true);
|
||||
if (!this.elytraUse) plugin().log(" Elytra use is disabled");
|
||||
|
||||
this.chorusFruitUse = config.getBoolean("chorusFruitTeleportation", false);
|
||||
if (!this.chorusFruitUse) {
|
||||
plugin().log(" Chorus Fruit Teleportation is disabled");
|
||||
@@ -145,10 +141,6 @@ public class GameFeaturesConfig extends SimpleHackConfig {
|
||||
return this.totemPowers;
|
||||
}
|
||||
|
||||
public boolean isElytraUse() {
|
||||
return this.elytraUse;
|
||||
}
|
||||
|
||||
public boolean isChorusFruitTeleportation() {
|
||||
return this.chorusFruitUse;
|
||||
}
|
||||
|
||||
@@ -36,7 +36,6 @@ import org.bukkit.event.block.BlockPlaceEvent;
|
||||
import org.bukkit.event.entity.CreatureSpawnEvent;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.event.entity.EntityResurrectEvent;
|
||||
import org.bukkit.event.entity.EntityToggleGlideEvent;
|
||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||
import org.bukkit.event.inventory.FurnaceExtractEvent;
|
||||
import org.bukkit.event.inventory.InventoryMoveItemEvent;
|
||||
@@ -63,7 +62,7 @@ import vg.civcraft.mc.civmodcore.inventory.items.ItemUtils;
|
||||
* It's part of a series of focused hacks.
|
||||
*
|
||||
* {@link GameFixes} is focused on things that are broken or don't work, and attempts to fix them.
|
||||
* {@link GameFeatures} focuses on enabling and disabling features, like elytra, various potion states.
|
||||
* {@link GameFeatures} focuses on enabling and disabling features, like ender chests, various potion states.
|
||||
* {@link GameTuning} neither fixes nor disables, but rather adjusts and reconfigures.
|
||||
*
|
||||
* Currently you can control the following:
|
||||
@@ -174,13 +173,6 @@ public class GameFeatures extends SimpleHack<GameFeaturesConfig> implements List
|
||||
genStatus.append("disabled\n");
|
||||
}
|
||||
|
||||
genStatus.append(" Elytra use is ");
|
||||
if (config.isElytraUse()) {
|
||||
genStatus.append("enabled\n");
|
||||
} else {
|
||||
genStatus.append("disabled\n");
|
||||
}
|
||||
|
||||
genStatus.append(" Chorus Fruit teleportation is ");
|
||||
if (config.isChorusFruitTeleportation()) {
|
||||
genStatus.append("enabled\n");
|
||||
@@ -365,13 +357,6 @@ public class GameFeatures extends SimpleHack<GameFeaturesConfig> implements List
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void disableElytraUse(EntityToggleGlideEvent event) {
|
||||
if (!config.isEnabled() || config.isElytraUse()) return;
|
||||
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void weepingAngelListener(PlayerDeathEvent event) {
|
||||
if (!config.isEnabled()) return;
|
||||
|
||||
+66
@@ -0,0 +1,66 @@
|
||||
package com.programmerdan.minecraft.simpleadminhacks.hacks.basic;
|
||||
|
||||
import com.destroystokyo.paper.event.player.PlayerElytraBoostEvent;
|
||||
import com.programmerdan.minecraft.simpleadminhacks.SimpleAdminHacks;
|
||||
import com.programmerdan.minecraft.simpleadminhacks.framework.BasicHack;
|
||||
import com.programmerdan.minecraft.simpleadminhacks.framework.BasicHackConfig;
|
||||
import com.programmerdan.minecraft.simpleadminhacks.framework.autoload.AutoLoad;
|
||||
import net.minelink.ctplus.CombatTagPlus;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.entity.EntityToggleGlideEvent;
|
||||
|
||||
public class ElytraFeatures extends BasicHack {
|
||||
|
||||
@AutoLoad
|
||||
private boolean disableFlight;
|
||||
|
||||
@AutoLoad
|
||||
private boolean disableFireworkBoosting;
|
||||
|
||||
@AutoLoad
|
||||
private boolean disableFlightInCombat;
|
||||
|
||||
public ElytraFeatures(final SimpleAdminHacks plugin, final BasicHackConfig config) {
|
||||
super(plugin, config);
|
||||
}
|
||||
|
||||
private boolean hasBypassPermission(final Entity entity) {
|
||||
if (!(entity instanceof Player)) {
|
||||
return false;
|
||||
}
|
||||
return entity.hasPermission("simpleadmin.elytrabypass");
|
||||
}
|
||||
|
||||
private boolean isInCombat(final Entity entity) {
|
||||
if (!(entity instanceof Player)) {
|
||||
return false;
|
||||
}
|
||||
final var pluginManager = Bukkit.getPluginManager();
|
||||
final var foundPlugin = pluginManager.getPlugin("CombatTagPlus");
|
||||
if (pluginManager.isPluginEnabled(foundPlugin)) {
|
||||
final var combatTagPlugin = (CombatTagPlus) foundPlugin;
|
||||
return combatTagPlugin.getTagManager().isTagged(entity.getUniqueId());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
public void disableElytraFlight(final EntityToggleGlideEvent event) {
|
||||
if (this.disableFlight || (this.disableFlightInCombat && isInCombat(event.getEntity()))) {
|
||||
if (!hasBypassPermission(event.getEntity())) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
public void disableElytraFireworkBoosting(final PlayerElytraBoostEvent event) {
|
||||
if (this.disableFireworkBoosting && !hasBypassPermission(event.getPlayer())) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -92,6 +92,11 @@ hacks:
|
||||
announcements:
|
||||
- "[\"\",{\"text\":\"Buy \"},{\"text\":\"Dogecoin\",\"color\":\"dark_red\",\"clickEvent\":{\"action\":\"open_url\",\"value\":\"https://www.coindesk.com/price/dogecoin\"}},{\"text\":\"!\"}]"
|
||||
- "[\"\",{\"text\":\"Very \"},{\"text\":\"Wow!\",\"italic\":true,\"hoverEvent\":{\"action\":\"show_text\",\"contents\":\"Wow!\"}}]"
|
||||
ElytraFeatures:
|
||||
enabled: true
|
||||
disableFlight: false
|
||||
disableFireworkBoosting: false
|
||||
disableFlightInCombat: false
|
||||
EventDebugHack:
|
||||
enabled: true
|
||||
EventHandlerList:
|
||||
@@ -259,8 +264,6 @@ hacks:
|
||||
# Enderchests is also true = enabled and false = disabled
|
||||
enderChestPlacement: true
|
||||
enderChestUse: false
|
||||
# ElytraUse: true = enabled, false = disabled
|
||||
elytraUse: true
|
||||
chorusFruitTeleportation: false
|
||||
# WeepingAngel bans people when they die, the numbers are in minutes.
|
||||
weepingAngel:
|
||||
|
||||
@@ -109,6 +109,7 @@ permissions:
|
||||
simpleadmin.revive: true
|
||||
simpleadmin.debugwand: true
|
||||
simpleadmin.bedlocator: true
|
||||
simpleadmin.elytrabypass: true
|
||||
simpleadmin.hacks:
|
||||
description: Allows control of the hacks and settings which simpleadminhacks supports
|
||||
default: op
|
||||
@@ -154,3 +155,6 @@ permissions:
|
||||
simpleadmin.bedlocator:
|
||||
description: Gives the ability to locate your own bed
|
||||
default: true
|
||||
simpleadmin.elytrabypass:
|
||||
description: Gives the ability to bypass elytra restrictions
|
||||
default: op
|
||||
Reference in new issue
Block a user