Skip to content

Commit

Permalink
Remove @nonnull
Browse files Browse the repository at this point in the history
反正要报错,开发者要收到提示也跟这个分支没关系
  • Loading branch information
mcchampions committed Jul 3, 2024
1 parent 56661ce commit 8e2d960
Show file tree
Hide file tree
Showing 437 changed files with 1,598 additions and 1,598 deletions.
6 changes: 3 additions & 3 deletions src/main/java/city/norain/slimefun4/EnvironmentChecker.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class EnvironmentChecker {
private static final List<String> UNSUPPORTED_PLUGINS = List.of(
"BedrockTechnology", "SlimefunFix", "SlimefunBugFixer", "Slimefunbookfix", "PlaceItemsOnGroundRebuilt");

static boolean checkIncompatiblePlugins(@Nonnull Logger logger) {
static boolean checkIncompatiblePlugins(Logger logger) {
List<String> plugins = UNSUPPORTED_PLUGINS.stream()
.filter(name -> Bukkit.getServer().getPluginManager().isPluginEnabled(name))
.toList();
Expand Down Expand Up @@ -53,7 +53,7 @@ static boolean checkHybridServer() {
}
}

static void scheduleSlimeGlueCheck(@Nonnull Slimefun sf) {
static void scheduleSlimeGlueCheck(Slimefun sf) {
Bukkit.getScheduler()
.runTaskLater(
sf,
Expand All @@ -66,7 +66,7 @@ static void scheduleSlimeGlueCheck(@Nonnull Slimefun sf) {
300); // 15s
}

private static void printBorder(@Nonnull Logger logger) {
private static void printBorder(Logger logger) {
logger.log(Level.WARNING, "#######################################################");
}
}
4 changes: 2 additions & 2 deletions src/main/java/city/norain/slimefun4/SlimefunExtended.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ private static void checkDebug() {
}
}

public static boolean checkEnvironment(@Nonnull Slimefun sf) {
public static boolean checkEnvironment(Slimefun sf) {
if (EnvironmentChecker.checkHybridServer()) {
sf.getLogger().log(Level.WARNING, "#######################################################");
sf.getLogger().log(Level.WARNING, "");
Expand Down Expand Up @@ -47,7 +47,7 @@ public static boolean checkEnvironment(@Nonnull Slimefun sf) {
}
}

public static void register(@Nonnull Slimefun sf) {
public static void register(Slimefun sf) {
EnvironmentChecker.scheduleSlimeGlueCheck(sf);

checkDebug();
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/city/norain/slimefun4/VaultIntegration.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
public class VaultIntegration {
private static Economy econ = null;

protected static void register(@Nonnull Slimefun plugin) {
protected static void register(Slimefun plugin) {
if (plugin.getServer().getPluginManager().isPluginEnabled("Vault")) {
var rsp = plugin.getServer().getServicesManager().getRegistration(Economy.class);
if (rsp != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public void onPlayerJoin(PlayerJoinEvent e) {
}
}

public void register(@Nonnull Slimefun plugin) {
public void register(Slimefun plugin) {
plugin.getServer().getPluginManager().registerEvents(this, plugin);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public void start() {
isProfiling = true;
}

public void subscribe(@Nonnull CommandSender sender) {
public void subscribe(CommandSender sender) {
subscribers.add(sender);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,14 @@ public boolean onClick(
}

@Override
public boolean canOpen(@Nonnull Block b, @Nonnull Player p) {
public boolean canOpen(Block b, Player p) {
return p.hasPermission("slimefun.inventory.bypass")
|| Slimefun.getProtectionManager()
.hasPermission(p, b.getLocation(), Interaction.INTERACT_BLOCK);
}

@Override
public void newInstance(@Nonnull BlockMenu menu, @Nonnull Block b) {
public void newInstance(BlockMenu menu, Block b) {
// Resume the ingredient count
String countStr = StorageCacheUtils.getData(b.getLocation(), "ingredientCount");
if (countStr != null) {
Expand Down Expand Up @@ -114,7 +114,7 @@ public void preRegister() {
addItemHandler(new BlockBreakHandler(false, true) {
@Override
public void onPlayerBreak(
@Nonnull BlockBreakEvent e, @Nonnull ItemStack item, @Nonnull List<ItemStack> drops) {
BlockBreakEvent e, ItemStack item, List<ItemStack> drops) {
BlockMenu inv = StorageCacheUtils.getMenu(e.getBlock().getLocation());
if (inv != null) {
for (int slot : INPUT_SLOTS) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public void addField(FieldKey field) {
changed = true;
}

@Nonnull

public Set<FieldKey> getFields() {
return Collections.unmodifiableSet(fields);
}
Expand All @@ -55,7 +55,7 @@ public void addCondition(FieldKey key, boolean val) {
addCondition(key, val ? "1" : "0");
}

@Nonnull

public List<Pair<FieldKey, String>> getConditions() {
return Collections.unmodifiableList(conditions);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public ScopeKey(DataScope scope) {
this.scope = scope;
}

@Nonnull

public DataScope getScope() {
return scope;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,13 @@ protected void checkData() {
}
}

@Nonnull

public Map<String, String> getAllData() {
checkData();
return Collections.unmodifiableMap(data);
}

@Nonnull

public Set<String> getDataKeys() {
checkData();
return Collections.unmodifiableSet(data.keySet());
Expand All @@ -73,7 +73,7 @@ public Set<String> getDataKeys() {
return getCacheInternal(key);
}

@Nonnull

public String getKey() {
return key;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,19 @@ public void save() {}
public void createFile() {}

@Override
public String getString(@Nonnull String path) {
public String getString(String path) {
return blockData.getData(path);
}

@Nonnull

@Override
public Set<String> getKeys() {
return new HashSet<>(blockData.getAllData().keySet());
}

@Nonnull

@Override
public Set<String> getKeys(@Nonnull String path) {
public Set<String> getKeys(String path) {
return getKeys();
}

Expand All @@ -47,12 +47,12 @@ public File getFile() {
}

@Override
public boolean contains(@Nonnull String path) {
public boolean contains(String path) {
return getString(path) != null;
}

@Nullable @Override
public Object getValue(@Nonnull String path) {
public Object getValue(String path) {
return getString(path);
}

Expand All @@ -62,7 +62,7 @@ public FileConfiguration getConfiguration() {
}

@Override
public void setDefaultValue(@Nonnull String path, @Nullable Object value) {
public void setDefaultValue(String path, @Nullable Object value) {
if (!(value instanceof String str)) {
throw new NotImplementedException();
}
Expand All @@ -72,15 +72,15 @@ public void setDefaultValue(@Nonnull String path, @Nullable Object value) {
}

@Override
public void setValue(@Nonnull String path, Object value) {
public void setValue(String path, Object value) {
if (!(value instanceof String str)) {
throw new NotImplementedException();
}
blockData.setData(path, str);
}

@Override
public void save(@Nonnull File file) {}
public void save(File file) {}

@Override
public void reload() {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ public void setDelayedSavingEnable(boolean isEnable) {
* @param sfId slimefun block id {@link SlimefunItem#getId()}
* @return {@link SlimefunBlockData}
*/
@Nonnull

public SlimefunBlockData createBlock(Location l, String sfId) {
checkDestroy();
var re = getChunkDataCache(l.getChunk(), true).createBlockData(l, sfId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ public void getProfileAsync(OfflinePlayer p, IAsyncReadCallback<PlayerProfile> c
return re;
}

@Nonnull

private ItemStack[] getBackpackInv(String uuid, int size) {
var key = new RecordKey(DataScope.BACKPACK_INVENTORY);
key.addField(FieldKey.INVENTORY_SLOT);
Expand All @@ -151,7 +151,7 @@ private ItemStack[] getBackpackInv(String uuid, int size) {
return re;
}

@Nonnull

private Set<NamespacedKey> getUnlockedResearchKeys(String uuid) {
var key = new RecordKey(DataScope.PLAYER_RESEARCH);
key.addField(FieldKey.RESEARCH_ID);
Expand All @@ -175,7 +175,7 @@ public void getBackpackAsync(String uuid, IAsyncReadCallback<PlayerBackpack> cal
scheduleReadTask(() -> invokeCallback(callback, getBackpack(uuid)));
}

@Nonnull

public Set<PlayerBackpack> getBackpacks(String pUuid) {
checkDestroy();
var key = new RecordKey(DataScope.BACKPACK_PROFILE);
Expand All @@ -199,7 +199,7 @@ public void getBackpacksAsync(String pUuid, IAsyncReadCallback<Set<PlayerBackpac
});
}

@Nonnull

public PlayerProfile createProfile(OfflinePlayer p) {
checkDestroy();
var uuid = p.getUniqueId().toString();
Expand Down Expand Up @@ -231,7 +231,7 @@ public void setResearch(String uuid, NamespacedKey researchKey, boolean unlocked
}
}

@Nonnull

public PlayerBackpack createBackpack(OfflinePlayer p, String name, int num, int size) {
var re = new PlayerBackpack(p, UUID.randomUUID(), name, num, size, null);
var key = new RecordKey(DataScope.BACKPACK_PROFILE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ public class SlimefunBlockData extends ASlimefunDataContainer {
this.sfId = other.sfId;
}

@Nonnull

public Location getLocation() {
return location;
}

@Nonnull

public String getSfId() {
return sfId;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ public class SlimefunChunkData extends ASlimefunDataContainer {
sfBlocks = new ConcurrentHashMap<>();
}

@Nonnull

public Chunk getChunk() {
return chunk;
}

@Nonnull

@ParametersAreNonnullByDefault
public SlimefunBlockData createBlockData(Location l, String sfId) {
var lKey = LocationUtils.getLocKey(l);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ public Chunk getChunk() {
return chunkData.getChunk();
}

public static @Nonnull HandlerList getHandlerList() {
public static HandlerList getHandlerList() {
return handlers;
}

@Override
public @Nonnull HandlerList getHandlers() {
public HandlerList getHandlers() {
return getHandlerList();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public MigrateStatus migrateData() {
return result;
}

private void migratePlayerProfile(@Nonnull OfflinePlayer p) {
private void migratePlayerProfile(OfflinePlayer p) {
var uuid = p.getUniqueId();
var configFile = new Config("data-storage/Slimefun/Players/" + uuid + ".yml");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public class DatabaseThreadFactory implements ThreadFactory {
private final AtomicInteger threadCount = new AtomicInteger(0);

@Override
public Thread newThread(@Nonnull Runnable r) {
public Thread newThread(Runnable r) {
return new Thread(r, "SF-Database-Thread #" + threadCount.getAndIncrement());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ public ErrorReport(T throwable, SlimefunItem item) {
*
* @return The {@link File} for this {@link ErrorReport}
*/
public @Nonnull File getFile() {
public File getFile() {
return file;
}

Expand All @@ -153,7 +153,7 @@ public ErrorReport(T throwable, SlimefunItem item) {
*
* @return The {@link Throwable}
*/
public @Nonnull T getThrown() {
public T getThrown() {
return throwable;
}

Expand All @@ -166,7 +166,7 @@ public static int count() {
return count.get();
}

private void print(@Nonnull Consumer<PrintStream> printer) {
private void print(Consumer<PrintStream> printer) {
this.file = getNewFile();
count.incrementAndGet();

Expand Down Expand Up @@ -236,7 +236,7 @@ private void print(@Nonnull Consumer<PrintStream> printer) {
}
}

private static void scanPlugins(@Nonnull List<String> plugins, @Nonnull List<String> addons) {
private static void scanPlugins(List<String> plugins, List<String> addons) {
String dependency = "Slimefun";

for (Plugin plugin : Bukkit.getPluginManager().getPlugins()) {
Expand All @@ -262,7 +262,7 @@ private static void scanPlugins(@Nonnull List<String> plugins, @Nonnull List<Str
}
}

private static @Nonnull File getNewFile() {
private static File getNewFile() {
String path = "plugins/Slimefun/error-reports/" + dateFormat.format(LocalDateTime.now());
File newFile = new File(path + ".err");

Expand All @@ -288,7 +288,7 @@ private static void scanPlugins(@Nonnull List<String> plugins, @Nonnull List<Str
* The code to execute
*/
public static void tryCatch(
@Nonnull Function<Exception, ErrorReport<Exception>> function, @Nonnull Runnable runnable) {
Function<Exception, ErrorReport<Exception>> function, Runnable runnable) {
try {
runnable.run();
} catch (Exception x) {
Expand Down
Loading

0 comments on commit 8e2d960

Please sign in to comment.