-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Version 1.14.2: New options + optimisations
Changelog: * You can now add potion effects on ridden player when mounted * You can now add potion effects on ridden player when whipped * Code refactoring to improve performances
- Loading branch information
1 parent
2cfb6af
commit af9a4d1
Showing
8 changed files
with
703 additions
and
498 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
package me.arboriginal.PlayerRider; | ||
|
||
import java.io.File; | ||
import org.bukkit.command.Command; | ||
import org.bukkit.command.CommandSender; | ||
import org.bukkit.configuration.file.FileConfiguration; | ||
import org.bukkit.configuration.file.YamlConfiguration; | ||
import org.bukkit.entity.Player; | ||
import org.bukkit.event.HandlerList; | ||
import org.bukkit.plugin.java.JavaPlugin; | ||
|
||
public class PR extends JavaPlugin { | ||
static File file; | ||
static FileConfiguration config; | ||
static PROptions options; | ||
static PRcooldown cooldown; | ||
static YamlConfiguration users; | ||
|
||
// JavaPlugin methods ----------------------------------------------------------------------------------------------- | ||
|
||
@Override | ||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { | ||
if (command.getName().equalsIgnoreCase("prider-reload")) { | ||
reloadConfig(); | ||
PRUtils.userMessage(sender, "reload"); | ||
|
||
return true; | ||
} | ||
|
||
if (command.getName().equalsIgnoreCase("prider-toggle")) { | ||
if (sender instanceof Player) | ||
PRUtils.userMessage(sender, PRUtils.rideToggle((Player) sender)); | ||
else | ||
PRUtils.userMessage(sender, "toggleWarn"); | ||
return true; | ||
} | ||
|
||
return super.onCommand(sender, command, label, args); | ||
} | ||
|
||
@Override | ||
public void onDisable() { | ||
super.onDisable(); | ||
|
||
HandlerList.unregisterAll((JavaPlugin) this); | ||
} | ||
|
||
@Override | ||
public void onEnable() { | ||
reloadConfig(); | ||
|
||
cooldown = new PRcooldown(); | ||
users = new YamlConfiguration(); | ||
file = new File(getDataFolder(), "usersPreferences.yml"); | ||
|
||
if (file.exists()) | ||
users = YamlConfiguration.loadConfiguration(file); | ||
else | ||
PRUtils.dataSave(); | ||
|
||
getServer().getPluginManager().registerEvents(new PRListener(this), this); | ||
} | ||
|
||
@Override | ||
public void reloadConfig() { | ||
super.reloadConfig(); | ||
|
||
saveDefaultConfig(); | ||
config = getConfig(); | ||
config.options().copyDefaults(true); | ||
saveConfig(); | ||
|
||
options = new PROptions(); | ||
} | ||
} |
Oops, something went wrong.