Removed /toggle and put the toggles in the config file due to some issues
This commit is contained in:
5vl 2021-01-14 10:20:46 +01:00
parent 0a2b9741ee
commit 750c6e9b5a
7 changed files with 13 additions and 15 deletions

View File

@ -10,7 +10,6 @@ import coreplugin.coreplugin.commands.heal;
import coreplugin.coreplugin.commands.punish.ban; import coreplugin.coreplugin.commands.punish.ban;
import coreplugin.coreplugin.commands.punish.kick; import coreplugin.coreplugin.commands.punish.kick;
import coreplugin.coreplugin.commands.punish.unban; import coreplugin.coreplugin.commands.punish.unban;
import coreplugin.coreplugin.commands.toggle;
import coreplugin.coreplugin.events.OnPlayerJoin; import coreplugin.coreplugin.events.OnPlayerJoin;
import coreplugin.coreplugin.events.OnPlayerLeave; import coreplugin.coreplugin.events.OnPlayerLeave;
import org.bukkit.plugin.PluginManager; import org.bukkit.plugin.PluginManager;
@ -43,6 +42,5 @@ public final class Core extends JavaPlugin {
getCommand("ban").setExecutor(new ban()); getCommand("ban").setExecutor(new ban());
getCommand("unban").setExecutor(new unban()); getCommand("unban").setExecutor(new unban());
getCommand("discord").setExecutor(new discord()); getCommand("discord").setExecutor(new discord());
getCommand("toggle").setExecutor(new toggle());
} }
} }

View File

@ -11,7 +11,7 @@ public class discord extends chatcolors implements CommandExecutor {
@Override @Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
boolean t; boolean t;
t = toggle.DiscordToggle; t = Boolean.parseBoolean(Core.getInstance().getConfig().getString("DiscordCommand"));
if (t) { if (t) {
if (label.equalsIgnoreCase("discord")) { if (label.equalsIgnoreCase("discord")) {
String Discord = Core.getInstance().getConfig().getString("Discord"); String Discord = Core.getInstance().getConfig().getString("Discord");

View File

@ -22,7 +22,7 @@ public class heal extends chatcolors implements CommandExecutor {
ps.setHealth(20); ps.setHealth(20);
ps.setFoodLevel(20); ps.setFoodLevel(20);
String HealOther = Core.getInstance().getConfig().getString("HealOther"); String HealOther = Core.getInstance().getConfig().getString("HealOther");
p.sendMessage(color(HealOther + args[0])); p.sendMessage(color(HealOther + " " + args[0]));
} else { } else {
String InvalidArgument = Core.getInstance().getConfig().getString("InvalidArgument"); String InvalidArgument = Core.getInstance().getConfig().getString("InvalidArgument");
p.sendMessage(color(InvalidArgument)); p.sendMessage(color(InvalidArgument));
@ -34,8 +34,8 @@ public class heal extends chatcolors implements CommandExecutor {
ps.setFoodLevel(20); ps.setFoodLevel(20);
String HealOther = Core.getInstance().getConfig().getString("HealOther"); String HealOther = Core.getInstance().getConfig().getString("HealOther");
String HealedOther = Core.getInstance().getConfig().getString("HealedOther"); String HealedOther = Core.getInstance().getConfig().getString("HealedOther");
p.sendMessage(color(HealOther + args[0])); p.sendMessage(color(HealOther + " " + args[0]));
ps.sendMessage(color(HealedOther + p.getPlayerListName())); ps.sendMessage(color(HealedOther + " " + p.getPlayerListName()));
} }
} }
catch (Exception e) { catch (Exception e) {

View File

@ -1,7 +1,6 @@
package coreplugin.coreplugin.events; package coreplugin.coreplugin.events;
import coreplugin.coreplugin.Core; import coreplugin.coreplugin.Core;
import coreplugin.coreplugin.commands.toggle;
import coreplugin.coreplugin.utils.chatcolors; import coreplugin.coreplugin.utils.chatcolors;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
@ -12,7 +11,7 @@ public class OnPlayerJoin extends chatcolors implements Listener {
@EventHandler @EventHandler
public void OnPlayerJoin(PlayerJoinEvent event) { public void OnPlayerJoin(PlayerJoinEvent event) {
boolean t; boolean t;
t = toggle.JoinToggle; t = Boolean.parseBoolean(Core.getInstance().getConfig().getString("CustomJoinAndLeave"));
if (t) { if (t) {
Player p = event.getPlayer(); Player p = event.getPlayer();
String CustomJoin = Core.getInstance().getConfig().getString("CustomJoin"); String CustomJoin = Core.getInstance().getConfig().getString("CustomJoin");

View File

@ -1,7 +1,6 @@
package coreplugin.coreplugin.events; package coreplugin.coreplugin.events;
import coreplugin.coreplugin.Core; import coreplugin.coreplugin.Core;
import coreplugin.coreplugin.commands.toggle;
import coreplugin.coreplugin.utils.chatcolors; import coreplugin.coreplugin.utils.chatcolors;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
@ -12,7 +11,7 @@ public class OnPlayerLeave extends chatcolors implements Listener {
@EventHandler @EventHandler
public void OnPlayerLeave(PlayerQuitEvent event){ public void OnPlayerLeave(PlayerQuitEvent event){
boolean t; boolean t;
t = toggle.LeaveToggle; t = Boolean.parseBoolean(Core.getInstance().getConfig().getString("CustomJoinAndLeave"));
if (t) { if (t) {
Player p = event.getPlayer(); Player p = event.getPlayer();
String CustomLeave = Core.getInstance().getConfig().getString("CustomLeave"); String CustomLeave = Core.getInstance().getConfig().getString("CustomLeave");

View File

@ -1,3 +1,7 @@
# Toggle features
DiscordCommand: true
CustomJoinAndLeave: true
# Gamemode messages # Gamemode messages
CreativeSelf: '&aYour gamemode has been changed to &cCreative.' CreativeSelf: '&aYour gamemode has been changed to &cCreative.'
CreativeSetOther: '&aYou changed the gamemode to &cCreative &afor: &d' # Last color code is the color that the playername will show in. CreativeSetOther: '&aYou changed the gamemode to &cCreative &afor: &d' # Last color code is the color that the playername will show in.
@ -26,8 +30,8 @@ FlyDisabledOther: '&aYour fly has been &cdisabled &aby: &d' # Last color code is
# Heal # Heal
HealSelf: '&aYou have &chealed &ayourself.' HealSelf: '&aYou have &chealed &ayourself.'
HealOther: '&aYou have &chealed &a:&d' # Last color code is the color that the playername will show in. HealOther: '&aYou have &chealed&a:&d' # Last color code is the color that the playername will show in.
HealedOther: '&aYou have been &chealed &aby: &d' # Last color code is the color that the playername will show in. HealedOther: '&aYou have been &chealed &aby:&d' # Last color code is the color that the playername will show in.
# Punishments # Punishments
DefaultKick: 'You have been kicked from the server.' DefaultKick: 'You have been kicked from the server.'

View File

@ -24,6 +24,4 @@ commands:
unban: unban:
description: You can unban people with this! description: You can unban people with this!
discord: discord:
description: Send your discord link in chat! description: Send your discord link in chat!
toggle:
description: You can toggle certain features with this!