Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package me.SirSlender.PixelmonXPBonus;
- import java.util.ArrayList;
- import java.util.Arrays;
- import com.pixelmonmod.pixelmon.comm.CommandChatHandler;
- import net.minecraft.command.CommandBase;
- import net.minecraft.command.ICommandSender;
- import net.minecraft.entity.player.EntityPlayer;
- import net.minecraftforge.common.config.Configuration;
- public class XPCommand extends CommandBase
- {
- String perm = "PixelmonBonus.modxp";
- private XPMethods methods;
- @SuppressWarnings({ "unchecked", "rawtypes" })
- public static ArrayList<String> commands = new ArrayList(Arrays.asList(new String[] { "xpmod"}));
- @Override
- public String getCommandName() {
- return "xpmod";
- }
- @Override
- public String getCommandUsage(ICommandSender var1) {
- CommandChatHandler.sendChat(var1, "/xpmod <multiplier> - change the experience modifier for Pixelmon.");
- return "/xpmod <argument>";
- }
- @Override
- public void processCommand(ICommandSender sender, String[] var2) {
- if (var2.length > 0 && var2.length < 1)
- {
- EntityPlayer cs = (EntityPlayer) sender;
- if (PixelXPPermissions.hasPermission(cs, perm))
- {
- Double mod = Double.parseDouble(var2[0].replaceAll("[^0-9.]", ""));
- Configuration config = Main.config;
- config.get(Configuration.CATEGORY_GENERAL, "Modifier", 1.0).set(mod);
- config.save();
- if (mod > 0.0 && mod < 10.0)
- {
- methods.setPixelmonModifier(mod);
- CommandChatHandler.sendChat(sender, "Pixelmon Experience Modifiers is now: " + var2[0]);
- }
- else
- {
- CommandChatHandler.sendChat(sender, "You can only use modifiers between 1 and 10!");
- CommandChatHandler.sendChat(sender, "Current Experience Modifier: " + var2[0]);
- }
- }
- else
- {
- CommandChatHandler.sendChat(sender, "Invalid Arguments.");
- CommandChatHandler.sendChat(sender, "/xpmod <multiplier>");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement