-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from PQguanfang/dev
2.7.3
- Loading branch information
Showing
9 changed files
with
159 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
src/main/java/cn/superiormc/mythictotem/api/TotemActivedEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package cn.superiormc.mythictotem.api; | ||
|
||
import org.bukkit.Bukkit; | ||
import org.bukkit.Location; | ||
import org.bukkit.entity.Player; | ||
import org.bukkit.event.Event; | ||
import org.bukkit.event.HandlerList; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
public class TotemActivedEvent extends Event { | ||
|
||
private static final HandlerList handlers = new HandlerList(); | ||
|
||
private final Player player; | ||
|
||
private final Location location; | ||
|
||
private final String totemID; | ||
|
||
public TotemActivedEvent(String totemID, Player player, Location location) { | ||
this.player = player; | ||
this.location = location; | ||
this.totemID = totemID; | ||
} | ||
|
||
public Player GetPlayer() { | ||
return player; | ||
} | ||
|
||
public Location GetLocation() { | ||
return location; | ||
} | ||
|
||
public String GetTotemID() { | ||
return totemID; | ||
} | ||
|
||
@NotNull | ||
@Override | ||
public HandlerList getHandlers() { | ||
return handlers; | ||
} | ||
|
||
public static HandlerList getHandlerList() { | ||
return handlers; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
88 changes: 88 additions & 0 deletions
88
src/main/java/cn/superiormc/mythictotem/libreforge/TriggerTotemActived.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
package cn.superiormc.mythictotem.libreforge; | ||
|
||
import cn.superiormc.mythictotem.api.TotemActivedEvent; | ||
import com.willfp.libreforge.Holder; | ||
import com.willfp.libreforge.ProvidedHolder; | ||
import com.willfp.libreforge.SimpleProvidedHolder; | ||
import com.willfp.libreforge.triggers.Trigger; | ||
import com.willfp.libreforge.triggers.TriggerData; | ||
import com.willfp.libreforge.triggers.TriggerParameter; | ||
import com.willfp.libreforge.triggers.Triggers; | ||
import org.bukkit.Location; | ||
import org.bukkit.block.Block; | ||
import org.bukkit.entity.Player; | ||
import org.bukkit.event.EventHandler; | ||
import org.jetbrains.annotations.NotNull; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
import java.util.HashSet; | ||
import java.util.Set; | ||
|
||
public class TriggerTotemActived extends Trigger { | ||
|
||
public static void load() { | ||
Triggers.INSTANCE.register(new TriggerTotemActived()); | ||
} | ||
|
||
public TriggerTotemActived() { | ||
super("totem_actived"); | ||
} | ||
|
||
|
||
@NotNull | ||
@Override | ||
public Set<TriggerParameter> getParameters() { | ||
Set<TriggerParameter> data = new HashSet<>(); | ||
data.add(TriggerParameter.PLAYER); | ||
data.add(TriggerParameter.BLOCK); | ||
data.add(TriggerParameter.LOCATION); | ||
data.add(TriggerParameter.TEXT); | ||
return data; | ||
} | ||
|
||
@EventHandler | ||
public void handle(TotemActivedEvent event) { | ||
Player player = event.GetPlayer(); | ||
Location location = event.GetLocation(); | ||
Block block = location.getBlock(); | ||
String text = event.GetTotemID(); | ||
ProvidedHolder holder = new ProvidedHolder() { | ||
@NotNull | ||
@Override | ||
public Holder getHolder() { | ||
return null; | ||
} | ||
|
||
@Nullable | ||
@Override | ||
public Object getProvider() { | ||
return null; | ||
} | ||
|
||
@NotNull | ||
@Override | ||
public Holder component1() { | ||
return null; | ||
} | ||
|
||
@Nullable | ||
@Override | ||
public Object component2() { | ||
return null; | ||
} | ||
}; | ||
TriggerData data = new TriggerData(holder, | ||
player, | ||
null, | ||
block, | ||
null, | ||
location, | ||
null, | ||
null, | ||
null, | ||
text, | ||
1, | ||
player); | ||
this.dispatch(player, data, null); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters