Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
MythicCraft
MythicAchievements
Commits
3053d264
Commit
3053d264
authored
3 months ago
by
Carson
Browse files
Options
Download
Email Patches
Plain Diff
added "forcegive" argument (defaults to false) to prevent getting an advancement multiple times.
parent
b46c8cab
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
9 deletions
+15
-9
plugin/src/main/java/io/lumine/achievements/achievement/AchievementImpl.java
...a/io/lumine/achievements/achievement/AchievementImpl.java
+0
-1
plugin/src/main/java/io/lumine/achievements/compat/mythicmobs/GrantAchievementMechanic.java
...ievements/compat/mythicmobs/GrantAchievementMechanic.java
+15
-8
No files found.
plugin/src/main/java/io/lumine/achievements/achievement/AchievementImpl.java
View file @
3053d264
...
@@ -213,7 +213,6 @@ public class AchievementImpl extends Achievement implements MenuData<Achievement
...
@@ -213,7 +213,6 @@ public class AchievementImpl extends Achievement implements MenuData<Achievement
.
model
(
iconModel
)
.
model
(
iconModel
)
.
hideAttributes
()
.
hideAttributes
()
.
lore
(
description
)
.
lore
(
description
)
.
skullTexture
(
TEXTURE
.
get
(
this
))
.
build
();
.
build
();
}
else
{
}
else
{
this
.
menuItem
=
ItemFactory
.
of
(
this
.
iconMaterial
)
this
.
menuItem
=
ItemFactory
.
of
(
this
.
iconMaterial
)
...
...
This diff is collapsed.
Click to expand it.
plugin/src/main/java/io/lumine/achievements/compat/mythicmobs/GrantAchievementMechanic.java
View file @
3053d264
...
@@ -13,36 +13,43 @@ import org.bukkit.entity.Player;
...
@@ -13,36 +13,43 @@ import org.bukkit.entity.Player;
public
class
GrantAchievementMechanic
implements
ITargetedEntitySkill
{
public
class
GrantAchievementMechanic
implements
ITargetedEntitySkill
{
private
final
MythicAchievementsPlugin
plugin
;
private
final
MythicAchievementsPlugin
plugin
;
private
String
achievement
;
private
final
String
achievement
;
private
boolean
giveRewards
=
false
;
private
final
boolean
giveRewards
;
private
final
boolean
forceGive
;
public
GrantAchievementMechanic
(
MythicAchievementsPlugin
plugin
,
MythicLineConfig
config
)
{
public
GrantAchievementMechanic
(
MythicAchievementsPlugin
plugin
,
MythicLineConfig
config
)
{
this
.
plugin
=
plugin
;
this
.
plugin
=
plugin
;
this
.
achievement
=
config
.
getString
(
new
String
[]
{
"achievement"
,
"achieve"
,
"a"
},
null
);
this
.
achievement
=
config
.
getString
(
new
String
[]
{
"achievement"
,
"achieve"
,
"a"
},
null
);
this
.
giveRewards
=
config
.
getBoolean
(
"giverewards"
,
false
);
this
.
forceGive
=
config
.
getBoolean
(
new
String
[]
{
"force"
,
"f"
,
"forcegive"
},
false
);
}
}
@Override
@Override
public
SkillResult
castAtEntity
(
SkillMetadata
skillMetadata
,
AbstractEntity
abstractEntity
)
{
public
SkillResult
castAtEntity
(
SkillMetadata
skillMetadata
,
AbstractEntity
abstractEntity
)
{
if
(!
abstractEntity
.
isPlayer
())
{
if
(!
abstractEntity
.
isPlayer
())
{
return
SkillResult
.
INVALID_TARGET
;
return
SkillResult
.
INVALID_TARGET
;
}
}
var
maybeAchieve
=
plugin
.
getAchievementManager
().
getAchievement
(
achievement
);
var
maybeAchieve
=
plugin
.
getAchievementManager
().
getAchievement
(
achievement
);
if
(
maybeAchieve
.
isEmpty
())
{
if
(
maybeAchieve
.
isEmpty
())
{
return
SkillResult
.
INVALID_CONFIG
;
return
SkillResult
.
INVALID_CONFIG
;
}
}
var
achieve
=
maybeAchieve
.
get
();
var
achieve
=
maybeAchieve
.
get
();
var
player
=
(
Player
)
abstractEntity
.
getBukkitEntity
();
var
player
=
(
Player
)
abstractEntity
.
getBukkitEntity
();
var
profile
=
plugin
.
getProfiles
().
getProfile
(
player
);
var
profile
=
plugin
.
getProfiles
().
getProfile
(
player
);
if
(
profile
.
hasCompleted
(
achieve
)
&&
!
forceGive
)
{
return
SkillResult
.
SUCCESS
;
}
profile
.
completeAchievement
(
achieve
,
giveRewards
);
profile
.
completeAchievement
(
achieve
,
giveRewards
);
return
SkillResult
.
SUCCESS
;
return
SkillResult
.
SUCCESS
;
}
}
@Override
@Override
public
ThreadSafetyLevel
getThreadSafetyLevel
()
{
public
ThreadSafetyLevel
getThreadSafetyLevel
()
{
return
ThreadSafetyLevel
.
SYNC_ONLY
;
return
ThreadSafetyLevel
.
SYNC_ONLY
;
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment