sxnnyy_69
📎 1 file 24,048 chars
📄
pasted-code-1785511509423.txt
txt 2848 lines
▶


Neverskipcode.

Nevershortencode.

Neverreplaceimplementationwithcommentslike:

//TODO
//Implementhere
//Example
//Continueyourself

Everythingmustbefullycoded.



TARGET



Server:
Paper1.21.8

Java:
Java21

Build:
GradleKotlinDSL

PluginName:
FlagsSMP

Package:

me.flagssmp



PLUGINGOALS



Thepluginaddspowerfulmagicalflags.

Playerscancraftthemthroughrituals.

Everyflaghas:

•CustomTexture
•LeftClickAbility
•RightClickAbility
•Cooldowns
•Configurablevalues
•Particles
•Sounds
•ActionBarTimers
•CustomRecipes
•RitualUnlockSystem

Noabilityshouldbehardcoded.

Everythingmustbeconfigurable.



Theplugincontainsexactly8uniqueflags.

1HeartFlag

2FireFlag

3CursedFlag

4AirFlag

5LightningFlag

6DirtFlag

7MagnetFlag

8ShadowFlag



GENERALREQUIREMENTS



Everyflagisacustomitem.

EveryflagusesCustomModelData.

Everytexturecomesfromaresourcepack.

Everyabilityisconfigurable.

Everycooldownisconfigurable.

Everydamagevalueisconfigurable.

Everyparticleisconfigurable.

Everysoundisconfigurable.

Everyradiusisconfigurable.

Everydurationisconfigurable.



CLICKSYSTEM



Everyflagsupports:

LEFTCLICK

RIGHTCLICK

SHIFTLEFTCLICK

SHIFTRIGHTCLICK

OnlyLeftClickandRightClickareusedforabilities.



COOLDOWNS



Eachflaghas:

LeftAbilityCooldown

Default:
120seconds

RightAbilityCooldown

Default:
300seconds

Cooldownsmustbestoredseparately.



ACTIONBAR



Insteadofchatspam,

showcooldownsintheactionbar.

Example

L:01:54
R:04:32

Ifabilityisready

show

L:READY

or

R:READY

Updateeverysecond.



NOCHATSPAM



Neverspamchat.

Use

ActionBar

BossBar

Titles

Particles

Sounds

instead.


Everyflaghasitsownconfigfile.

Example

flags/

heart.yml

fire.yml

air.yml

shadow.yml

etc.

Nothingshouldrequirerecompiling.



ADMINCOMMANDS



/flagsreload

Reloadconfigs.

/flagsgive

/flagsritualstart

/flagsritualstop

/flagsrecipe

OpensrecipeeditorGUI.



flagssmp.admin

flagssmp.use

flagssmp.reload

flagssmp.recipe

flagssmp.give



CODEQUALITY



UseOOP.

Usemanagers.

Uselisteners.

Useutilityclasses.

Avoidduplicatedcode.

Everythingmustbemodular.

Nostaticabuse.



PERFORMANCE



Support200+players.

Neveruserepeatingtasksunnecessarily.

Cancelalltaskscorrectly.

Preventmemoryleaks.



ANTIBUG



Prevent:

Cooldownbypass

Itemduplication

Ritualduplication

Inventoryexploits

Chunkunloadissues

Combatexploits

Lagabuse



PROJECTSTRUCTURE



Createproperpackagesincluding:

commands

config

cooldown

flags

ritual

recipes

INVENTORY GUI

listeners

items

models

managers

utils

storage

particle

sound

scheduler

api



OUTPUTRULES



GenerateeveryJavafilecompletely.

Generateplugin.yml.

Generatebuild.gradle.kts.

Generatesettings.gradle.kts.

Generatedefaultconfigs.

GenerateREADME.
Neverskipfiles.

Ifresponselimitisreached,

continueautomaticallyinthenextresponse.

Neversummarize.

Alwayscontinuecoding.

Neversay"thisisenough."

Continueuntilthepluginisfullycomplete.
PART2
HEARTFLAG
FIREFLAG


GENERALFLAGRULES

EveryflagisaCustomModelDataitem.

Playerscannotstackflags.

Maximumstacksize:
1

Flagsneverlosedurability.

Flagsarefireproof.

Flagsarenotconsumedafterabilities.

Whenanabilityfinishes,theflagremainsintheplayer'sinventory.

Iftheplayerdies,flagdroppingmustbeconfigurable.

Default:
Keepflagondeath=false


HEARTFLAG


DisplayName

§c❤HeartFlag

Lore

§7TheFlagofLife

§8LeftClick:
§fGainHealthBoost.

§8RightClick:
§fPlacetheflagandweakenenemies.


LEFTCLICKABILITY


AbilityName

BlessingofLife

Cooldown

120seconds

Duration

15seconds

Effects

HealthBoostII

RegenerationI

AbsorptionII

Showheartparticlesaroundtheplayer.

Playahealingsound.

Showgreenspiralparticles.

Showatitle

Title

❤Blessed

Subtitle

Youfeelstronger.

Whendurationends

Playendingsound.


RIGHTCLICKABILITY


AbilityName

HeartZone

Cooldown

300seconds

Theplayerplacestheflagontheground.

Theflagbecomesatemporaryentity.

Theplayerimmediatelyreceivestheflagbackintoinventory.

Theplacedflagcannotbebroken.

Theplacedflagdisappearsafter:

10seconds

Radius

10Blocks

Insidetheradius

Enemyplayersreceive

Hunger

Saturationexhaustion

Everysecond

Deal

1HalfHeartDamage

TotalDuration

10seconds

DoNOTaffect:

Owner

Spectators

Creativeplayers

Playersoutsidetheradius

Showredparticleseverysecond.

Playheartbeatsounds.

Everysecond

Showapulseanimation.


CONFIGVALUES

Damage

Radius

Duration

Particles

Sounds

Title

Subtitle

PotionLevels

Cooldown


FIREFLAG


DisplayName

§6🔥FireFlag

Lore

§7MasterofFlames

LeftClick

GainStrength

RightClick

CreateaFireStorm


LEFTCLICK

Ability

BurningSpirit

Cooldown

120seconds

Duration

15seconds

Effects

StrengthII

FireResistance

SpeedI

Playblazesounds.

Spawnflameparticles.


RIGHTCLICK

Ability

FireStorm

Cooldown

300seconds

Playerplacestheflag.

Theflagbecomesaninvisiblemarker.

Afterplacement

Everysecond

Launchfireballsinalldirections.

Fireballsexplodeonimpact.

ExplosiondestroysNOblocks.

Explosionstartsfire=configurable.

FireballCount

16

Directions

360Degrees

Range

20Blocks

Damage

DiamondArmor

5Hearts

NetheriteArmor

5Hearts

Iron

Configurable

Leather

Configurable

Gold

Configurable

ExplosionPower

Configurable

FireTickDuration

Configurable

TotalDuration

10Seconds

Afterduration

Removemarker.


VISUALEFFECTS

Largeflamecircle.

Smokeparticles.

Lavaparticles.

Firecracklesounds.

Explosionsounds.


SAFEGUARDS

Neverdamageowner.

Neverdamageteammates
(ifscoreboardteamsexist).

Neverdamagecreativemode.

Neverdamagespectators.

Noblockgriefing.

NoTNTchainreactions.


CONFIG

Everyvalueconfigurable.

FireballCount

FireballSpeed

Damage

Radius

ExplosionPower

Duration

ParticleDensity

Sounds

Cooldown

ArmorMultipliers


AIIMPLEMENTATIONRULES

NeveruserepeatingBukkitRunnableunnecessarily.

Useschedulermanager.

Trackactiveflags.

Automaticallyremoveorphanedentities.

Cancelallscheduledtasks.

Optimizefor200+players.

AvoidlagduringmultipleFireFlags.

NeverallowduplicateHeartZones.

NeverallowduplicateFireStormmarkers.


PART3
CURSEDFLAG
AIRFLAG



CURSEDFLAG


DisplayName

§5☠CursedFlag

Lore

§7Aforbiddenflagfilledwithdarkpower.

LeftClick

Empoweryourswordwithacurse.

RightClick

Createacursedzone.


LEFTCLICK


AbilityName

CursedBlade

Cooldown

120seconds

Duration

15seconds

Requirements

Playermustbeholdingasword.

Supportedswords

Wood

Stone

Iron

Gold

Diamond

Netherite

Effects

Theplayer'scurrentswordbecomescursed.

VisualEffect

Purpleenchantmentglow.

Darkpurpleparticles.

Soulparticles.

Smallsmokeparticles.

Ambientsounds.


SwordAbility

Everysuccessfulhitapplies:

SlownessII

Duration

5seconds

Configurable

Optionaleffects

WeaknessI

WitherI

Bothconfigurable.

Noeffectonowner.

Cooldownbeginsimmediatelyafteractivation.

Ifplayerchangessword

Abilityends.

Ifswordisdropped

Abilityends.

Ifplayerdies

Abilityends.


RIGHTCLICK


AbilityName

CurseField

Cooldown

300seconds

Playerplacesflag.

Flagremains

15seconds

Radius

10blocks

Everyenemyplayerinsideradiusreceives

Blindness

PoisonI

Duration

15seconds

Refresheffectseverysecondwhileinside.

Leavingtheradiusimmediatelyremoveseffects
(ifenabledinconfig).

DoNOTaffect

Owner

Creative

Spectator

Teammates(configurable)

Particles

Darksmoke

Soul

Purpledust

Witchparticles

Sounds

Witherambient

Soulescape

Lowheartbeat


CONFIG

Radius

Cooldown

Duration

PotionLevels

Particles

Sounds


AIRFLAG


DisplayName

§f🌪AirFlag

Lore

§7MasterofWind

LeftClick

WindAura

RightClick

WindChickens


LEFTCLICK


AbilityName

WindAura

Cooldown

120seconds

Duration

10seconds

Playerbecomessurroundedbywind.

Everyenemyentering

3blockradius

Immediatelyreceives

Strongwindchargeknockback.

Launchdistance

10blocks

Configurable.

VerticalLaunch

Configurable.

HorizontalLaunch

Configurable.

FallDamage

Enabledbydefault.

Configurable.

Eachplayercanonlybelaunched

Onceevery

2seconds.

Thispreventsspam.

Particles

Cloud

Sweepattack

Whitedust

Wind

Sounds

Windburst

Breeze


RIGHTCLICK


AbilityName

WindGuardians

Cooldown

300seconds

Spawn

3Chickens

Thechickensareinvulnerable.

Cannotbedamaged.

Cannotbepushed.

Cannotbreed.

Cannotdroploot.

Cannotlayeggs.

Cannotenterportals.

Cannotattackplayersdirectly.

Lifetime

10seconds

Every

5seconds

Eachchickenfires

OneWindCharge

Nearestenemywithin

15blocks.

WindChargeDamage

2Hearts

WindChargeKnockback

Configurable.

WindChargeSpeed

Configurable.

MaximumTargetDistance

15blocks

Ifnotargetexists

Shootrandomly.

After

10seconds

Allchickensdisappear.

Playcloudparticles.

Playwindsounds.


AIRULES

Useinvisiblearmorstandsifneeded.

Preventchickensescaping.

Preventchunkloadingissues.

Preventduplicateentities.

Removeallchickensifownerdies.

Removeallchickensifserverreloads.

Cancelscheduledtaskscorrectly.


CONFIG

ChickenCount

Lifetime

WindChargeInterval

WindChargeDamage

Knockback

TargetRadius

Particles

Sounds

Cooldown


PERFORMANCE

MaximumactiveAirFlags

Configurable.

Default

5

Maximumchickensperplayer

3

Maximumtotalchickens

Configurable.

PreventlagifmultipleplayersactivateAirFlagsimultaneously.




PART4
LIGHTNINGFLAG
DIRTFLAG



LIGHTNINGFLAG


DisplayName

§e⚡LightningFlag

Lore

§7MasterofThunder

§8LeftClick
§fThunderBlade

§8RightClick
§fStormField


LEFTCLICK


AbilityName

ThunderBlade

Cooldown

120Seconds

Duration

15Seconds

Requirement

Playermustholdasword.

Supported

Wood

Stone

Iron

Gold

Diamond

Netherite

Whenactivated

Theswordbecomeschargedwithlightning.

Showelectricparticles.

Showyellowglow.

Playthunderchargingsound.


THROWABLESWORD


Whileabilityisactive

PressLeftClick

Theswordisthrown.

Theswordspinswhileflying.

TravelDistance

30Blocks

ProjectileSpeed

Configurable

CooldownBetweenThrows

5Seconds

Theplayerneverlosesthesword.

Instead

Spawnaprojectilemodelofthesword.

Whenprojectilehitsplayer

Damage

6Hearts

Applies

LightningStrike

LightningStrike

VisualOnly

NoFire

NoBlockDamage

NoExplosion

Knockback

Configurable

Return

Theswordimmediatelyreturns
toplayer'shand.

Maximum

1activethrownsword.

Ifprojectilemisses

Returnautomatically.


RIGHTCLICK


AbilityName

StormField

Cooldown

300Seconds

PlayerplacesLightningFlag.

Flagexists

5Seconds

Radius

10Blocks

Everysecond

Everyenemyinsideradius

Getsstruckbylightning.

Lightning

VisualOnly

Damage

1Heart

EverySecond

Total

5Hearts

Armor

Damageignoresarmortype.

Worksequallyon

Leather

Gold

Iron

Diamond

Netherite

Particles

ElectricSpark

YellowDust

Flash

Sounds

Thunder

Lightning

ElectricHum

DoNOTaffect

Owner

Creative

Spectator

Teammates
(Optional)


CONFIG

Radius

Damage

Duration

Particles

Sounds

Cooldown

LightningDelay

StrikeInterval


DIRTFLAG


DisplayName

§6🟫DirtFlag

Lore

§7Natureobeysyourcommand.

§8LeftClick
§fPumpkinCurse

§8RightClick
§fEarthBarrage


LEFTCLICK


AbilityName

PumpkinCurse

Cooldown

120Seconds

Duration

10Seconds

Hitaplayer

Immediatelyequip

CarvedPumpkin

Onvictim'shead.

Storeoriginalhelmet.

After

10Seconds

Restoreoriginalhelmet.

Ifvictimdies

Restorehelmetinstantly.

Ifhelmetinventoryfull

Dropsafely.

Noduplication.

Noitemloss.

Particles

BlockDust

OrangeDust

Sounds

PumpkinPlace

CurseSound


RIGHTCLICK


AbilityName

EarthBarrage

Cooldown

300Seconds

PlayerplacesDirtFlag.

Immediately

Randomlypick

5DirtBlocks

Aroundflag.

SearchRadius

10Blocks

Onlyvalidblocks

Dirt

GrassBlock

CoarseDirt

Podzol

RootedDirt

(Configurable)

Eachselectedblock

Launchestoward

Nearestenemy.

ProjectileSpeed

Configurable

Damage

2Hearts

PerDirtBlock

Maximum

5Projectiles

MaximumTotalDamage

10Hearts

Projectiledisappears

Onhit.

Noterraindestruction.

Originalworldblocksremainunchanged.

Onlyvisualprojectiles.


TARGETING

Targetnearestplayer.

MaximumTargetRange

20Blocks

Ifnotarget

Throwrandomly.

Cannothit

Owner

Creative

Spectator


PARTICLES

BlockDust

FallingDust

BrownDust

Debris


SOUNDS

GrassBreak

DirtBreak

HeavyThrow

Impact


CONFIG

ProjectileCount

Damage

Speed

Radius

Duration

Particles

Sounds

Cooldown

AllowedBlocks


AIIMPLEMENTATIONRULES

Neverremoveactualworldblocks.

UseFallingBlockentities
orDisplayEntities.

Preventchunkloadingissues.

Preventduplicateprojectiles.

Removeprojectilesonreload.

Canceltaskscorrectly.

OptimizeforlargeSMPservers.

MaximumactiveDirtBarrages

Configurable

Default

10

Preventlagspikes.


COMMONRULES

Everyabilitymustsupport:

ActionBarCooldowns

ConfigFiles

Sounds

Particles

Permissions

Futureupgrades

Nohardcodedvalues.

Everythingconfigurable.



PART5
MAGNETFLAG
SHADOWFLAG



MAGNETFLAG


DisplayName

§8🧲MagnetFlag

Lore

§7Controlthebattlefieldbypullingyourenemies.

LeftClick

ArmorBreak

RightClick

MagneticField


LEFTCLICK


AbilityName

ArmorBreak

Cooldown

120Seconds

Duration

5Seconds

Requirement

Playermustholdasword.

Whileactive

Everysuccessfulhitapplies

Doublearmordurabilitydamage.

ArmorDurabilityMultiplier

2.0x

Configurable

SupportedArmor

Leather

Gold

Iron

Chainmail

Diamond

Netherite

VisualEffects

Grayparticles

Metalsparks

Smallexplosionparticles

Sounds

AnvilHit

IronBreak

MetalClang

Abilityendsafter

5Seconds


RIGHTCLICK


AbilityName

MagneticField

Cooldown

300Seconds

Playerplacestheflag.

FlagLifetime

15Seconds

Radius

15Blocks

Every2Ticks

Searchallnearbyenemyplayers.

Eachenemyisslowlypulled

towardstheflag.

PullSpeed

0.50

Configurable

VerticalPull

Disabled

Playerscanstillmove,

buttheyconstantlyfight
againstthepull.

DoNOTfreezeplayers.

DoNOTteleportplayers.

Onlyapplyvelocity.

Whenplayerreaches

1.5Blocks

Stoppulling.

Particles

GrayDust

MagneticCircle

ElectricSpark

Sounds

BeaconAmbient

LowHum

MetalSound

Cannotaffect

Owner

Creative

Spectator

Teammates
(Configurable)


CONFIG

Radius

Duration

Cooldown

PullSpeed

Particles

Sounds


SHADOWFLAG


DisplayName

§0🌑ShadowFlag

Lore

§7Becomeonewiththedarkness.

LeftClick

ShadowStep

RightClick

DarkDomain


LEFTCLICK


AbilityName

ShadowStep

Cooldown

120Seconds

Duration

15Seconds

Effects

SpeedII

JumpBoostI

Invisibility

Important

Whileinvisible

Armorshouldalsobecomeinvisible
(ifsupportedusingpackets).

Playercannotreceive

Gloweffect.

Particles

BlackSmoke

Portal

Soul

Sounds

EndermanAmbient

Portal

SmallWhisper

Ifplayerattacks

Invisibilityimmediatelyends.


RIGHTCLICK


AbilityName

DarkDomain

Cooldown

300Seconds

PlayerplacesShadowFlag.

Lifetime

15Seconds

Radius

10Blocks

Everyenemyinsidereceives

Darkness

WeaknessI

Duration

15Seconds

Everysecond

Spawnblacksmoke.

Portalparticles.

Soulparticles.

Ambientwhispers.

Playersoutsideradius

Immediatelyloseeffects
(optionalconfigurable).


SPECIALEFFECT

InsideDarkDomain

Enemyplayerviewdistance

canbereduced

(Optional)

Fogeffect

(Optional)


CONFIG

Cooldown

Duration

Radius

Particles

Sounds

PotionEffects

Fog

ViewDistanceModifier


AIIMPLEMENTATIONRULES

Preventpacketmemoryleaks.

Cancelallscheduledtasks.

Preventduplicateinvisibilitybugs.

Preventvelocityglitches.

Preventarmordesync.

Preventeffectstacking.

SupportPlaceholderAPI.

SupportMythicMobscompatibility.

SupportWorldGuardregionblacklist.

Supportdisabledworldslist.

Everythingconfigurable.


ENDOFFLAGABILITIES

Thenextsectionbegins

GLOBALSYSTEMS

Rituals

RecipeGUI

CooldownManager

BossBars

Storage

Database

ConfigSystem

ActionBar

Permissions

AdminCommands

CustomResourcePack

Localization

Metrics

PluginAPI


PART6
GLOBALRITUALSYSTEM


ThisplugindoesNOTallowplayerstoinstantlycraft
aFlag.

InsteadeveryFlagmustbeunlockedthroughaRitual.


RITUALOVERVIEW


EveryFlaghasitsownrecipe.

CraftingtherecipeDOESNOTgivetherealFlag.

Insteaditgivesa

"FlagRitualCore"

forthatFlag.

Example

HeartRitualCore

FireRitualCore

AirRitualCore

etc.


STARTINGARITUAL


WhenaplayerholdsaRitualCore
intheirmainhand

theritualautomaticallystarts.

Nocommandrequired.

NoGUIrequired.

ImmediatelyconsumetheRitualCore.

SpawntheRitualStructure.


RITUALLOCATION


Theritualbeginsexactlywhere
theplayerstartedit.

Store

World

X

Y

Z

UUID

StartTime

FlagType


ONLYONERITUAL


OnlyONEritualcanexist
fortheentireserver.

Ifanotherplayerattempts
tostartone

Show

"Aritualisalreadyactive."

Configurable


RITUALTIME


Default

10Minutes

Configurable


BOSSBAR


ShowALLonlineplayers

OneBossBar.

Example

⚑HeartFlagRitual

09:59Remaining

Updateeverysecond.

BossBarColor

Configurable

BossBarStyle

Configurable


GLOBALANNOUNCEMENT


Immediatelyannounce

=================================

⚑AHeartFlagRitualhasbegun!

Startedby



Location

X:123

Y:74

Z:-512

World

world

Protectorstealtheflag!

=================================

Configurable.


COMPASSSUPPORT


Everyonlineplayer'scompass
shouldautomaticallypoint

towards

theritual.

Configurable

true

false


ACTIONBAR


Everyplayersees

Distance

Direction

Example

HeartRitual

125m

NorthWest

Updateeverysecond.


RITUALSTRUCTURE


Spawn

OnefloatingFlagModel

Aboveground

Height

2Blocks

Circleofparticles

Redstoneparticles

Enchantparticles

EndRod

Configurable

Smallrotatinganimation.


SOUNDS


Play

BeaconActivate

BeaconAmbient

EnchantSound

Every20seconds

Playritualpulse.


LIGHTEFFECTS


Every

5Seconds

Spawn

LightningVisual

NoDamage

NoFire


RITUALPROTECTION


Playerscanfightnormally.

BlocksareNOTprotected.

TheRitualEntity

cannotbedestroyed.

Explosions

donothing.


ENDING


After

10Minutes

Play

Hugeexplosionparticles.

Lightning.

Beaconsound.

Dragongrowl.

RemoveRitualEntity.

Drop

ONEREALFLAG

exactlyatritualcenter.

=

ThedroppedFlag

canbepickedup

byANYplayer.

Firstplayer

topickitup

ownsit.

==

Announcement



hasclaimed

HeartFlag!

BossBardisappears.

Compassresets.

ActionBardisappears.


===
Ifservershutsdown

Saveritual.

Resumeafterrestart.

Ifownerdisconnects

Continueritual.

Ifownerdies

Continueritual.



ritual.yml

enabled

true

duration

600

allow_multiple

false

bossbar

true

compass_tracking

true

announce

true

particle_density

normal

drop_height

1


ANTIEXPLOIT


Prevent

Duplicaterituals

Duplicatedrops

Chunkunloadissues

Serverrestartduplication

Itemduplication

Pluginreloadduplication


SAVEDATA


Save

UUID

FlagType

RemainingTime

World

XYZ

to

rituals.yml

Automaticallyrestore
afterrestart.


PERFORMANCE


Onlyonescheduler.

Norepeatingentityscans.

Optimizefor

200+

Players.

Neverleakmemory.

Canceltaskscorrectly.


PROJECTNAME

FlagsSMP

Version

1.0.0

Minecraft

Paper1.21.8+

Java

Java21



AllFlagsmustuse

CustomModelData

Notextureshouldreplacevanillatextures.

EveryflagmusthaveauniqueCustomModelDatavalue.

Example

HeartFlag
1001

FireFlag
1002

CursedFlag
1003

AirFlag
1004

LightningFlag
1005

DirtFlag
1006

MagnetFlag
1007

ShadowFlag
1008

Valuesmustbeconfigurable.


\
Generateacompleteresourcepack.

PackFormat

CompatiblewithMinecraft1.21.x

Folders

assets/minecraft/models/item

assets/minecraft/textures/item

assets/minecraft/lang

assets/minecraft/font

pack.mcmeta

pack.png



Everyflagmustuseasmalltriangularshapesimilar
totheMinesweeperflag.

Thestickshouldbedarkgray.

Flagsizeshouldbesmallenoughtofitnaturallyin
theplayer'shand.

Theme

Heart
Redwithsmallwhitehearticon.

Fire
Orangewithflameicon.

Cursed
Purpleandblackwithskullicon.

Air
Purewhitewithlightgraywindicon.

Lightning
Yellowwithwhitelightningbolt.

Dirt
Brownwithdirtblockicon.

Magnet
Blackwithred/bluemagneticon.

Shadow
Darkblackwithpurpleeyeicon.



Everyflaghas

ActivationSound

LoopSound

EndingSound

ImpactSound

CooldownReadySound

Allconfigurable.



Everyparticleamount

Everyparticletype

Everyparticlecolor

Everyparticlespeed

mustbeconfigurable.



GenerateALLJavafiles.

Donotskipanything.

Suggestedstructure:

me.flagssmp

FlagsSMP.java

commands/

listeners/

flags/

abilities/

cooldown/

ritual/

recipes/

INVENTORY GUI/

items/

models/

storage/

config/

managers/

api/

events/

particles/

sounds/

utils/

scheduler/

compatibility/

placeholders/


Generatecustomeventssuchas:

FlagUseEvent

FlagPlaceEvent

FlagPickupEvent

FlagCooldownStartEvent

FlagCooldownEndEvent

RitualStartEvent

RitualCompleteEvent

RitualCancelEvent

UseYAMLbydefault.

StructureshouldsupportfuturemigrationtoSQLite.

Store:

Cooldowns

Rituals

PlayerData

Statistics


STATISTICS


Track:

FlagsCrafted

FlagsClaimed

AbilitiesUsed

PlayersKilledWithFlags

DamageDealt

DistancePulled

LightningStrikes

FireballsShot

WindChargesFired


PLACEHOLDERAPI


GeneratefullPlaceholderAPIexpansion.

Oneplaceholderforeverycooldown.

Oneplaceholderforactiveritual.

Oneplaceholderforownedflags.


WORLDGUARD


Supportblockedworlds.

Supportblockedregions.

Configurable.


LOGGING


Usecleanconsolelogs.

Supportdebugmode.


CODEQUALITY


UseSOLIDprinciples.

Avoidduplicatedcode.

Avoidstaticabuse.

Usedependencyinjectionwhereappropriate.

UseAdventureAPI.

UsePaperAPI.

NeverusedeprecatedBukkitmethods.


OPTIMIZATION


Pluginmustcomfortablysupport

200+onlineplayers.

Nounnecessaryrepeatingtasks.

Nomemoryleaks.

Canceltaskscorrectly.

Removeorphanentities.


ERRORHANDLING


Gracefullyhandle:

Serverreload

Playerlogout

Worldunload

Chunkunload

Plugindisable

Pluginenable

Kodari AI
KodariJul 31 at 3:37 pm 3
FlagsSMP
FlagsSMP is a modular Skript-based magical flag system for Paper 1.21.8. It adds eight unique custom-model-data flags with configurable abilities, particles, sounds, cooldowns, action-bar timers, combat effects, temporary zones, ritual unlocking, admin commands, recipe guidance, statistics, and resource-pack delivery. Each flag is maintained in its own script with independent settings, while shared managers handle cooldowns, targeting, active zones, cleanup, permissions, and persistent ritual state.

FlagsSMP

Place every .sk file in:

plugins/Skript/scripts/

Required:

- Paper 1.21.8

- Skript compatible with Minecraft 1.21.8

- SkBee recommended for CustomModelData, particles, vectors, and PlaceholderAPI support

Reload:

/sk reload scripts

Permissions:

flagssmp.use

flagssmp.admin

flagssmp.reload

flagssmp.give

flagssmp.recipe

Commands:

/flagsreload

/flagsgive <player> <flag>

/flagsritualstart [flag]

/flagsritualstop

/flagsrecipe

/flagcore <flag>

/flagsstats [player]

Custom model data:

Heart: 1001

Fire: 1002

Cursed: 1003

Air: 1004

Lightning: 1005

Dirt: 1006

Magnet: 1007

Shadow: 1008

Ritual cores use model data 2001 through 2008.

Edit the options section in each individual flag script, then reload.

Attach a resource pack containing the corresponding item models and textures.

Set resource-pack-url in flags-resourcepack.sk before enabling automatic delivery.

Kodari can make mistakes. Review important code before using.
Files
flags-air.sk
flags-core.sk
flags-cursed.sk
flags-dirt.sk
flags-fire.sk
flags-heart.sk
flags-lightning.sk
flags-magnet.sk
flags-placeholders.sk
flags-recipes.sk
flags-resourcepack.sk
flags-shadow.sk
flags-statistics.sk
ritual-system.sk
Code
14 1,104
flags-core.sk
options:
    prefix: &8[&dFlagsSMP&8]&r
    use-permission: flagssmp.use
    admin-permission: flagssmp.admin
    reload-permission: flagssmp.reload
    give-permission: flagssmp.give
    recipe-permission: flagssmp.recipe

on script load:
    if {flags.model::heart} is not set:
        set {flags.model::heart} to 1001
    if {flags.model::fire} is not set:
        set {flags.model::fire} to 1002
    if {flags.model::cursed} is not set:
        set {flags.model::cursed} to 1003
    if {flags.model::air} is not set:
        set {flags.model::air} to 1004
    if {flags.model::lightning} is not set:
        set {flags.model::lightning} to 1005
    if {flags.model::dirt} is not set:
        set {flags.model::dirt} to 1006
    if {flags.model::magnet} is not set:
        set {flags.model::magnet} to 1007
    if {flags.model::shadow} is not set:
        set {flags.model::shadow} to 1008
    if {flags.name::heart} is not set:
        set {flags.name::heart} to "&c❤ Heart Flag"
    if {flags.name::fire} is not set:
        set {flags.name::fire} to "&6🔥 Fire Flag"
    if {flags.name::cursed} is not set:
        set {flags.name::cursed} to "&5☠ Cursed Flag"
    if {flags.name::air} is not set:
        set {flags.name::air} to "&f🌪 Air Flag"
    if {flags.name::lightning} is not set:
        set {flags.name::lightning} to "&e⚡ Lightning Flag"
    if {flags.name::dirt} is not set:
        set {flags.name::dirt} to "&6🟫 Dirt Flag"
    if {flags.name::magnet} is not set:
        set {flags.name::magnet} to "&8🧲 Magnet Flag"
    if {flags.name::shadow} is not set:
        set {flags.name::shadow} to "&0🌑 Shadow Flag"

function flagItem(flag: text) :: item:
    set {_item} to stick
    set name of {_item} to {flags.name::%{_flag}%}
    set lore of {_item} to "&7Magical Flag", "&8Left Click: Ability", "&8Right Click: Ability", "&0ID:%random integer between 100000 and 999999999%"
    set custom model data of {_item} to {flags.model::%{_flag}%}
    set amount of {_item} to 1
    return {_item}

function ritualCoreItem(flag: text) :: item:
    set {_item} to amethyst shard
    set name of {_item} to "&d%{flags.name::%{_flag}%}% Ritual Core"
    set lore of {_item} to "&7Crafting this item starts a global ritual.", "&8Hold it in your main hand to begin.", "&0CORE:%random integer between 100000 and 999999999%"
    set custom model data of {_item} to 2000 + {flags.model::%{_flag}%} - 1000
    set amount of {_item} to 1
    return {_item}

function flagFromItem(item: item) :: text:
    if {_item} is air:
        return ""
    set {_model} to custom model data of {_item}
    if {_model} is not set:
        return ""
    if {_model} = {flags.model::heart}:
        return "heart"
    if {_model} = {flags.model::fire}:
        return "fire"
    if {_model} = {flags.model::cursed}:
        return "cursed"
    if {_model} = {flags.model::air}:
        return "air"
    if {_model} = {flags.model::lightning}:
        return "lightning"
    if {_model} = {flags.model::dirt}:
        return "dirt"
    if {_model} = {flags.model::magnet}:
        return "magnet"
    if {_model} = {flags.model::shadow}:
        return "shadow"
    return ""

function flagFromCore(item: item) :: text:
    if {_item} is air:
        return ""
    set {_model} to custom model data of {_item}
    if {_model} is not set:
        return ""
    if {_model} = 2001:
        return "heart"
    if {_model} = 2002:
        return "fire"
    if {_model} = 2003:
        return "cursed"
    if {_model} = 2004:
        return "air"
    if {_model} = 2005:
        return "lightning"
    if {_model} = 2006:
        return "dirt"
    if {_model} = 2007:
        return "magnet"
    if {_model} = 2008:
        return "shadow"
    return ""

function cooldownReady(player: player, flag: text, side: text) :: boolean:
    set {_key} to "%uuid of {_player}%::%{_flag}%::%{_side}%"
    if {flags.cooldown::%{_key}%} is not set:
        return true
    if unix timestamp >= {flags.cooldown::%{_key}%}:
        return true
    return false

function startCooldown(player: player, flag: text, side: text, seconds: number):
    set {flags.cooldown::%uuid of {_player}%::%{_flag}%::%{_side}%} to unix timestamp + {_seconds}
    set {flags.stats::%uuid of {_player}%::abilities-used} to {flags.stats::%uuid of {_player}%::abilities-used} + 1

function cooldownRemaining(player: player, flag: text, side: text) :: number:
    set {_key} to {flags.cooldown::%uuid of {_player}%::%{_flag}%::%{_side}%}
    if {_key} is not set:
        return 0
    set {_remaining} to {_key} - unix timestamp
    if {_remaining} < 1:
        return 0
    return {_remaining}

function cooldownText(player: player, flag: text, side: text) :: text:
    set {_remaining} to cooldownRemaining({_player}, {_flag}, {_side})
    if {_remaining} <= 0:
        return "READY"
    set {_minutes} to rounded down ({_remaining} / 60)
    set {_seconds} to {_remaining} - ({_minutes} * 60)
    if {_minutes} < 10:
        set {_minute-text} to "0%{_minutes}%"
    else:
        set {_minute-text} to "%{_minutes}%"
    if {_seconds} < 10:
        set {_second-text} to "0%{_seconds}%"
    else:
        set {_second-text} to "%{_seconds}%"
    return "%{_minute-text}%:%{_second-text}%"

function flagCanAffect(owner: player, target: player, same-team: boolean = false) :: boolean:
    if uuid of {_owner} is uuid of {_target}:
        return false
    if gamemode of {_target} is creative:
        return false
    if gamemode of {_target} is spectator:
        return false
    if {_same-team} is true:
        if team of {_owner} is set:
            if team of {_owner} is team of {_target}:
                return false
    return true

function nearestFlagTarget(owner: player, center: location, radius: number) :: player:
    set {_nearest} to none
    set {_nearest-distance} to {_radius} + 1
    loop all players:
        if flagCanAffect({_owner}, loop-player) is true:
            if world of loop-player is world of {_center}:
                set {_distance} to distance between {_center} and location of loop-player
                if {_distance} <= {_radius}:
                    if {_distance} < {_nearest-distance}:
                        set {_nearest} to loop-player
                        set {_nearest-distance} to {_distance}
    return {_nearest}

function zoneStart(id: text, zone-type: text, owner: player, center: location, duration: number) :: boolean:
    if {flags.zone::%{_id}%::active} is true:
        return false
    set {flags.zone::%{_id}%::active} to true
    set {flags.zone::%{_id}%::type} to {_zone-type}
    set {flags.zone::%{_id}%::owner} to uuid of {_owner}
    set {flags.zone::%{_id}%::center} to {_center}
    set {flags.zone::%{_id}%::expires} to unix timestamp + {_duration}
    add {_id} to {flags.zones::*}
    return true

function zoneActive(id: text) :: boolean:
    if {flags.zone::%{_id}%::active} is true:
        return true
    return false

function zoneStop(id: text):
    delete {flags.zone::%{_id}%::*}
    remove {_id} from {flags.zones::*}

function clearPlayerFlagState(player: player):
    delete {flags.active::%uuid of {_player}%::*}
    delete {flags.cursed::%uuid of {_player}%}
    delete {flags.thunder::%uuid of {_player}%}
    delete {flags.armorbreak::%uuid of {_player}%}
    delete {flags.shadow::%uuid of {_player}%}
    delete {flags.wind-aura::%uuid of {_player}%}

every 1 second:
    loop all players:
        set {_flag} to flagFromItem(loop-player's tool)