Compare commits

...

7 Commits

5 changed files with 39 additions and 44 deletions
+5 -1
View File
@@ -6,7 +6,7 @@
<groupId>me.youhavetrouble</groupId>
<artifactId>PreventStabby</artifactId>
<version>1.6.0</version>
<version>1.7.2</version>
<packaging>jar</packaging>
<name>PreventStabby</name>
@@ -49,6 +49,10 @@
<pattern>org.bstats</pattern>
<shadedPattern>bstats</shadedPattern>
</relocation>
<relocation>
<pattern>net.kyori</pattern>
<shadedPattern>kyori</shadedPattern>
</relocation>
</relocations>
</configuration>
</execution>
+28 -37
View File
@@ -1,43 +1,34 @@
<h2>PreventStabby ⚔</h2>
<h1>PreventStabby ⚔</h1>
Use Issues section to report bugs or submit suggestions.
<h3>Commands</h3>
Permission: <code>preventstabby.command</code> (given by default to everyone) :
You can find available commands <a href="https://github.com/YouHaveTrouble/PreventStabby/wiki/Commands">HERE</a>.
<h3>Configuration</h3>
Explanation of all available config options is <a href="https://github.com/YouHaveTrouble/PreventStabby/wiki/Config">HERE</a>.
<h3>Placeholders</h3>
List of all PlaceholderAPI placeholders can be found <a href="https://github.com/YouHaveTrouble/PreventStabby/wiki/Placeholders">HERE</a>.
<h3>Developer API</h3>
Developer API documetation is <a href="https://github.com/YouHaveTrouble/PreventStabby/wiki/Developer-API">HERE</a>!
<h2>Features</h2>
<ul>
<li>/pvp help- displays help message</li>
<li>Per-player PvP Toggle</li>
<li>Global PvP override, allowing to ignore personal toggles temporarily</li>
<li>Block all forms of player-induced damage when PvP off</li>
<li>Block damage done to pets and mounts when PvP off</li>
<li>Block the ability to pour lava and set fire under player's feet</li>
<li>Block channeling tridents spawning fire under players with PvP off</li>
<li>Block fishing pole pulling for players with PvP off</li>
<li>Pets do not attack players with PvP off</li>
<li>Configurable PvP protection after login</li>
<li>Configurable PvP protection after teleport</li>
<li>Kill players that logged out during combat</li>
<li>Block specific commands while in combat</li>
<li>Block teleports in combat (might cause issues with some plugins)</li>
<li>Toggles for eggs and snowballs applying knockback</li>
<li>Extensive developer API</li>
</ul>
Permission: <code>preventstabby.command.toggle</code> (given by default to everyone) :
<ul>
<li>/pvp toggle - toggles PvP</li>
<li>/pvp on - enables PvP (aliases: enable)</li>
<li>/pvp off - disables PvP (aliases: disable)</li>
</ul>
Permission: <code>preventstabby.command.toggle.others</code> (given by default to ops) :
<ul>
<li>/pvp toggle [player] - toggles other player's PvP</li>
<li>/pvp on [player] - enables other player's PvP (aliases: enable)</li>
<li>/pvp off [player] - disables other player's PvP (aliases: disable)</li>
</ul>
<h3>Features</h3>
Player who disables PvP cannot get hurt by any player induced damage.
They also can't deal any damage to other players.
This includes basic attacks, projectiles, splash potions,
lingering potions and lightning strikes from channeling trident enchant.
Additionally lightning strikes from channeling cannot spawn fire under
players, who have pvp disabled and it's impossible to use
fishing rod on players who have pvp disabled.
There is also a feature that disallows pouring lava or using
flint and steel nearby players with disabled pvp. You can
either disable it in config or set its radius.
All the protections are extended to tameable entities (pets) that set player's uuid as their owner on tame.
Pets will not attack players with pvp off or if their owner has pvp off.
@@ -150,11 +150,7 @@ public class PreventStabbyAPI {
}
/**
*
* @param newForcedPvpState<br>
* true - force enable PvP for every player<br>
* false - force disable PvP for every player<br>
* null - don't force PvP state<br>
* Sets forced PvP state until server restart or changed with override command or this method.
*/
public static void setForcedPvpState(PvpState newForcedPvpState) {
PreventStabby.getPlugin().getPlayerManager().setForcedPvpState(newForcedPvpState);
@@ -16,7 +16,7 @@ public class ConfigCache {
@Getter private final boolean pvp_enabled_by_default, lava_and_fire_stopper_enabled, channeling_enchant_disabled,
punish_for_combat_logout, punish_for_combat_logout_announce, only_owner_can_interact_with_pet,
snowballs_knockback, egg_knockback, block_commands_in_combat, block_teleports_in_combat;
snowballs_knockback, egg_knockback, block_commands_in_combat, block_teleports_in_combat, allow_fishing_rod_pull;
@Getter private final String pvp_enabled, pvp_disabled, cannot_attack_victim, cannot_attack_attacker,
cannot_attack_pets_victim, cannot_attack_pets_attacker, no_permission, no_such_command, pvp_enabled_other,
pvp_disabled_other, punish_for_combat_logout_message, entering_combat, leaving_combat,
@@ -57,6 +57,8 @@ public class ConfigCache {
addDefault("settings.eggs_do_knockback", false, "Set to true if eggs should cause knockback to players");
addDefault("settings.allow_fishing_rod_pull", false, "Allows players with pvp off to be pulled by fishing rods");
addComment("settings.block_in_combat", "Set what actions should be blocked while in combat");
addDefault("settings.block_in_combat.block_commands.enabled", true);
List<String> defaultCommandsBlocked = new ArrayList<>();
@@ -113,6 +115,7 @@ public class ConfigCache {
this.punish_for_combat_logout_message = config.getString("settings.punish_for_combat_logout.message", "%player%<reset><white> logged out while in combat. What a loser.");
this.only_owner_can_interact_with_pet = config.getBoolean("settings.only_owner_can_interact_with_pet", false);
this.allow_fishing_rod_pull = config.getBoolean("settings.allow_fishing_rod_pull", false);
this.snowballs_knockback = config.getBoolean("settings.snowballs_do_knockback", false);
this.egg_knockback = config.getBoolean("settings.eggs_do_knockback", false);
this.block_commands_in_combat = config.getBoolean("settings.block_in_combat.block_commands", true);
@@ -19,6 +19,7 @@ public class FishingListener implements Listener {
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onFish(org.bukkit.event.player.PlayerFishEvent event) {
if (event.getCaught() instanceof Player) {
if (PreventStabby.getPlugin().getConfigCache().isAllow_fishing_rod_pull()) return;
UUID damager = event.getPlayer().getUniqueId();
UUID victim = event.getCaught().getUniqueId();
if (damager == victim)