Skip to content

Commit 02fb220

Browse files
author
Xyness
committed
1.11.8.2
1 parent 948efe6 commit 02fb220

File tree

9 files changed

+574
-141
lines changed

9 files changed

+574
-141
lines changed

build.gradle.kts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ java {
1616

1717
repositories {
1818
mavenCentral()
19-
maven("https://papermc.io/repo/repository/maven-public/")
19+
maven("https://repo.papermc.io/repository/maven-public/")
2020
maven("https://ci.ender.zone/plugin/repository/everything/")
2121
maven("https://repo.extendedclip.com/content/repositories/placeholderapi/")
2222
maven("https://jitpack.io")
@@ -41,7 +41,9 @@ dependencies {
4141
compileOnly("com.sk89q.worldguard:worldguard-bukkit:7.0.4") {
4242
exclude(group = "org.bstats", module = "bstats-bukkit")
4343
}
44-
compileOnly("com.github.MilkBowl:VaultAPI:1.7")
44+
compileOnly('com.github.MilkBowl:VaultAPI:1.7') {
45+
exclude(group = "org.bukkit", module = "bukkit")
46+
}
4547
compileOnly(files("libs/Dynmap-3.7-beta-6-spigot.jar"))
4648
compileOnly("de.bluecolored.bluemap:BlueMapAPI:2.7.2")
4749
compileOnly("maven.modrinth:pl3xmap:1.21-500")

src/main/java/fr/xyness/SCS/ClaimMain.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,9 @@ public void clearDataForPlayer(Player player) {
141141
* @param type the type of message (ACTION_BAR, SUBTITLE, TITLE, CHAT, BOSSBAR)
142142
*/
143143
public void sendMessage(Player player, String message, String type) {
144+
if(message.isBlank()) {
145+
return;
146+
}
144147
switch (type) {
145148
case "ACTION_BAR":
146149
player.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(message));

src/main/java/fr/xyness/SCS/Commands/ClaimCommand.java

Lines changed: 459 additions & 111 deletions
Large diffs are not rendered by default.

src/main/java/fr/xyness/SCS/Listeners/ClaimEvents.java

Lines changed: 66 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
import org.bukkit.event.player.PlayerBucketFillEvent;
5555
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
5656
import org.bukkit.event.player.PlayerDropItemEvent;
57+
import org.bukkit.event.player.PlayerFishEvent;
5758
import org.bukkit.event.player.PlayerInteractAtEntityEvent;
5859
import org.bukkit.event.player.PlayerInteractEntityEvent;
5960
import org.bukkit.event.player.PlayerInteractEvent;
@@ -65,6 +66,7 @@
6566
import org.bukkit.potion.PotionEffect;
6667
import org.bukkit.potion.PotionEffectType;
6768
import org.bukkit.projectiles.ProjectileSource;
69+
import org.bukkit.util.Vector;
6870

6971
import fr.xyness.SCS.SimpleClaimSystem;
7072
import fr.xyness.SCS.Types.CPlayer;
@@ -362,6 +364,12 @@ public void onEntityExplode(EntityExplodeEvent event) {
362364
blockIterator.remove();
363365
}
364366
}
367+
event.getEntity().getNearbyEntities(5, 5, 5).forEach(entity -> {
368+
Chunk chunk = entity.getLocation().getChunk();
369+
if (instance.getMain().checkIfClaimExists(chunk) && !instance.getMain().canPermCheck(chunk, "Explosions", "Natural")) {
370+
entity.setVelocity(new Vector(0, 0, 0));
371+
}
372+
});
365373
}
366374

367375
/**
@@ -384,6 +392,32 @@ public void onProjectileHit(ProjectileHitEvent event) {
384392
event.setCancelled(true);
385393
}
386394
}
395+
event.getEntity().getNearbyEntities(5, 5, 5).forEach(entity -> {
396+
Chunk chunk = entity.getLocation().getChunk();
397+
if (instance.getMain().checkIfClaimExists(chunk) && !instance.getMain().canPermCheck(chunk, "Explosions", "Natural")) {
398+
entity.setVelocity(new Vector(0, 0, 0));
399+
}
400+
});
401+
} else if (event.getEntityType() == EntityType.WIND_CHARGE) {
402+
if (event.getHitBlock() != null) {
403+
Block block = event.getHitBlock();
404+
Chunk chunk = block.getLocation().getChunk();
405+
if (instance.getMain().checkIfClaimExists(chunk) && !instance.getMain().canPermCheck(chunk, "Explosions", "Natural")) {
406+
event.setCancelled(true);
407+
}
408+
}
409+
if (event.getHitEntity() != null) {
410+
Chunk chunk = event.getHitEntity().getLocation().getChunk();
411+
if(instance.getMain().checkIfClaimExists(chunk) && !instance.getMain().canPermCheck(chunk, "Explosions", "Natural")) {
412+
event.setCancelled(true);
413+
}
414+
}
415+
event.getEntity().getNearbyEntities(5, 5, 5).forEach(entity -> {
416+
Chunk chunk = entity.getLocation().getChunk();
417+
if (instance.getMain().checkIfClaimExists(chunk) && !instance.getMain().canPermCheck(chunk, "Explosions", "Natural")) {
418+
entity.setVelocity(new Vector(0, 0, 0));
419+
}
420+
});
387421
}
388422
}
389423

@@ -539,6 +573,8 @@ public void onHangingBreak(HangingBreakEvent event) {
539573
if(instance.getMain().checkIfClaimExists(chunk)) {
540574
if(event.getCause() == HangingBreakEvent.RemoveCause.PHYSICS && !instance.getMain().canPermCheck(chunk, "Destroy", "Visitors")) {
541575
event.setCancelled(true);
576+
} else if (event.getCause() == HangingBreakEvent.RemoveCause.EXPLOSION && !instance.getMain().canPermCheck(chunk, "Explosions", "Natural")) {
577+
event.setCancelled(true);
542578
}
543579
}
544580
}
@@ -549,28 +585,9 @@ public void onHangingBreak(HangingBreakEvent event) {
549585
*/
550586
@EventHandler(priority = EventPriority.LOWEST)
551587
public void onHangingBreakByEntity(HangingBreakByEntityEvent event) {
552-
if(event.isCancelled()) return;
553-
if (event.getEntity().getType() == EntityType.PAINTING) {
554-
Chunk chunk = event.getEntity().getLocation().getChunk();
555-
if (event.getRemover() instanceof Player) {
556-
if(instance.getMain().checkIfClaimExists(chunk)) {
557-
Player player = (Player) event.getRemover();
558-
if(instance.getPlayerMain().checkPermPlayer(player, "scs.bypass")) return;
559-
Claim claim = instance.getMain().getClaim(chunk);
560-
if(!claim.getPermissionForPlayer("Destroy", player)) {
561-
event.setCancelled(true);
562-
instance.getMain().sendMessage(player,instance.getLanguage().getMessage("destroy"), instance.getSettings().getSetting("protection-message"));
563-
return;
564-
}
565-
}
566-
return;
567-
}
568-
if(!instance.getMain().canPermCheck(chunk, "Destroy", "Visitors")) {
569-
event.setCancelled(true);
570-
return;
571-
}
572-
}
573-
if (event.getEntity().getType() == EntityType.ITEM_FRAME || event.getEntity().getType() == EntityType.GLOW_ITEM_FRAME) {
588+
if (event.getEntity().getType() == EntityType.PAINTING
589+
|| event.getEntity().getType() == EntityType.ITEM_FRAME
590+
|| event.getEntity().getType() == EntityType.GLOW_ITEM_FRAME) {
574591
Chunk chunk = event.getEntity().getLocation().getChunk();
575592
if (event.getRemover() instanceof Player) {
576593
if(instance.getMain().checkIfClaimExists(chunk)) {
@@ -632,6 +649,31 @@ public void onBucketUse(PlayerBucketFillEvent event) {
632649
}
633650
}
634651

652+
/**
653+
* Handles the player fish event.
654+
*
655+
* @param event the player fish event.
656+
*/
657+
@EventHandler
658+
public void onPlayerFish(PlayerFishEvent event) {
659+
Player player = event.getPlayer();
660+
if(instance.getPlayerMain().checkPermPlayer(player, "scs.bypass")) return;
661+
if(event.getCaught() instanceof Entity) {
662+
Entity entity = event.getCaught();
663+
if(entity != null) {
664+
Chunk chunk = entity.getLocation().getChunk();
665+
if(instance.getMain().checkIfClaimExists(chunk)) {
666+
Claim claim = instance.getMain().getClaim(chunk);
667+
if(!claim.getPermissionForPlayer("Entities", player)) {
668+
event.setCancelled(true);
669+
instance.getMain().sendMessage(player,instance.getLanguage().getMessage("entities"), instance.getSettings().getSetting("protection-message"));
670+
return;
671+
}
672+
}
673+
}
674+
}
675+
}
676+
635677
/**
636678
* Handles entity place events to prevent entity placement in claims.
637679
* @param event the entity place event.
@@ -991,7 +1033,7 @@ public void onBlockBurn(BlockBurnEvent event) {
9911033
* Handles entity damage by entity events to prevent damage to armor stands, item frames, and glow item frames in claims.
9921034
* @param event the entity damage by entity event.
9931035
*/
994-
@EventHandler(priority = EventPriority.LOWEST)
1036+
@EventHandler
9951037
public void onEntityDamageByEntity2(EntityDamageByEntityEvent event) {
9961038
Entity entity = event.getEntity();
9971039
if(entity instanceof ArmorStand || entity instanceof ItemFrame || entity instanceof GlowItemFrame) {
@@ -1008,7 +1050,6 @@ public void onEntityDamageByEntity2(EntityDamageByEntityEvent event) {
10081050
}
10091051
return;
10101052
}
1011-
10121053
if (!instance.getMain().canPermCheck(chunk, "Destroy", "Visitors")) {
10131054
event.setCancelled(true);
10141055
}
@@ -1019,7 +1060,7 @@ public void onEntityDamageByEntity2(EntityDamageByEntityEvent event) {
10191060
* Handles entity damage by entity events to prevent damage to non-player, non-monster, non-armor stand, non-item frame entities in claims.
10201061
* @param event the entity damage by entity event.
10211062
*/
1022-
@EventHandler(priority = EventPriority.LOWEST)
1063+
@EventHandler
10231064
public void onEntityDamageByEntity(EntityDamageByEntityEvent event) {
10241065
Entity entity = event.getEntity();
10251066
Chunk chunk = entity.getLocation().getChunk();

src/main/java/fr/xyness/SCS/SimpleClaimSystem.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ public class SimpleClaimSystem extends JavaPlugin {
112112
private SimpleClaimSystem instance;
113113

114114
/** The version of the plugin */
115-
private String Version = "1.11.8.1";
115+
private String Version = "1.11.8.2";
116116

117117
/** Data source for database connections */
118118
private HikariDataSource dataSource;
@@ -620,6 +620,12 @@ public boolean loadConfig(boolean reload, CommandSender sender) {
620620
// Check the max length of the claim description
621621
claimSettingsInstance.addSetting("max-length-claim-description", getConfig().getString("max-length-claim-description"));
622622

623+
// Add invitations system setting
624+
claimSettingsInstance.addSetting("claim-invitations-system", getConfig().getString("claim-invitations-system"));
625+
626+
// Add invitation expiration delay setting
627+
claimSettingsInstance.addSetting("claim-invitation-expiration-delay", getConfig().getString("claim-invitation-expiration-delay"));
628+
623629
// Add confirmation check setting
624630
claimSettingsInstance.addSetting("claim-confirmation", getConfig().getString("claim-confirmation"));
625631

@@ -1158,6 +1164,12 @@ public boolean reloadOnlyConfig(CommandSender sender) {
11581164
// Check the max length of the claim description
11591165
claimSettingsInstance.addSetting("max-length-claim-description", getConfig().getString("max-length-claim-description"));
11601166

1167+
// Add invitations system setting
1168+
claimSettingsInstance.addSetting("claim-invitations-system", getConfig().getString("claim-invitations-system"));
1169+
1170+
// Add invitation expiration delay setting
1171+
claimSettingsInstance.addSetting("claim-invitation-expiration-delay", getConfig().getString("claim-invitation-expiration-delay"));
1172+
11611173
// Add confirmation check setting
11621174
claimSettingsInstance.addSetting("claim-confirmation", getConfig().getString("claim-confirmation"));
11631175

src/main/resources/config.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,12 @@ max-length-claim-name: 16
6060
# Length max for claim description
6161
max-length-claim-description: 50
6262

63+
# Is there an invitation system for claims? If not, players can add anyone to their claims
64+
claim-invitations-system: false
65+
66+
# Expiration of an invitation (in seconds)
67+
claim-invitation-expiration-delay: 120
68+
6369
# Confirmation before claiming? (available with adding chunks system too)
6470
claim-confirmation: false
6571

src/main/resources/langs/en_US.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,27 @@ can-not-buy-your-own-claim: "§cYou can not buy your own claim."
290290
claim-already-in-sale: "§cThis claim is already in sale."
291291
no-claim-can-be-merged: "§cThere are no claims to merge."
292292

293+
player-invite-other-player: "§e%sender%§f sent you an invitation to join §e%claim-name%"
294+
player-invite-other: "§aInvitation sent to %player%."
295+
player-already-invite-other: |
296+
§cYou have already sent an invitation to %player%.
297+
§cUse /claim cancelinv %player% to cancel the old invitation.
298+
player-invite-accept-button: "§a[Accept]"
299+
player-invite-deny-button: "§c[Deny]"
300+
player-invite-accept-button-hover: "§aClick to accept"
301+
player-invite-deny-button-hover: "§cClick to deny"
302+
player-accept-invitation: "§aYou accepted the invitation."
303+
player-cancel-invitation: "§cYou cancelled the invitation of %player%."
304+
player-deny-invitation: "§cYou denied the invitation."
305+
player-accept-invitation-other: "§a%player%§f accepted the invitation."
306+
player-deny-invitation-other: "§c%player%§f denied the invitation."
307+
player-no-invitation: "§c%player% didn't invite you."
308+
player-do-not-invite: "§cYou didn't invite %player%."
309+
player-invitation-expired: "§cYour invitation to %player% has expired."
310+
player-invitation-expired-other: "§cThe invitation of %player% has expired."
311+
player-invitation-all-their-claims: "all their claims"
312+
player-invitations-system-off: "§cThe invitations system is disabled on this server."
313+
293314

294315
# > Deny messages
295316

src/main/resources/plugin.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: SimpleClaimSystem
2-
version: 1.11.8.1
2+
version: 1.11.8.2
33
main: fr.xyness.SCS.SimpleClaimSystem
44
authors: [Xyness]
55
softdepend: [PlaceholderAPI, WorldGuard, Vault, dynmap, BlueMap, pl3xmap, GriefPrevention]

version.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.11.8.1
1+
1.11.8.2

0 commit comments

Comments
 (0)