mirror of
https://github.com/GeorgH93/Minepacks.git
synced 2025-02-02 23:31:49 +01:00
Refactoring
This commit is contained in:
parent
c7c8ac81f2
commit
ba3331d16a
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2019 GeorgH93
|
||||
* Copyright (C) 2020 GeorgH93
|
||||
*
|
||||
* 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
|
||||
@ -29,7 +29,7 @@
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.LinkedList;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@ -162,7 +162,7 @@ else if(getPermission() != null && !sender.hasPermission(getPermission()))
|
||||
@Override
|
||||
public @Nullable List<HelpData> getHelp(@NotNull CommandSender requester)
|
||||
{
|
||||
List<HelpData> help = new LinkedList<>();
|
||||
List<HelpData> help = new ArrayList<>(1);
|
||||
help.add(new HelpData(getTranslatedName(), null, getDescription()));
|
||||
return help;
|
||||
}
|
||||
|
@ -33,7 +33,7 @@
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.LinkedList;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
@ -244,7 +244,7 @@ public int getSize()
|
||||
public @NotNull List<ItemStack> setSize(int newSize)
|
||||
{
|
||||
opened.forEach((key, value) -> key.closeInventory()); // Close all open views of the inventory
|
||||
List<ItemStack> removedItems = new LinkedList<>();
|
||||
List<ItemStack> removedItems = new ArrayList<>();
|
||||
ItemStack[] itemStackArray;
|
||||
if(bp.getSize() > newSize)
|
||||
{
|
||||
|
@ -29,7 +29,7 @@
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class BackupCommand extends MinepacksCommand
|
||||
@ -81,7 +81,7 @@ public List<String> tabComplete(final @NotNull CommandSender sender, final @NotN
|
||||
@Override
|
||||
public List<HelpData> getHelp(final @NotNull CommandSender requester)
|
||||
{
|
||||
List<HelpData> help = new LinkedList<>();
|
||||
List<HelpData> help = new ArrayList<>(1);
|
||||
help.add(new HelpData(getTranslatedName(), helpParam, getDescription()));
|
||||
return help;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2019 GeorgH93
|
||||
* Copyright (C) 2020 GeorgH93
|
||||
*
|
||||
* 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
|
||||
@ -25,8 +25,8 @@
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
public class HelpCommand extends MinepacksCommand
|
||||
@ -49,7 +49,7 @@ public HelpCommand(Minepacks plugin, Collection<MinepacksCommand> commands, Comm
|
||||
public void execute(@NotNull CommandSender sender, @NotNull String mainCommandAlias, @NotNull String alias, @NotNull String[] args)
|
||||
{
|
||||
messageHeader.send(sender);
|
||||
Collection<HelpData> help = new LinkedList<>(), temp;
|
||||
Collection<HelpData> help = new ArrayList<>(), temp;
|
||||
for(MinepacksCommand cmd : commands)
|
||||
{
|
||||
temp = cmd.doGetHelp(sender);
|
||||
|
@ -32,7 +32,7 @@
|
||||
import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
@ -118,7 +118,7 @@ public List<String> tabComplete(@NotNull CommandSender commandSender, @NotNull S
|
||||
@Override
|
||||
public List<HelpData> getHelp(@NotNull CommandSender requester)
|
||||
{
|
||||
List<HelpData> help = new LinkedList<>();
|
||||
List<HelpData> help = new ArrayList<>(2);
|
||||
help.add(new HelpData(getTranslatedName(), null, getDescription(), MessageClickEvent.ClickEventAction.RUN_COMMAND));
|
||||
if(requester.hasPermission(Permissions.OTHERS))
|
||||
{
|
||||
|
@ -179,7 +179,7 @@ public List<String> tabComplete(final @NotNull CommandSender sender, final @NotN
|
||||
if(args.length == 1)
|
||||
{
|
||||
List<String> backups = ((Minepacks) getMinepacksPlugin()).getDatabase().getBackups();
|
||||
autoComplete = new LinkedList<>();
|
||||
autoComplete = new ArrayList<>();
|
||||
for(String backupId : backups)
|
||||
{
|
||||
if(backupId.toLowerCase(Locale.ROOT).startsWith(arg)) autoComplete.add(backupId);
|
||||
@ -191,7 +191,7 @@ public List<String> tabComplete(final @NotNull CommandSender sender, final @NotN
|
||||
}
|
||||
else if(args.length == 2)
|
||||
{
|
||||
autoComplete = new LinkedList<>();
|
||||
autoComplete = new ArrayList<>();
|
||||
for(Player player : Bukkit.getOnlinePlayers())
|
||||
{
|
||||
if(player.getName().toLowerCase(Locale.ROOT).startsWith(arg)) autoComplete.add(player.getName());
|
||||
@ -203,7 +203,7 @@ else if(args.length == 2)
|
||||
@Override
|
||||
public List<HelpData> getHelp(final @NotNull CommandSender requester)
|
||||
{
|
||||
List<HelpData> help = new LinkedList<>();
|
||||
List<HelpData> help = new ArrayList<>();
|
||||
help.add(new HelpData(getTranslatedName() + " " + listCommands[0], null, ((Minepacks) getMinepacksPlugin()).getLanguage().getTranslated("Commands.Description.RestoreList"), MessageClickEvent.ClickEventAction.RUN_COMMAND));
|
||||
help.add(new HelpData(getTranslatedName(), helpParam, getDescription(), MessageClickEvent.ClickEventAction.SUGGEST_COMMAND));
|
||||
return help;
|
||||
|
@ -124,7 +124,7 @@ public UpdateData(String uuid, int id)
|
||||
try(Connection connection = getConnection())
|
||||
{
|
||||
Map<String, UpdateData> toConvert = new HashMap<>();
|
||||
List<UpdateData> toUpdate = new LinkedList<>();
|
||||
List<UpdateData> toUpdate = new ArrayList<>();
|
||||
try(Statement stmt = connection.createStatement(); ResultSet res = stmt.executeQuery(queryGetUnsetOrInvalidUUIDs))
|
||||
{
|
||||
while(res.next())
|
||||
|
@ -36,4 +36,7 @@ public class Permissions
|
||||
public static final String BACKUP = BASE + "backup";
|
||||
public static final String RESTORE = BASE + "restore";
|
||||
public static final String VERSION = BASE + "version";
|
||||
|
||||
public static final String INVENTORY_CLEAR = "clearInventory";
|
||||
public static final String INVENTORY_CLEAR_OTHER = "clearInventory.other";
|
||||
}
|
Loading…
Reference in New Issue
Block a user