Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implemented Admin Upgrade #121

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Implemented Admin Upgrade #121

wants to merge 1 commit into from

Conversation

Schmille
Copy link

Adds an Admin Upgrade that, as suggested in #118, makes the stargate indestructible when applied.
After applying the upgrade, the Stargate can only be destroyed by an operator in creative mode.

To accomplish this the following additions and changes have been made:

  • SGBaseTE

    • added field "takesBlastDamage" - if false stargates will not be destroyed due to explosions (default: true)
    • added field "requiresAdminToBreak" - if true stargates cannot be broken unless the player is an operator (default: false)
    • added method "applyAdminUpgrade" - sets takeBlastDamage to false, canPlayerBreakGate to false and requiresAdminToBreak to true
  • SGBlock

    • added method "takesBlastDamage" - used to access the SGBaseTE field of the same name
    • added method "isOperator" - checks if the player is an operator (SGCraft.hasPermission causes error due to not being able to cast EntityPlayerSP to Sponge EntityPlayer)
    • added method "requiresAdminToBreak" - used to access the SGBaseTE field of the same name
    • changed "removedByPlayer" - method now checks if "requiresAdminToBreak" is true
    • added override "onBlockExploded" - used to cancel destruction if "takesBlastDamage" is false
  • SGAdminUpgradeItem

    • Added a simple item to apply the upgrade, in a similar way to SGChevronUpgradeItem, SGIrisUpgradeItem or SGPegasusUpgradeItem
  • Added appropriate entries to English and German lang files

  • Added "output.resourcesDir = output.classesDir" to build.grade to make IntelliJ recognise the mod's assets (I don't know why it didn't before)

The new fields are currently not available through the Configurator, though they could be added.
It might be a good idea to not make the "requiresAdminToBreak" field available in this way, to keep gates from being broken even by players that have full access to the Configurator.

Additions/changes:
 - SGBaseTE
	- added field "takesBlastDamage" - if false stargates will not be destroyed due to explosions (default: true)
	- added field "requiresAdminToBreak" - if true stargates cannot be broken unless the player is an operator (default: false)
	- added method "applyAdminUpgrade" - sets takeBlastDamage to false, canPlayerBreakGate to false and requiresAdminToBreak to true

 - SGBlock
	- added method "takesBlastDamage" - used to access the SGBaseTE field of the same name
	- added method "isOperator" - checks if the player is an operator (SGCraft.hasPermission causes error due to not being able to cast EntityPlayerSP to Sponge EntityPlayer)
	- added method "requiresAdminToBreak" - used to access the SGBaseTE field of the same name
	- changed "removedByPlayer" - method now checks if "requiresAdminToBreak" is true
	- added override "onBlockExploded" - used to cancel destruction if "takesBlastDamage" is false

 - SGAdminUpgradeItem
	- Added a simple item to apply the upgrade, in a similar way to SGChevronUpgradeItem, SGIrisUpgradeItem or SGPegasusUpgradeItem

 - Added appropriate entries to English and German lang files
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant