-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1.2.3 Released
- Loading branch information
Showing
40 changed files
with
1,530 additions
and
188 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
244 changes: 198 additions & 46 deletions
244
src/main/java/tk/bluetree242/discordsrvutils/DiscordSRVUtils.java
Large diffs are not rendered by default.
Oops, something went wrong.
68 changes: 68 additions & 0 deletions
68
src/main/java/tk/bluetree242/discordsrvutils/PAPIExpansion.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,68 @@ | ||
/* | ||
* LICENSE | ||
* DiscordSRVUtils | ||
* ------------- | ||
* Copyright (C) 2020 - 2021 BlueTree242 | ||
* ------------- | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as | ||
* published by the Free Software Foundation, either version 3 of the | ||
* License, or (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public | ||
* License along with this program. If not, see | ||
* <http://www.gnu.org/licenses/gpl-3.0.html>. | ||
* END | ||
*/ | ||
|
||
package tk.bluetree242.discordsrvutils; | ||
|
||
import me.clip.placeholderapi.expansion.PlaceholderExpansion; | ||
import org.bukkit.entity.Player; | ||
import tk.bluetree242.discordsrvutils.leveling.LevelingManager; | ||
|
||
import java.util.regex.Pattern; | ||
|
||
public class PAPIExpansion extends PlaceholderExpansion { | ||
private DiscordSRVUtils core = DiscordSRVUtils.get(); | ||
@Override | ||
public String getIdentifier() { | ||
return "DiscordSRVUtils"; | ||
} | ||
|
||
@Override | ||
public boolean canRegister() { | ||
return DiscordSRVUtils.get().isEnabled(); | ||
} | ||
|
||
@Override | ||
public String getAuthor() { | ||
return String.join( ", ", core.getDescription().getAuthors()); | ||
} | ||
|
||
@Override | ||
public String getVersion() { | ||
return core.getDescription().getVersion(); | ||
} | ||
|
||
@Override | ||
public String onPlaceholderRequest(Player p, String identifier) { | ||
identifier = identifier.toLowerCase(); | ||
if (identifier.equalsIgnoreCase("level")) { | ||
if (p == null) return "Unknown"; | ||
return LevelingManager.get().getCachedStats(p.getUniqueId()).getLevel() + ""; | ||
} else if (identifier.equalsIgnoreCase("xp")) { | ||
if (p == null) return "Unknown"; | ||
return LevelingManager.get().getCachedStats(p.getUniqueId()).getXp() + ""; | ||
} else if (identifier.equalsIgnoreCase("rank")) { | ||
if (p == null) return "Unknown"; | ||
return LevelingManager.get().getCachedStats(p.getUniqueId()).getRank() + ""; | ||
} | ||
return 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
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
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
61 changes: 61 additions & 0 deletions
61
src/main/java/tk/bluetree242/discordsrvutils/events/CommandExecuteEvent.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,61 @@ | ||
/* | ||
* LICENSE | ||
* DiscordSRVUtils | ||
* ------------- | ||
* Copyright (C) 2020 - 2021 BlueTree242 | ||
* ------------- | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as | ||
* published by the Free Software Foundation, either version 3 of the | ||
* License, or (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public | ||
* License along with this program. If not, see | ||
* <http://www.gnu.org/licenses/gpl-3.0.html>. | ||
* END | ||
*/ | ||
|
||
package tk.bluetree242.discordsrvutils.events; | ||
|
||
import github.scarsz.discordsrv.api.events.Event; | ||
import github.scarsz.discordsrv.dependencies.jda.api.entities.MessageChannel; | ||
import github.scarsz.discordsrv.dependencies.jda.api.entities.User; | ||
import github.scarsz.discordsrv.dependencies.jda.api.events.message.MessageReceivedEvent; | ||
import tk.bluetree242.discordsrvutils.commandmanagement.Command; | ||
|
||
public class CommandExecuteEvent extends Event { | ||
|
||
|
||
private final Command command; | ||
private final MessageChannel channel; | ||
private final User user; | ||
private final MessageReceivedEvent event; | ||
|
||
public CommandExecuteEvent(Command command, MessageChannel channel, User user, MessageReceivedEvent event) { | ||
this.command = command; | ||
this.channel = channel; | ||
this.user = user; | ||
this.event = event; | ||
} | ||
|
||
public Command getCommand() { | ||
return command; | ||
} | ||
|
||
public MessageChannel getChannel() { | ||
return channel; | ||
} | ||
|
||
public User getUser() { | ||
return user; | ||
} | ||
|
||
public MessageReceivedEvent getEvent() { | ||
return event; | ||
} | ||
} |
Oops, something went wrong.